List of usage examples for android.view MenuItem setEnabled
public MenuItem setEnabled(boolean enabled);
From source file:net.wespot.pim.view.InqDataCollectionTaskFragment.java
public void setEnabledDisabled(MenuItem item, boolean shouldBeEnabled) { if (shouldBeEnabled) { item.setEnabled(true); item.getIcon().setAlpha(255);/*ww w . j a va 2 s . c o m*/ } else { item.setEnabled(false); item.getIcon().setAlpha(130); } }
From source file:com.bellman.bible.android.control.page.CurrentPageBase.java
@Override public void updateOptionsMenu(Menu menu) { // these are fine for Bible and commentary MenuItem menuItem = menu.findItem(R.id.searchButton); if (menuItem != null) { menuItem.setEnabled(isSearchable()); }//from www. j a v a2 s. com menuItem = menu.findItem(R.id.bookmarksButton); if (menuItem != null) { menuItem.setEnabled(true); } menuItem = menu.findItem(R.id.speakButton); if (menuItem != null) { menuItem.setEnabled(isSpeakable()); } }
From source file:com.justplay1.shoppist.features.lists.items.ListItemActivity.java
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { super.onPrepareActionMode(mode, menu); MenuItem move = menu.findItem(R.id.action_move); MenuItem copy = menu.findItem(R.id.action_copy); boolean enable = fragment.isMoveCopyButtonEnable(); move.setEnabled(enable); copy.setEnabled(enable);/*from w w w. j av a 2 s. com*/ MenuItem edit = menu.findItem(R.id.action_edit); if (edit != null) { edit.setVisible(fragment.isEditButtonEnable()); } MenuItem checkAll = menu.findItem(R.id.menu_check_all); checkAll.setEnabled(fragment.isCheckAllButtonEnable()); return true; }
From source file:com.darizotas.metadatastrip.FileDetailFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { MenuItem item = menu.findItem(R.id.location); Boolean enabled = getUriGeoLocation() != null; item.setVisible(enabled);//ww w .j a v a2 s . c o m item.setEnabled(enabled); }
From source file:com.justplay1.shoppist.features.lists.MainActivity.java
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { super.onPrepareActionMode(mode, menu); MenuItem edit = menu.findItem(R.id.action_edit); if (edit != null) { edit.setVisible(listFragment.isEditButtonEnable()); }/*from w w w . j a v a2 s .c o m*/ MenuItem checkAll = menu.findItem(R.id.menu_check_all); checkAll.setEnabled(listFragment.isCheckAllButtonEnable()); return true; }
From source file:am.roadpolice.roadpolice.ViolationInfoActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_info, menu); // Get 'Settings' Menu item. MenuItem itemSettings = menu.findItem(R.id.action_settings); // Disable 'Settings' menu item in the case if user is not // logged-in, but just entered activity for data view. itemSettings.setEnabled(mAutoLogin); return true;/*from w w w .ja va2s. co m*/ }
From source file:org.csploit.android.plugins.Inspector.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item = menu.findItem(R.id.focused_scan); if (item != null) { item.setChecked(mFocusedScan);/*from w w w . ja va 2 s. c o m*/ item.setEnabled(System.getCurrentTarget().hasOpenPorts()); } return super.onPrepareOptionsMenu(menu); }
From source file:nu.firetech.android.pactrack.frontend.ParcelListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.parcel_menu, menu); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; boolean enabled = (Preferences.getPreferences(getActivity()).getCheckInterval() > 0); MenuItem autoInclude = menu.findItem(R.id.action_auto_include); autoInclude.setEnabled(enabled); autoInclude.setChecked(enabled && mDbAdapter.getAutoUpdate(info.id)); }
From source file:com.jecelyin.android.file_explorer.FileExplorerAction.java
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.add(0, R.id.select_all, 0, R.string.select_all).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, R.id.cut, 0, R.string.cut).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, R.id.copy, 0, R.string.copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem pasteMenu = menu.add(0, R.id.paste, 0, R.string.paste); pasteMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); pasteMenu.setEnabled(fileClipboard.canPaste()); renameMenu = menu.add(0, R.id.rename, 0, R.string.rename); renameMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareMenu = menu.add(0, R.id.share, 0, R.string.share); shareMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareActionProvider = new ShareActionProvider(context); shareActionProvider.setOnShareTargetSelectedListener(this); MenuItemCompat.setActionProvider(shareMenu, shareActionProvider); menu.add(0, R.id.delete, 0, R.string.delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); return true;/*from ww w . j a va2 s .c om*/ }
From source file:com.jefftharris.passwdsafe.sync.gdriveplay.GDrivePlayMainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item = menu.findItem(R.id.menu_sync); item.setEnabled(itsClient.isConnected()); return super.onPrepareOptionsMenu(menu); }