Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | |
| 17 | package com.android.internal.view.menu; |
| 18 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 19 | import android.content.Context; |
Adam Powell | bfcdfaf | 2011-08-19 11:46:59 -0700 | [diff] [blame] | 20 | import android.content.res.Configuration; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 21 | import android.content.res.Resources; |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 22 | import android.os.Parcel; |
| 23 | import android.os.Parcelable; |
Adam Powell | ad79b90 | 2013-06-19 11:33:28 -0700 | [diff] [blame] | 24 | import android.transition.Transition; |
| 25 | import android.transition.TransitionManager; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 26 | import android.util.SparseBooleanArray; |
Adam Powell | 823f074 | 2011-09-21 17:17:01 -0700 | [diff] [blame] | 27 | import android.view.ActionProvider; |
Adam Powell | 54c94de | 2013-09-26 15:36:34 -0700 | [diff] [blame] | 28 | import android.view.Gravity; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 29 | import android.view.MenuItem; |
| 30 | import android.view.SoundEffectConstants; |
| 31 | import android.view.View; |
| 32 | import android.view.View.MeasureSpec; |
| 33 | import android.view.ViewGroup; |
Adam Powell | ad79b90 | 2013-06-19 11:33:28 -0700 | [diff] [blame] | 34 | import android.view.accessibility.AccessibilityNodeInfo; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 35 | import android.widget.ImageButton; |
Alan Viverette | ca6a3611 | 2013-08-16 14:41:06 -0700 | [diff] [blame] | 36 | import android.widget.ListPopupWindow; |
| 37 | import android.widget.ListPopupWindow.ForwardingListener; |
Adam Powell | ad79b90 | 2013-06-19 11:33:28 -0700 | [diff] [blame] | 38 | import com.android.internal.transition.ActionBarTransition; |
Alan Viverette | 80e7270 | 2013-07-29 11:12:59 -0700 | [diff] [blame] | 39 | import com.android.internal.view.ActionBarPolicy; |
| 40 | import com.android.internal.view.menu.ActionMenuView.ActionMenuChildView; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 41 | |
| 42 | import java.util.ArrayList; |
| 43 | |
| 44 | /** |
| 45 | * MenuPresenter for building action menus as seen in the action bar and action modes. |
| 46 | */ |
Adam Powell | 823f074 | 2011-09-21 17:17:01 -0700 | [diff] [blame] | 47 | public class ActionMenuPresenter extends BaseMenuPresenter |
| 48 | implements ActionProvider.SubUiVisibilityListener { |
Adam Powell | 640a66e | 2011-04-29 10:18:53 -0700 | [diff] [blame] | 49 | private static final String TAG = "ActionMenuPresenter"; |
| 50 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 51 | private View mOverflowButton; |
| 52 | private boolean mReserveOverflow; |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 53 | private boolean mReserveOverflowSet; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 54 | private int mWidthLimit; |
| 55 | private int mActionItemWidthLimit; |
| 56 | private int mMaxItems; |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 57 | private boolean mMaxItemsSet; |
Adam Powell | 640a66e | 2011-04-29 10:18:53 -0700 | [diff] [blame] | 58 | private boolean mStrictWidthLimit; |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 59 | private boolean mWidthLimitSet; |
Adam Powell | b187cd9 | 2011-07-20 14:17:56 -0700 | [diff] [blame] | 60 | private boolean mExpandedActionViewsExclusive; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 61 | |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 62 | private int mMinCellSize; |
| 63 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 64 | // Group IDs that have been added as actions - used temporarily, allocated here for reuse. |
| 65 | private final SparseBooleanArray mActionButtonGroups = new SparseBooleanArray(); |
| 66 | |
| 67 | private View mScrapActionButtonView; |
| 68 | |
| 69 | private OverflowPopup mOverflowPopup; |
| 70 | private ActionButtonSubmenu mActionButtonPopup; |
| 71 | |
| 72 | private OpenOverflowRunnable mPostedOpenRunnable; |
| 73 | |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 74 | final PopupPresenterCallback mPopupPresenterCallback = new PopupPresenterCallback(); |
| 75 | int mOpenSubMenuId; |
| 76 | |
Adam Powell | 538e565 | 2011-10-11 13:47:08 -0700 | [diff] [blame] | 77 | public ActionMenuPresenter(Context context) { |
| 78 | super(context, com.android.internal.R.layout.action_menu_layout, |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 79 | com.android.internal.R.layout.action_menu_item_layout); |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public void initForMenu(Context context, MenuBuilder menu) { |
| 84 | super.initForMenu(context, menu); |
| 85 | |
| 86 | final Resources res = context.getResources(); |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 87 | |
Adam Powell | b8139af | 2012-04-19 13:52:46 -0700 | [diff] [blame] | 88 | final ActionBarPolicy abp = ActionBarPolicy.get(context); |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 89 | if (!mReserveOverflowSet) { |
Adam Powell | b8139af | 2012-04-19 13:52:46 -0700 | [diff] [blame] | 90 | mReserveOverflow = abp.showsOverflowMenuButton(); |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | if (!mWidthLimitSet) { |
Adam Powell | b8139af | 2012-04-19 13:52:46 -0700 | [diff] [blame] | 94 | mWidthLimit = abp.getEmbeddedMenuWidthLimit(); |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 95 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 96 | |
| 97 | // Measure for initial configuration |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 98 | if (!mMaxItemsSet) { |
Adam Powell | b8139af | 2012-04-19 13:52:46 -0700 | [diff] [blame] | 99 | mMaxItems = abp.getMaxActionButtons(); |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 100 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 101 | |
| 102 | int width = mWidthLimit; |
| 103 | if (mReserveOverflow) { |
Adam Powell | 9b4bee0 | 2011-04-27 19:24:47 -0700 | [diff] [blame] | 104 | if (mOverflowButton == null) { |
Adam Powell | 538e565 | 2011-10-11 13:47:08 -0700 | [diff] [blame] | 105 | mOverflowButton = new OverflowMenuButton(mSystemContext); |
Adam Powell | 9b4bee0 | 2011-04-27 19:24:47 -0700 | [diff] [blame] | 106 | final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); |
| 107 | mOverflowButton.measure(spec, spec); |
| 108 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 109 | width -= mOverflowButton.getMeasuredWidth(); |
| 110 | } else { |
| 111 | mOverflowButton = null; |
| 112 | } |
| 113 | |
| 114 | mActionItemWidthLimit = width; |
| 115 | |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 116 | mMinCellSize = (int) (ActionMenuView.MIN_CELL_SIZE * res.getDisplayMetrics().density); |
| 117 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 118 | // Drop a scrap view as it may no longer reflect the proper context/config. |
| 119 | mScrapActionButtonView = null; |
| 120 | } |
| 121 | |
Adam Powell | bfcdfaf | 2011-08-19 11:46:59 -0700 | [diff] [blame] | 122 | public void onConfigurationChanged(Configuration newConfig) { |
| 123 | if (!mMaxItemsSet) { |
| 124 | mMaxItems = mContext.getResources().getInteger( |
| 125 | com.android.internal.R.integer.max_action_buttons); |
Adam Powell | f203e0a | 2012-03-06 17:40:12 -0800 | [diff] [blame] | 126 | } |
| 127 | if (mMenu != null) { |
| 128 | mMenu.onItemsChanged(true); |
Adam Powell | bfcdfaf | 2011-08-19 11:46:59 -0700 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | |
Adam Powell | 640a66e | 2011-04-29 10:18:53 -0700 | [diff] [blame] | 132 | public void setWidthLimit(int width, boolean strict) { |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 133 | mWidthLimit = width; |
Adam Powell | 640a66e | 2011-04-29 10:18:53 -0700 | [diff] [blame] | 134 | mStrictWidthLimit = strict; |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 135 | mWidthLimitSet = true; |
| 136 | } |
| 137 | |
| 138 | public void setReserveOverflow(boolean reserveOverflow) { |
| 139 | mReserveOverflow = reserveOverflow; |
| 140 | mReserveOverflowSet = true; |
Adam Powell | 9b4bee0 | 2011-04-27 19:24:47 -0700 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | public void setItemLimit(int itemCount) { |
| 144 | mMaxItems = itemCount; |
Adam Powell | 1ab418a | 2011-06-09 20:49:49 -0700 | [diff] [blame] | 145 | mMaxItemsSet = true; |
Adam Powell | 9b4bee0 | 2011-04-27 19:24:47 -0700 | [diff] [blame] | 146 | } |
| 147 | |
Adam Powell | b187cd9 | 2011-07-20 14:17:56 -0700 | [diff] [blame] | 148 | public void setExpandedActionViewsExclusive(boolean isExclusive) { |
| 149 | mExpandedActionViewsExclusive = isExclusive; |
| 150 | } |
| 151 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 152 | @Override |
| 153 | public MenuView getMenuView(ViewGroup root) { |
| 154 | MenuView result = super.getMenuView(root); |
| 155 | ((ActionMenuView) result).setPresenter(this); |
| 156 | return result; |
| 157 | } |
| 158 | |
| 159 | @Override |
Alan Viverette | fbe4a58 | 2013-09-06 13:45:54 -0700 | [diff] [blame] | 160 | public View getItemView(final MenuItemImpl item, View convertView, ViewGroup parent) { |
Adam Powell | 8d02dea | 2011-05-31 21:35:13 -0700 | [diff] [blame] | 161 | View actionView = item.getActionView(); |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 162 | if (actionView == null || item.hasCollapsibleActionView()) { |
Adam Powell | c3ca3ea | 2013-10-10 18:07:48 -0700 | [diff] [blame] | 163 | actionView = super.getItemView(item, convertView, parent); |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 164 | } |
Adam Powell | 8d02dea | 2011-05-31 21:35:13 -0700 | [diff] [blame] | 165 | actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE); |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 166 | |
Adam Powell | efc3bb0 | 2014-01-10 10:16:27 -0800 | [diff] [blame] | 167 | final ActionMenuView menuParent = (ActionMenuView) parent; |
| 168 | final ViewGroup.LayoutParams lp = actionView.getLayoutParams(); |
| 169 | if (!menuParent.checkLayoutParams(lp)) { |
| 170 | actionView.setLayoutParams(menuParent.generateLayoutParams(lp)); |
| 171 | } |
| 172 | return actionView; |
| 173 | } |
| 174 | |
| 175 | @Override |
| 176 | public void bindItemView(final MenuItemImpl item, MenuView.ItemView itemView) { |
| 177 | itemView.initialize(item, 0); |
| 178 | |
| 179 | final ActionMenuView menuView = (ActionMenuView) mMenuView; |
| 180 | final ActionMenuItemView actionItemView = (ActionMenuItemView) itemView; |
| 181 | actionItemView.setItemInvoker(menuView); |
| 182 | |
Alan Viverette | fbe4a58 | 2013-09-06 13:45:54 -0700 | [diff] [blame] | 183 | if (item.hasSubMenu()) { |
Adam Powell | efc3bb0 | 2014-01-10 10:16:27 -0800 | [diff] [blame] | 184 | actionItemView.setOnTouchListener(new ForwardingListener(actionItemView) { |
Alan Viverette | fbe4a58 | 2013-09-06 13:45:54 -0700 | [diff] [blame] | 185 | @Override |
| 186 | public ListPopupWindow getPopup() { |
| 187 | return mActionButtonPopup != null ? mActionButtonPopup.getPopup() : null; |
| 188 | } |
| 189 | |
| 190 | @Override |
| 191 | protected boolean onForwardingStarted() { |
| 192 | return onSubMenuSelected((SubMenuBuilder) item.getSubMenu()); |
| 193 | } |
| 194 | |
| 195 | @Override |
| 196 | protected boolean onForwardingStopped() { |
| 197 | return dismissPopupMenus(); |
| 198 | } |
| 199 | }); |
| 200 | } else { |
Adam Powell | efc3bb0 | 2014-01-10 10:16:27 -0800 | [diff] [blame] | 201 | actionItemView.setOnTouchListener(null); |
Alan Viverette | fbe4a58 | 2013-09-06 13:45:54 -0700 | [diff] [blame] | 202 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | @Override |
| 206 | public boolean shouldIncludeItem(int childIndex, MenuItemImpl item) { |
| 207 | return item.isActionButton(); |
| 208 | } |
| 209 | |
| 210 | @Override |
| 211 | public void updateMenuView(boolean cleared) { |
Adam Powell | ad79b90 | 2013-06-19 11:33:28 -0700 | [diff] [blame] | 212 | final ViewGroup menuViewParent = (ViewGroup) ((View) mMenuView).getParent(); |
| 213 | if (menuViewParent != null) { |
Chet Haase | d8d7c38 | 2013-09-23 11:26:36 -0700 | [diff] [blame] | 214 | ActionBarTransition.beginDelayedTransition(menuViewParent); |
Adam Powell | ad79b90 | 2013-06-19 11:33:28 -0700 | [diff] [blame] | 215 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 216 | super.updateMenuView(cleared); |
| 217 | |
Adam Powell | da97108 | 2013-10-03 18:21:58 -0700 | [diff] [blame] | 218 | ((View) mMenuView).requestLayout(); |
| 219 | |
Adam Powell | 823f074 | 2011-09-21 17:17:01 -0700 | [diff] [blame] | 220 | if (mMenu != null) { |
| 221 | final ArrayList<MenuItemImpl> actionItems = mMenu.getActionItems(); |
| 222 | final int count = actionItems.size(); |
| 223 | for (int i = 0; i < count; i++) { |
| 224 | final ActionProvider provider = actionItems.get(i).getActionProvider(); |
| 225 | if (provider != null) { |
| 226 | provider.setSubUiVisibilityListener(this); |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
Adam Powell | 275702c | 2011-09-23 17:34:04 -0700 | [diff] [blame] | 231 | final ArrayList<MenuItemImpl> nonActionItems = mMenu != null ? |
| 232 | mMenu.getNonActionItems() : null; |
| 233 | |
| 234 | boolean hasOverflow = false; |
| 235 | if (mReserveOverflow && nonActionItems != null) { |
| 236 | final int count = nonActionItems.size(); |
| 237 | if (count == 1) { |
| 238 | hasOverflow = !nonActionItems.get(0).isActionViewExpanded(); |
| 239 | } else { |
| 240 | hasOverflow = count > 0; |
| 241 | } |
| 242 | } |
| 243 | |
Adam Powell | 14b7e2c | 2011-08-12 11:11:50 -0700 | [diff] [blame] | 244 | if (hasOverflow) { |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 245 | if (mOverflowButton == null) { |
Adam Powell | 538e565 | 2011-10-11 13:47:08 -0700 | [diff] [blame] | 246 | mOverflowButton = new OverflowMenuButton(mSystemContext); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 247 | } |
| 248 | ViewGroup parent = (ViewGroup) mOverflowButton.getParent(); |
| 249 | if (parent != mMenuView) { |
| 250 | if (parent != null) { |
| 251 | parent.removeView(mOverflowButton); |
| 252 | } |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 253 | ActionMenuView menuView = (ActionMenuView) mMenuView; |
| 254 | menuView.addView(mOverflowButton, menuView.generateOverflowButtonLayoutParams()); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 255 | } |
| 256 | } else if (mOverflowButton != null && mOverflowButton.getParent() == mMenuView) { |
| 257 | ((ViewGroup) mMenuView).removeView(mOverflowButton); |
| 258 | } |
Adam Powell | 14b7e2c | 2011-08-12 11:11:50 -0700 | [diff] [blame] | 259 | |
| 260 | ((ActionMenuView) mMenuView).setOverflowReserved(mReserveOverflow); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | @Override |
| 264 | public boolean filterLeftoverView(ViewGroup parent, int childIndex) { |
| 265 | if (parent.getChildAt(childIndex) == mOverflowButton) return false; |
| 266 | return super.filterLeftoverView(parent, childIndex); |
| 267 | } |
| 268 | |
| 269 | public boolean onSubMenuSelected(SubMenuBuilder subMenu) { |
| 270 | if (!subMenu.hasVisibleItems()) return false; |
| 271 | |
| 272 | SubMenuBuilder topSubMenu = subMenu; |
| 273 | while (topSubMenu.getParentMenu() != mMenu) { |
| 274 | topSubMenu = (SubMenuBuilder) topSubMenu.getParentMenu(); |
| 275 | } |
| 276 | View anchor = findViewForItem(topSubMenu.getItem()); |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 277 | if (anchor == null) { |
| 278 | if (mOverflowButton == null) return false; |
| 279 | anchor = mOverflowButton; |
| 280 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 281 | |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 282 | mOpenSubMenuId = subMenu.getItem().getItemId(); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 283 | mActionButtonPopup = new ActionButtonSubmenu(mContext, subMenu); |
| 284 | mActionButtonPopup.setAnchorView(anchor); |
| 285 | mActionButtonPopup.show(); |
| 286 | super.onSubMenuSelected(subMenu); |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | private View findViewForItem(MenuItem item) { |
| 291 | final ViewGroup parent = (ViewGroup) mMenuView; |
| 292 | if (parent == null) return null; |
| 293 | |
| 294 | final int count = parent.getChildCount(); |
| 295 | for (int i = 0; i < count; i++) { |
| 296 | final View child = parent.getChildAt(i); |
| 297 | if (child instanceof MenuView.ItemView && |
| 298 | ((MenuView.ItemView) child).getItemData() == item) { |
| 299 | return child; |
| 300 | } |
| 301 | } |
| 302 | return null; |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * Display the overflow menu if one is present. |
| 307 | * @return true if the overflow menu was shown, false otherwise. |
| 308 | */ |
| 309 | public boolean showOverflowMenu() { |
Adam Powell | 70e9f4b | 2011-08-22 16:31:24 -0700 | [diff] [blame] | 310 | if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null && |
Jake Wharton | a647640 | 2012-03-29 01:42:37 -0700 | [diff] [blame] | 311 | mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) { |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 312 | OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true); |
| 313 | mPostedOpenRunnable = new OpenOverflowRunnable(popup); |
| 314 | // Post this for later; we might still need a layout for the anchor to be right. |
| 315 | ((View) mMenuView).post(mPostedOpenRunnable); |
| 316 | |
| 317 | // ActionMenuPresenter uses null as a callback argument here |
| 318 | // to indicate overflow is opening. |
| 319 | super.onSubMenuSelected(null); |
| 320 | |
| 321 | return true; |
| 322 | } |
| 323 | return false; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Hide the overflow menu if it is currently showing. |
| 328 | * |
| 329 | * @return true if the overflow menu was hidden, false otherwise. |
| 330 | */ |
| 331 | public boolean hideOverflowMenu() { |
| 332 | if (mPostedOpenRunnable != null && mMenuView != null) { |
| 333 | ((View) mMenuView).removeCallbacks(mPostedOpenRunnable); |
Adam Powell | 678ed0c | 2011-10-27 17:46:07 -0700 | [diff] [blame] | 334 | mPostedOpenRunnable = null; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 335 | return true; |
| 336 | } |
| 337 | |
| 338 | MenuPopupHelper popup = mOverflowPopup; |
| 339 | if (popup != null) { |
| 340 | popup.dismiss(); |
| 341 | return true; |
| 342 | } |
| 343 | return false; |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * Dismiss all popup menus - overflow and submenus. |
| 348 | * @return true if popups were dismissed, false otherwise. (This can be because none were open.) |
| 349 | */ |
| 350 | public boolean dismissPopupMenus() { |
| 351 | boolean result = hideOverflowMenu(); |
| 352 | result |= hideSubMenus(); |
| 353 | return result; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Dismiss all submenu popups. |
| 358 | * |
| 359 | * @return true if popups were dismissed, false otherwise. (This can be because none were open.) |
| 360 | */ |
| 361 | public boolean hideSubMenus() { |
| 362 | if (mActionButtonPopup != null) { |
| 363 | mActionButtonPopup.dismiss(); |
| 364 | return true; |
| 365 | } |
| 366 | return false; |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * @return true if the overflow menu is currently showing |
| 371 | */ |
| 372 | public boolean isOverflowMenuShowing() { |
| 373 | return mOverflowPopup != null && mOverflowPopup.isShowing(); |
| 374 | } |
| 375 | |
Adam Powell | 5fcf5b9 | 2013-09-11 08:45:36 -0700 | [diff] [blame] | 376 | public boolean isOverflowMenuShowPending() { |
| 377 | return mPostedOpenRunnable != null || isOverflowMenuShowing(); |
| 378 | } |
| 379 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 380 | /** |
| 381 | * @return true if space has been reserved in the action menu for an overflow item. |
| 382 | */ |
| 383 | public boolean isOverflowReserved() { |
| 384 | return mReserveOverflow; |
| 385 | } |
| 386 | |
| 387 | public boolean flagActionItems() { |
| 388 | final ArrayList<MenuItemImpl> visibleItems = mMenu.getVisibleItems(); |
| 389 | final int itemsSize = visibleItems.size(); |
| 390 | int maxActions = mMaxItems; |
| 391 | int widthLimit = mActionItemWidthLimit; |
| 392 | final int querySpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); |
| 393 | final ViewGroup parent = (ViewGroup) mMenuView; |
| 394 | |
| 395 | int requiredItems = 0; |
| 396 | int requestedItems = 0; |
| 397 | int firstActionWidth = 0; |
| 398 | boolean hasOverflow = false; |
| 399 | for (int i = 0; i < itemsSize; i++) { |
| 400 | MenuItemImpl item = visibleItems.get(i); |
| 401 | if (item.requiresActionButton()) { |
| 402 | requiredItems++; |
| 403 | } else if (item.requestsActionButton()) { |
| 404 | requestedItems++; |
| 405 | } else { |
| 406 | hasOverflow = true; |
| 407 | } |
Adam Powell | b187cd9 | 2011-07-20 14:17:56 -0700 | [diff] [blame] | 408 | if (mExpandedActionViewsExclusive && item.isActionViewExpanded()) { |
| 409 | // Overflow everything if we have an expanded action view and we're |
| 410 | // space constrained. |
| 411 | maxActions = 0; |
| 412 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 413 | } |
| 414 | |
| 415 | // Reserve a spot for the overflow item if needed. |
| 416 | if (mReserveOverflow && |
| 417 | (hasOverflow || requiredItems + requestedItems > maxActions)) { |
| 418 | maxActions--; |
| 419 | } |
| 420 | maxActions -= requiredItems; |
| 421 | |
| 422 | final SparseBooleanArray seenGroups = mActionButtonGroups; |
| 423 | seenGroups.clear(); |
| 424 | |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 425 | int cellSize = 0; |
| 426 | int cellsRemaining = 0; |
| 427 | if (mStrictWidthLimit) { |
| 428 | cellsRemaining = widthLimit / mMinCellSize; |
| 429 | final int cellSizeRemaining = widthLimit % mMinCellSize; |
| 430 | cellSize = mMinCellSize + cellSizeRemaining / cellsRemaining; |
| 431 | } |
| 432 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 433 | // Flag as many more requested items as will fit. |
| 434 | for (int i = 0; i < itemsSize; i++) { |
| 435 | MenuItemImpl item = visibleItems.get(i); |
| 436 | |
| 437 | if (item.requiresActionButton()) { |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 438 | View v = getItemView(item, mScrapActionButtonView, parent); |
| 439 | if (mScrapActionButtonView == null) { |
| 440 | mScrapActionButtonView = v; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 441 | } |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 442 | if (mStrictWidthLimit) { |
| 443 | cellsRemaining -= ActionMenuView.measureChildForCells(v, |
| 444 | cellSize, cellsRemaining, querySpec, 0); |
| 445 | } else { |
| 446 | v.measure(querySpec, querySpec); |
| 447 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 448 | final int measuredWidth = v.getMeasuredWidth(); |
| 449 | widthLimit -= measuredWidth; |
| 450 | if (firstActionWidth == 0) { |
| 451 | firstActionWidth = measuredWidth; |
| 452 | } |
| 453 | final int groupId = item.getGroupId(); |
| 454 | if (groupId != 0) { |
| 455 | seenGroups.put(groupId, true); |
| 456 | } |
Adam Powell | ea1ca95 | 2011-06-21 14:07:59 -0700 | [diff] [blame] | 457 | item.setIsActionButton(true); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 458 | } else if (item.requestsActionButton()) { |
| 459 | // Items in a group with other items that already have an action slot |
| 460 | // can break the max actions rule, but not the width limit. |
| 461 | final int groupId = item.getGroupId(); |
| 462 | final boolean inGroup = seenGroups.get(groupId); |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 463 | boolean isAction = (maxActions > 0 || inGroup) && widthLimit > 0 && |
| 464 | (!mStrictWidthLimit || cellsRemaining > 0); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 465 | |
| 466 | if (isAction) { |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 467 | View v = getItemView(item, mScrapActionButtonView, parent); |
| 468 | if (mScrapActionButtonView == null) { |
| 469 | mScrapActionButtonView = v; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 470 | } |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 471 | if (mStrictWidthLimit) { |
| 472 | final int cells = ActionMenuView.measureChildForCells(v, |
| 473 | cellSize, cellsRemaining, querySpec, 0); |
| 474 | cellsRemaining -= cells; |
| 475 | if (cells == 0) { |
| 476 | isAction = false; |
| 477 | } |
| 478 | } else { |
| 479 | v.measure(querySpec, querySpec); |
| 480 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 481 | final int measuredWidth = v.getMeasuredWidth(); |
| 482 | widthLimit -= measuredWidth; |
| 483 | if (firstActionWidth == 0) { |
| 484 | firstActionWidth = measuredWidth; |
| 485 | } |
| 486 | |
Adam Powell | 640a66e | 2011-04-29 10:18:53 -0700 | [diff] [blame] | 487 | if (mStrictWidthLimit) { |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 488 | isAction &= widthLimit >= 0; |
Adam Powell | 640a66e | 2011-04-29 10:18:53 -0700 | [diff] [blame] | 489 | } else { |
| 490 | // Did this push the entire first item past the limit? |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 491 | isAction &= widthLimit + firstActionWidth > 0; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 492 | } |
| 493 | } |
| 494 | |
| 495 | if (isAction && groupId != 0) { |
| 496 | seenGroups.put(groupId, true); |
| 497 | } else if (inGroup) { |
| 498 | // We broke the width limit. Demote the whole group, they all overflow now. |
| 499 | seenGroups.put(groupId, false); |
| 500 | for (int j = 0; j < i; j++) { |
| 501 | MenuItemImpl areYouMyGroupie = visibleItems.get(j); |
| 502 | if (areYouMyGroupie.getGroupId() == groupId) { |
Adam Powell | 23f4cc0 | 2011-08-18 10:30:46 -0700 | [diff] [blame] | 503 | // Give back the action slot |
| 504 | if (areYouMyGroupie.isActionButton()) maxActions++; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 505 | areYouMyGroupie.setIsActionButton(false); |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | |
Adam Powell | 23f4cc0 | 2011-08-18 10:30:46 -0700 | [diff] [blame] | 510 | if (isAction) maxActions--; |
| 511 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 512 | item.setIsActionButton(isAction); |
Svetoslav Ganov | 14c4669 | 2012-10-09 18:11:36 -0700 | [diff] [blame] | 513 | } else { |
| 514 | // Neither requires nor requests an action button. |
| 515 | item.setIsActionButton(false); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 516 | } |
| 517 | } |
| 518 | return true; |
| 519 | } |
| 520 | |
| 521 | @Override |
| 522 | public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) { |
| 523 | dismissPopupMenus(); |
| 524 | super.onCloseMenu(menu, allMenusAreClosing); |
| 525 | } |
| 526 | |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 527 | @Override |
| 528 | public Parcelable onSaveInstanceState() { |
| 529 | SavedState state = new SavedState(); |
| 530 | state.openSubMenuId = mOpenSubMenuId; |
| 531 | return state; |
| 532 | } |
| 533 | |
| 534 | @Override |
| 535 | public void onRestoreInstanceState(Parcelable state) { |
| 536 | SavedState saved = (SavedState) state; |
| 537 | if (saved.openSubMenuId > 0) { |
| 538 | MenuItem item = mMenu.findItem(saved.openSubMenuId); |
| 539 | if (item != null) { |
| 540 | SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); |
| 541 | onSubMenuSelected(subMenu); |
| 542 | } |
| 543 | } |
| 544 | } |
| 545 | |
Adam Powell | 823f074 | 2011-09-21 17:17:01 -0700 | [diff] [blame] | 546 | @Override |
| 547 | public void onSubUiVisibilityChanged(boolean isVisible) { |
| 548 | if (isVisible) { |
| 549 | // Not a submenu, but treat it like one. |
| 550 | super.onSubMenuSelected(null); |
| 551 | } else { |
| 552 | mMenu.close(false); |
| 553 | } |
| 554 | } |
| 555 | |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 556 | private static class SavedState implements Parcelable { |
| 557 | public int openSubMenuId; |
| 558 | |
| 559 | SavedState() { |
| 560 | } |
| 561 | |
| 562 | SavedState(Parcel in) { |
| 563 | openSubMenuId = in.readInt(); |
| 564 | } |
| 565 | |
| 566 | @Override |
| 567 | public int describeContents() { |
| 568 | return 0; |
| 569 | } |
| 570 | |
| 571 | @Override |
| 572 | public void writeToParcel(Parcel dest, int flags) { |
| 573 | dest.writeInt(openSubMenuId); |
| 574 | } |
| 575 | |
| 576 | public static final Parcelable.Creator<SavedState> CREATOR |
| 577 | = new Parcelable.Creator<SavedState>() { |
| 578 | public SavedState createFromParcel(Parcel in) { |
| 579 | return new SavedState(in); |
| 580 | } |
| 581 | |
| 582 | public SavedState[] newArray(int size) { |
| 583 | return new SavedState[size]; |
| 584 | } |
| 585 | }; |
| 586 | } |
| 587 | |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 588 | private class OverflowMenuButton extends ImageButton implements ActionMenuChildView { |
| 589 | public OverflowMenuButton(Context context) { |
| 590 | super(context, null, com.android.internal.R.attr.actionOverflowButtonStyle); |
| 591 | |
| 592 | setClickable(true); |
| 593 | setFocusable(true); |
| 594 | setVisibility(VISIBLE); |
| 595 | setEnabled(true); |
Alan Viverette | ca6a3611 | 2013-08-16 14:41:06 -0700 | [diff] [blame] | 596 | |
Alan Viverette | 6996014 | 2013-08-22 17:26:57 -0700 | [diff] [blame] | 597 | setOnTouchListener(new ForwardingListener(this) { |
Alan Viverette | ca6a3611 | 2013-08-16 14:41:06 -0700 | [diff] [blame] | 598 | @Override |
| 599 | public ListPopupWindow getPopup() { |
| 600 | if (mOverflowPopup == null) { |
| 601 | return null; |
| 602 | } |
| 603 | |
| 604 | return mOverflowPopup.getPopup(); |
| 605 | } |
| 606 | |
| 607 | @Override |
| 608 | public boolean onForwardingStarted() { |
| 609 | showOverflowMenu(); |
| 610 | return true; |
| 611 | } |
| 612 | |
| 613 | @Override |
| 614 | public boolean onForwardingStopped() { |
| 615 | // Displaying the popup occurs asynchronously, so wait for |
| 616 | // the runnable to finish before deciding whether to stop |
| 617 | // forwarding. |
| 618 | if (mPostedOpenRunnable != null) { |
| 619 | return false; |
| 620 | } |
| 621 | |
| 622 | hideOverflowMenu(); |
| 623 | return true; |
| 624 | } |
| 625 | }); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | @Override |
| 629 | public boolean performClick() { |
| 630 | if (super.performClick()) { |
| 631 | return true; |
| 632 | } |
| 633 | |
| 634 | playSoundEffect(SoundEffectConstants.CLICK); |
| 635 | showOverflowMenu(); |
| 636 | return true; |
| 637 | } |
| 638 | |
Alan Viverette | 80e7270 | 2013-07-29 11:12:59 -0700 | [diff] [blame] | 639 | @Override |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 640 | public boolean needsDividerBefore() { |
Adam Powell | 35aecd5 | 2011-07-01 13:43:49 -0700 | [diff] [blame] | 641 | return false; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 642 | } |
| 643 | |
Alan Viverette | 80e7270 | 2013-07-29 11:12:59 -0700 | [diff] [blame] | 644 | @Override |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 645 | public boolean needsDividerAfter() { |
| 646 | return false; |
| 647 | } |
Adam Powell | d5c81db | 2012-08-02 14:35:26 -0700 | [diff] [blame] | 648 | |
| 649 | @Override |
| 650 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 651 | if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { |
| 652 | // Fill available height |
| 653 | heightMeasureSpec = MeasureSpec.makeMeasureSpec( |
| 654 | MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY); |
| 655 | } |
| 656 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
| 657 | } |
Alan Viverette | 058ac7c | 2013-08-19 16:44:30 -0700 | [diff] [blame] | 658 | |
| 659 | @Override |
| 660 | public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { |
| 661 | super.onInitializeAccessibilityNodeInfo(info); |
Svetoslav Ganov | cb8ed39 | 2013-08-23 20:37:28 -0700 | [diff] [blame] | 662 | info.setCanOpenPopup(true); |
Alan Viverette | 058ac7c | 2013-08-19 16:44:30 -0700 | [diff] [blame] | 663 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | private class OverflowPopup extends MenuPopupHelper { |
| 667 | public OverflowPopup(Context context, MenuBuilder menu, View anchorView, |
| 668 | boolean overflowOnly) { |
| 669 | super(context, menu, anchorView, overflowOnly); |
Adam Powell | 54c94de | 2013-09-26 15:36:34 -0700 | [diff] [blame] | 670 | setGravity(Gravity.END); |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 671 | setCallback(mPopupPresenterCallback); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | @Override |
| 675 | public void onDismiss() { |
| 676 | super.onDismiss(); |
| 677 | mMenu.close(); |
| 678 | mOverflowPopup = null; |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | private class ActionButtonSubmenu extends MenuPopupHelper { |
| 683 | private SubMenuBuilder mSubMenu; |
| 684 | |
| 685 | public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) { |
| 686 | super(context, subMenu); |
| 687 | mSubMenu = subMenu; |
| 688 | |
| 689 | MenuItemImpl item = (MenuItemImpl) subMenu.getItem(); |
| 690 | if (!item.isActionButton()) { |
| 691 | // Give a reasonable anchor to nested submenus. |
| 692 | setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton); |
| 693 | } |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 694 | |
| 695 | setCallback(mPopupPresenterCallback); |
Adam Powell | 9151103 | 2011-07-13 10:24:06 -0700 | [diff] [blame] | 696 | |
| 697 | boolean preserveIconSpacing = false; |
| 698 | final int count = subMenu.size(); |
| 699 | for (int i = 0; i < count; i++) { |
| 700 | MenuItem childItem = subMenu.getItem(i); |
| 701 | if (childItem.isVisible() && childItem.getIcon() != null) { |
| 702 | preserveIconSpacing = true; |
| 703 | break; |
| 704 | } |
| 705 | } |
| 706 | setForceShowIcon(preserveIconSpacing); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | @Override |
| 710 | public void onDismiss() { |
| 711 | super.onDismiss(); |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 712 | mActionButtonPopup = null; |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 713 | mOpenSubMenuId = 0; |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | private class PopupPresenterCallback implements MenuPresenter.Callback { |
| 718 | |
| 719 | @Override |
| 720 | public boolean onOpenSubMenu(MenuBuilder subMenu) { |
Adam Powell | 823f074 | 2011-09-21 17:17:01 -0700 | [diff] [blame] | 721 | if (subMenu == null) return false; |
| 722 | |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 723 | mOpenSubMenuId = ((SubMenuBuilder) subMenu).getItem().getItemId(); |
Adam Powell | b411b32 | 2013-11-01 18:22:11 -0700 | [diff] [blame] | 724 | final MenuPresenter.Callback cb = getCallback(); |
| 725 | return cb != null ? cb.onOpenSubMenu(subMenu) : false; |
Adam Powell | 11ed1d6 | 2011-07-11 21:19:59 -0700 | [diff] [blame] | 726 | } |
| 727 | |
| 728 | @Override |
| 729 | public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) { |
Adam Powell | 823f074 | 2011-09-21 17:17:01 -0700 | [diff] [blame] | 730 | if (menu instanceof SubMenuBuilder) { |
| 731 | ((SubMenuBuilder) menu).getRootMenu().close(false); |
| 732 | } |
Adam Powell | b411b32 | 2013-11-01 18:22:11 -0700 | [diff] [blame] | 733 | final MenuPresenter.Callback cb = getCallback(); |
| 734 | if (cb != null) { |
| 735 | cb.onCloseMenu(menu, allMenusAreClosing); |
| 736 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 737 | } |
| 738 | } |
| 739 | |
| 740 | private class OpenOverflowRunnable implements Runnable { |
| 741 | private OverflowPopup mPopup; |
| 742 | |
| 743 | public OpenOverflowRunnable(OverflowPopup popup) { |
| 744 | mPopup = popup; |
| 745 | } |
| 746 | |
| 747 | public void run() { |
| 748 | mMenu.changeMenuMode(); |
Adam Powell | 678ed0c | 2011-10-27 17:46:07 -0700 | [diff] [blame] | 749 | final View menuView = (View) mMenuView; |
| 750 | if (menuView != null && menuView.getWindowToken() != null && mPopup.tryShow()) { |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 751 | mOverflowPopup = mPopup; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 752 | } |
Adam Powell | 678ed0c | 2011-10-27 17:46:07 -0700 | [diff] [blame] | 753 | mPostedOpenRunnable = null; |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 754 | } |
| 755 | } |
Adam Powell | 696cba5 | 2011-03-29 10:38:16 -0700 | [diff] [blame] | 756 | } |