Exemplo n.º 1
0
 public virtual bool onSubMenuSelected([email protected]
                                       subMenu)
 {
     if (subMenu.hasVisibleItems())
     {
         [email protected] subPopup = new [email protected]
                                                                    (mContext, subMenu, mAnchorView, false);
         subPopup.setCallback(mPresenterCallback);
         bool preserveIconSpacing = false;
         int  count = subMenu.size();
         {
             for (int i = 0; i < count; i++)
             {
                 android.view.MenuItem childItem = subMenu.getItem(i);
                 if (childItem.isVisible() && childItem.getIcon() != null)
                 {
                     preserveIconSpacing = true;
                     break;
                 }
             }
         }
         subPopup.setForceShowIcon(preserveIconSpacing);
         if (subPopup.tryShow())
         {
             if (mPresenterCallback != null)
             {
                 mPresenterCallback.onOpenSubMenu(subMenu);
             }
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 2
0
            public ActionButtonSubmenu(ActionMenuPresenter _enclosing, android.content.Context
                                       context, [email protected] subMenu) : base(context, subMenu
                                                                                                           )
            {
                this._enclosing = _enclosing;
                this.mSubMenu   = subMenu;
                [email protected] item = ([email protected]
                                                                 )subMenu.getItem();
                if (!item.isActionButton())
                {
                    // Give a reasonable anchor to nested submenus.
                    this.setAnchorView(this._enclosing.mOverflowButton == null ? (android.view.View) this
                                       ._enclosing.mMenuView : this._enclosing.mOverflowButton);
                }
                this.setCallback(this._enclosing.mPopupPresenterCallback);
                bool preserveIconSpacing = false;
                int  count = subMenu.size();

                {
                    for (int i = 0; i < count; i++)
                    {
                        android.view.MenuItem childItem = subMenu.getItem(i);
                        if (childItem.isVisible() && childItem.getIcon() != null)
                        {
                            preserveIconSpacing = true;
                            break;
                        }
                    }
                }
                this.setForceShowIcon(preserveIconSpacing);
            }