List of usage examples for android.view Menu size
public int size();
From source file:click.kobaken.rxirohaandroid_sample.view.activity.MainActivity.java
private void allClearBottomNavigationMenuChecked() { Menu menu = binding.bottomNavigation.getMenu(); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setChecked(false); }// w w w .j a v a 2 s . c om }
From source file:bander.notepad.NoteListAppCompat.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { ArrayList<Drawable> mTempList = new ArrayList<>(); Log.i("Menu Size", menu.size() + ""); for (int i = 0; i < menu.size(); i++) { mTempList.add(menu.getItem(i).getIcon()); }// ww w.j av a 2 s .c om final ArrayList<Drawable> mList; if (!PreferenceManager.getDefaultSharedPreferences(NoteListAppCompat.this).getBoolean("darkAppCompatTheme", false)) mList = IconTintFactory.setDarkMaterialColor(mTempList, NoteListAppCompat.this); else mList = IconTintFactory.setLightMaterialColor(mTempList, NoteListAppCompat.this); for (int i = 0; i < menu.size(); i++) { if (mList.get(i) != null) { menu.getItem(i).setIcon(mList.get(i)); } } return super.onPrepareOptionsMenu(menu); }
From source file:com.example.rps.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { // only add the menu when the selection fragment is showing if (fragments[RPS].isVisible()) { if (menu.size() == 0) { share = menu.add(R.string.share_on_facebook); message = menu.add(R.string.send_with_messenger); challenge = menu.add(R.string.challenge_friends); settings = menu.add(R.string.check_settings); invite = menu.add(R.string.invite_friends); }//from w w w . j ava 2 s . com return true; } else { menu.clear(); settings = null; } return false; }
From source file:gov.wa.wsdot.android.wsdot.ui.mountainpasses.passitem.MountainPassItemActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem menuItem_Star = menu.add(0, MENU_ITEM_STAR, menu.size(), R.string.description_star); MenuItemCompat.setShowAsAction(menuItem_Star, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); if (mIsStarred) { menu.getItem(MENU_ITEM_STAR).setIcon(R.drawable.ic_menu_star_on); menu.getItem(MENU_ITEM_STAR).setTitle("Favorite checkbox, checked"); } else {//from ww w .j ava 2 s . c o m menu.getItem(MENU_ITEM_STAR).setIcon(R.drawable.ic_menu_star); menu.getItem(MENU_ITEM_STAR).setTitle("Favorite checkbox, not checked"); } MenuItem menuItem_Refresh = menu.add(1, MENU_ITEM_REFRESH, menu.size(), R.string.description_refresh); MenuItemCompat.setShowAsAction(menuItem_Refresh, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); menu.getItem(MENU_ITEM_REFRESH).setIcon(R.drawable.ic_menu_refresh); if (mRefreshState) { startRefreshAnimation(); } return super.onCreateOptionsMenu(menu); }
From source file:com.esri.android.rt.map.PopupFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { // Turn on/off menu items based on popup's edit capabilities for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if (mPopupContainer != null) { Popup popup = mPopupContainer.getCurrentPopup(); if (popup != null) { if (popup.isEditMode()) { if (item.getItemId() == R.id.menu_save || item.getItemId() == R.id.menu_camera) { item.setVisible(true); item.setEnabled(true); } else { item.setVisible(false); item.setEnabled(false); }//from w ww .j a v a 2 s .com } else { if (((item.getItemId() == R.id.menu_edit) && (popup.isEditable())) || ((item.getItemId() == R.id.menu_delete) && (popup.isDeletable()))) { item.setVisible(true); item.setEnabled(true); } else { item.setVisible(false); item.setEnabled(false); } } } else { item.setVisible(false); item.setEnabled(false); } } else { item.setVisible(false); item.setEnabled(false); } } }
From source file:com.artemchep.horario.ui.fragments.details.MooDetailsFragment.java
/** * Disables all menu items and the// ww w .j a v a2s . co m * {@link #mFab floating action button}. */ private void setMenuItemsEnabled(boolean enabled) { Menu menu = mToolbar.getMenu(); int size = menu.size(); for (int i = 0; i < size; i++) { menu.getItem(i).setEnabled(enabled); } mFab.setEnabled(enabled); }
From source file:org.horizonremote.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerContent); /* hide menu items when drawer is opened */ int items = menu.size(); for (int i = 0; i < items; ++i) menu.getItem(i).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); }
From source file:org.sufficientlysecure.localcalendar.ui.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_main, menu); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { menu.getItem(menu.size() - 1).setEnabled(false); }/*from w w w .ja v a2s .c o m*/ return true; }
From source file:com.owncloud.android.files.FileMenuFilter.java
private void hideAll(Menu menu) { MenuItem item;//from ww w . ja v a2 s. c o m for (int i = 0; i < menu.size(); i++) { item = menu.getItem(i); item.setVisible(false); item.setEnabled(false); } }
From source file:com.activiti.android.app.activity.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!mDrawerLayout.isDrawerOpen(mLeftDrawer)); }//from ww w .ja va 2 s . c om return super.onPrepareOptionsMenu(menu); }