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 | c43e5b6bd84f5a7635766f70677097f6958f4058 (patch) | |
| tree | f67d337db6239c2580c9f1f2954710c5b510f3ee | |
| parent | 03e752e0c9f9978663fb5bca06edd5e56476132e (diff) | |
| download | android_packages_apps_Gallery2-c43e5b6bd84f5a7635766f70677097f6958f4058.tar.gz android_packages_apps_Gallery2-c43e5b6bd84f5a7635766f70677097f6958f4058.tar.bz2 android_packages_apps_Gallery2-c43e5b6bd84f5a7635766f70677097f6958f4058.zip | |
Update capture animation
Bug: 8253060
Update preview thumb margins and size
Add touch target for thumbnail
Change-Id: I2b298de330834c42a55b4cb082148d971727f530
| -rw-r--r-- | res/layout-land/camera_controls.xml | 8 | ||||
| -rw-r--r-- | res/layout-port/camera_controls.xml | 7 | ||||
| -rw-r--r-- | res/values-land/dimensions.xml | 2 | ||||
| -rw-r--r-- | res/values-sw360dp-land/dimensions.xml | 18 | ||||
| -rw-r--r-- | res/values-sw360dp/dimensions.xml | 18 | ||||
| -rw-r--r-- | res/values-sw600dp/dimens.xml | 2 | ||||
| -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 |
10 files changed, 100 insertions, 4 deletions
diff --git a/res/layout-land/camera_controls.xml b/res/layout-land/camera_controls.xml index e99c0cb0c..04841a013 100644 --- a/res/layout-land/camera_controls.xml +++ b/res/layout-land/camera_controls.xml @@ -57,4 +57,12 @@ android:focusable="true" android:scaleType="center" android:src="@drawable/btn_new_shutter" /> + + <View + android:id="@+id/preview_thumb" + android:visibility="invisible" + android:layout_width="@dimen/capture_size" + android:layout_height="@dimen/capture_size" + android:layout_gravity="top|right" /> + </com.android.camera.ui.CameraControls> diff --git a/res/layout-port/camera_controls.xml b/res/layout-port/camera_controls.xml index 77a19e9e6..4ed9e63c3 100644 --- a/res/layout-port/camera_controls.xml +++ b/res/layout-port/camera_controls.xml @@ -58,4 +58,11 @@ android:scaleType="center" android:src="@drawable/btn_new_shutter" /> + <View + android:id="@+id/preview_thumb" + android:visibility="invisible" + android:layout_width="@dimen/capture_size" + android:layout_height="@dimen/capture_size" + android:layout_gravity="top|right" /> + </com.android.camera.ui.CameraControls>
\ No newline at end of file diff --git a/res/values-land/dimensions.xml b/res/values-land/dimensions.xml index b15017978..3eae85647 100644 --- a/res/values-land/dimensions.xml +++ b/res/values-land/dimensions.xml @@ -16,5 +16,5 @@ <resources> <!-- for manage cache bar --> <dimen name="manage_cache_bottom_height">39dp</dimen> - <dimen name="capture_margin_top">8dip</dimen> + <dimen name="capture_top_margin">0dip</dimen> </resources> diff --git a/res/values-sw360dp-land/dimensions.xml b/res/values-sw360dp-land/dimensions.xml new file mode 100644 index 000000000..fe3e6f5ed --- /dev/null +++ b/res/values-sw360dp-land/dimensions.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <dimen name="capture_margin_top">8dip</dimen> +</resources> diff --git a/res/values-sw360dp/dimensions.xml b/res/values-sw360dp/dimensions.xml new file mode 100644 index 000000000..b18b93417 --- /dev/null +++ b/res/values-sw360dp/dimensions.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <dimen name="capture_margin_top">16dip</dimen> +</resources> diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml index ce506cc17..59d86d900 100644 --- a/res/values-sw600dp/dimens.xml +++ b/res/values-sw600dp/dimens.xml @@ -20,4 +20,6 @@ <dimen name="setting_item_icon_width">@dimen/setting_item_icon_width_large</dimen> <dimen name="onscreen_indicators_height">@dimen/onscreen_indicators_height_large</dimen> <dimen name="shutter_offset">-33dp</dimen> + <dimen name="capture_size">80dip</dimen> + <dimen name="capture_top_margin">16dip</dimen> </resources> 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 |
