From 014d9586d8145a33f4e99eaad570587f6d650026 Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Wed, 18 Apr 2012 17:10:02 +0800 Subject: [PATCH] Add page tap listener. Camera needs this for touch focus and video snapshot. bug:6313318 Change-Id: Ie0b8129160c2a79d4b20fab2173027cddfee7a79 --- src/com/android/gallery3d/app/PhotoPage.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 8797f84e5..2bdf970d3 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -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 -- 2.11.0