public override void updateMenuView(bool cleared) { [email protected] menuView = ([email protected] )mMenuView; if (mMaxItems < 0) { mMaxItems = menuView.getMaxItems(); } java.util.ArrayList <*****@*****.**> itemsToShow = mMenu .getNonActionItems(); bool needsMore = itemsToShow.size() > mMaxItems; base.updateMenuView(cleared); if (needsMore && (mMoreView == null || mMoreView.getParent() != menuView)) { if (mMoreView == null) { mMoreView = menuView.createMoreItemView(); mMoreView.setBackgroundDrawable(menuView.getItemBackgroundDrawable()); } menuView.addView(mMoreView); } else { if (!needsMore && mMoreView != null) { menuView.removeView(mMoreView); } } menuView.setNumActualItemsShown(needsMore ? mMaxItems - 1 : itemsToShow.size()); }
/// <summary> /// Creates the item view for the 'More' button which is used to switch to /// the expanded menu view. /// </summary> /// <remarks> /// Creates the item view for the 'More' button which is used to switch to /// the expanded menu view. This button is a special case since it does not /// have a MenuItemData backing it. /// </remarks> /// <returns>The IconMenuItemView for the 'More' button</returns> internal [email protected] createMoreItemView() { android.content.Context context = getContext(); android.view.LayoutInflater inflater = android.view.LayoutInflater.from(context); [email protected] itemView = ([email protected] )inflater.inflate([email protected]_menu_item_layout, null); android.content.res.Resources r = context.getResources(); itemView.initialize(r.getText([email protected][email protected]_item_label), mMoreIcon ); itemView.setOnClickListener(new _OnClickListener_303(this)); return(itemView); }
protected internal override void addItemView(android.view.View itemView, int childIndex ) { [email protected] v = ([email protected] )itemView; [email protected] parent = ([email protected] )mMenuView; v.setIconMenuView(parent); v.setItemInvoker(parent); v.setBackgroundDrawable(parent.getItemBackgroundDrawable()); base.addItemView(itemView, childIndex); }
public override void bindItemView([email protected] item, [email protected] itemView) { [email protected] view = ([email protected] )itemView; view.setItemData(item); view.initialize(item.getTitleForItemView(view), item.getIcon()); view.setVisibility(item.isVisible() ? android.view.View.VISIBLE : android.view.View .GONE); view.setEnabled(view.isEnabled()); view.setLayoutParams(view.getTextAppropriateLayoutParams()); }
public override void updateMenuView(bool cleared) { [email protected] menuView = ([email protected] )mMenuView; if (mMaxItems < 0) { mMaxItems = menuView.getMaxItems(); } java.util.ArrayList<*****@*****.**> itemsToShow = mMenu .getNonActionItems(); bool needsMore = itemsToShow.size() > mMaxItems; base.updateMenuView(cleared); if (needsMore && (mMoreView == null || mMoreView.getParent() != menuView)) { if (mMoreView == null) { mMoreView = menuView.createMoreItemView(); mMoreView.setBackgroundDrawable(menuView.getItemBackgroundDrawable()); } menuView.addView(mMoreView); } else { if (!needsMore && mMoreView != null) { menuView.removeView(mMoreView); } } menuView.setNumActualItemsShown(needsMore ? mMaxItems - 1 : itemsToShow.size()); }