Example #1
0
 @Override
 public void initForMenu(Context context, MenuBuilder menu) {
   // Clear the expanded action view when menus change.
   if (mMenu != null && mCurrentExpandedItem != null) {
     mMenu.collapseItemActionView(mCurrentExpandedItem);
   }
   mMenu = menu;
 }
Example #2
0
  public void clear() {
    if (mExpandedItem != null) {
      collapseItemActionView(mExpandedItem);
    }
    mItems.clear();

    onItemsChanged(true);
  }
Example #3
0
 public boolean collapseActionView()
 {
     if ((mShowAsAction & 8) != 0)
     {
         if (mActionView == null)
         {
             return true;
         }
         if (mOnActionExpandListener == null || mOnActionExpandListener.onMenuItemActionCollapse(this))
         {
             return mMenu.collapseItemActionView(this);
         }
     }
     return false;
 }
Example #4
0
  @Override
  public boolean collapseActionView() {
    if ((mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) == 0) {
      return false;
    }
    if (mActionView == null) {
      // We're already collapsed if we have no action view.
      return true;
    }

    if (mOnActionExpandListener == null || mOnActionExpandListener.onMenuItemActionCollapse(this)) {
      return mMenu.collapseItemActionView(this);
    }

    return false;
  }