From 76aaa1870d77856c975283392d3a0fea3e1fb7ba Mon Sep 17 00:00:00 2001 From: Doris Liu Date: Thu, 3 Apr 2014 15:59:00 -0700 Subject: [PATCH] Fix layout error during mode switch Cause for the incorrect layout: the two modes have a preview of the same aspect ratio, and therefore bottom bar did not need to re-layout after the mode switch and it incidentally skipped adjusting preview position. Bug: 13210080 Change-Id: Iad722abd682885633885ff0e8d9fba4efb4e5e6a --- src/com/android/camera/ui/BottomBar.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/android/camera/ui/BottomBar.java b/src/com/android/camera/ui/BottomBar.java index 245b52830..fd578644a 100644 --- a/src/com/android/camera/ui/BottomBar.java +++ b/src/com/android/camera/ui/BottomBar.java @@ -115,6 +115,7 @@ public class BottomBar extends FrameLayout private final RectF mRect = new RectF(); + private final RectF mPreviewArea = new RectF(); private AdjustPreviewAreaListener mAdjustPreviewAreaListener; public void setAdjustPreviewAreaListener(AdjustPreviewAreaListener listener) { @@ -357,6 +358,10 @@ public class BottomBar extends FrameLayout @Override public void onPreviewAreaChanged(RectF previewArea) { + if (mPreviewArea.equals(previewArea)) { + return; + } + mPreviewArea.set(previewArea); setOffset(previewArea.width(), previewArea.height()); } @@ -373,6 +378,10 @@ public class BottomBar extends FrameLayout mPreviewLongEdge = offsetLongerEdge; mPreviewShortEdge = offsetShorterEdge; requestLayout(); + } else { + // This is when the aspect ratio of the preview stays the same but the + // preview rect needs to be offseted. + notifyAreaAdjust(); } } -- 2.11.0