Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 160e6d77 authored by Chih-Chung Chang's avatar Chih-Chung Chang
Browse files

Don't do capture animation if we don't have Camera ScreenNail.

Also make "Back" jump to first picture instead of the previous one.

Bug: 6388263

Change-Id: Idf78363cf3952bf66c6b0688e79d99c01956cd07
parent 2c617382
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -339,6 +339,11 @@ public class PhotoDataAdapter implements PhotoPage.Model {
        updateCurrentIndex(mCurrentIndex - 1);
    }

    @Override
    public void moveToFirst() {
        updateCurrentIndex(0);
    }

    @Override
    public ScreenNail getScreenNail(int offset) {
        return getImage(mCurrentIndex + offset);
+2 −1
Original line number Diff line number Diff line
@@ -403,7 +403,8 @@ public class PhotoPage extends ActivityState
    protected void onBackPressed() {
        if (mShowDetails) {
            hideDetails();
        } else if (!switchWithCaptureAnimation(-1)) {
        } else if (mScreenNail == null
                || !switchWithCaptureAnimation(-1)) {
            super.onBackPressed();
        }
    }
+5 −0
Original line number Diff line number Diff line
@@ -163,6 +163,11 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter
        throw new UnsupportedOperationException();
    }

    @Override
    public void moveToFirst() {
        throw new UnsupportedOperationException();
    }

    @Override
    public void getImageSize(int offset, PhotoView.Size size) {
        if (offset == 0) {
+6 −2
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class PhotoView extends GLView {
    public interface Model extends TileImageView.Model {
        public void next();
        public void previous();
        public void moveToFirst();

        // Returns the size for the specified picture. If the size information is
        // not avaiable, width = height = 0.
@@ -935,6 +936,10 @@ public class PhotoView extends GLView {
        mModel.previous();
    }

    private void switchToFirstImage() {
        mModel.moveToFirst();
    }

    ////////////////////////////////////////////////////////////////////////////
    //  Opening Animation
    ////////////////////////////////////////////////////////////////////////////
@@ -958,7 +963,6 @@ public class PhotoView extends GLView {
    }

    private boolean switchWithCaptureAnimationLocked(int offset) {
        if (mFilmMode) return false;
        if (mHolding != 0) return true;
        if (offset == 1) {
            if (mNextBound <= 0) return false;
@@ -966,7 +970,7 @@ public class PhotoView extends GLView {
            mPositionController.startCaptureAnimationSlide(-1);
        } else if (offset == -1) {
            if (mPrevBound >= 0) return false;
            switchToPrevImage();
            switchToFirstImage();
            mPositionController.startCaptureAnimationSlide(1);
        } else {
            return false;