List of usage examples for android.view Menu NONE
int NONE
To view the source code for android.view Menu NONE.
Click Source Link
From source file:com.ichi2.anki2.Reviewer.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Resources res = getResources(); UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_MARK, Menu.NONE, R.string.menu_mark_card, R.drawable.ic_menu_mark);/*ww w .j av a2 s . co m*/ UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_UNDO, Menu.NONE, R.string.undo, R.drawable.ic_menu_revert_disabled); UIUtils.addMenuItem(menu, Menu.NONE, MENU_EDIT, Menu.NONE, R.string.menu_edit_card, R.drawable.ic_menu_edit); if (mPrefWhiteboard) { if (mShowWhiteboard) { UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE, R.string.hide_whiteboard, R.drawable.ic_menu_compose); } else { UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE, R.string.show_whiteboard, R.drawable.ic_menu_compose); } UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_CLEAR_WHITEBOARD, Menu.NONE, R.string.clear_whiteboard, R.drawable.ic_menu_clear_playlist); } if (mPrefRecord) { // TODO proper icon final MenuItem recorderItem = UIUtils.addMenuItem(menu, Menu.NONE, MENU_RECORD, Menu.NONE, Recorder.recording() ? R.string.record_stop : R.string.record_start, R.drawable.ic_circle_pressed); final MenuItem replayItem = UIUtils.addMenuItem(menu, Menu.NONE, MENU_RECORD_REPLAY, Menu.NONE, R.string.record_play, R.drawable.ic_circle_normal); // disable unless something is recorded replayItem.setEnabled(false); // set relevant listeners Recorder.setRecordingStartedListener(new Recorder.RecordingStartedListener() { @Override public void onRecordingStarted() { recorderItem.setTitle(R.string.record_stop); } }); Recorder.setRecordingFinishedListener(new Recorder.RecordingFinishedListener() { @Override public void onRecordingFinished() { recorderItem.setTitle(R.string.record_start); replayItem.setEnabled(true); } }); Recorder.setRecorderResetListener(new Recorder.RecorderResetListener() { @Override public void onRecorderReset() { replayItem.setEnabled(false); } }); } SubMenu removeDeckSubMenu = menu.addSubMenu(Menu.NONE, MENU_REMOVE, Menu.NONE, R.string.menu_dismiss_note); removeDeckSubMenu.setIcon(R.drawable.ic_menu_stop); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_BURY, Menu.NONE, R.string.menu_bury_note); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_CARD, Menu.NONE, R.string.menu_suspend_card); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_NOTE, Menu.NONE, R.string.menu_suspend_note); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_DELETE, Menu.NONE, R.string.menu_delete_note); if (mPrefTextSelection) { MenuItem item = menu.add(Menu.NONE, MENU_SEARCH, Menu.NONE, res.getString(R.string.menu_select)); item.setIcon(R.drawable.ic_menu_search); item.setEnabled(Lookup.isAvailable()); } return true; }
From source file:com.edible.ocr.CaptureActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.equals(ocrResultView)) { menu.add(Menu.NONE, OPTIONS_COPY_RECOGNIZED_TEXT_ID, Menu.NONE, "Copy recognized text"); menu.add(Menu.NONE, OPTIONS_SHARE_RECOGNIZED_TEXT_ID, Menu.NONE, "Share recognized text"); } else if (v.equals(translationView)) { menu.add(Menu.NONE, OPTIONS_COPY_TRANSLATED_TEXT_ID, Menu.NONE, "Copy translated text"); menu.add(Menu.NONE, OPTIONS_SHARE_TRANSLATED_TEXT_ID, Menu.NONE, "Share translated text"); }/*from w w w. ja v a 2 s. c o m*/ }
From source file:com.nit.vicky.Reviewer.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Resources res = getResources(); UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_MARK, Menu.NONE, R.string.menu_mark_card, R.drawable.ic_menu_mark);/*from ww w . j a v a 2 s . c o m*/ UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_UNDO, Menu.NONE, R.string.undo, R.drawable.ic_menu_revert_disabled); UIUtils.addMenuItem(menu, Menu.NONE, MENU_EDIT, Menu.NONE, R.string.menu_edit_card, R.drawable.ic_menu_edit); if (mPrefWhiteboard) { if (mShowWhiteboard) { UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE, R.string.hide_whiteboard, R.drawable.ic_menu_compose); } else { UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE, R.string.show_whiteboard, R.drawable.ic_menu_compose); } UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_CLEAR_WHITEBOARD, Menu.NONE, R.string.clear_whiteboard, R.drawable.ic_menu_clear_playlist); } SubMenu removeDeckSubMenu = menu.addSubMenu(Menu.NONE, MENU_REMOVE, Menu.NONE, R.string.menu_dismiss_note); removeDeckSubMenu.setIcon(R.drawable.ic_menu_stop); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_BURY_CARD, Menu.NONE, R.string.menu_bury_card); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_BURY_NOTE, Menu.NONE, R.string.menu_bury_note); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_CARD, Menu.NONE, R.string.menu_suspend_card); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_NOTE, Menu.NONE, R.string.menu_suspend_note); removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_DELETE, Menu.NONE, R.string.menu_delete_note); if (mPrefTextSelection) { MenuItem item = menu.add(Menu.NONE, MENU_SEARCH, Menu.NONE, res.getString(R.string.menu_select)); item.setIcon(R.drawable.ic_menu_search); item.setEnabled(Lookup.isAvailable()); } return true; }
From source file:org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsFragment.java
public void getMenu(Context context, AlfrescoSession session, Menu menu, Node node) { MenuItem mi;/*www. ja va 2 s . c o m*/ 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(), getSession(), node, 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 (!(session instanceof CloudSession) && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, 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 (session == null) { return; } if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_EDIT)) { mi = menu.add(Menu.NONE, R.id.menu_action_edit, Menu.FIRST + 10, R.string.edit); mi.setIcon(R.drawable.ic_properties); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (node.hasAspect(ContentModel.ASPECT_GEOGRAPHIC)) { mi = menu.add(Menu.NONE, R.id.menu_action_location, Menu.FIRST + 50, R.string.geolocation); mi.setIcon(R.drawable.ic_location); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } 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_NEVER); } }
From source file:com.ubuntuone.android.files.activity.FilesActivity.java
private void buildDirectoryContextMenu(Menu menu, FileViewHolder viewHolder) { menu.add(Menu.NONE, R.id.context_download, 0, R.string.context_download); menu.add(Menu.NONE, R.id.context_rename, 10, R.string.context_rename); menu.add(Menu.NONE, R.id.context_delete, 11, R.string.context_delete); }
From source file:com.ubuntuone.android.files.activity.FilesActivity.java
private void buildFileContextMenu(Menu menu, FileViewHolder holder) { if (ResourceState.STATE_GETTING.equals(holder.resourceState)) { menu.add(Menu.NONE, R.id.context_cancel_download, 1, R.string.context_cancel_download); } else {/*from w ww . ja v a2s . c om*/ menu.add(Menu.NONE, R.id.context_download, 1, R.string.context_download); } if (holder.isPublic) { menu.add(Menu.NONE, R.id.context_share_link, 1, R.string.context_share_link); menu.add(Menu.NONE, R.id.context_disable_link, 2, R.string.context_disable_link); } else { menu.add(Menu.NONE, R.id.context_create_link, 1, R.string.context_create_link); } menu.add(Menu.NONE, R.id.context_rename, 10, R.string.context_rename); menu.add(Menu.NONE, R.id.context_delete, 11, R.string.context_delete); if (!TextUtils.isEmpty(holder.data) && !holder.data.startsWith(ContentResolver.SCHEME_CONTENT)) { menu.add(Menu.NONE, R.id.context_delete_from_device, 12, R.string.context_delete_from_device); } }
From source file:com.ichi2.anki.NoteEditor.java
private void setRemapButtonListener(ImageButton remapButton, final int newFieldIndex) { remapButton.setOnClickListener(new View.OnClickListener() { @Override//from w w w.ja va 2s .c o m public void onClick(View v) { Timber.i("NoteEditor:: Remap button pressed for new field %d", newFieldIndex); // Show list of fields from the original note which we can map to PopupMenu popup = new PopupMenu(NoteEditor.this, v); final String[][] items = mEditorNote.items(); for (int i = 0; i < items.length; i++) { popup.getMenu().add(Menu.NONE, i, Menu.NONE, items[i][0]); } // Add "nothing" at the end of the list popup.getMenu().add(Menu.NONE, items.length, Menu.NONE, R.string.nothing); popup.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { // Get menu item id Integer idx = item.getItemId(); Timber.i("NoteEditor:: User chose to remap to old field %d", idx); // Retrieve any existing mappings between newFieldIndex and idx Integer previousMapping = getKeyByValue(mModelChangeFieldMap, newFieldIndex); Integer mappingConflict = mModelChangeFieldMap.get(idx); // Update the mapping depending on any conflicts if (idx == items.length && previousMapping != null) { // Remove the previous mapping if None selected mModelChangeFieldMap.remove(previousMapping); } else if (idx < items.length && mappingConflict != null && previousMapping != null && newFieldIndex != mappingConflict) { // Swap the two mappings if there was a conflict and previous mapping mModelChangeFieldMap.put(previousMapping, mappingConflict); mModelChangeFieldMap.put(idx, newFieldIndex); } else if (idx < items.length && mappingConflict != null) { // Set the conflicting field to None if no previous mapping to swap into it mModelChangeFieldMap.remove(previousMapping); mModelChangeFieldMap.put(idx, newFieldIndex); } else if (idx < items.length) { // Can simply set the new mapping if no conflicts mModelChangeFieldMap.put(idx, newFieldIndex); } // Reload the fields updateFieldsFromMap(getCurrentlySelectedModel()); return true; } }); popup.show(); } }); }
From source file:org.uguess.android.sysinfo.SiragonManager.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem mi = menu.add(Menu.NONE, MI_REFRESH, Menu.NONE, R.string.refresh); mi.setIcon(android.R.drawable.ic_menu_rotate); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_IF_ROOM); /*mi = menu.add( Menu.NONE, MI_ABOUT, Menu.NONE, R.string.about ); mi.setIcon( android.R.drawable.ic_menu_info_details ); Util.setShowAsAction( mi, MenuItem.SHOW_AS_ACTION_NEVER ); //from www. j av a 2 s. c o m mi = menu.add( Menu.NONE, MI_HELP, Menu.NONE, R.string.help ); mi.setIcon( android.R.drawable.ic_menu_help ); Util.setShowAsAction( mi, MenuItem.SHOW_AS_ACTION_NEVER );*/ mi = menu.add(Menu.NONE, MI_PREFERENCE, Menu.NONE, R.string.preference); mi.setIcon(android.R.drawable.ic_menu_preferences); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER); mi = menu.add(Menu.NONE, MI_EXIT, Menu.NONE, R.string.exit); mi.setIcon(android.R.drawable.ic_menu_close_clear_cancel); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER); }
From source file:org.openintents.shopping.ui.ShoppingActivity.java
protected void showStoresFilter(final View v) { QuickSelectMenu popup = new QuickSelectMenu(this, v); Menu menu = popup.getMenu();// w w w.ja va2 s .c o m if (menu == null) { return; } Cursor c = getContentResolver().query( Stores.QUERY_BY_LIST_URI.buildUpon().appendPath(this.mListUri.getLastPathSegment()).build(), new String[] { Stores._ID, Stores.NAME }, null, null, "stores.name COLLATE NOCASE ASC"); int i_store, count = c.getCount(); if (count == 0) { c.deactivate(); c.close(); Toast.makeText(this, R.string.no_stores_available, Toast.LENGTH_SHORT).show(); return; } // prepend the "no filter" option menu.add(0, -1, Menu.NONE, R.string.unfiltered); // get the list of stores c.moveToFirst(); for (i_store = 0; i_store < count; i_store++) { long id = c.getLong(0); String name = c.getString(1); menu.add(0, (int) id, Menu.NONE, name); c.moveToNext(); } c.deactivate(); c.close(); popup.setOnItemSelectedListener(new QuickSelectMenu.OnItemSelectedListener() { public void onItemSelected(CharSequence name, int id) { // set the selected store filter // update the filter summary? not until filter region collapsed. ContentValues values = new ContentValues(); values.put(Lists.STORE_FILTER, (long) id); getContentResolver().update(mListUri, values, null, null); if (id == -1) { ((Button) v).setText(R.string.stores); } else { ((Button) v).setText(name); } fillItems(false); } }); popup.show(); }