ActionBarContainer.java revision 7d09f04363cdda6a3cf8b2ad1b67c9a07fa8975f
145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell/*
245f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * Copyright (C) 2010 The Android Open Source Project
345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell *
445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * Licensed under the Apache License, Version 2.0 (the "License");
545f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * you may not use this file except in compliance with the License.
645f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * You may obtain a copy of the License at
745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell *
845f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell *      http://www.apache.org/licenses/LICENSE-2.0
945f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell *
1045f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * Unless required by applicable law or agreed to in writing, software
1145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * distributed under the License is distributed on an "AS IS" BASIS,
1245f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * See the License for the specific language governing permissions and
1445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * limitations under the License.
1545f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell */
1645f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell
1745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powellpackage com.android.internal.widget;
1845f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell
19310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powellimport android.app.ActionBar;
2045f1e08c348ccb129bcc25e438c05421f7123f41Adam Powellimport android.content.Context;
2145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powellimport android.content.res.TypedArray;
22a72ef62e5c329a19eab9935acba816fc1369c637Adam Powellimport android.graphics.Canvas;
23a72ef62e5c329a19eab9935acba816fc1369c637Adam Powellimport android.graphics.drawable.Drawable;
2445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powellimport android.util.AttributeSet;
25640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powellimport android.view.ActionMode;
266ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powellimport android.view.MotionEvent;
27dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powellimport android.view.View;
28af6b97ebe0e6a67d1691c4d7789c7bc312c1e13eAdam Powellimport android.view.ViewGroup;
2945f1e08c348ccb129bcc25e438c05421f7123f41Adam Powellimport android.widget.FrameLayout;
3045f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell
3145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell/**
3245f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * This class acts as a container for the action bar view and action mode context views.
3345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * It applies special styles as needed to help handle animated transitions between them.
3445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell * @hide
3545f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell */
3645f1e08c348ccb129bcc25e438c05421f7123f41Adam Powellpublic class ActionBarContainer extends FrameLayout {
3701feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    private boolean mIsTransitioning;
38dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    private View mTabContainer;
39310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell    private ActionBarView mActionBarView;
4001feaee3d9767ef1185783877e92244f14d7d4baAdam Powell
41a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    private Drawable mBackground;
42a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    private Drawable mStackedBackground;
43a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    private Drawable mSplitBackground;
44a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    private boolean mIsSplit;
45a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    private boolean mIsStacked;
46a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
4745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell    public ActionBarContainer(Context context) {
4845f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        this(context, null);
4945f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell    }
5045f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell
5145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell    public ActionBarContainer(Context context, AttributeSet attrs) {
5245f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        super(context, attrs);
5345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell
54a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        setBackgroundDrawable(null);
55a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
5645f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        TypedArray a = context.obtainStyledAttributes(attrs,
5745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell                com.android.internal.R.styleable.ActionBar);
58a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        mBackground = a.getDrawable(com.android.internal.R.styleable.ActionBar_background);
59a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        mStackedBackground = a.getDrawable(
60a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                com.android.internal.R.styleable.ActionBar_backgroundStacked);
61a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
62a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        if (getId() == com.android.internal.R.id.split_action_bar) {
63a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            mIsSplit = true;
64a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            mSplitBackground = a.getDrawable(
65a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                    com.android.internal.R.styleable.ActionBar_backgroundSplit);
66a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        }
6745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        a.recycle();
68a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
69a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        setWillNotDraw(mIsSplit ? mSplitBackground == null :
70a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                mBackground == null && mStackedBackground == null);
7145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell    }
726ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powell
73310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell    @Override
74310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell    public void onFinishInflate() {
75310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell        super.onFinishInflate();
76310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell        mActionBarView = (ActionBarView) findViewById(com.android.internal.R.id.action_bar);
77310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell    }
78310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell
79f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    public void setPrimaryBackground(Drawable bg) {
80f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell        mBackground = bg;
81f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell        invalidate();
82f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    }
83f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell
84f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    public void setStackedBackground(Drawable bg) {
85f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell        mStackedBackground = bg;
86f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell        invalidate();
87f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    }
88f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell
89f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    public void setSplitBackground(Drawable bg) {
90f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell        mSplitBackground = bg;
91f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell        invalidate();
92f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    }
93f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell
9401feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    /**
9501feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     * Set the action bar into a "transitioning" state. While transitioning
9601feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     * the bar will block focus and touch from all of its descendants. This
9701feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     * prevents the user from interacting with the bar while it is animating
9801feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     * in or out.
9901feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     *
10001feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     * @param isTransitioning true if the bar is currently transitioning, false otherwise.
10101feaee3d9767ef1185783877e92244f14d7d4baAdam Powell     */
10201feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    public void setTransitioning(boolean isTransitioning) {
10301feaee3d9767ef1185783877e92244f14d7d4baAdam Powell        mIsTransitioning = isTransitioning;
10401feaee3d9767ef1185783877e92244f14d7d4baAdam Powell        setDescendantFocusability(isTransitioning ? FOCUS_BLOCK_DESCENDANTS
10501feaee3d9767ef1185783877e92244f14d7d4baAdam Powell                : FOCUS_AFTER_DESCENDANTS);
10601feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    }
10701feaee3d9767ef1185783877e92244f14d7d4baAdam Powell
10801feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    @Override
10901feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    public boolean onInterceptTouchEvent(MotionEvent ev) {
11001feaee3d9767ef1185783877e92244f14d7d4baAdam Powell        return mIsTransitioning || super.onInterceptTouchEvent(ev);
11101feaee3d9767ef1185783877e92244f14d7d4baAdam Powell    }
11201feaee3d9767ef1185783877e92244f14d7d4baAdam Powell
1136ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powell    @Override
1146ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powell    public boolean onTouchEvent(MotionEvent ev) {
1156ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powell        super.onTouchEvent(ev);
116dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell
117dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        // An action bar always eats touch events.
1186ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powell        return true;
1196ecf3d1690789ace1a667093ad6bbdd6cd35bda7Adam Powell    }
120dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell
1217d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell    @Override
1227d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell    public boolean onHoverEvent(MotionEvent ev) {
1237d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell        super.onHoverEvent(ev);
1247d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell
1257d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell        // An action bar always eats hover events.
1267d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell        return true;
1277d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell    }
1287d09f04363cdda6a3cf8b2ad1b67c9a07fa8975fAdam Powell
129f5645cbafe7eed33452d888f16726bee8a0cd9feAdam Powell    public void setTabContainer(ScrollingTabContainerView tabView) {
130dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        if (mTabContainer != null) {
131dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell            removeView(mTabContainer);
132dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        }
133dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        mTabContainer = tabView;
13425151e4792e9be8dbb892b7eba7349773b8127afAdam Powell        if (tabView != null) {
13525151e4792e9be8dbb892b7eba7349773b8127afAdam Powell            addView(tabView);
136af6b97ebe0e6a67d1691c4d7789c7bc312c1e13eAdam Powell            final ViewGroup.LayoutParams lp = tabView.getLayoutParams();
137af6b97ebe0e6a67d1691c4d7789c7bc312c1e13eAdam Powell            lp.width = LayoutParams.MATCH_PARENT;
138af6b97ebe0e6a67d1691c4d7789c7bc312c1e13eAdam Powell            lp.height = LayoutParams.WRAP_CONTENT;
139f5645cbafe7eed33452d888f16726bee8a0cd9feAdam Powell            tabView.setAllowCollapse(false);
14025151e4792e9be8dbb892b7eba7349773b8127afAdam Powell        }
141dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    }
142dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell
143dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    public View getTabContainer() {
144dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        return mTabContainer;
145dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    }
146dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell
147dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    @Override
148a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    public void onDraw(Canvas canvas) {
149a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        if (getWidth() == 0 || getHeight() == 0) {
150a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            return;
151a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        }
152a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
153a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        if (mIsSplit) {
154a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            if (mSplitBackground != null) mSplitBackground.draw(canvas);
155a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        } else {
156a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            if (mBackground != null) {
157a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                mBackground.draw(canvas);
158a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            }
159a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            if (mStackedBackground != null && mIsStacked) {
160a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                mStackedBackground.draw(canvas);
161a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            }
162a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        }
163a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    }
164a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
165a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell    @Override
166640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell    public ActionMode startActionModeForChild(View child, ActionMode.Callback callback) {
167640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        // No starting an action mode for an action bar child! (Where would it go?)
168640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        return null;
169640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell    }
170640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell
171640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell    @Override
172dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
173dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
174d21aa12e8eb9d46ee92bf408b4b48386c6bf062dAdam Powell
175f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell        if (mActionBarView == null) return;
176310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell
177f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell        final LayoutParams lp = (LayoutParams) mActionBarView.getLayoutParams();
178f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell        final int actionBarViewHeight = mActionBarView.isCollapsed() ? 0 :
179f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                mActionBarView.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
180d21aa12e8eb9d46ee92bf408b4b48386c6bf062dAdam Powell
181dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
182dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell            final int mode = MeasureSpec.getMode(heightMeasureSpec);
183dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell            if (mode == MeasureSpec.AT_MOST) {
184dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell                final int maxHeight = MeasureSpec.getSize(heightMeasureSpec);
185dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell                setMeasuredDimension(getMeasuredWidth(),
186f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                        Math.min(actionBarViewHeight + mTabContainer.getMeasuredHeight(),
187f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                                maxHeight));
188dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell            }
189dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        }
190dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    }
191dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell
192dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    @Override
193dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    public void onLayout(boolean changed, int l, int t, int r, int b) {
194dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        super.onLayout(changed, l, t, r, b);
195a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
196a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        final boolean hasTabs = mTabContainer != null && mTabContainer.getVisibility() != GONE;
197a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
198dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
199dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell            final int containerHeight = getMeasuredHeight();
200310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell            final int tabHeight = mTabContainer.getMeasuredHeight();
201310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell
202310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell            if ((mActionBarView.getDisplayOptions() & ActionBar.DISPLAY_SHOW_HOME) == 0) {
203310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                // Not showing home, put tabs on top.
204310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                final int count = getChildCount();
205f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                for (int i = 0; i < count; i++) {
206310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                    final View child = getChildAt(i);
207310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell
208310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                    if (child == mTabContainer) continue;
209310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell
210f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                    if (!mActionBarView.isCollapsed()) {
211f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                        child.offsetTopAndBottom(tabHeight);
212f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell                    }
213310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                }
214310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                mTabContainer.layout(l, 0, r, tabHeight);
215310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell            } else {
216310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell                mTabContainer.layout(l, containerHeight - tabHeight, r, containerHeight);
217310849abb1a0763ea9912b59187f0a4271efaa2eAdam Powell            }
218dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell        }
219a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
220a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        boolean needsInvalidate = false;
221a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        if (mIsSplit) {
222a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            if (mSplitBackground != null) {
223a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                mSplitBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
224a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                needsInvalidate = true;
225a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            }
226a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        } else {
227a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            if (mBackground != null) {
228a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                mBackground.setBounds(mActionBarView.getLeft(), mActionBarView.getTop(),
229a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                        mActionBarView.getRight(), mActionBarView.getBottom());
230a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                needsInvalidate = true;
231a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            }
232a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            if ((mIsStacked = hasTabs && mStackedBackground != null)) {
233a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                mStackedBackground.setBounds(mTabContainer.getLeft(), mTabContainer.getTop(),
234a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                        mTabContainer.getRight(), mTabContainer.getBottom());
235a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell                needsInvalidate = true;
236a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            }
237a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        }
238a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell
239a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        if (needsInvalidate) {
240a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell            invalidate();
241a72ef62e5c329a19eab9935acba816fc1369c637Adam Powell        }
242dae7824c4b78d02159c6ad0896f246942d7b3d8cAdam Powell    }
24345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell}
244