List of usage examples for android.view Menu size
public int size();
From source file:com.soil.soilsample.ui.main.FileBrowserFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if ((item.getItemId() == R.id.action_add_sample) || (item.getItemId() == R.id.menu_dir_select) || (item.getItemId() == R.id.action_upload)) { item.setVisible(false);//from w ww . ja v a2 s. c o m } else if ((item.getItemId() == R.id.menu_dir_up)) { item.setVisible(true); } } }
From source file:syncthing.android.ui.LauncherActivity.java
void clearCheckedMenuItems() { Menu menu = mNavigation.getMenu(); for (int ii = 0; ii < menu.size(); ii++) { menu.getItem(ii).setChecked(false); }//w w w .ja va 2 s . com }
From source file:ie.tcd.scss.dsg.particpatory.SampleListFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Menu menu = newMenuInstance(getActivity()); if (menu != null) { new MenuInflater(getActivity()).inflate(R.menu.sliding_menu, menu); MenuListAdapter adapter = new MenuListAdapter(getActivity()); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); adapter.add(new SampleItem(item.getTitle().toString(), item.getIcon())); }/*from w w w . j ava 2 s. c om*/ setListAdapter(adapter); } else { TextView emptyText = new TextView(getActivity()); emptyText.setText("No Menu"); getListView().setEmptyView(emptyText); } ListView listView = new ListView(getActivity()); listView.setId(android.R.id.list); return listView; }
From source file:com.facebook.samples.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); friends = menu.add(R.string.see_friends); settings = menu.add(R.string.check_settings); }// w w w . j a v a 2s .co m return true; } else { menu.clear(); settings = null; } return false; }
From source file:com.arcgis.android.samples.localdata.localrasterdata.FileBrowserFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if ((item.getItemId() == R.id.menu_layer_raster) || (item.getItemId() == R.id.menu_renderer) || (item.getItemId() == R.id.menu_dir_select)) { item.setVisible(false);/*from w w w . j ava2 s.c om*/ } else if ((item.getItemId() == R.id.menu_dir_up)) { item.setVisible(true); } } }
From source file:com.joaquimley.faboptions.FabOptions.java
private void addButtonsFromMenu(Context context, Menu menu) { for (int i = 0; i < menu.size(); i++) { addButton(context, menu.getItem(i)); }//from w ww .j a va 2 s . c o m }
From source file:de.aw.monma.actions.FragmentWPList.java
/** * Bei Click wird das contextmenu gezeigt. In den jeweiligen extras sind folgende Informationen * enthalten: WPID, AMOUNT, WPNAME des gewaehlten Wertpapiers. */// w w w. j a va2 s . c o m @Override public void onRecyclerItemClick(View view, int position, WertpapierListItem item) { super.onRecyclerItemClick(view, position, item); Intent intent = new Intent(); intent.putExtra(WPID, item.getID()); intent.putExtra(WPNAME, item.getWPName()); intent.putExtra(ACCOUNTID, NOID); intent.putExtra(AMOUNT, item.getGewinn()); PopupMenu popUpMenu = new PopupMenu(getActivity(), view); popUpMenu.inflate(R.menu.context_fragment_wpuebersicht); popUpMenu.inflate(R.menu.context_fragment_wpliste); Menu menu = popUpMenu.getMenu(); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setIntent(intent); } popUpMenu.setOnMenuItemClickListener(this); popUpMenu.show(); }
From source file:com.google.reviewit.DetailedChangeFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { SortActionHandler actionHandler = getApp().getSortActionHandler(); inflater.inflate(R.menu.menu_detailed_change, menu); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if (item.getItemId() == R.id.action_abandon) { item.setVisible(actionHandler.hasCurrentChange() && (actionHandler.getCurrentChange().info.status == ChangeStatus.NEW || actionHandler.getCurrentChange().info.status == ChangeStatus.SUBMITTED)); } else if (item.getItemId() == R.id.action_restore) { item.setVisible(actionHandler.hasCurrentChange() && actionHandler.getCurrentChange().info.status == ChangeStatus.ABANDONED); }// ww w .j a v a 2 s .co m } }
From source file:click.kobaken.rxirohaandroid_sample.view.activity.MainActivity.java
private void allClearNavigationMenuChecked() { Menu menu = binding.navigation.getMenu(); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setChecked(false); }/* w ww . j av a 2 s . c om*/ }
From source file:com.jaspersoft.android.jaspermobile.ui.view.activity.NavigationActivity.java
private void hideMenuItems(Menu menu, boolean visible) { for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(visible); }/*from w w w.j a v a2 s. c om*/ }