summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/CameraRootView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/ui/CameraRootView.java')
-rw-r--r--src/com/android/camera/ui/CameraRootView.java23
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() {