From 4f91ab5d099632afd84dd7bd80a804cbbe1f3588 Mon Sep 17 00:00:00 2001 From: Sascha Haeberling Date: Tue, 21 May 2013 11:26:13 -0700 Subject: Make capture thumbnail tappable in video mode. Bug: 9054122 Also make gotoGallery public for LightCycle to use. Change-Id: I3cd5af26531a756e78c1478de29155dfda709afc --- src/com/android/camera/ActivityBase.java | 2 +- src/com/android/camera/VideoModule.java | 15 +++++++++++++++ src/com/android/camera/VideoUI.java | 21 +++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) (limited to 'src/com') diff --git a/src/com/android/camera/ActivityBase.java b/src/com/android/camera/ActivityBase.java index c3cde8bfc..59bd82c98 100644 --- a/src/com/android/camera/ActivityBase.java +++ b/src/com/android/camera/ActivityBase.java @@ -353,7 +353,7 @@ public abstract class ActivityBase extends AbstractGalleryActivity } } - protected void gotoGallery() { + public void gotoGallery() { // Move the next picture with capture animation. "1" means next. mAppBridge.switchWithCaptureAnimation(1); } diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index f7830a303..2c654fc29 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -91,6 +91,7 @@ public class VideoModule implements CameraModule, private static final int SWITCH_CAMERA = 8; private static final int SWITCH_CAMERA_START_ANIMATION = 9; private static final int HIDE_SURFACE_VIEW = 10; + private static final int CAPTURE_ANIMATION_DONE = 11; private static final int SCREEN_DELAY = 2 * 60 * 1000; @@ -296,6 +297,11 @@ public class VideoModule implements CameraModule, break; } + case CAPTURE_ANIMATION_DONE: { + mUI.enablePreviewThumb(false); + break; + } + default: Log.v(TAG, "Unhandled message: " + msg.what); break; @@ -578,6 +584,14 @@ public class VideoModule implements CameraModule, // the preview. This will cause the preview flicker since the preview // will not be continuous for a short period of time. ((CameraScreenNail) mActivity.mCameraScreenNail).animateCapture(mDisplayRotation); + + mUI.enablePreviewThumb(true); + + // Make sure to disable the thumbnail preview after the + // animation is done to disable the click target. + mHandler.removeMessages(CAPTURE_ANIMATION_DONE); + mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE, + CaptureAnimManager.getAnimationDuration()); } } } @@ -1457,6 +1471,7 @@ public class VideoModule implements CameraModule, private void startVideoRecording() { Log.v(TAG, "startVideoRecording"); + mUI.enablePreviewThumb(false); mActivity.setSwipingEnabled(false); mActivity.updateStorageSpaceAndHint(); diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 0c9457204..dc23ec814 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -76,6 +76,7 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, private VideoController mController; private int mZoomMax; private List mZoomRatios; + private View mPreviewThumb; public VideoUI(CameraActivity activity, VideoController controller, View parent) { mActivity = activity; @@ -227,6 +228,14 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, mGestures.addTouchReceiver(mReviewPlayButton); } } + + mPreviewThumb = mActivity.findViewById(R.id.preview_thumb); + mPreviewThumb.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + mActivity.gotoGallery(); + } + }); } public void setPrefChangedListener(OnPreferenceChangedListener listener) { @@ -520,4 +529,16 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, } } + /** + * Enable or disable the preview thumbnail for click events. + */ + public void enablePreviewThumb(boolean enabled) { + if (enabled) { + mGestures.addTouchReceiver(mPreviewThumb); + mPreviewThumb.setVisibility(View.VISIBLE); + } else { + mGestures.removeTouchReceiver(mPreviewThumb); + mPreviewThumb.setVisibility(View.GONE); + } + } } -- cgit v1.2.3