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

Commit 2ae47200 authored by Wu-cheng Li's avatar Wu-cheng Li Committed by Android (Google) Code Review
Browse files

Merge "Add page tap listener."

parents 1ff1afcb 014d9586
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class PhotoPage extends ActivityState
    private boolean mShowBars = true;
    private GalleryActionBar mActionBar;
    private MyMenuVisibilityListener mMenuVisibilityListener;
    private PageTapListener mPageTapListener;
    private boolean mIsMenuVisible;
    private boolean mIsInteracting;
    private MediaItem mCurrentPhoto = null;
@@ -131,6 +132,15 @@ public class PhotoPage extends ActivityState
        }
    }

    public interface PageTapListener {
        // Return true if the tap is consumed.
        public boolean onSingleTapUp(int x, int y);
    }

    public void setPageTapListener(PageTapListener listener) {
        mPageTapListener = listener;
    }

    private final GLView mRootPane = new GLView() {

        @Override
@@ -515,6 +525,10 @@ public class PhotoPage extends ActivityState
    }

    public void onSingleTapUp(int x, int y) {
        if (mPageTapListener != null) {
            if (mPageTapListener.onSingleTapUp(x, y)) return;
        }

        MediaItem item = mModel.getCurrentMediaItem();
        if (item == null) {
            // item is not ready, ignore