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.sync.SyncCursorAdapter.java
public void getMenu(Menu menu, Integer statut, boolean rootSynced) { MenuItem mi;/* ww w . j av a 2 s.com*/ switch (statut) { case SyncContentStatus.STATUS_HIDDEN: mi = menu.add(Menu.NONE, R.id.menu_action_favorite_group, Menu.FIRST, R.string.favorite); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); break; case SyncContentStatus.STATUS_FAILED: case SyncContentStatus.STATUS_REQUEST_USER: mi = menu.add(Menu.NONE, R.id.menu_sync_resolution, Menu.FIRST, R.string.sync_resolve_conflict); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); break; default: if (rootSynced) { mi = menu.add(Menu.NONE, R.id.menu_action_sync_group_unsync, Menu.FIRST, R.string.unsync); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } break; } }
From source file:org.mixare.MixListView.java
@Override public boolean onCreateOptionsMenu(Menu menu) { int base = Menu.FIRST; /*define menu items*/ MenuItem item1 = menu.add(base, base, base, getString(DataView.MENU_ITEM_3)); MenuItem item2 = menu.add(base, base + 1, base + 1, getString(DataView.MENU_CAM_MODE)); /*assign icons to the menu items*/ item1.setIcon(android.R.drawable.ic_menu_mapmode); item2.setIcon(android.R.drawable.ic_menu_camera); return true;/*from w w w . j a va 2 s. c om*/ }
From source file:fm.libre.droid.LibreDroid.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem changeStation = menu.add(0, Menu.FIRST, 0, "Change Station").setIcon(R.drawable.back); MenuItem quit = menu.add(0, 2, 0, R.string.quit).setIcon(R.drawable.quit); changeStation.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { final ViewAnimator view = (ViewAnimator) findViewById(R.id.viewAnimator); if (view.getDisplayedChild() == 4) { LibreDroid.this.libreServiceConn.service.stop(); LibreDroid.this.prevPage(); LibreDroid.this.prevPage(); LibreDroid.this.prevPage(); return true; } else { return false; }/*from w w w . ja v a2s .com*/ } }); quit.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { LibreDroid.this.libreServiceConn.service.stop(); LibreDroid.this.finish(); return true; } }); return super.onCreateOptionsMenu(menu); }
From source file:org.alfresco.mobile.android.application.fragments.favorites.FavoritesSyncFragment.java
public void getMenu(Menu menu) { info = SyncScanInfo.getLastSyncScanData(getActivity(), acc); if (info != null && (info.hasWarning() && !info.hasResponse())) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_SYNC_WARNING, Menu.FIRST + MenuActionItem.MENU_SYNC_WARNING, R.string.sync_warning); mi.setIcon(R.drawable.ic_warning); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }/*w ww . j av a 2 s . c o m*/ mi = menu.add(Menu.NONE, MenuActionItem.MENU_REFRESH, MenuActionItem.MENU_SYNC_WARNING + MenuActionItem.MENU_REFRESH, R.string.refresh); mi.setIcon(R.drawable.ic_refresh); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }
From source file:com.easemob.chatuidemo.activity.main.MainActivity.java
/** * ?/*from w ww . j av a2 s . com*/ */ private void initView() { tvMessage = (TextView) findViewById(R.id.user_message); unreadLabel = (TextView) findViewById(R.id.unread_msg_number); unreadAddressLable = (TextView) findViewById(R.id.unread_msg_number_main); mTabs = new Button[3]; mTabs[0] = (Button) findViewById(R.id.btn_schoolyard); mTabs[1] = (Button) findViewById(R.id.btn_seikatsu); mTabs[2] = (Button) findViewById(R.id.btn_setting); registerForContextMenu(mTabs[1]); tvMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this, MessageActivity.class); intent.putExtra("invitenum", mInviteNum); intent.putExtra("chatnum", mChatNum); startActivityForResult(intent, 301); } }); tvMemu = (TextView) findViewById(R.id.user_menu); popupMenu = new PopupMenu(this, tvMemu); menu = popupMenu.getMenu(); tvMemu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popupMenu.show(); } }); menu.add(Menu.NONE, Menu.FIRST + 0, 0, ""); menu.add(Menu.NONE, Menu.FIRST + 1, 1, ""); menu.add(Menu.NONE, Menu.FIRST + 2, 2, "?"); MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.popupmenu, menu); // ? popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case Menu.FIRST + 0: Intent intent = new Intent(MainActivity.this, UserProfileActivity.class); intent.putExtra("username", EMChatManager.getInstance().getCurrentUser()); intent.putExtra("nick", DemoApplication.getInstance().getNick()); intent.putExtra("setting", true); startActivity(intent); break; case Menu.FIRST + 1: logout(); break; case Menu.FIRST + 2: intent = new Intent(MainActivity.this, RegisterActivity.class); intent.putExtra("action", "update"); startActivity(intent); break; default: break; } return false; } }); }
From source file:org.alfresco.mobile.android.application.fragments.workflow.task.TaskDetailsFragment.java
public void getMenu(Menu menu) { MenuItem mi;//w w w .jav a 2 s . c om String processDefinitionKey = WorkflowUtils.getKeyFromProcessDefinitionId(processDefinitionId); if (endedAt == null && processDefinitionKey.startsWith(WorkflowModel.KEY_PREFIX_ACTIVITI)) { mi = menu.add(Menu.NONE, R.id.menu_process_details, Menu.FIRST, R.string.process_diagram); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } mi = menu.add(Menu.NONE, R.id.menu_process_history, Menu.FIRST + 1, R.string.tasks_history); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); if (currentTask == null || endedAt != null) { return; } // unclaim : I unassign myself (generally created by a pooled process) if (currentTask.getAssigneeIdentifier() != null && WorkflowModel.FAMILY_PROCESS_POOLED_REVIEW.contains(processDefinitionKey)) { mi = menu.add(Menu.NONE, R.id.menu_task_unclaim, Menu.FIRST + 2, R.string.task_unclaim); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT); } // reassign : I have a task and I decide I dont want to be responsible // anymore of this task so I reassign to a specific person else if (currentTask.getAssigneeIdentifier() != null) { mi = menu.add(Menu.NONE, R.id.menu_task_reassign, Menu.FIRST + 3, R.string.task_reassign); mi.setIcon(R.drawable.ic_reassign); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } // claim : I assign to me an unassigned task (created by a pooled // process) else if ((currentTask.getAssigneeIdentifier() == null && WorkflowModel.FAMILY_PROCESS_POOLED_REVIEW.contains(processDefinitionKey)) || "unclaimed".equals(state)) { mi = menu.add(Menu.NONE, R.id.menu_task_claim, Menu.FIRST + 4, R.string.task_claim); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT); } }
From source file:org.alfresco.mobile.android.application.fragments.node.browser.ProgressNodeAdapter.java
public void getMenu(Menu menu, Node node) { MenuItem mi;/*from w ww.jav a 2 s .c o m*/ 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); } 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); } }
From source file:org.alfresco.mobile.android.application.fragments.sync.SyncFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { info = SyncScanInfo.getLastSyncScanData(getActivity(), acc); if (info != null && (info.hasWarning() && !info.hasResponse())) { mi = menu.add(Menu.NONE, R.id.menu_sync_warning, Menu.FIRST, R.string.sync_warning); mi.setIcon(R.drawable.ic_warning); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }/*from ww w . j a v a 2s . co m*/ MenuFragmentHelper.getMenu(getActivity(), menu); }
From source file:org.alfresco.mobile.android.application.fragments.search.SearchFragment.java
public static void getMenu(Menu menu) { MenuItem mi = menu.add(Menu.NONE, R.id.menu_search_option, Menu.FIRST, R.string.search_advanced); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); }
From source file:org.alfresco.mobile.android.application.activity.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (sessionState == SESSION_ERROR && getCurrentSession() == null) { MenuItem mi = menu.add(Menu.NONE, R.id.menu_account_reload, Menu.FIRST, R.string.retry_account_loading); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS); }/* w ww . j a va2 s. com*/ return super.onCreateOptionsMenu(menu); }