diff options
author | Doris Liu <tianliu@google.com> | 2013-11-13 17:59:24 -0800 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2013-11-13 17:59:24 -0800 |
commit | fc7b834155f3a15939b0dcfaf7140a9da21b876c (patch) | |
tree | da4a8e94bde6b362b81c388ba5794e76a01951a8 /src/com/android/camera/ui/CameraRootView.java | |
parent | ff3a994a2f33c493024b82023bfa910686c4d1de (diff) | |
download | android_packages_apps_Snap-fc7b834155f3a15939b0dcfaf7140a9da21b876c.tar.gz android_packages_apps_Snap-fc7b834155f3a15939b0dcfaf7140a9da21b876c.tar.bz2 android_packages_apps_Snap-fc7b834155f3a15939b0dcfaf7140a9da21b876c.zip |
Ensure view size gets updated after phone decors change.
Bug: 11661906
Change-Id: I63234a94b5a0bbd0cc6aa62ccd2642de09208403
Diffstat (limited to 'src/com/android/camera/ui/CameraRootView.java')
-rw-r--r-- | src/com/android/camera/ui/CameraRootView.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/com/android/camera/ui/CameraRootView.java b/src/com/android/camera/ui/CameraRootView.java index 505549c80..daaefc027 100644 --- a/src/com/android/camera/ui/CameraRootView.java +++ b/src/com/android/camera/ui/CameraRootView.java @@ -37,7 +37,7 @@ public class CameraRootView extends FrameLayout { private int mBottomMargin = 0; private int mLeftMargin = 0; private int mRightMargin = 0; - private Rect mCurrentInsets; + private final Rect mCurrentInsets = new Rect(0, 0, 0, 0); private int mOffset = 0; private Object mDisplayListener; private MyDisplayListener mListener; @@ -53,19 +53,24 @@ public class CameraRootView extends FrameLayout { @Override protected boolean fitSystemWindows(Rect insets) { - mCurrentInsets = insets; // insets include status bar, navigation bar, etc // In this case, we are only concerned with the size of nav bar - if (mOffset > 0) { - return true; + if (mCurrentInsets.equals(insets)) { + // Local copy of the insets is up to date. No need to do anything. + return false; } - if (insets.bottom > 0) { - mOffset = insets.bottom; - } else if (insets.right > 0) { - mOffset = insets.right; + if (mOffset == 0) { + if (insets.bottom > 0) { + mOffset = insets.bottom; + } else if (insets.right > 0) { + mOffset = insets.right; + } } - return true; + mCurrentInsets.set(insets); + // Make sure onMeasure will be called to adapt to the new insets. + requestLayout(); + return false; } public void initDisplayListener() { |