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);
 }
Exemple #2
0
		/// <summary>Construct a new PopupMenu.</summary>
		/// <remarks>Construct a new PopupMenu.</remarks>
		/// <param name="context">Context for the PopupMenu.</param>
		/// <param name="anchor">
		/// Anchor view for this popup. The popup will appear below the anchor if there
		/// is room, or above it if there is not.
		/// </param>
		public PopupMenu(android.content.Context context, android.view.View anchor)
		{
			// TODO Theme?
			mContext = context;
			mMenu = new [email protected](context);
			mMenu.setCallback(this);
			mAnchor = anchor;
			mPopup = new [email protected](context, mMenu, anchor);
			mPopup.setCallback(this);
		}
Exemple #3
0
 /// <summary>Construct a new PopupMenu.</summary>
 /// <remarks>Construct a new PopupMenu.</remarks>
 /// <param name="context">Context for the PopupMenu.</param>
 /// <param name="anchor">
 /// Anchor view for this popup. The popup will appear below the anchor if there
 /// is room, or above it if there is not.
 /// </param>
 public PopupMenu(android.content.Context context, android.view.View anchor)
 {
     // TODO Theme?
     mContext = context;
     mMenu    = new [email protected](context);
     mMenu.setCallback(this);
     mAnchor = anchor;
     mPopup  = new [email protected](context, mMenu, anchor);
     mPopup.setCallback(this);
 }
Exemple #4
0
 /// <summary>Hide the overflow menu if it is currently showing.</summary>
 /// <remarks>Hide the overflow menu if it is currently showing.</remarks>
 /// <returns>true if the overflow menu was hidden, false otherwise.</returns>
 public virtual bool hideOverflowMenu()
 {
     if (mPostedOpenRunnable != null && mMenuView != null)
     {
         ((android.view.View)mMenuView).removeCallbacks(mPostedOpenRunnable);
         return(true);
     }
     [email protected] popup = mOverflowPopup;
     if (popup != null)
     {
         popup.dismiss();
         return(true);
     }
     return(false);
 }
Exemple #5
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;
		}