List of usage examples for android.view MenuItem setShowAsAction
public void setShowAsAction(int actionEnum);
From source file:com.mifos.mifosxdroid.online.collectionsheet.CollectionSheetFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();//www . j a v a2 s . com 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(R.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(R.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.mifos.mifosxdroid.online.ClientChargeFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();//from w w w . j av a 2s . c o m MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_CHARGES, Menu.NONE, getString(R.string.add_new)); menuItemAddNewDocument .setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_action_content_new, null)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); super.onPrepareOptionsMenu(menu); }
From source file:com.getchute.android.photopickerplus.ui.activity.ServicesActivity.java
@SuppressLint("NewApi") @Override/* www.jav a 2s .co m*/ public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (PhotoPicker.getInstance().hasLogoutOption()) { MenuItem item = menu.add(0, LOGOUT_ITEM, 0, R.string.button_navigation_services_logout); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } return true; }
From source file:net.olejon.mdapp.NotesEditActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_notes_edit, menu); if (noteId != 0) { MenuItem menuItem = menu .add(Menu.NONE, Menu.NONE, Menu.NONE, getString(R.string.notes_edit_menu_delete)) .setIcon(R.drawable.ic_delete_white_24dp); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override//w w w . ja va2s .c om public boolean onMenuItemClick(MenuItem menuItem) { deleteNote(false); return true; } }); } return true; }
From source file:com.mifos.mifosxdroid.online.documentlist.DocumentListFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();/*from w ww . j a v a 2s . co m*/ MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_DOCUMENT, Menu.NONE, getString(R.string.add_new)); menuItemAddNewDocument.setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.ic_add_white_24dp)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); super.onPrepareOptionsMenu(menu); }
From source file:org.alfresco.mobile.android.application.fragments.preferences.AccountSettingsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear();/*from w w w. j av a2 s .c om*/ MenuItem mi = menu.add(Menu.NONE, R.id.menu_account_delete, Menu.FIRST + 10, R.string.delete); mi.setIcon(R.drawable.ic_clear_grey); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); if (SessionManager.getInstance(getActivity()).hasSession(account.getId())) { mi = menu.add(Menu.NONE, R.id.my_profile, Menu.FIRST, R.string.my_profile); mi.setIcon(R.drawable.ic_account_circle_grey); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } }
From source file:com.pacoapp.paco.ui.FindExperimentsActivity.java
@SuppressLint("NewApi") @Override/*from w w w . ja va2 s .co m*/ public boolean onCreateOptionsMenu(Menu menu) { int pos = 1; if (true || !mNavigationDrawerFragment.isDrawerOpen()) { getMenuInflater().inflate(R.menu.main, menu); //restoreActionBar(); // TODO hide find experiments (this is that item) // TODO make refresh be an always action MenuItem findExperiments = menu.getItem(0); findExperiments.setVisible(false); MenuItem refreshExperiments = menu.getItem(1); refreshExperiments.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } return super.onCreateOptionsMenu(menu); }
From source file:be.brunoparmentier.openbikesharing.app.activities.StationsListActivity.java
private void setRefreshActionButtonState(final boolean refreshing) { if (optionsMenu != null) { final MenuItem refreshItem = optionsMenu.findItem(R.id.action_refresh); if (refreshItem != null) { if (refreshing) { refreshItem.setActionView(R.layout.actionbar_indeterminate_progress); refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } else { refreshItem.setActionView(null); refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }/*from www . j ava2s. c om*/ } } }
From source file:edu.stanford.mobisocial.dungbeetle.ui.fragments.FeedActionsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item; int placement = 0; Log.d(TAG, "creating menu " + mDualPane); if (mDualPane || MusubiBaseActivity.isDeveloperModeEnabled(getActivity())) { item = menu.add(0, MENU_VIEW, placement++, "View"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }//from w w w . j a v a 2 s . c o m } item = menu.add(0, MENU_SHARE, placement++, "Share"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } }
From source file:org.alfresco.mobile.android.application.fragments.node.browser.ProgressNodeAdapter.java
public void getMenu(Menu menu, Node node) { MenuItem mi; mi = menu.add(Menu.NONE, R.id.menu_node_details, Menu.FIRST, R.string.action_view_properties); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); if (ConfigurableActionHelper.isVisible(getActivity(), SessionUtils.getAccount(getActivity()), SessionUtils.getSession(getActivity()), node, ConfigurableActionHelper.ACTION_NODE_EDIT)) { mi = menu.add(Menu.NONE, R.id.menu_action_edit, Menu.FIRST + 50, R.string.action_edit_properties); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); }//from w w w .j a v a 2 s . c o m if (ConfigurableActionHelper.isVisible(getActivity(), SessionUtils.getAccount(getActivity()), SessionUtils.getSession(getActivity()), node, ConfigurableActionHelper.ACTION_NODE_DELETE)) { mi = menu.add(Menu.NONE, R.id.menu_action_delete_folder, Menu.FIRST + 1000, R.string.delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } }