blob: 183cfbd7fc490ca0722667e6e80c037614b18499 [file] [log] [blame]
Adam Powell89e06452010-06-23 20:24:52 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.app;
18
Adam Powellf8ac6b72011-05-23 18:14:09 -070019import com.android.internal.R;
Adam Powell2c9c9fe2010-07-16 10:17:57 -070020import com.android.internal.view.menu.MenuBuilder;
Adam Powell2c9c9fe2010-07-16 10:17:57 -070021import com.android.internal.view.menu.MenuPopupHelper;
22import com.android.internal.view.menu.SubMenuBuilder;
Adam Powell01feaee2011-02-10 15:05:05 -080023import com.android.internal.widget.ActionBarContainer;
Adam Powell89e06452010-06-23 20:24:52 -070024import com.android.internal.widget.ActionBarContextView;
25import com.android.internal.widget.ActionBarView;
Adam Powellf8ac6b72011-05-23 18:14:09 -070026import com.android.internal.widget.ScrollingTabContainerView;
Adam Powell89e06452010-06-23 20:24:52 -070027
Adam Powelld8b3f2e2010-12-02 13:37:03 -080028import android.animation.Animator;
Adam Powelld8b3f2e2010-12-02 13:37:03 -080029import android.animation.Animator.AnimatorListener;
Adam Powell07e1f982011-03-24 11:11:15 -070030import android.animation.AnimatorListenerAdapter;
Adam Powelld8b3f2e2010-12-02 13:37:03 -080031import android.animation.AnimatorSet;
Adam Powelle6ec7322010-12-07 15:29:26 -080032import android.animation.ObjectAnimator;
Adam Powell89e06452010-06-23 20:24:52 -070033import android.app.ActionBar;
Adam Powell661c9082010-07-02 10:09:44 -070034import android.app.Activity;
Adam Powelldec9dfd2010-08-09 15:27:54 -070035import android.app.Dialog;
Adam Powell661c9082010-07-02 10:09:44 -070036import android.app.FragmentTransaction;
Adam Powelldec9dfd2010-08-09 15:27:54 -070037import android.content.Context;
Adam Powellf8ac6b72011-05-23 18:14:09 -070038import android.content.res.Configuration;
39import android.content.res.TypedArray;
Adam Powell89e06452010-06-23 20:24:52 -070040import android.graphics.drawable.Drawable;
Adam Powell0e94b512010-06-29 17:58:20 -070041import android.os.Handler;
Adam Powell6e346362010-07-23 10:18:23 -070042import android.view.ActionMode;
Adam Powell32555f32010-11-17 13:49:22 -080043import android.view.LayoutInflater;
Adam Powell89e06452010-06-23 20:24:52 -070044import android.view.Menu;
Adam Powell9168f0b2010-08-02 15:46:24 -070045import android.view.MenuInflater;
Adam Powell89e06452010-06-23 20:24:52 -070046import android.view.MenuItem;
47import android.view.View;
Adam Powelle6ec7322010-12-07 15:29:26 -080048import android.view.Window;
Adam Powell89e06452010-06-23 20:24:52 -070049import android.widget.SpinnerAdapter;
Adam Powell89e06452010-06-23 20:24:52 -070050
Adam Powell29ed7572010-07-14 16:24:56 -070051import java.lang.ref.WeakReference;
Adam Powell661c9082010-07-02 10:09:44 -070052import java.util.ArrayList;
53
Adam Powell89e06452010-06-23 20:24:52 -070054/**
55 * ActionBarImpl is the ActionBar implementation used
56 * by devices of all screen sizes. If it detects a compatible decor,
57 * it will split contextual modes across both the ActionBarView at
58 * the top of the screen and a horizontal LinearLayout at the bottom
59 * which is normally hidden.
60 */
61public class ActionBarImpl extends ActionBar {
Adam Powelld8145042011-03-24 14:18:27 -070062 private static final String TAG = "ActionBarImpl";
Adam Powell661c9082010-07-02 10:09:44 -070063
Adam Powelldec9dfd2010-08-09 15:27:54 -070064 private Context mContext;
Adam Powell661c9082010-07-02 10:09:44 -070065 private Activity mActivity;
Adam Powelldec9dfd2010-08-09 15:27:54 -070066 private Dialog mDialog;
Adam Powell661c9082010-07-02 10:09:44 -070067
Adam Powell01feaee2011-02-10 15:05:05 -080068 private ActionBarContainer mContainerView;
Adam Powell89e06452010-06-23 20:24:52 -070069 private ActionBarView mActionView;
Adam Powell640a66e2011-04-29 10:18:53 -070070 private ActionBarContextView mContextView;
71 private ActionBarContainer mSplitView;
Adam Powelle6ec7322010-12-07 15:29:26 -080072 private View mContentView;
Adam Powellf8ac6b72011-05-23 18:14:09 -070073 private ScrollingTabContainerView mTabScrollView;
Adam Powell661c9082010-07-02 10:09:44 -070074
75 private ArrayList<TabImpl> mTabs = new ArrayList<TabImpl>();
76
Adam Powell661c9082010-07-02 10:09:44 -070077 private TabImpl mSelectedTab;
Adam Powell0c24a552010-11-03 16:44:11 -070078 private int mSavedTabPosition = INVALID_POSITION;
Adam Powell89e06452010-06-23 20:24:52 -070079
Adam Powell5d279772010-07-27 16:34:07 -070080 private ActionMode mActionMode;
Adam Powell89e06452010-06-23 20:24:52 -070081
Adam Powell8515ee82010-11-30 14:09:55 -080082 private boolean mLastMenuVisibility;
83 private ArrayList<OnMenuVisibilityListener> mMenuVisibilityListeners =
84 new ArrayList<OnMenuVisibilityListener>();
85
Adam Powell89e06452010-06-23 20:24:52 -070086 private static final int CONTEXT_DISPLAY_NORMAL = 0;
87 private static final int CONTEXT_DISPLAY_SPLIT = 1;
88
Adam Powell0c24a552010-11-03 16:44:11 -070089 private static final int INVALID_POSITION = -1;
90
Adam Powell89e06452010-06-23 20:24:52 -070091 private int mContextDisplayMode;
Adam Powellf8ac6b72011-05-23 18:14:09 -070092 private boolean mHasEmbeddedTabs;
93 private int mContentHeight;
Adam Powell0e94b512010-06-29 17:58:20 -070094
95 final Handler mHandler = new Handler();
Adam Powellf8ac6b72011-05-23 18:14:09 -070096 Runnable mTabSelector;
Adam Powelld8b3f2e2010-12-02 13:37:03 -080097
Adam Powell07e1f982011-03-24 11:11:15 -070098 private Animator mCurrentShowAnim;
99 private Animator mCurrentModeAnim;
Adam Powell50efbed2011-02-08 16:20:15 -0800100 private boolean mShowHideAnimationEnabled;
Adam Powell07e1f982011-03-24 11:11:15 -0700101 boolean mWasHiddenBeforeMode;
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800102
Adam Powell07e1f982011-03-24 11:11:15 -0700103 final AnimatorListener mHideListener = new AnimatorListenerAdapter() {
Adam Powelle6ec7322010-12-07 15:29:26 -0800104 @Override
105 public void onAnimationEnd(Animator animation) {
106 if (mContentView != null) {
107 mContentView.setTranslationY(0);
108 }
109 mContainerView.setVisibility(View.GONE);
Adam Powell01feaee2011-02-10 15:05:05 -0800110 mContainerView.setTransitioning(false);
Adam Powell07e1f982011-03-24 11:11:15 -0700111 mCurrentShowAnim = null;
Adam Powelle6ec7322010-12-07 15:29:26 -0800112 }
113 };
114
Adam Powell07e1f982011-03-24 11:11:15 -0700115 final AnimatorListener mShowListener = new AnimatorListenerAdapter() {
Adam Powelle6ec7322010-12-07 15:29:26 -0800116 @Override
117 public void onAnimationEnd(Animator animation) {
Adam Powell07e1f982011-03-24 11:11:15 -0700118 mCurrentShowAnim = null;
Adam Powell45f1e082010-12-10 14:20:13 -0800119 mContainerView.requestLayout();
Adam Powelle6ec7322010-12-07 15:29:26 -0800120 }
Adam Powelle6ec7322010-12-07 15:29:26 -0800121 };
122
Adam Powell661c9082010-07-02 10:09:44 -0700123 public ActionBarImpl(Activity activity) {
Adam Powell661c9082010-07-02 10:09:44 -0700124 mActivity = activity;
Adam Powelle6ec7322010-12-07 15:29:26 -0800125 Window window = activity.getWindow();
126 View decor = window.getDecorView();
127 init(decor);
128 if (!mActivity.getWindow().hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
129 mContentView = decor.findViewById(android.R.id.content);
130 }
Adam Powelldec9dfd2010-08-09 15:27:54 -0700131 }
132
133 public ActionBarImpl(Dialog dialog) {
134 mDialog = dialog;
135 init(dialog.getWindow().getDecorView());
136 }
137
138 private void init(View decor) {
139 mContext = decor.getContext();
Adam Powell89e06452010-06-23 20:24:52 -0700140 mActionView = (ActionBarView) decor.findViewById(com.android.internal.R.id.action_bar);
Adam Powell640a66e2011-04-29 10:18:53 -0700141 mContextView = (ActionBarContextView) decor.findViewById(
Adam Powell89e06452010-06-23 20:24:52 -0700142 com.android.internal.R.id.action_context_bar);
Adam Powell01feaee2011-02-10 15:05:05 -0800143 mContainerView = (ActionBarContainer) decor.findViewById(
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800144 com.android.internal.R.id.action_bar_container);
Adam Powell640a66e2011-04-29 10:18:53 -0700145 mSplitView = (ActionBarContainer) decor.findViewById(
146 com.android.internal.R.id.split_action_bar);
Steve Block08f194b2010-08-24 18:20:48 +0100147
Adam Powell640a66e2011-04-29 10:18:53 -0700148 if (mActionView == null || mContextView == null || mContainerView == null) {
Adam Powell89e06452010-06-23 20:24:52 -0700149 throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
150 "with a compatible window decor layout");
151 }
Adam Powell0e94b512010-06-29 17:58:20 -0700152
Adam Powellf8ac6b72011-05-23 18:14:09 -0700153 mHasEmbeddedTabs = mContext.getResources().getBoolean(
154 com.android.internal.R.bool.action_bar_embed_tabs);
Adam Powell640a66e2011-04-29 10:18:53 -0700155 mActionView.setContextView(mContextView);
Adam Powell9b4bee02011-04-27 19:24:47 -0700156 mContextDisplayMode = mActionView.isSplitActionBar() ?
157 CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;
Adam Powelldae78242011-04-25 15:23:41 -0700158
Adam Powellf8ac6b72011-05-23 18:14:09 -0700159 TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar);
160 mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
161 a.recycle();
162 }
163
164 public void onConfigurationChanged(Configuration newConfig) {
165 mHasEmbeddedTabs = mContext.getResources().getBoolean(
166 com.android.internal.R.bool.action_bar_embed_tabs);
167
168 // Switch tab layout configuration if needed
169 if (!mHasEmbeddedTabs) {
170 mActionView.setEmbeddedTabView(null);
171 mContainerView.setTabContainer(mTabScrollView);
172 } else {
173 mContainerView.setTabContainer(null);
174 if (mTabScrollView != null) {
175 mTabScrollView.setVisibility(View.VISIBLE);
176 }
177 mActionView.setEmbeddedTabView(mTabScrollView);
178 }
179
180 TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar);
181 mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
182 a.recycle();
183
184 if (mTabScrollView != null) {
185 mTabScrollView.getLayoutParams().height = mContentHeight;
186 mTabScrollView.requestLayout();
187 }
188 }
189
190 private void ensureTabsExist() {
191 if (mTabScrollView != null) {
192 return;
193 }
194
195 ScrollingTabContainerView tabScroller = mActionView.createTabContainer();
196
197 if (mHasEmbeddedTabs) {
198 tabScroller.setVisibility(View.VISIBLE);
199 mActionView.setEmbeddedTabView(tabScroller);
200 } else {
Adam Powelldae78242011-04-25 15:23:41 -0700201 tabScroller.setVisibility(getNavigationMode() == NAVIGATION_MODE_TABS ?
202 View.VISIBLE : View.GONE);
Adam Powelldae78242011-04-25 15:23:41 -0700203 mContainerView.setTabContainer(tabScroller);
Adam Powelldae78242011-04-25 15:23:41 -0700204 }
Adam Powellf8ac6b72011-05-23 18:14:09 -0700205 mTabScrollView = tabScroller;
Adam Powell89e06452010-06-23 20:24:52 -0700206 }
207
Adam Powell50efbed2011-02-08 16:20:15 -0800208 /**
209 * Enables or disables animation between show/hide states.
210 * If animation is disabled using this method, animations in progress
211 * will be finished.
212 *
213 * @param enabled true to animate, false to not animate.
214 */
215 public void setShowHideAnimationEnabled(boolean enabled) {
216 mShowHideAnimationEnabled = enabled;
Adam Powell07e1f982011-03-24 11:11:15 -0700217 if (!enabled && mCurrentShowAnim != null) {
218 mCurrentShowAnim.end();
Adam Powell50efbed2011-02-08 16:20:15 -0800219 }
220 }
221
Adam Powell8515ee82010-11-30 14:09:55 -0800222 public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
223 mMenuVisibilityListeners.add(listener);
224 }
225
226 public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
227 mMenuVisibilityListeners.remove(listener);
228 }
229
230 public void dispatchMenuVisibilityChanged(boolean isVisible) {
231 if (isVisible == mLastMenuVisibility) {
232 return;
233 }
234 mLastMenuVisibility = isVisible;
235
236 final int count = mMenuVisibilityListeners.size();
237 for (int i = 0; i < count; i++) {
238 mMenuVisibilityListeners.get(i).onMenuVisibilityChanged(isVisible);
239 }
240 }
241
Adam Powella66c7b02010-07-28 15:28:25 -0700242 @Override
Adam Powell3f476b32011-01-03 19:25:36 -0800243 public void setCustomView(int resId) {
244 setCustomView(LayoutInflater.from(mContext).inflate(resId, mActionView, false));
245 }
246
247 @Override
248 public void setDisplayUseLogoEnabled(boolean useLogo) {
249 setDisplayOptions(useLogo ? DISPLAY_USE_LOGO : 0, DISPLAY_USE_LOGO);
250 }
251
252 @Override
253 public void setDisplayShowHomeEnabled(boolean showHome) {
254 setDisplayOptions(showHome ? DISPLAY_SHOW_HOME : 0, DISPLAY_SHOW_HOME);
255 }
256
257 @Override
258 public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
259 setDisplayOptions(showHomeAsUp ? DISPLAY_HOME_AS_UP : 0, DISPLAY_HOME_AS_UP);
260 }
261
262 @Override
263 public void setDisplayShowTitleEnabled(boolean showTitle) {
264 setDisplayOptions(showTitle ? DISPLAY_SHOW_TITLE : 0, DISPLAY_SHOW_TITLE);
265 }
266
267 @Override
268 public void setDisplayShowCustomEnabled(boolean showCustom) {
269 setDisplayOptions(showCustom ? DISPLAY_SHOW_CUSTOM : 0, DISPLAY_SHOW_CUSTOM);
270 }
271
272 @Override
Adam Powelldae78242011-04-25 15:23:41 -0700273 public void setDisplayDisableHomeEnabled(boolean disableHome) {
274 setDisplayOptions(disableHome ? DISPLAY_DISABLE_HOME : 0, DISPLAY_DISABLE_HOME);
275 }
276
277 @Override
Adam Powella66c7b02010-07-28 15:28:25 -0700278 public void setTitle(int resId) {
Adam Powelldec9dfd2010-08-09 15:27:54 -0700279 setTitle(mContext.getString(resId));
Adam Powella66c7b02010-07-28 15:28:25 -0700280 }
281
282 @Override
283 public void setSubtitle(int resId) {
Adam Powelldec9dfd2010-08-09 15:27:54 -0700284 setSubtitle(mContext.getString(resId));
Adam Powella66c7b02010-07-28 15:28:25 -0700285 }
286
Adam Powell17809772010-07-21 13:25:11 -0700287 public void setSelectedNavigationItem(int position) {
288 switch (mActionView.getNavigationMode()) {
289 case NAVIGATION_MODE_TABS:
290 selectTab(mTabs.get(position));
291 break;
Adam Powell9ab97872010-10-26 21:47:29 -0700292 case NAVIGATION_MODE_LIST:
Adam Powell17809772010-07-21 13:25:11 -0700293 mActionView.setDropdownSelectedPosition(position);
294 break;
295 default:
296 throw new IllegalStateException(
Adam Powell9ab97872010-10-26 21:47:29 -0700297 "setSelectedNavigationIndex not valid for current navigation mode");
Adam Powell17809772010-07-21 13:25:11 -0700298 }
299 }
300
Adam Powell9ab97872010-10-26 21:47:29 -0700301 public void removeAllTabs() {
302 cleanupTabs();
Adam Powell17809772010-07-21 13:25:11 -0700303 }
304
Adam Powell661c9082010-07-02 10:09:44 -0700305 private void cleanupTabs() {
306 if (mSelectedTab != null) {
307 selectTab(null);
308 }
Adam Powell2b6230e2010-09-07 17:55:25 -0700309 mTabs.clear();
Adam Powellf8ac6b72011-05-23 18:14:09 -0700310 mTabScrollView.removeAllTabs();
Adam Powell0c24a552010-11-03 16:44:11 -0700311 mSavedTabPosition = INVALID_POSITION;
Adam Powell661c9082010-07-02 10:09:44 -0700312 }
313
Adam Powell0e94b512010-06-29 17:58:20 -0700314 public void setTitle(CharSequence title) {
315 mActionView.setTitle(title);
316 }
317
318 public void setSubtitle(CharSequence subtitle) {
319 mActionView.setSubtitle(subtitle);
320 }
321
Adam Powell89e06452010-06-23 20:24:52 -0700322 public void setDisplayOptions(int options) {
323 mActionView.setDisplayOptions(options);
324 }
Adam Powell0e94b512010-06-29 17:58:20 -0700325
Adam Powell89e06452010-06-23 20:24:52 -0700326 public void setDisplayOptions(int options, int mask) {
327 final int current = mActionView.getDisplayOptions();
328 mActionView.setDisplayOptions((options & mask) | (current & ~mask));
329 }
330
331 public void setBackgroundDrawable(Drawable d) {
Adam Powelle8c1e5c2010-12-13 10:49:32 -0800332 mContainerView.setBackgroundDrawable(d);
Adam Powell89e06452010-06-23 20:24:52 -0700333 }
334
Adam Powellef704442010-11-16 14:48:22 -0800335 public View getCustomView() {
Adam Powell89e06452010-06-23 20:24:52 -0700336 return mActionView.getCustomNavigationView();
337 }
338
339 public CharSequence getTitle() {
340 return mActionView.getTitle();
341 }
342
343 public CharSequence getSubtitle() {
344 return mActionView.getSubtitle();
345 }
346
347 public int getNavigationMode() {
348 return mActionView.getNavigationMode();
349 }
350
351 public int getDisplayOptions() {
352 return mActionView.getDisplayOptions();
353 }
354
Adam Powell5d279772010-07-27 16:34:07 -0700355 public ActionMode startActionMode(ActionMode.Callback callback) {
356 if (mActionMode != null) {
357 mActionMode.finish();
Adam Powell6e346362010-07-23 10:18:23 -0700358 }
Adam Powell3461b322010-07-14 11:34:43 -0700359
Adam Powell640a66e2011-04-29 10:18:53 -0700360 mContextView.killMode();
Adam Powell5d279772010-07-27 16:34:07 -0700361 ActionMode mode = new ActionModeImpl(callback);
Adam Powell6e346362010-07-23 10:18:23 -0700362 if (callback.onCreateActionMode(mode, mode.getMenu())) {
Adam Powell07e1f982011-03-24 11:11:15 -0700363 mWasHiddenBeforeMode = !isShowing();
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700364 mode.invalidate();
Adam Powell640a66e2011-04-29 10:18:53 -0700365 mContextView.initForMode(mode);
366 animateToMode(true);
367 if (mSplitView != null) {
Adam Powell89e06452010-06-23 20:24:52 -0700368 // TODO animate this
Adam Powell640a66e2011-04-29 10:18:53 -0700369 mSplitView.setVisibility(View.VISIBLE);
Adam Powell89e06452010-06-23 20:24:52 -0700370 }
Adam Powell5d279772010-07-27 16:34:07 -0700371 mActionMode = mode;
Adam Powellac695c62010-07-20 18:19:27 -0700372 return mode;
Adam Powell89e06452010-06-23 20:24:52 -0700373 }
Adam Powellac695c62010-07-20 18:19:27 -0700374 return null;
Adam Powell89e06452010-06-23 20:24:52 -0700375 }
376
Adam Powell661c9082010-07-02 10:09:44 -0700377 private void configureTab(Tab tab, int position) {
378 final TabImpl tabi = (TabImpl) tab;
Adam Powell2b6230e2010-09-07 17:55:25 -0700379 final ActionBar.TabListener callback = tabi.getCallback();
380
381 if (callback == null) {
382 throw new IllegalStateException("Action Bar Tab must have a Callback");
383 }
Adam Powell661c9082010-07-02 10:09:44 -0700384
385 tabi.setPosition(position);
386 mTabs.add(position, tabi);
387
Adam Powell81b89442010-11-02 17:58:56 -0700388 final int count = mTabs.size();
389 for (int i = position + 1; i < count; i++) {
390 mTabs.get(i).setPosition(i);
Adam Powell661c9082010-07-02 10:09:44 -0700391 }
Adam Powell661c9082010-07-02 10:09:44 -0700392 }
393
394 @Override
395 public void addTab(Tab tab) {
Adam Powell81b89442010-11-02 17:58:56 -0700396 addTab(tab, mTabs.isEmpty());
Adam Powell661c9082010-07-02 10:09:44 -0700397 }
398
399 @Override
Adam Powell2b6230e2010-09-07 17:55:25 -0700400 public void addTab(Tab tab, int position) {
Adam Powell81b89442010-11-02 17:58:56 -0700401 addTab(tab, position, mTabs.isEmpty());
402 }
403
404 @Override
405 public void addTab(Tab tab, boolean setSelected) {
Adam Powellf8ac6b72011-05-23 18:14:09 -0700406 ensureTabsExist();
407 mTabScrollView.addTab(tab, setSelected);
Adam Powell81b89442010-11-02 17:58:56 -0700408 configureTab(tab, mTabs.size());
409 if (setSelected) {
410 selectTab(tab);
411 }
412 }
413
414 @Override
415 public void addTab(Tab tab, int position, boolean setSelected) {
Adam Powellf8ac6b72011-05-23 18:14:09 -0700416 ensureTabsExist();
417 mTabScrollView.addTab(tab, position, setSelected);
Adam Powell661c9082010-07-02 10:09:44 -0700418 configureTab(tab, position);
Adam Powell81b89442010-11-02 17:58:56 -0700419 if (setSelected) {
420 selectTab(tab);
421 }
Adam Powell661c9082010-07-02 10:09:44 -0700422 }
423
424 @Override
425 public Tab newTab() {
426 return new TabImpl();
427 }
428
429 @Override
430 public void removeTab(Tab tab) {
431 removeTabAt(tab.getPosition());
432 }
433
434 @Override
435 public void removeTabAt(int position) {
Adam Powellf8ac6b72011-05-23 18:14:09 -0700436 if (mTabScrollView == null) {
437 // No tabs around to remove
438 return;
439 }
440
Adam Powell0c24a552010-11-03 16:44:11 -0700441 int selectedTabPosition = mSelectedTab != null
442 ? mSelectedTab.getPosition() : mSavedTabPosition;
Adam Powellf8ac6b72011-05-23 18:14:09 -0700443 mTabScrollView.removeTabAt(position);
Adam Powell0d8ec1d2011-05-03 14:49:13 -0700444 TabImpl removedTab = mTabs.remove(position);
445 if (removedTab != null) {
446 removedTab.setPosition(-1);
447 }
Adam Powell661c9082010-07-02 10:09:44 -0700448
449 final int newTabCount = mTabs.size();
450 for (int i = position; i < newTabCount; i++) {
451 mTabs.get(i).setPosition(i);
452 }
453
Adam Powell0c24a552010-11-03 16:44:11 -0700454 if (selectedTabPosition == position) {
455 selectTab(mTabs.isEmpty() ? null : mTabs.get(Math.max(0, position - 1)));
456 }
Adam Powell661c9082010-07-02 10:09:44 -0700457 }
458
459 @Override
Adam Powell661c9082010-07-02 10:09:44 -0700460 public void selectTab(Tab tab) {
Adam Powell0c24a552010-11-03 16:44:11 -0700461 if (getNavigationMode() != NAVIGATION_MODE_TABS) {
462 mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
463 return;
464 }
465
Dianne Hackborn48e7b452011-01-17 12:28:35 -0800466 final FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction()
Adam Powell0c24a552010-11-03 16:44:11 -0700467 .disallowAddToBackStack();
Adam Powell7f9b9052010-10-19 16:56:07 -0700468
469 if (mSelectedTab == tab) {
470 if (mSelectedTab != null) {
471 mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
Adam Powellf8ac6b72011-05-23 18:14:09 -0700472 mTabScrollView.animateToTab(tab.getPosition());
Adam Powell7f9b9052010-10-19 16:56:07 -0700473 }
474 } else {
Adam Powellf8ac6b72011-05-23 18:14:09 -0700475 mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
Adam Powell7f9b9052010-10-19 16:56:07 -0700476 if (mSelectedTab != null) {
477 mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
478 }
479 mSelectedTab = (TabImpl) tab;
480 if (mSelectedTab != null) {
481 mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
482 }
Adam Powell2b6230e2010-09-07 17:55:25 -0700483 }
484
485 if (!trans.isEmpty()) {
486 trans.commit();
487 }
488 }
489
490 @Override
491 public Tab getSelectedTab() {
492 return mSelectedTab;
Adam Powell661c9082010-07-02 10:09:44 -0700493 }
494
Adam Powell6b336f82010-08-10 20:13:01 -0700495 @Override
496 public int getHeight() {
497 return mActionView.getHeight();
498 }
499
500 @Override
501 public void show() {
Adam Powell07e1f982011-03-24 11:11:15 -0700502 show(true);
503 }
504
505 void show(boolean markHiddenBeforeMode) {
506 if (mCurrentShowAnim != null) {
507 mCurrentShowAnim.end();
Adam Powell45f1e082010-12-10 14:20:13 -0800508 }
Adam Powelld76cee22011-01-31 15:05:05 -0800509 if (mContainerView.getVisibility() == View.VISIBLE) {
Adam Powell07e1f982011-03-24 11:11:15 -0700510 if (markHiddenBeforeMode) mWasHiddenBeforeMode = false;
Adam Powelld76cee22011-01-31 15:05:05 -0800511 return;
512 }
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800513 mContainerView.setVisibility(View.VISIBLE);
Adam Powell50efbed2011-02-08 16:20:15 -0800514
515 if (mShowHideAnimationEnabled) {
516 mContainerView.setAlpha(0);
517 AnimatorSet anim = new AnimatorSet();
518 AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 1));
519 if (mContentView != null) {
520 b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
521 -mContainerView.getHeight(), 0));
522 mContainerView.setTranslationY(-mContainerView.getHeight());
523 b.with(ObjectAnimator.ofFloat(mContainerView, "translationY", 0));
524 }
Adam Powell640a66e2011-04-29 10:18:53 -0700525 if (mSplitView != null) {
526 mSplitView.setAlpha(0);
527 b.with(ObjectAnimator.ofFloat(mSplitView, "alpha", 1));
528 }
Adam Powell50efbed2011-02-08 16:20:15 -0800529 anim.addListener(mShowListener);
Adam Powell07e1f982011-03-24 11:11:15 -0700530 mCurrentShowAnim = anim;
Adam Powell50efbed2011-02-08 16:20:15 -0800531 anim.start();
532 } else {
Adam Powelld8145042011-03-24 14:18:27 -0700533 mContainerView.setAlpha(1);
534 mContainerView.setTranslationY(0);
Adam Powell50efbed2011-02-08 16:20:15 -0800535 mShowListener.onAnimationEnd(null);
Adam Powelle6ec7322010-12-07 15:29:26 -0800536 }
Adam Powell6b336f82010-08-10 20:13:01 -0700537 }
538
539 @Override
540 public void hide() {
Adam Powell07e1f982011-03-24 11:11:15 -0700541 if (mCurrentShowAnim != null) {
542 mCurrentShowAnim.end();
Adam Powelle6ec7322010-12-07 15:29:26 -0800543 }
544 if (mContainerView.getVisibility() == View.GONE) {
545 return;
546 }
Adam Powell50efbed2011-02-08 16:20:15 -0800547
548 if (mShowHideAnimationEnabled) {
549 mContainerView.setAlpha(1);
Adam Powell01feaee2011-02-10 15:05:05 -0800550 mContainerView.setTransitioning(true);
Adam Powell50efbed2011-02-08 16:20:15 -0800551 AnimatorSet anim = new AnimatorSet();
552 AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 0));
553 if (mContentView != null) {
554 b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
555 0, -mContainerView.getHeight()));
556 b.with(ObjectAnimator.ofFloat(mContainerView, "translationY",
557 -mContainerView.getHeight()));
558 }
Adam Powell640a66e2011-04-29 10:18:53 -0700559 if (mSplitView != null) {
560 mSplitView.setAlpha(1);
561 b.with(ObjectAnimator.ofFloat(mSplitView, "alpha", 0));
562 }
Adam Powell50efbed2011-02-08 16:20:15 -0800563 anim.addListener(mHideListener);
Adam Powell07e1f982011-03-24 11:11:15 -0700564 mCurrentShowAnim = anim;
Adam Powell50efbed2011-02-08 16:20:15 -0800565 anim.start();
566 } else {
567 mHideListener.onAnimationEnd(null);
Adam Powelle6ec7322010-12-07 15:29:26 -0800568 }
Adam Powell6b336f82010-08-10 20:13:01 -0700569 }
570
571 public boolean isShowing() {
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800572 return mContainerView.getVisibility() == View.VISIBLE;
573 }
574
Adam Powell640a66e2011-04-29 10:18:53 -0700575 void animateToMode(boolean toActionMode) {
Adam Powell07e1f982011-03-24 11:11:15 -0700576 show(false);
577 if (mCurrentModeAnim != null) {
578 mCurrentModeAnim.end();
579 }
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800580
Adam Powell640a66e2011-04-29 10:18:53 -0700581 mActionView.animateToVisibility(toActionMode ? View.GONE : View.VISIBLE);
582 mContextView.animateToVisibility(toActionMode ? View.VISIBLE : View.GONE);
Adam Powell6b336f82010-08-10 20:13:01 -0700583 }
584
Adam Powell89e06452010-06-23 20:24:52 -0700585 /**
586 * @hide
587 */
Adam Powell5d279772010-07-27 16:34:07 -0700588 public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
Adam Powell6e346362010-07-23 10:18:23 -0700589 private ActionMode.Callback mCallback;
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700590 private MenuBuilder mMenu;
Adam Powell29ed7572010-07-14 16:24:56 -0700591 private WeakReference<View> mCustomView;
Adam Powell89e06452010-06-23 20:24:52 -0700592
Adam Powell5d279772010-07-27 16:34:07 -0700593 public ActionModeImpl(ActionMode.Callback callback) {
Adam Powell89e06452010-06-23 20:24:52 -0700594 mCallback = callback;
Adam Powell4d9861e2010-08-17 11:14:40 -0700595 mMenu = new MenuBuilder(mActionView.getContext())
596 .setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700597 mMenu.setCallback(this);
Adam Powell89e06452010-06-23 20:24:52 -0700598 }
Adam Powell9168f0b2010-08-02 15:46:24 -0700599
600 @Override
601 public MenuInflater getMenuInflater() {
Adam Powell4d9861e2010-08-17 11:14:40 -0700602 return new MenuInflater(mContext);
Adam Powell9168f0b2010-08-02 15:46:24 -0700603 }
604
Adam Powell89e06452010-06-23 20:24:52 -0700605 @Override
606 public Menu getMenu() {
607 return mMenu;
608 }
609
610 @Override
611 public void finish() {
Adam Powell5d279772010-07-27 16:34:07 -0700612 if (mActionMode != this) {
613 // Not the active action mode - no-op
Adam Powell93b6bc32010-07-22 11:36:35 -0700614 return;
615 }
616
Adam Powell6e346362010-07-23 10:18:23 -0700617 mCallback.onDestroyActionMode(this);
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800618 mCallback = null;
Adam Powell640a66e2011-04-29 10:18:53 -0700619 animateToMode(false);
Adam Powell0e94b512010-06-29 17:58:20 -0700620
621 // Clear out the context mode views after the animation finishes
Adam Powell640a66e2011-04-29 10:18:53 -0700622 mContextView.closeMode();
Adam Powell5d279772010-07-27 16:34:07 -0700623 mActionMode = null;
Adam Powell07e1f982011-03-24 11:11:15 -0700624
625 if (mWasHiddenBeforeMode) {
626 hide();
627 }
Adam Powell89e06452010-06-23 20:24:52 -0700628 }
629
630 @Override
631 public void invalidate() {
Adam Powell6e346362010-07-23 10:18:23 -0700632 if (mCallback.onPrepareActionMode(this, mMenu)) {
Adam Powell89e06452010-06-23 20:24:52 -0700633 // Refresh content in both context views
634 }
635 }
636
637 @Override
638 public void setCustomView(View view) {
Adam Powell640a66e2011-04-29 10:18:53 -0700639 mContextView.setCustomView(view);
Adam Powell29ed7572010-07-14 16:24:56 -0700640 mCustomView = new WeakReference<View>(view);
Adam Powell89e06452010-06-23 20:24:52 -0700641 }
642
643 @Override
644 public void setSubtitle(CharSequence subtitle) {
Adam Powell640a66e2011-04-29 10:18:53 -0700645 mContextView.setSubtitle(subtitle);
Adam Powell89e06452010-06-23 20:24:52 -0700646 }
647
648 @Override
649 public void setTitle(CharSequence title) {
Adam Powell640a66e2011-04-29 10:18:53 -0700650 mContextView.setTitle(title);
Adam Powell89e06452010-06-23 20:24:52 -0700651 }
Adam Powell29ed7572010-07-14 16:24:56 -0700652
653 @Override
Adam Powellc9ae2a22010-07-28 14:44:21 -0700654 public void setTitle(int resId) {
Adam Powell48e8ac32011-01-14 12:10:24 -0800655 setTitle(mContext.getResources().getString(resId));
Adam Powellc9ae2a22010-07-28 14:44:21 -0700656 }
657
658 @Override
659 public void setSubtitle(int resId) {
Adam Powell48e8ac32011-01-14 12:10:24 -0800660 setSubtitle(mContext.getResources().getString(resId));
Adam Powellc9ae2a22010-07-28 14:44:21 -0700661 }
662
663 @Override
Adam Powell29ed7572010-07-14 16:24:56 -0700664 public CharSequence getTitle() {
Adam Powell640a66e2011-04-29 10:18:53 -0700665 return mContextView.getTitle();
Adam Powell29ed7572010-07-14 16:24:56 -0700666 }
667
668 @Override
669 public CharSequence getSubtitle() {
Adam Powell640a66e2011-04-29 10:18:53 -0700670 return mContextView.getSubtitle();
Adam Powell29ed7572010-07-14 16:24:56 -0700671 }
Adam Powell89e06452010-06-23 20:24:52 -0700672
Adam Powell29ed7572010-07-14 16:24:56 -0700673 @Override
674 public View getCustomView() {
675 return mCustomView != null ? mCustomView.get() : null;
676 }
677
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700678 public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800679 if (mCallback != null) {
680 return mCallback.onActionItemClicked(this, item);
681 } else {
682 return false;
683 }
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700684 }
685
686 public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
687 }
688
689 public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800690 if (mCallback == null) {
691 return false;
692 }
693
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700694 if (!subMenu.hasVisibleItems()) {
695 return true;
Adam Powell89e06452010-06-23 20:24:52 -0700696 }
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700697
Adam Powelldec9dfd2010-08-09 15:27:54 -0700698 new MenuPopupHelper(mContext, subMenu).show();
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700699 return true;
700 }
701
702 public void onCloseSubMenu(SubMenuBuilder menu) {
703 }
704
705 public void onMenuModeChange(MenuBuilder menu) {
Adam Powelld8b3f2e2010-12-02 13:37:03 -0800706 if (mCallback == null) {
707 return;
708 }
Adam Powellf6148c52010-08-11 21:10:16 -0700709 invalidate();
Adam Powell640a66e2011-04-29 10:18:53 -0700710 mContextView.showOverflowMenu();
Adam Powell2c9c9fe2010-07-16 10:17:57 -0700711 }
Adam Powell661c9082010-07-02 10:09:44 -0700712 }
713
714 /**
715 * @hide
716 */
717 public class TabImpl extends ActionBar.Tab {
Adam Powell2b6230e2010-09-07 17:55:25 -0700718 private ActionBar.TabListener mCallback;
719 private Object mTag;
Adam Powell661c9082010-07-02 10:09:44 -0700720 private Drawable mIcon;
721 private CharSequence mText;
Adam Powell0d8ec1d2011-05-03 14:49:13 -0700722 private int mPosition = -1;
Adam Powell2b6230e2010-09-07 17:55:25 -0700723 private View mCustomView;
Adam Powell661c9082010-07-02 10:09:44 -0700724
725 @Override
Adam Powell2b6230e2010-09-07 17:55:25 -0700726 public Object getTag() {
727 return mTag;
728 }
729
730 @Override
Adam Powell9ab97872010-10-26 21:47:29 -0700731 public Tab setTag(Object tag) {
Adam Powell2b6230e2010-09-07 17:55:25 -0700732 mTag = tag;
Adam Powell9ab97872010-10-26 21:47:29 -0700733 return this;
Adam Powell2b6230e2010-09-07 17:55:25 -0700734 }
735
736 public ActionBar.TabListener getCallback() {
737 return mCallback;
738 }
739
740 @Override
Adam Powell9ab97872010-10-26 21:47:29 -0700741 public Tab setTabListener(ActionBar.TabListener callback) {
Adam Powell2b6230e2010-09-07 17:55:25 -0700742 mCallback = callback;
Adam Powell9ab97872010-10-26 21:47:29 -0700743 return this;
Adam Powell2b6230e2010-09-07 17:55:25 -0700744 }
745
746 @Override
747 public View getCustomView() {
748 return mCustomView;
749 }
750
751 @Override
Adam Powell9ab97872010-10-26 21:47:29 -0700752 public Tab setCustomView(View view) {
Adam Powell2b6230e2010-09-07 17:55:25 -0700753 mCustomView = view;
Adam Powellf8ac6b72011-05-23 18:14:09 -0700754 if (mPosition >= 0) {
755 mTabScrollView.updateTab(mPosition);
756 }
Adam Powell9ab97872010-10-26 21:47:29 -0700757 return this;
Adam Powell661c9082010-07-02 10:09:44 -0700758 }
759
760 @Override
Adam Powell32555f32010-11-17 13:49:22 -0800761 public Tab setCustomView(int layoutResId) {
762 return setCustomView(LayoutInflater.from(mContext).inflate(layoutResId, null));
763 }
764
765 @Override
Adam Powell661c9082010-07-02 10:09:44 -0700766 public Drawable getIcon() {
767 return mIcon;
768 }
769
770 @Override
771 public int getPosition() {
772 return mPosition;
773 }
774
775 public void setPosition(int position) {
776 mPosition = position;
777 }
778
779 @Override
780 public CharSequence getText() {
781 return mText;
782 }
783
784 @Override
Adam Powell9ab97872010-10-26 21:47:29 -0700785 public Tab setIcon(Drawable icon) {
Adam Powell661c9082010-07-02 10:09:44 -0700786 mIcon = icon;
Adam Powellf8ac6b72011-05-23 18:14:09 -0700787 if (mPosition >= 0) {
788 mTabScrollView.updateTab(mPosition);
789 }
Adam Powell9ab97872010-10-26 21:47:29 -0700790 return this;
Adam Powell661c9082010-07-02 10:09:44 -0700791 }
792
793 @Override
Adam Powell32555f32010-11-17 13:49:22 -0800794 public Tab setIcon(int resId) {
795 return setIcon(mContext.getResources().getDrawable(resId));
796 }
797
798 @Override
Adam Powell9ab97872010-10-26 21:47:29 -0700799 public Tab setText(CharSequence text) {
Adam Powell661c9082010-07-02 10:09:44 -0700800 mText = text;
Adam Powellf8ac6b72011-05-23 18:14:09 -0700801 if (mPosition >= 0) {
802 mTabScrollView.updateTab(mPosition);
803 }
Adam Powell9ab97872010-10-26 21:47:29 -0700804 return this;
Adam Powell661c9082010-07-02 10:09:44 -0700805 }
806
807 @Override
Adam Powell32555f32010-11-17 13:49:22 -0800808 public Tab setText(int resId) {
809 return setText(mContext.getResources().getText(resId));
810 }
811
812 @Override
Adam Powell661c9082010-07-02 10:09:44 -0700813 public void select() {
814 selectTab(this);
Adam Powell89e06452010-06-23 20:24:52 -0700815 }
816 }
Adam Powell9ab97872010-10-26 21:47:29 -0700817
818 @Override
819 public void setCustomView(View view) {
820 mActionView.setCustomNavigationView(view);
821 }
822
823 @Override
824 public void setCustomView(View view, LayoutParams layoutParams) {
825 view.setLayoutParams(layoutParams);
826 mActionView.setCustomNavigationView(view);
827 }
828
829 @Override
Adam Powell8515ee82010-11-30 14:09:55 -0800830 public void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback) {
Adam Powell9ab97872010-10-26 21:47:29 -0700831 mActionView.setDropdownAdapter(adapter);
832 mActionView.setCallback(callback);
833 }
834
835 @Override
836 public int getSelectedNavigationIndex() {
837 switch (mActionView.getNavigationMode()) {
838 case NAVIGATION_MODE_TABS:
Adam Powell04587962010-11-11 22:15:07 -0800839 return mSelectedTab != null ? mSelectedTab.getPosition() : -1;
Adam Powell9ab97872010-10-26 21:47:29 -0700840 case NAVIGATION_MODE_LIST:
841 return mActionView.getDropdownSelectedPosition();
842 default:
843 return -1;
844 }
845 }
846
847 @Override
848 public int getNavigationItemCount() {
849 switch (mActionView.getNavigationMode()) {
850 case NAVIGATION_MODE_TABS:
851 return mTabs.size();
852 case NAVIGATION_MODE_LIST:
853 SpinnerAdapter adapter = mActionView.getDropdownAdapter();
854 return adapter != null ? adapter.getCount() : 0;
855 default:
856 return 0;
857 }
858 }
859
860 @Override
Adam Powell0c24a552010-11-03 16:44:11 -0700861 public int getTabCount() {
862 return mTabs.size();
863 }
864
865 @Override
Adam Powell9ab97872010-10-26 21:47:29 -0700866 public void setNavigationMode(int mode) {
Adam Powell0c24a552010-11-03 16:44:11 -0700867 final int oldMode = mActionView.getNavigationMode();
868 switch (oldMode) {
869 case NAVIGATION_MODE_TABS:
870 mSavedTabPosition = getSelectedNavigationIndex();
871 selectTab(null);
Adam Powelldae78242011-04-25 15:23:41 -0700872 if (!mActionView.hasEmbeddedTabs()) {
Adam Powellf8ac6b72011-05-23 18:14:09 -0700873 mTabScrollView.setVisibility(View.GONE);
Adam Powelldae78242011-04-25 15:23:41 -0700874 }
Adam Powell0c24a552010-11-03 16:44:11 -0700875 break;
876 }
Adam Powell9ab97872010-10-26 21:47:29 -0700877 mActionView.setNavigationMode(mode);
Adam Powell0c24a552010-11-03 16:44:11 -0700878 switch (mode) {
879 case NAVIGATION_MODE_TABS:
Adam Powellf8ac6b72011-05-23 18:14:09 -0700880 ensureTabsExist();
Adam Powelldae78242011-04-25 15:23:41 -0700881 if (!mActionView.hasEmbeddedTabs()) {
Adam Powellf8ac6b72011-05-23 18:14:09 -0700882 mTabScrollView.setVisibility(View.VISIBLE);
Adam Powelldae78242011-04-25 15:23:41 -0700883 }
Adam Powell0c24a552010-11-03 16:44:11 -0700884 if (mSavedTabPosition != INVALID_POSITION) {
885 setSelectedNavigationItem(mSavedTabPosition);
886 mSavedTabPosition = INVALID_POSITION;
887 }
888 break;
889 }
Adam Powell9ab97872010-10-26 21:47:29 -0700890 }
891
892 @Override
893 public Tab getTabAt(int index) {
894 return mTabs.get(index);
895 }
Adam Powell0c24a552010-11-03 16:44:11 -0700896
Adam Powell0c24a552010-11-03 16:44:11 -0700897
Adam Powell1969b872011-03-22 11:52:48 -0700898 @Override
899 public void setIcon(int resId) {
Adam Powell45c515b2011-04-21 18:50:20 -0700900 mActionView.setIcon(resId);
Adam Powell1969b872011-03-22 11:52:48 -0700901 }
Adam Powell0c24a552010-11-03 16:44:11 -0700902
Adam Powell1969b872011-03-22 11:52:48 -0700903 @Override
904 public void setIcon(Drawable icon) {
905 mActionView.setIcon(icon);
906 }
907
908 @Override
909 public void setLogo(int resId) {
Adam Powell45c515b2011-04-21 18:50:20 -0700910 mActionView.setLogo(resId);
Adam Powell1969b872011-03-22 11:52:48 -0700911 }
912
913 @Override
914 public void setLogo(Drawable logo) {
915 mActionView.setLogo(logo);
Adam Powell0c24a552010-11-03 16:44:11 -0700916 }
Adam Powell89e06452010-06-23 20:24:52 -0700917}