List of usage examples for android.view Menu FIRST
int FIRST
To view the source code for android.view Menu FIRST.
Click Source Link
From source file:org.alfresco.mobile.android.application.fragments.MenuFragmentHelper.java
public static MenuItem getMenu(Context context, Menu menu) { if (menu == null || context == null) { return null; }//from w ww . ja v a 2 s . co m if (AccessibilityUtils.isEnabled(context)) { MenuItem mi = menu.add(Menu.NONE, R.id.menu_refresh, Menu.FIRST + 40, R.string.refresh); mi.setIcon(R.drawable.ic_refresh); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return mi; } else { return null; } }
From source file:com.grarak.kerneladiutor.activities.EditorActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_save); DrawableCompat.setTint(drawable, Color.WHITE); menu.add(0, Menu.FIRST, Menu.FIRST, getString(R.string.save)).setIcon(drawable) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return super.onCreateOptionsMenu(menu); }
From source file:org.alfresco.mobile.android.application.fragments.search.HistorySearchActions.java
protected void getMenu(FragmentActivity activity, Menu menu) { SubMenu createMenu;// ww w. ja v a 2 s .com createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_historysearch_delete, Menu.FIRST, R.string.delete); createMenu.setIcon(R.drawable.ic_delete); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); }
From source file:org.alfresco.mobile.android.application.fragments.actions.NodeIdActions.java
protected void getMenu(FragmentActivity activity, Menu menu) { SubMenu createMenu;/*w w w. j a va 2s.co m*/ // SYNC if (SyncContentManager.getInstance(getActivity()).hasActivateSync(getAccount())) { 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); hideActionIfNecessary(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 + 2, R.string.favorite); createMenu.setIcon(R.drawable.ic_favorite_light); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); hideActionIfNecessary(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 + 3, R.string.like); createMenu.setIcon(R.drawable.ic_like); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); hideActionIfNecessary(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); } }
From source file:org.alfresco.mobile.android.application.fragments.activitystream.ActivityFeedAdapter.java
public void getMenu(Menu menu, ActivityEntry entry) { if (entry.getCreatedBy() != null) { menu.add(Menu.NONE, R.id.menu_activity_profile, Menu.FIRST, String.format(getContext().getString(R.string.activity_profile), entry.getCreatedBy())); }//from w w w. j av a 2s . c o m }
From source file:com.gh4a.activities.IssueListBaseActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, R.string.actions) .setIcon(R.drawable.abc_ic_menu_moreoverflow_mtrl_alpha); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); }
From source file:com.gh4a.activities.IssueListMineActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { int resIdState = Constants.Issue.STATE_OPEN.equals(mState) ? R.string.issues_menu_show_closed : R.string.issues_menu_show_open; MenuItem item = menu.add(Menu.NONE, Menu.FIRST + 1, Menu.NONE, resIdState); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); return super.onCreateOptionsMenu(menu); }
From source file:com.gh4a.activities.Github4AndroidActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, R.string.login); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); }
From source file:com.gh4a.activities.IssueListBaseActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == Menu.FIRST) { toggleDrawer();//ww w .j a v a 2 s.co m return true; } return super.onOptionsItemSelected(item); }
From source file:org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsActionMode.java
protected void getMenu(FragmentActivity activity, Menu menu) { if (selectedItems.isEmpty() || selectedItems.size() > 1) { return;/* ww w . j av a 2 s . c o m*/ } MenuItem mi; Node node = getCurrentItem(); if (node == null) { return; } if (node instanceof NodeSyncPlaceHolder) { return; } boolean isRestrict = node.hasAspect(ContentModel.ASPECT_RESTRICTABLE); if (node.isDocument()) { if (((Document) node).getContentStreamLength() > 0 && !isRestrict && ConfigurableActionHelper .isVisible(getActivity(), getAccount(), ConfigurableActionHelper.ACTION_NODE_DOWNLOAD)) { mi = menu.add(Menu.NONE, R.id.menu_action_download, Menu.FIRST, R.string.download); mi.setIcon(R.drawable.ic_download_light); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (((Document) node).isLatestVersion() && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_UPDATE)) { mi = menu.add(Menu.NONE, R.id.menu_action_update, Menu.FIRST + 130, R.string.update); mi.setIcon(R.drawable.ic_upload); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (!(SessionUtils.getSession(activity) instanceof CloudSession) && ConfigurableActionHelper .isVisible(getActivity(), getAccount(), ConfigurableActionHelper.ACTION_NODE_REVIEW)) { mi = menu.add(Menu.NONE, R.id.menu_workflow_add, Menu.FIRST + 500, R.string.process_start_review); mi.setIcon(R.drawable.ic_start_review); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } } if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_EDIT)) { mi = menu.add(Menu.NONE, R.id.menu_action_edit, Menu.FIRST + 50, R.string.edit); mi.setIcon(R.drawable.ic_properties); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, 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); } }