List of usage examples for android.view MenuItem SHOW_AS_ACTION_IF_ROOM
int SHOW_AS_ACTION_IF_ROOM
To view the source code for android.view MenuItem SHOW_AS_ACTION_IF_ROOM.
Click Source Link
From source file:com.giantturtle.badenumbersquiz.PrepareYourSelfActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1)//ako je predposlednja stranica onda da prikae finish, a ako nije predposlednja ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;/*from ww w . j a va 2s. c om*/ }
From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileActions.java
private void getMenu(Menu menu) { menu.clear();//from w w w . j av 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.notifry.android.SourceList.java
@Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, ADD_SOURCE, 0, R.string.create_source).setIcon(android.R.drawable.ic_menu_add) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(0, REFRESH_SERVER, 0, R.string.refresh_sources_server).setIcon(android.R.drawable.ic_menu_rotate) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return result; }
From source file:com.github.jobs.ui.fragment.JobDetailsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); Context themedContext = getActivity().getActionBar().getThemedContext(); ShareActionProvider shareActionProvider = new ShareActionProvider(themedContext); shareActionProvider//ww w .j av a 2 s . com .setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() { @Override public boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent) { getTracker(getActivity()).trackEvent(CATEGORY_JOBS, ACTION_SHARE, intent.getComponent().getPackageName()); return false; } }); menu.add(0, SHARE, 0, R.string.share).setActionProvider(shareActionProvider) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(SHARE); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); actionProvider.setShareIntent(ShareHelper.getShareIntent(mJob)); }
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/*w ww . ja v a2 s.c o m*/ .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 public boolean onMenuItemClick(MenuItem menuItem) { deleteNote(false); return true; } }); } return true; }
From source file:de.stadtrallye.rallyesoft.fragments.TasksOverviewFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem refreshMenuItem = menu.add(Menu.NONE, R.id.refresh_menu, 30, R.string.refresh); refreshMenuItem.setIcon(R.drawable.ic_refresh_light); refreshMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); MenuItem resize = menu.add(Menu.NONE, R.id.resize_menu, 40, R.string.resize); resize.setIcon(R.drawable.ic_center_light); resize.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); }
From source file:org.catnut.fragment.TimelineFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(Menu.NONE, R.id.refresh, Menu.NONE, R.string.refresh) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // prefer actionbar refresh menu.add(Menu.NONE, R.id.action_back_top, Menu.NONE, getString(R.string.back_to_top)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // ??/* w w w .ja v a 2 s .com*/ MenuItem search = menu.add(android.R.string.search_go); search.setIcon(R.drawable.ic_title_search_default); search.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView = VividSearchView.getSearchView(getActivity()); mSearchView.setOnQueryTextListener(this); mSearchView.setOnCloseListener(this); search.setActionView(mSearchView); }
From source file:org.deviceconnect.android.deviceplugin.irkit.settings.fragment.IRKitRegisterIRFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { final MenuItem menuItem = menu.add(getString(R.string.menu_close)); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override/*w ww .j a va2 s. co m*/ public boolean onMenuItemClick(final MenuItem item) { if (item.getTitle().equals(menuItem.getTitle())) { getActivity().finish(); } return true; } }); }
From source file:com.android.settings.profiles.ProfilesSettings.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(0, MENU_RESET, 0, R.string.profile_reset_title).setIcon(R.drawable.ic_settings_backup) // use the backup icon .setAlphabeticShortcut('r').setEnabled(mEnabled) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add(0, MENU_ADD, 0, R.string.profiles_add).setIcon(R.drawable.ic_menu_add).setAlphabeticShortcut('a') .setEnabled(mEnabled)// w ww. jav a2s.c o m .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }
From source file:com.example.shiwangi.dataplan.ScreenSlideActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;//from w ww. j a v a 2s . com }