summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-08-30 16:20:58 -0700
committerDoris Liu <tianliu@google.com>2013-08-30 17:10:54 -0700
commitf9ddb6034e560684e4d3ddd460ef9dff345e4e91 (patch)
treec7943a995abca1f59aa5505c0087ef3721db5737
parent72a57ddf178b410ffb3c4532fc4e56b8b1d99706 (diff)
downloadandroid_packages_apps_Snap-f9ddb6034e560684e4d3ddd460ef9dff345e4e91.tar.gz
android_packages_apps_Snap-f9ddb6034e560684e4d3ddd460ef9dff345e4e91.tar.bz2
android_packages_apps_Snap-f9ddb6034e560684e4d3ddd460ef9dff345e4e91.zip
Reset zoom view when user exits app or rotate device
Bug:10308195 Change-Id: Icf1acc4b17611b28a9c65ec809083ac58da5bd8f
-rw-r--r--src/com/android/camera/ui/FilmStripView.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index de57296bc..bc56333d2 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -566,6 +566,12 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
mView.setTranslationY(transY);
}
+ void resetTransform() {
+ mView.setScaleX(FULL_SCREEN_SCALE);
+ mView.setScaleY(FULL_SCREEN_SCALE);
+ mView.setTranslationX(0f);
+ mView.setTranslationY(0f);
+ }
}
public FilmStripView(Context context) {
@@ -1173,9 +1179,30 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
mDrawArea.right = r;
mDrawArea.bottom = b;
+ resetZoomView();
layoutChildren();
}
+ /**
+ * Clears the translation and scale that has been set on the view, cancels any loading
+ * request for image partial decoding, and hides zoom view.
+ * This is needed for when there is a layout change (e.g. when users re-enter the app,
+ * or rotate the device, etc).
+ */
+ private void resetZoomView() {
+ if (!mController.isZoomStarted()) {
+ return;
+ }
+ ViewItem current = mViewItem[mCurrentItem];
+ if (current == null) {
+ return;
+ }
+ mScale = FULL_SCREEN_SCALE;
+ current.resetTransform();
+ mController.cancelLoadingZoomedImage();
+ mZoomView.setVisibility(GONE);
+ }
+
// Keeps the view in the view hierarchy if it's camera preview.
// Remove from the hierarchy otherwise.
private void checkForRemoval(ImageData data, View v) {