Search in sources :

Example 1 with CubicPanoNative

use of org.openpanodroid.panoutils.android.CubicPanoNative in project OpenPanodroid by duerrfk.

the class PanoViewerActivity method onCreate.

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.i(LOG_TAG, "Creating");
    super.onCreate(savedInstanceState);
    stateSaved = false;
    setupImageInfo();
    Bitmap front, back, top, bottom, left, right;
    front = back = top = bottom = left = right = null;
    if (savedInstanceState != null) {
        Parcelable parcelData;
        parcelData = savedInstanceState.getParcelable(FRONT_BITMAP_KEY);
        if (parcelData != null) {
            Assert.assertTrue(parcelData instanceof Bitmap);
            front = (Bitmap) parcelData;
        }
        parcelData = savedInstanceState.getParcelable(BACK_BITMAP_KEY);
        if (parcelData != null) {
            Assert.assertTrue(parcelData instanceof Bitmap);
            back = (Bitmap) parcelData;
        }
        parcelData = savedInstanceState.getParcelable(TOP_BITMAP_KEY);
        if (parcelData != null) {
            Assert.assertTrue(parcelData instanceof Bitmap);
            top = (Bitmap) parcelData;
        }
        parcelData = savedInstanceState.getParcelable(BOTTOM_BITMAP_KEY);
        if (parcelData != null) {
            Assert.assertTrue(parcelData instanceof Bitmap);
            bottom = (Bitmap) parcelData;
        }
        parcelData = savedInstanceState.getParcelable(LEFT_BITMAP_KEY);
        if (parcelData != null) {
            Assert.assertTrue(parcelData instanceof Bitmap);
            left = (Bitmap) parcelData;
        }
        parcelData = savedInstanceState.getParcelable(RIGHT_BITMAP_KEY);
        if (parcelData != null) {
            Assert.assertTrue(parcelData instanceof Bitmap);
            right = (Bitmap) parcelData;
        }
    }
    if (front == null || back == null || top == null || bottom == null || left == null || right == null) {
        if (front != null) {
            front.recycle();
            front = null;
        }
        if (back != null) {
            back.recycle();
            back = null;
        }
        if (top != null) {
            top.recycle();
            top = null;
        }
        if (bottom != null) {
            bottom.recycle();
            bottom = null;
        }
        if (left != null) {
            left.recycle();
            left = null;
        }
        if (right != null) {
            right.recycle();
            right = null;
        }
        downloadPano();
    } else {
        cubicPano = new CubicPanoNative(front, back, top, bottom, left, right);
        setupOpenGLView();
    }
}
Also used : Bitmap(android.graphics.Bitmap) Parcelable(android.os.Parcelable) CubicPanoNative(org.openpanodroid.panoutils.android.CubicPanoNative)

Aggregations

Bitmap (android.graphics.Bitmap)1 Parcelable (android.os.Parcelable)1 CubicPanoNative (org.openpanodroid.panoutils.android.CubicPanoNative)1