summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-04-19 17:17:44 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-19 17:17:44 +0000
commit29f5085a0b27ca62744974df67394f2c4b1df136 (patch)
tree9459821dcadab47197a52a597425802ba5ff3c6e /src
parentd3f4b9350cfa2caf6fb175731b36626cf00e9dd9 (diff)
parent9cdfe00cf57f05f81e6d02ca050e6afd8cc4a25f (diff)
downloadandroid_packages_apps_Snap-29f5085a0b27ca62744974df67394f2c4b1df136.tar.gz
android_packages_apps_Snap-29f5085a0b27ca62744974df67394f2c4b1df136.tar.bz2
android_packages_apps_Snap-29f5085a0b27ca62744974df67394f2c4b1df136.zip
Merge "Allow swiping to filmstrip from blocker bar" into gb-ub-photos-bryce
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java3
-rw-r--r--src/com/android/camera/PhotoModule.java8
-rw-r--r--src/com/android/camera/PhotoUI.java4
-rw-r--r--src/com/android/camera/PreviewGestures.java37
-rw-r--r--src/com/android/camera/VideoUI.java4
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);