From ccd3da23c6dbdda2af5c5d746652e4b240cb4f50 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Fri, 12 Sep 2014 18:03:55 -0700 Subject: [PATCH] set correct bounds in ActionBar based on visibility of ActionBarView ActionBarContainer was setting the bounds of its background assuming the visibility of the ActionBarView. But that view becomes GONE when the ActionBarContextView is visible, causing artifacts such as wrong shadows when resized (as in custom configuration changes). Issue #17280341 Quantum: drop shadow on CAB has wrong width after rotation on L, when configuration change is handled by the app Change-Id: I07e57f00e27b41d5370cb9440b35734a8ec10f3a --- .../internal/widget/ActionBarContainer.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/widget/ActionBarContainer.java b/core/java/com/android/internal/widget/ActionBarContainer.java index 8111e637a9173..0105f51ff0100 100644 --- a/core/java/com/android/internal/widget/ActionBarContainer.java +++ b/core/java/com/android/internal/widget/ActionBarContainer.java @@ -39,6 +39,7 @@ public class ActionBarContainer extends FrameLayout { private boolean mIsTransitioning; private View mTabContainer; private View mActionBarView; + private View mActionContextView; private Drawable mBackground; private Drawable mStackedBackground; @@ -79,6 +80,7 @@ public class ActionBarContainer extends FrameLayout { public void onFinishInflate() { super.onFinishInflate(); mActionBarView = findViewById(com.android.internal.R.id.action_bar); + mActionContextView = findViewById(com.android.internal.R.id.action_context_bar); } public void setPrimaryBackground(Drawable bg) { @@ -312,8 +314,16 @@ public class ActionBarContainer extends FrameLayout { } } else { if (mBackground != null) { - mBackground.setBounds(mActionBarView.getLeft(), mActionBarView.getTop(), - mActionBarView.getRight(), mActionBarView.getBottom()); + if (mActionBarView.getVisibility() == View.VISIBLE) { + mBackground.setBounds(mActionBarView.getLeft(), mActionBarView.getTop(), + mActionBarView.getRight(), mActionBarView.getBottom()); + } else if (mActionContextView != null && + mActionContextView.getVisibility() == View.VISIBLE) { + mBackground.setBounds(mActionContextView.getLeft(), mActionContextView.getTop(), + mActionContextView.getRight(), mActionContextView.getBottom()); + } else { + mBackground.setBounds(0, 0, 0, 0); + } needsInvalidate = true; } mIsStacked = hasTabs;