PanoramaGL library was the first open source library in the world to see panoramic views on Android. This is a gradle build adaptation, along with other changes and updates. I am evolving the library to something easy to use any help is welcome. The native code is used as a static library.
Temporal docs about panorama object and json protocol the original google code wiki and here the new usage
The supported features in version 0.2 beta are:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.hannesa2:panoramagl:$latestVersion'
}
Create a PLManager
object and add the bindings to the activity lifecycle methods:
private PLManager plManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
plManager = new PLManager(this);
plManager.onCreate();
}
@Override
protected void onResume() {
super.onResume();
plManager.onResume();
}
@Override
protected void onPause() {
plManager.onPause();
super.onPause();
}
@Override
protected void onDestroy() {
plManager.onDestroy();
super.onDestroy();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return plManager.onTouchEvent(event);
}
Next set the view, before calling plManager.onCreate
:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
plManager = new PLManager(this);
plManager.setContentView(R.layout.activity_main);
plManager.onCreate();
}
Finally add the panorama you want, for example;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
plManager = new PLManager(this);
plManager.setContentView(R.layout.activity_main);
plManager.onCreate();
PLSphericalPanorama panorama = new PLSphericalPanorama();
panorama.getCamera().lookAt(30.0f, 90.0f);
panorama.setImage(new PLImage(PLUtils.getBitmap(this, R.raw.sighisoara_sphere), false));
plManager.setPanorama(panorama);
}