Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccd3da23 authored by Chet Haase's avatar Chet Haase
Browse files

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
parent ee2ec05e
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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) {
                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;