diff options
author | Michael Kolb <kolby@google.com> | 2013-04-30 15:34:19 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2013-05-01 11:48:02 -0700 |
commit | 78a5b224eca3c702f4ecf8abd072779e32e26641 (patch) | |
tree | fe3ad3db10478fb0586cfd4dec4b16e8ed2d527c | |
parent | 8788079a51a90255dce330e56afcb6674deccbf7 (diff) | |
download | android_packages_apps_Snap-78a5b224eca3c702f4ecf8abd072779e32e26641.tar.gz android_packages_apps_Snap-78a5b224eca3c702f4ecf8abd072779e32e26641.tar.bz2 android_packages_apps_Snap-78a5b224eca3c702f4ecf8abd072779e32e26641.zip |
Update capture animation
Bug: 8253060
Update preview thumb margins and size
Add touch target for thumbnail
Change-Id: I2b298de330834c42a55b4cb082148d971727f530
-rw-r--r-- | src/com/android/camera/CaptureAnimManager.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 11 | ||||
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 19 | ||||
-rw-r--r-- | src/com/android/camera/ui/CameraControls.java | 12 |
4 files changed, 46 insertions, 3 deletions
diff --git a/src/com/android/camera/CaptureAnimManager.java b/src/com/android/camera/CaptureAnimManager.java index b820ac9fa..f6e112d7e 100644 --- a/src/com/android/camera/CaptureAnimManager.java +++ b/src/com/android/camera/CaptureAnimManager.java @@ -19,7 +19,6 @@ package com.android.camera; import android.content.res.Resources; import android.graphics.Color; import android.os.SystemClock; -import android.util.Log; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; @@ -68,6 +67,10 @@ public class CaptureAnimManager { private int mSize; private Resources mResources; + public static int getAnimationDuration() { + return TIME_SLIDE2; + } + /* preview: camera preview view. * review: view of picture just taken. */ @@ -124,7 +127,7 @@ public class CaptureAnimManager { break; case 90: // Preview is below. mHoldX = x + mMarginTop; - mHoldY = y + mMarginRight + mSize; + mHoldY = y + mMarginRight; break; case 180: // Preview on the right. mHoldX = x + mMarginRight; diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 4d3f7fb22..5b352719f 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -105,6 +105,7 @@ public class PhotoModule private static final int START_PREVIEW_DONE = 10; private static final int OPEN_CAMERA_FAIL = 11; private static final int CAMERA_DISABLED = 12; + private static final int CAPTURE_ANIMATION_DONE = 13; // The subset of parameters we need to update in setCameraParameters(). private static final int UPDATE_PARAM_INITIALIZE = 1; @@ -398,6 +399,10 @@ public class PhotoModule R.string.camera_disabled); break; } + case CAPTURE_ANIMATION_DONE: { + mUI.enablePreviewThumb(false); + break; + } } } } @@ -809,7 +814,10 @@ public class PhotoModule if (ApiHelper.HAS_SURFACE_TEXTURE && !mIsImageCaptureIntent && mActivity.mShowCameraAppView) { // Finish capture animation + mHandler.removeMessages(CAPTURE_ANIMATION_DONE); ((CameraScreenNail) mActivity.mCameraScreenNail).animateSlide(); + mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE, + CaptureAnimManager.getAnimationDuration()); } mFocusManager.updateFocusUI(); // Ensure focus indicator is hidden. if (!mIsImageCaptureIntent) { @@ -968,6 +976,9 @@ public class PhotoModule && mActivity.mShowCameraAppView) { // Start capture animation. ((CameraScreenNail) mActivity.mCameraScreenNail).animateFlash(mDisplayRotation); + mUI.enablePreviewThumb(true); + mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE, + CaptureAnimManager.getAnimationDuration()); } } diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 094910496..bc43f4763 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -92,6 +92,7 @@ public class PhotoUI implements PieListener, private int mPreviewWidth = 0; private int mPreviewHeight = 0; + private View mPreviewThumb; private OnLayoutChangeListener mLayoutListener = new OnLayoutChangeListener() { @Override @@ -173,6 +174,7 @@ public class PhotoUI implements PieListener, mGestures.setRenderOverlay(mRenderOverlay); mGestures.addTouchReceiver(mMenuButton); mGestures.addUnclickableArea(mBlocker); + enablePreviewThumb(false); // make sure to add touch targets for image capture if (mController.isImageCaptureIntent()) { if (mReviewCancelButton != null) { @@ -201,6 +203,13 @@ public class PhotoUI implements PieListener, public void initializeControlByIntent() { mBlocker = mActivity.findViewById(R.id.blocker); + mPreviewThumb = mActivity.findViewById(R.id.preview_thumb); + mPreviewThumb.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + mActivity.gotoGallery(); + } + }); mMenuButton = mActivity.findViewById(R.id.menu); mMenuButton.setOnClickListener(new OnClickListener() { @Override @@ -367,6 +376,16 @@ public class PhotoUI implements PieListener, if (!full && mCountDownView != null) mCountDownView.cancelCountDown(); } + public void enablePreviewThumb(boolean enabled) { + if (enabled) { + mGestures.addTouchReceiver(mPreviewThumb); + mPreviewThumb.setVisibility(View.VISIBLE); + } else { + mGestures.removeTouchReceiver(mPreviewThumb); + mPreviewThumb.setVisibility(View.GONE); + } + } + public boolean removeTopLevelPopup() { // Remove the top level popup or dialog box and return true if there's any if (mPopup != null) { diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java index 3a5fbde57..e5b90dd51 100644 --- a/src/com/android/camera/ui/CameraControls.java +++ b/src/com/android/camera/ui/CameraControls.java @@ -21,7 +21,6 @@ import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; import android.util.AttributeSet; -import android.util.Log; import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; @@ -38,6 +37,7 @@ public class CameraControls extends RotatableLayout { private View mSwitcher; private View mMenu; private View mIndicators; + private View mPreview; public CameraControls(Context context, AttributeSet attrs) { super(context, attrs); @@ -61,6 +61,7 @@ public class CameraControls extends RotatableLayout { mShutter = findViewById(R.id.shutter_button); mMenu = findViewById(R.id.menu); mIndicators = findViewById(R.id.on_screen_indicators); + mPreview = findViewById(R.id.preview_thumb); } @Override @@ -75,6 +76,7 @@ public class CameraControls extends RotatableLayout { toLeft(mSwitcher, l, t, r, b, orientation, rotation, shutter); toRight(mMenu, l, t, r, b, orientation, rotation, shutter); toRight(mIndicators, l, t, r, b, orientation, rotation, shutter); + topRight(mPreview, l, t, r, b, orientation, rotation); View retake = findViewById(R.id.btn_retake); if (retake != null) { Rect retakeRect = new Rect(); @@ -96,6 +98,7 @@ public class CameraControls extends RotatableLayout { } return rotation; } + private void center(View v, int l, int t, int r, int b, int orientation, int rotation, Rect result) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) v.getLayoutParams(); int tw = lp.leftMargin + v.getMeasuredWidth() + lp.rightMargin; @@ -209,6 +212,13 @@ public class CameraControls extends RotatableLayout { v.layout(result.left, result.top, result.right, result.bottom); } + private void topRight(View v, int l, int t, int r, int b, int orientation, int rotation) { + // layout using the specific margins; the rotation code messes up the others + int mt = getContext().getResources().getDimensionPixelSize(R.dimen.capture_margin_top); + int mr = getContext().getResources().getDimensionPixelSize(R.dimen.capture_margin_right); + v.layout(r - v.getMeasuredWidth() - mr, t + mt, r - mr, t + mt + v.getMeasuredHeight()); + } + // In reverse landscape and reverse portrait, camera controls will be laid out // on the wrong side of the screen. We need to make adjustment to move the controls // to the USB side |