diff options
author | Doris Liu <tianliu@google.com> | 2013-04-16 09:50:56 -0700 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2013-04-18 13:59:42 -0700 |
commit | 9cdfe00cf57f05f81e6d02ca050e6afd8cc4a25f (patch) | |
tree | 6460980a3be0f75d4dcd5b34fe966b2882caa17c | |
parent | 172d37e178a33fd1138d7e3a9b08f8c541959cc3 (diff) | |
download | android_packages_apps_Snap-9cdfe00cf57f05f81e6d02ca050e6afd8cc4a25f.tar.gz android_packages_apps_Snap-9cdfe00cf57f05f81e6d02ca050e6afd8cc4a25f.tar.bz2 android_packages_apps_Snap-9cdfe00cf57f05f81e6d02ca050e6afd8cc4a25f.zip |
Allow swiping to filmstrip from blocker bar
Bug: 8607910
Change-Id: I69bfcf8d95d6071be7d65fbf433916740cbb655c
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 4 | ||||
-rw-r--r-- | src/com/android/camera/PreviewGestures.java | 37 | ||||
-rw-r--r-- | src/com/android/camera/VideoUI.java | 4 |
5 files changed, 44 insertions, 12 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 1215cecf0..5e5584694 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -423,9 +423,10 @@ public class CameraActivity extends ActivityBase } // Preview area is touched. Handle touch focus. + // Touch to focus is handled by PreviewGestures, this function call + // is no longer needed. TODO: Clean it up in the next refactor @Override protected void onSingleTapUp(View view, int x, int y) { - mCurrentModule.onSingleTapUp(view, x, y); } @Override diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 1270364d6..3e71aa648 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -1199,10 +1199,6 @@ public class PhotoModule if (pressed && !canTakePicture()) return; if (pressed) { - if (mSceneMode == Util.SCENE_MODE_HDR) { - mActivity.hideSwitcher(); - mActivity.setSwipingEnabled(false); - } mFocusManager.onShutterDown(); } else { // for countdown mode, we need to postpone the shutter release @@ -1227,6 +1223,10 @@ public class PhotoModule } Log.v(TAG, "onShutterButtonClick: mCameraState=" + mCameraState); + if (mSceneMode == Util.SCENE_MODE_HDR) { + mActivity.hideSwitcher(); + mActivity.setSwipingEnabled(false); + } // If the user wants to do a snapshot while the previous one is still // in progress, remember the fact and do it after we finish the previous // one and re-start the preview. Snapshot in progress also includes the diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 53fdc969e..fd148bad7 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -180,10 +180,10 @@ public class PhotoUI implements PieListener, mGestures = new PreviewGestures(mActivity, this, mZoomRenderer, mPieRenderer, this); } - mGestures.clearTouchReceivers(); + mGestures.reset(); mGestures.setRenderOverlay(mRenderOverlay); mGestures.addTouchReceiver(mMenuButton); - mGestures.addTouchReceiver(mBlocker); + mGestures.addUnclickableArea(mBlocker); // make sure to add touch targets for image capture if (mController.isImageCaptureIntent()) { if (mReviewCancelButton != null) { diff --git a/src/com/android/camera/PreviewGestures.java b/src/com/android/camera/PreviewGestures.java index 351da0afd..b968a0244 100644 --- a/src/com/android/camera/PreviewGestures.java +++ b/src/com/android/camera/PreviewGestures.java @@ -59,6 +59,7 @@ public class PreviewGestures private MotionEvent mCurrent; private ScaleGestureDetector mScale; private List<View> mReceivers; + private List<View> mUnclickableAreas; private int mMode; private int mSlop; private int mTapTimeout; @@ -127,12 +128,41 @@ public class PreviewGestures mReceivers.add(v); } + public void addUnclickableArea(View v) { + if (mUnclickableAreas == null) { + mUnclickableAreas = new ArrayList<View>(); + } + mUnclickableAreas.add(v); + } + public void clearTouchReceivers() { if (mReceivers != null) { mReceivers.clear(); } } + public void clearUnclickableAreas() { + if (mUnclickableAreas != null) { + mUnclickableAreas.clear(); + } + } + + private boolean checkClickable(MotionEvent m) { + if (mUnclickableAreas != null) { + for (View v : mUnclickableAreas) { + if (isInside(m, v)) { + return false; + } + } + } + return true; + } + + public void reset() { + clearTouchReceivers(); + clearUnclickableAreas(); + } + public boolean dispatchTouch(MotionEvent m) { if (!mEnabled) { return mActivity.superDispatchTouchEvent(m); @@ -149,7 +179,7 @@ public class PreviewGestures mMode = MODE_PIE; return sendToPie(m); } - if (mPie != null && !mZoomOnly) { + if (mPie != null && !mZoomOnly && checkClickable(m)) { mHandler.sendEmptyMessageDelayed(MSG_PIE, TIMEOUT_PIE); } if (mZoom != null) { @@ -216,9 +246,10 @@ public class PreviewGestures } if (MotionEvent.ACTION_UP == m.getActionMasked()) { cancelPie(); - cancelActivityTouchHandling(m); // must have been tap - if (m.getEventTime() - mDown.getEventTime() < mTapTimeout) { + if (m.getEventTime() - mDown.getEventTime() < mTapTimeout + && checkClickable(m)) { + cancelActivityTouchHandling(m); mTapListener.onSingleTapUp(null, (int) mDown.getX() - mOverlay.getWindowPositionX(), (int) mDown.getY() - mOverlay.getWindowPositionY()); diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 43822e7e0..79150e9fe 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -213,9 +213,9 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, mGestures = new PreviewGestures(mActivity, this, mZoomRenderer, mPieRenderer, this); } mGestures.setRenderOverlay(mRenderOverlay); - mGestures.clearTouchReceivers(); + mGestures.reset(); mGestures.addTouchReceiver(mMenu); - mGestures.addTouchReceiver(mBlocker); + mGestures.addUnclickableArea(mBlocker); if (mController.isVideoCaptureIntent()) { if (mReviewCancelButton != null) { mGestures.addTouchReceiver(mReviewCancelButton); |