List of usage examples for android.view MenuItem SHOW_AS_ACTION_NEVER
int SHOW_AS_ACTION_NEVER
To view the source code for android.view MenuItem SHOW_AS_ACTION_NEVER.
Click Source Link
From source file:se.chalmers.watchme.activity.TagMovieListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); /*//from w w w . j a v a 2 s . c om * It should not be possible to mail or sort in this activity */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:se.chalmers.watchme.activity.SearchableActivity.java
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); /*/*w w w. j a va 2 s . co m*/ * It should not be possible to mail or sort in this activity */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:se.chalmers.watchme.ui.TagListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { /*/* w ww . j a va 2 s . co m*/ * It should not be possible to mail or sort in this fragment */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.keithandthegirl.ui.activity.EpisodesActivity.java
@TargetApi(11) @Override//from w w w . j a v a2 s . com public boolean onCreateOptionsMenu(Menu menu) { Log.d(TAG, "onCreateOptionsMenu : enter"); MenuItem settings = menu.add(Menu.NONE, SETTINGS_ID, Menu.NONE, getResources().getString(R.string.pref_settings_title)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { settings.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } MenuItem about = menu.add(Menu.NONE, ABOUT_ID, Menu.NONE, getResources().getString(R.string.about_header)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { about.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } Log.d(TAG, "onCreateOptionsMenu : exit"); return super.onCreateOptionsMenu(menu); }
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 w ww .j a v a 2 s . c o m*/ }
From source file:com.duy.pascal.ui.file.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(mFileClipboard.canPaste()); mRenameMenu = menu.add(0, R.id.rename, 0, R.string.rename); mRenameMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mShareMenu = menu.add(0, R.id.share, 0, R.string.share); mShareMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mShareActionProvider = new ShareActionProvider(mContext); mShareActionProvider.setOnShareTargetSelectedListener(this); MenuItemCompat.setActionProvider(mShareMenu, mShareActionProvider); menu.add(0, R.id.delete, 0, R.string.delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); return true;//from w ww. ja v a 2s . c om }
From source file:com.arantius.tivocommander.Utils.java
@SuppressLint("InlinedApi") public final static void createFullOptionsMenu(Menu menu, Activity activity) { Utils.activateHomeButton(activity);//from w w w . ja v a2s .c om addToMenu(menu, activity, R.id.menu_item_remote, R.drawable.icon_remote, "Remote", MenuItem.SHOW_AS_ACTION_IF_ROOM); addToMenu(menu, activity, R.id.menu_item_my_shows, R.drawable.icon_tv32, "My Shows", MenuItem.SHOW_AS_ACTION_IF_ROOM); addToMenu(menu, activity, R.id.menu_item_search, R.drawable.icon_search, "Search", MenuItem.SHOW_AS_ACTION_IF_ROOM); addToMenu(menu, activity, R.id.menu_item_todo, R.drawable.icon_todo, "To Do List", MenuItem.SHOW_AS_ACTION_NEVER); addToMenu(menu, activity, R.id.menu_item_season_pass, R.drawable.icon_seasonpass, "Season Pass Manager", MenuItem.SHOW_AS_ACTION_NEVER); addToMenu(menu, activity, R.id.menu_item_devices, R.drawable.icon_devices, "Devices", MenuItem.SHOW_AS_ACTION_NEVER); addToMenu(menu, activity, R.id.menu_item_settings, R.drawable.icon_help, "Settings", MenuItem.SHOW_AS_ACTION_NEVER); addToMenu(menu, activity, R.id.menu_item_help, R.drawable.icon_help, "Help", MenuItem.SHOW_AS_ACTION_NEVER); addToMenu(menu, activity, R.id.menu_item_about, R.drawable.icon_info, "About", MenuItem.SHOW_AS_ACTION_NEVER); }
From source file:cz.msebera.unbound.dns.fragments.MainLogFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(Menu.NONE, MENU_CLEAR, Menu.NONE, R.string.menu_clear) .setIcon(android.R.drawable.ic_menu_close_clear_cancel) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(Menu.NONE, MENU_EMPTY, Menu.NONE, R.string.mainlog_menu_truncate_log) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.mifos.mifosxdroid.online.CollectionSheetFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();/* w w w .j av a 2 s . co m*/ MenuItem mItemSearch = menu.add(Menu.NONE, MENU_ITEM_SEARCH, Menu.NONE, getString(R.string.search)); // mItemSearch.setIcon(new IconDrawable(getActivity(), MaterialIcons.md_search) // .colorRes(Color.WHITE) // .actionBarSize()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mItemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } MenuItem mItemRefresh = menu.add(Menu.NONE, MENU_ITEM_REFRESH, Menu.NONE, getString(R.string.refresh)); mItemRefresh.setIcon( new IconDrawable(getActivity(), MaterialIcons.md_refresh).colorRes(Color.WHITE).actionBarSize()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mItemRefresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } MenuItem mItemSave = menu.add(Menu.NONE, MENU_ITEM_SAVE, Menu.NONE, getString(R.string.save)); mItemSave.setIcon( new IconDrawable(getActivity(), MaterialIcons.md_save).colorRes(Color.WHITE).actionBarSize()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mItemSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } super.onPrepareOptionsMenu(menu); }
From source file:com.silentcircle.contacts.utils.HelpUtils.java
/** * Prepares the help menu item by doing the following. * - If the helpUrlString is empty or null, the help menu item is made invisible. * - Otherwise, this makes the help menu item visible and sets the intent for the help menu * item to view the URL.// w w w . j av a 2 s . c o m * * @return returns whether the help menu item has been made visible. */ public static boolean prepareHelpMenuItem(Context context, MenuItem helpMenuItem, String helpUrlString) { if (TextUtils.isEmpty(helpUrlString)) { // The help url string is empty or null, so set the help menu item to be invisible. helpMenuItem.setVisible(false); // return that the help menu item is not visible (i.e. false) return false; } else { // The help url string exists, so first add in some extra query parameters. final Uri fullUri = uriWithAddedParameters(context, Uri.parse(helpUrlString)); // Then, create an intent that will be fired when the user // selects this help menu item. Intent intent = new Intent(Intent.ACTION_VIEW, fullUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); // Set the intent to the help menu item, show the help menu item in the overflow // menu, and make it visible. helpMenuItem.setIntent(intent); MenuItemCompat.setShowAsAction(helpMenuItem, MenuItem.SHOW_AS_ACTION_NEVER); helpMenuItem.setVisible(true); // return that the help menu item is visible (i.e., true) return true; } }