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:org.alfresco.mobile.android.application.extension.samsung.pen.SNoteEditorActionMode.java
private void getMenu(Menu menu) { MenuItem mi;//from w ww . jav a2 s . c o m menu.clear(); mi = menu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_DELETE_ID, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS, R.string.editor_tools_settings); mi.setIcon(R.drawable.ic_delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // GROUP MENU if (selectedSpenObjects.size() > 1) { SubMenu groupSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST, R.string.editor_group_menu); groupSubMenu.setIcon(R.drawable.ic_group); groupSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); mi = groupSubMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_GROUP_ID, Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_GROUP_ID, R.string.editor_group); mi = groupSubMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_UNGROUP_ID, Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_UNGROUP_ID, R.string.editor_ungroup); mi.setEnabled(false); for (SpenObjectBase obj : selectedSpenObjects) { if (obj.getType() == SpenObjectBase.TYPE_CONTAINER) { mi.setEnabled(true); break; } } } // UP MENU SubMenu upMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST, R.string.editor_front_menu); upMenu.setIcon(R.drawable.ic_move_up); upMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); mi = upMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_FORWARD_ID, Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_FORWARD_ID, R.string.editor_forward); mi = upMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_TOP_ID, Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_TOP_ID, R.string.editor_front); // DOWN MENU SubMenu downMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST, R.string.editor_back_menu); downMenu.setIcon(R.drawable.ic_move_down); downMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); mi = downMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BACKWARD_ID, Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BACKWARD_ID, R.string.editor_backward); mi = downMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BOTTOM_ID, Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BOTTOM_ID, R.string.editor_back); }
From source file:eu.chainfire.geolog.ui.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { int tab = getActionBar().getSelectedNavigationIndex(); if (tab == 0) { menu.add(R.string.menu_add).setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override//w w w . j a v a 2 s . com public boolean onMenuItemClick(MenuItem item) { addProfile(); return true; } }).setIcon(R.drawable.ic_action_add).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } else if (tab == 1) { menu.add(R.string.menu_export).setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { ExportActivity.launchActivity(MainActivity.this, 0); return true; } }).setIcon(R.drawable.ic_action_export).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(R.string.menu_clear).setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { (new AlertDialog.Builder(MainActivity.this)).setTitle(R.string.generic_clear) .setMessage(Html.fromHtml(getString(R.string.logs_clear_confirm))) .setPositiveButton(getString(R.string.generic_clear), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { (new ClearLogsAsync()).execute(); } }) .setNegativeButton(getString(R.string.generic_cancel), null).show(); return true; } }).setIcon(R.drawable.ic_action_delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } else if (tab == 2) { } return true; }
From source file:org.smap.smapTask.android.activities.MainTabsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); CompatibilityUtils.setShowAsAction(//w w w. j a v a2 s . c o m menu.add(0, MENU_ENTERDATA, 0, R.string.enter_data).setIcon(android.R.drawable.ic_menu_edit), MenuItem.SHOW_AS_ACTION_IF_ROOM); CompatibilityUtils.setShowAsAction( menu.add(0, MENU_GETTASKS, 1, R.string.smap_get_tasks).setIcon(android.R.drawable.ic_menu_rotate), MenuItem.SHOW_AS_ACTION_IF_ROOM); CompatibilityUtils.setShowAsAction(menu.add(0, MENU_PREFERENCES, 2, R.string.server_preferences) .setIcon(android.R.drawable.ic_menu_preferences), MenuItem.SHOW_AS_ACTION_IF_ROOM); CompatibilityUtils.setShowAsAction( menu.add(0, MENU_GETFORMS, 3, R.string.get_forms).setIcon(android.R.drawable.ic_input_add), MenuItem.SHOW_AS_ACTION_IF_ROOM); CompatibilityUtils.setShowAsAction( menu.add(0, MENU_SENDDATA, 4, R.string.send_data).setIcon(android.R.drawable.ic_menu_send), MenuItem.SHOW_AS_ACTION_IF_ROOM); CompatibilityUtils.setShowAsAction( menu.add(0, MENU_MANAGEFILES, 5, R.string.manage_files).setIcon(android.R.drawable.ic_delete), MenuItem.SHOW_AS_ACTION_IF_ROOM); return true; }
From source file:org.codecyprus.android_client.ui.ActivityCurrentQuestion.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(R.string.SKIP)// w ww . java 2 s. c om .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); menu.add(R.string.Score_board) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); return true; }
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); }/*from w ww. ja va2 s. c o m*/ } } return true; }
From source file:cf.obsessiveorange.rhcareerfairlayout.ui.fragments.VPCompaniesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); MenuItem searchBtn = menu.findItem(R.id.action_search); searchBtn.setVisible(true);// w ww .ja va2s .co m SubMenu selectionMenu = menu.addSubMenu(getResources().getString(R.string.selection_options_btn)); selectionMenu.getItem().setIcon(new IconDrawable(this.getActivity(), Iconify.IconValue.fa_edit) .colorRes(R.color.accentNoTransparency).actionBarSize()); selectionMenu.getItem().setTitle(getResources().getString(R.string.selection_options_btn)); selectionMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); MenuItem selectAllItem = selectionMenu.add(getResources().getString(R.string.btn_select_all)); selectAllItem.setIcon(new IconDrawable(this.getActivity(), Iconify.IconValue.fa_check_square_o) .colorRes(R.color.accentNoTransparency).actionBarSize()); selectAllItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); selectAllItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Toast.makeText(getActivity(), "Selected all items", Toast.LENGTH_SHORT).show(); try { DBManager.setFilteredCompaniesSelected(true); } catch (SQLException e) { e.printStackTrace(); } ((CompaniesCellAdapter) recyclerView.getAdapter()).refreshData(); synchronized (RHCareerFairLayout.refreshMapNotifier) { RHCareerFairLayout.refreshMapNotifier.notifyChanged(); } return true; } }); MenuItem deselectAllItem = selectionMenu.add(getResources().getString(R.string.btn_deselect_all)); deselectAllItem.setIcon(new IconDrawable(this.getActivity(), Iconify.IconValue.fa_square_o) .colorRes(R.color.accentNoTransparency).actionBarSize()); deselectAllItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); deselectAllItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Toast.makeText(getActivity(), "Deselected all items", Toast.LENGTH_SHORT).show(); try { DBManager.setFilteredCompaniesSelected(false); } catch (SQLException e) { e.printStackTrace(); } ((CompaniesCellAdapter) recyclerView.getAdapter()).refreshData(); synchronized (RHCareerFairLayout.refreshMapNotifier) { RHCareerFairLayout.refreshMapNotifier.notifyChanged(); } return true; } }); }
From source file:de.stadtrallye.rallyesoft.ConnectionAssistantActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem scan_qr = menu.add(Menu.NONE, R.id.scan_qr_login, 10, R.string.scan_barcode); scan_qr.setIcon(R.drawable.ic_scan_qr_light); scan_qr.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;//from w w w . j a v a 2 s . co m }
From source file:net.potterpcs.recipebook.RecipeListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.listviewmenu, menu); MenuItemCompat.setShowAsAction(menu.findItem(R.id.switchtoflipbook), MenuItem.SHOW_AS_ACTION_IF_ROOM); }
From source file:org.alfresco.mobile.android.application.fragments.person.PersonProfileFragment.java
public static void getMenu(Menu menu) { MenuItem mi = menu.add(Menu.NONE, MenuActionItem.MENU_PROFILE, Menu.FIRST + MenuActionItem.MENU_PROFILE, R.string.my_profile);// ww w . j a v a 2 s . c o m mi.setIcon(R.drawable.ic_avatar); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }
From source file:org.alfresco.mobile.android.application.fragments.actions.NodeActions.java
protected void getMenu(FragmentActivity activity, Menu menu) { MenuItem mi;//from w ww .j ava2 s . c om SubMenu createMenu; if (selectedFolder.isEmpty()) { mi = menu.add(Menu.NONE, R.id.menu_action_download_all, Menu.FIRST, R.string.download); mi.setIcon(R.drawable.ic_download_light); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); removeActionIfNecessary(menu, mi.getItemId(), ConfigurableActionHelper.ACTION_NODE_DOWNLOAD); if (!(SessionUtils.getSession(activity) instanceof CloudSession)) { mi = menu.add(Menu.NONE, R.id.menu_workflow_review_attachments, Menu.FIRST + 500, R.string.process_start_review); mi.setIcon(R.drawable.ic_start_review); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); removeActionIfNecessary(menu, mi.getItemId(), ConfigurableActionHelper.ACTION_NODE_REVIEW); } } // SYNC if (SyncContentManager.getInstance(getActivity()).hasActivateSync(getAccount()) && !SyncContentManager.getInstance(getActivity()).isSynced(getAccount(), parentFolder)) { createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_action_sync_group, Menu.FIRST, R.string.sync); createMenu.setIcon(R.drawable.ic_sync_light); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); removeActionIfNecessary(menu, createMenu.getItem().getItemId(), ConfigurableActionHelper.ACTION_NODE_SYNC); createMenu.add(Menu.NONE, R.id.menu_action_sync_group_sync, Menu.FIRST + 1, R.string.sync); createMenu.add(Menu.NONE, R.id.menu_action_sync_group_unsync, Menu.FIRST + 2, R.string.unsync); } // FAVORITES createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_action_favorite_group, Menu.FIRST + 135, R.string.favorite); createMenu.setIcon(R.drawable.ic_favorite_light); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); removeActionIfNecessary(menu, createMenu.getItem().getItemId(), ConfigurableActionHelper.ACTION_NODE_FAVORITE); createMenu.add(Menu.NONE, R.id.menu_action_favorite_group_favorite, Menu.FIRST + 1, R.string.favorite); createMenu.add(Menu.NONE, R.id.menu_action_favorite_group_unfavorite, Menu.FIRST + 2, R.string.unfavorite); // LIKE AlfrescoSession alfSession = SessionUtils.getSession(activity); if (alfSession != null && alfSession.getRepositoryInfo() != null && alfSession.getRepositoryInfo().getCapabilities() != null && alfSession.getRepositoryInfo().getCapabilities().doesSupportLikingNodes()) { createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_action_like_group, Menu.FIRST + 150, R.string.like); createMenu.setIcon(R.drawable.ic_like); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); removeActionIfNecessary(menu, createMenu.getItem().getItemId(), ConfigurableActionHelper.ACTION_NODE_LIKE); createMenu.add(Menu.NONE, R.id.menu_action_like_group_like, Menu.FIRST + 1, R.string.like); createMenu.add(Menu.NONE, R.id.menu_action_like_group_unlike, Menu.FIRST + 2, R.string.unlike); } if (parentFolder != null && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), parentFolder, ConfigurableActionHelper.ACTION_NODE_DELETE)) { 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); removeActionIfNecessary(menu, mi.getItemId(), ConfigurableActionHelper.ACTION_NODE_DELETE); } }