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:org.alfresco.mobile.android.application.fragments.fileexplorer.FileActions.java
private void getMenu(Menu menu) { menu.clear();// ww w . ja v a 2 s . c o m MenuItem mi; if (getFragment() instanceof ListingModeFragment) { switch (((ListingModeFragment) getFragment()).getMode()) { case FileExplorerFragment.MODE_LISTING: if (selectedFolder.isEmpty()) { mi = menu.add(Menu.NONE, R.id.menu_upload, Menu.FIRST + 30, R.string.upload); mi.setIcon(R.drawable.ic_upload); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = menu.add(Menu.NONE, R.id.menu_action_share, Menu.FIRST + 100, R.string.share); mi.setIcon(R.drawable.ic_share); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete); mi.setIcon(R.drawable.ic_delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); break; case FileExplorerFragment.MODE_PICK: if (selectedFolder.isEmpty()) { mi = menu.add(Menu.NONE, R.id.menu_file_send, Menu.FIRST, R.string.action_upload); mi.setIcon(R.drawable.ic_upload); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS); } break; default: break; } mi = menu.add(Menu.NONE, R.id.menu_select_all, Menu.FIRST + 200, R.string.select_all); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } }
From source file:com.prasanna.android.stacknetwork.QuestionActivity.java
private void setupMenuIfAuthenticatedUser() { if (AppUtils.inAuthenticatedRealm(this)) { MenuItem favorite = setupFavoriteActionBarIcon(); favorite.setVisible(true);//from w w w . j a v a 2 s.com menu.findItem(R.id.menu_refresh).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); setupAddComment(menu); } }
From source file:com.android.mms.ui.SelectRecipientsList.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Load the required preference values SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); mMobileOnly = sharedPreferences.getBoolean(PREF_MOBILE_NUMBERS_ONLY, true); menu.add(0, MENU_DONE, 0, R.string.menu_done).setIcon(R.drawable.ic_menu_done) .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT) .setVisible(false);//from ww w.j av a 2s . c o m menu.add(0, MENU_MOBILE, 0, R.string.menu_mobile).setCheckable(true).setChecked(mMobileOnly) .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); boolean useAltNameOrdering = mContactsPreferences .getSortOrder() == ContactsPreferences.SORT_ORDER_ALTERNATIVE; int nameOrderItemTitleRes = useAltNameOrdering ? R.string.menu_order_by_given_name : R.string.menu_order_by_last_name; menu.add(0, MENU_NAME_ORDER, 0, nameOrderItemTitleRes) .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return super.onCreateOptionsMenu(menu); }
From source file:com.by_syk.lib.nanoiconpack.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); // If latest icons is provided, show the entrance menu item. if (getResources().getStringArray(R.array.latest_icons).length > 0) { menu.findItem(R.id.menu_whats_new).setVisible(true); if (menu.findItem(R.id.menu_apply).getIcon() == null) { if (!sp.getBoolean("hideLatest" + PkgUtil.getAppVer(this, "%1$s"))) { menu.findItem(R.id.menu_whats_new).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.findItem(R.id.menu_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); }/*ww w. j av a2 s . co m*/ } } return true; }
From source file:com.vadimfrolov.duorem.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem miAdd = (MenuItem) menu.findItem(R.id.action_add_host); MenuItem miEdit = (MenuItem) menu.findItem(R.id.action_edit_host); MenuItem miDelete = (MenuItem) menu.findItem(R.id.action_delete_host); boolean targetIsValid = mTarget != null && ((mTarget.ipAddress != null && !mTarget.ipAddress.equals(NetInfo.NOIP)) || (mTarget.hardwareAddress != null && !mTarget.hardwareAddress.equals(NetInfo.NOMAC))); if (targetIsValid) { miAdd.setTitle(getResources().getString(R.string.replace_host)); } else {/*from w w w . j a v a 2 s .co m*/ miAdd.setTitle(getResources().getString(R.string.add_host)); } miEdit.setEnabled(targetIsValid); miDelete.setEnabled(targetIsValid); miEdit.setShowAsAction(targetIsValid ? MenuItem.SHOW_AS_ACTION_ALWAYS : MenuItem.SHOW_AS_ACTION_NEVER); miDelete.setShowAsAction(targetIsValid ? MenuItem.SHOW_AS_ACTION_ALWAYS : MenuItem.SHOW_AS_ACTION_NEVER); // hide replace menu item under the unfoldable menu miAdd.setShowAsAction(targetIsValid ? MenuItem.SHOW_AS_ACTION_NEVER : MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onPrepareOptionsMenu(menu); }
From source file:org.protocoder.fragments.EditorFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { this.menu = menu; menu.clear();/*ww w.ja va 2s . c om*/ menu.add(1, MENU_RUN, 0, "Run").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(1, MENU_SAVE, 0, "Save").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(1, MENU_FILES, 0, "Files").setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(1, MENU_API, 0, "API").setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.keithandthegirl.ui.activity.GuestsDashboardFragment.java
@Override @TargetApi(11)//from www . jav a 2s . c o m public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { Log.v(TAG, "onCreateOptionsMenu : enter"); super.onCreateOptionsMenu(menu, inflater); MenuItem refresh = menu.add(Menu.NONE, REFRESH_ID, Menu.NONE, getResources().getString(R.string.menu_refresh)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { refresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } MenuItem mostRecent = menu.add(Menu.NONE, MOST_RECENT_ID, Menu.NONE, getResources().getString(R.string.menu_most_recent)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mostRecent.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } MenuItem topCount = menu.add(Menu.NONE, TOP_COUNT_ID, Menu.NONE, getResources().getString(R.string.menu_top_count)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { topCount.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } MenuItem name = menu.add(Menu.NONE, NAME_ID, Menu.NONE, getResources().getString(R.string.menu_name)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { name.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } Log.v(TAG, "onCreateOptionsMenu : exit"); }
From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.LibraryCursorAdapter.java
public void getMenu(Menu menu, File f) { MenuItem mi;/* ww w. j a v a 2 s.c o m*/ if (f.isFile()) { mi = menu.add(Menu.NONE, R.id.menu_action_share, Menu.FIRST, R.string.share); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mi = menu.add(Menu.NONE, R.id.menu_upload, Menu.FIRST + 30, R.string.upload); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } if (f.canWrite() && downloadPath != null && f.getPath().startsWith(downloadPath)) { mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } }
From source file:lewa.support.v7.app.ActionBarActivityDelegateBase.java
void toggleActionMenuStyle(boolean actionMode) { ArrayList<MenuItemImpl> actionMenus = null; if (!actionMode) { // PanelFeatureState st = window.getPanelState(FEATURE_OPTIONS_PANEL, false); // if (window.isDestroyed() || (st == null || st.menu == null)) { // return; // } // actionMenus = st.menu.lewaGetVisibleItems(); if (mMenu != null) { actionMenus = mMenu.lewaGetVisibleItems(); }//from www .j av a 2 s. co m } else { if (mActionMode != null) { MenuBuilder menu = (MenuBuilder) mActionMode.getMenu(); if (menu != null) { actionMenus = menu.lewaGetVisibleItems(); } } } if (actionMenus == null) { return; } MenuItemImpl item = null; int actionFlag = 0; int menuStyle = -1; for (int i = 0; i < actionMenus.size(); i++) { item = actionMenus.get(i); actionFlag = item.getShowAsAction(); if (actionFlag == MenuItem.SHOW_AS_ACTION_NEVER) { continue; } if (item.showsTextAsAction()) { menuStyle = ActionBar.LEWA_ACTION_MENU_STYLE_ICON; actionFlag ^= MenuItem.SHOW_AS_ACTION_WITH_TEXT; item.setShowAsAction(actionFlag); } else { menuStyle = ActionBar.LEWA_ACTION_MENU_STYLE_ICON_WITH_TEXT; actionFlag |= MenuItem.SHOW_AS_ACTION_WITH_TEXT; item.setShowAsAction(actionFlag); } saveActionMenuStyle(menuStyle); } }
From source file:nl.sogeti.android.gpstracker.viewer.TrackList.java
/*******************************************************************/ @Override/*from w w w . j a v a 2 s . c o m*/ public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); MenuItem item; item = menu.add(ContextMenu.NONE, MENU_SEARCH, ContextMenu.NONE, android.R.string.search_go) .setIcon(R.drawable.ic_search_24dp).setAlphabeticShortcut(SearchManager.MENU_KEY); MenuItemCompat.setShowAsAction(item, MenuItem.SHOW_AS_ACTION_ALWAYS); item = menu.add(ContextMenu.NONE, MENU_PICKER, ContextMenu.NONE, R.string.menu_picker) .setIcon(R.drawable.ic_import_24dp); MenuItemCompat.setShowAsAction(item, MenuItem.SHOW_AS_ACTION_ALWAYS); item = menu.add(ContextMenu.NONE, MENU_VACUUM, ContextMenu.NONE, R.string.menu_vacuum) .setIcon(android.R.drawable.ic_menu_crop); MenuItemCompat.setShowAsAction(item, MenuItem.SHOW_AS_ACTION_NEVER); return result; }