diff options
| author | Dianne Hackborn <hackbod@google.com> | 2013-03-06 21:40:56 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-03-06 21:40:56 +0000 |
| commit | f6fcea602750bbc0eb7d394f4daf3848ffaaed7d (patch) | |
| tree | a3bea6c87df7a95c0c03344d9e02c3f604523137 /core/java | |
| parent | 652b79153f78033494bd6c77e3418cefff2ff48a (diff) | |
| parent | 474690caf8b3bece133b40914979ac2520036989 (diff) | |
Merge "Fix issue #8325007: EyeEm app crashes on launch- NPE at..." into jb-mr2-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/widget/ActionBarOverlayLayout.java | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java index 79dadd75581b..f3591463e283 100644 --- a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java +++ b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java @@ -73,10 +73,6 @@ public class ActionBarOverlayLayout extends ViewGroup { ta.recycle(); } - public void setOverlayMode(boolean mode) { - mOverlayMode = mode; - } - public void setActionBar(ActionBarImpl impl, boolean overlayMode) { mActionBar = impl; mOverlayMode = overlayMode; @@ -177,7 +173,9 @@ public class ActionBarOverlayLayout extends ViewGroup { // The top and bottom action bars are always within the content area. boolean changed = applyInsets(mActionBarTop, insets, true, true, false, true); - changed |= applyInsets(mActionBarBottom, insets, true, false, true, true); + if (mActionBarBottom != null) { + changed |= applyInsets(mActionBarBottom, insets, true, false, true, true); + } mBaseInnerInsets.set(insets); computeFitSystemWindows(mBaseInnerInsets, mBaseContentInsets); @@ -219,6 +217,8 @@ public class ActionBarOverlayLayout extends ViewGroup { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + pullChildren(); + int maxHeight = 0; int maxWidth = 0; int childState = 0; @@ -234,13 +234,16 @@ public class ActionBarOverlayLayout extends ViewGroup { mActionBarTop.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); childState = combineMeasuredStates(childState, mActionBarTop.getMeasuredState()); - measureChildWithMargins(mActionBarBottom, widthMeasureSpec, 0, heightMeasureSpec, 0); - lp = (LayoutParams) mActionBarBottom.getLayoutParams(); - maxWidth = Math.max(maxWidth, - mActionBarBottom.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); - maxHeight = Math.max(maxHeight, - mActionBarBottom.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); - childState = combineMeasuredStates(childState, mActionBarBottom.getMeasuredState()); + // xlarge screen layout doesn't have bottom action bar. + if (mActionBarBottom != null) { + measureChildWithMargins(mActionBarBottom, widthMeasureSpec, 0, heightMeasureSpec, 0); + lp = (LayoutParams) mActionBarBottom.getLayoutParams(); + maxWidth = Math.max(maxWidth, + mActionBarBottom.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); + maxHeight = Math.max(maxHeight, + mActionBarBottom.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); + childState = combineMeasuredStates(childState, mActionBarBottom.getMeasuredState()); + } final int vis = getWindowSystemUiVisibility(); final boolean stable = (vis & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0; @@ -264,10 +267,12 @@ public class ActionBarOverlayLayout extends ViewGroup { if (mActionView.isSplitActionBar()) { // If action bar is split, adjust bottom insets for it. - if (stable) { - bottomInset = mActionBarHeight; - } else { - bottomInset = mActionBarBottom.getMeasuredHeight(); + if (mActionBarBottom != null) { + if (stable) { + bottomInset = mActionBarHeight; + } else { + bottomInset = mActionBarBottom.getMeasuredHeight(); + } } } |
