@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; MainActivity.BlockModel model = models.get(info.position); if (deleteList.size() > 0) { menu.add(0, 4, Menu.NONE, R.string.delete_selections); menu.add(0, 5, Menu.NONE, R.string.share_selections); return; } menu.add(0, 1, Menu.NONE, R.string.delete_item); // if (!model.className.equals("*")) { // menu.add(0, 2, Menu.NONE, "设为不按类名定位"); // } menu.add(0, 3, Menu.NONE, R.string.share); menu.add(0, 6, Menu.NONE, model.enable ?R.string.disable_item: R.string.enable_item); }
public void initializeItems(ContextMenu menu) { TGContext context = findContext(); TGCaret caret = TGSongViewController.getInstance(context).getCaret(); TGNote note = caret.getSelectedNote(); boolean restBeat = caret.isRestBeatSelected(); boolean running = TuxGuitar.getInstance(context).getPlayer().isRunning(); this.initializeItem(menu, R.id.menu_beat_change_tied_note, this.createActionProcessor(TGChangeTiedNoteAction.NAME), !running, note != null && note.isTiedNote()); this.initializeItem(menu, R.id.menu_beat_clean_beat, this.createActionProcessor(TGCleanBeatAction.NAME), !running); this.initializeItem(menu, R.id.menu_beat_decrement_note_semitone, this.createActionProcessor(TGDecrementNoteSemitoneAction.NAME), (!running && note != null)); this.initializeItem(menu, R.id.menu_beat_delete_note_or_rest, this.createActionProcessor(TGDeleteNoteOrRestAction.NAME), !running); this.initializeItem(menu, R.id.menu_beat_increment_note_semitone, this.createActionProcessor(TGIncrementNoteSemitoneAction.NAME), (!running && note != null)); this.initializeItem(menu, R.id.menu_beat_insert_rest_beat, this.createActionProcessor(TGInsertRestBeatAction.NAME), !running); this.initializeItem(menu, R.id.menu_beat_move_beats_left, this.createActionProcessor(TGMoveBeatsLeftAction.NAME), !running); this.initializeItem(menu, R.id.menu_beat_move_beats_right, this.createActionProcessor(TGMoveBeatsRightAction.NAME), !running); this.initializeItem(menu, R.id.menu_beat_remove_unused_voice, this.createActionProcessor(TGRemoveUnusedVoiceAction.NAME), !running); this.initializeItem(menu, R.id.menu_beat_set_voice_auto, this.createActionProcessor(TGSetVoiceAutoAction.NAME), (!running && !restBeat)); this.initializeItem(menu, R.id.menu_beat_set_voice_down, this.createActionProcessor(TGSetVoiceDownAction.NAME), (!running && !restBeat)); this.initializeItem(menu, R.id.menu_beat_set_voice_up, this.createActionProcessor(TGSetVoiceUpAction.NAME), (!running && !restBeat)); this.initializeItem(menu, R.id.menu_beat_shift_note_down, this.createActionProcessor(TGShiftNoteDownAction.NAME), (!running && note != null)); this.initializeItem(menu, R.id.menu_beat_shift_note_up, this.createActionProcessor(TGShiftNoteUpAction.NAME), (!running && note != null)); this.initializeItem(menu, R.id.menu_beat_stroke, new TGStrokeDialogController(), !running); this.initializeItem(menu, R.id.menu_beat_edit_text, new TGTextDialogController(), !running); }
/** * Creates context menu for certain actions on a specific item. */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; if (v instanceof ListView) { ListView listView = (ListView) v; Object item = listView.getAdapter().getItem(info.position); if (item instanceof DIDLObject) { selectedDIDLObject = (DIDLObject) item; } } menu.setHeaderTitle(v.getContext().getString( R.string.browse_context_title)); ArrayList<String> menuItems = new ArrayList<String>(); menuItems.add(v.getContext().getString(R.string.browse_context_play_all)); menuItems.add(v.getContext().getString(R.string.browse_context_play)); //menuItems.add(v.getContext().getString( R.string.browse_context_add_to_playplist)); menuItems.add(v.getContext() .getString(R.string.browse_context_download)); for (int i = 0; i < menuItems.size(); i++) { menu.add(Menu.NONE, i, i, menuItems.get(i)); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { try { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; if (info != null) { fileListView.setSelection(info.position, 0); } menu.setHeaderTitle(R.string.fman_operation); AdapterIf ca = getListAdapter(); ca.populateContextMenu(menu, info, fileListView.getSelected()); } catch (Exception e) { e.printStackTrace(); } }
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); // Show the name of the file in the header AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo)menuInfo; int position = adapterMenuInfo.position; mActivityFileCursor.moveToPosition(position); String path = mActivityFileCursor.getString(mDataIndex); MetaFile file = MetaFile.from(path); menu.setHeaderTitle(file.getName()); // Add the context menu items menu.add(0, R.string.info, 0, R.string.info); // Save the path, we will need it when an entry of the menu is selected mContextMenuPath = path; }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (!canCreateContextMenu(menu, menuInfo)) { return; } menu.clear(); ViewHolder holder = (ViewHolder) ((AdapterContextMenuInfo) menuInfo).targetView.getTag(); menu.setHeaderTitle(holder.nameView.getText()); if (holder.icon != null) { setHeaderIcon(menu, holder.icon); } menu.add(Menu.NONE, R.string.app_info, Menu.NONE, R.string.app_info); updatePreventMenu(menu, holder.packageName); if (getMainIntent(holder.packageName) != null) { menu.add(Menu.NONE, R.string.open, Menu.NONE, R.string.open); } if (holder.canUninstall) { menu.add(Menu.NONE, R.string.uninstall, Menu.NONE, R.string.uninstall); } if (appNotification) { menu.add(Menu.NONE, R.string.app_notifications, Menu.NONE, R.string.app_notifications); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getTag() instanceof InputKeyReference) { menu.setHeaderTitle(R.string.what_do_you_want); menu.add(0, KEY_CONTEXT_MENU_CUT, 0, R.string.cut_key); menu.add(0, KEY_CONTEXT_MENU_COPY, 0, R.string.copy_key); if (minputKeyRefClipboard.isEmpty() == false) { menu.add(0, KEY_CONTEXT_MENU_PASTE_BEFORE, 0, R.string.paste_before_key); menu.add(0, KEY_CONTEXT_MENU_PASTE_ON, 0, R.string.paste_on_key); menu.add(0, KEY_CONTEXT_MENU_PASTE_AFTER, 0, R.string.paste_after_key); } menu.add(0, KEY_CONTEXT_MENU_CREATE_BEFORE, 0, R.string.create_before_key); menu.add(0, KEY_CONTEXT_MENU_CREATE_AFTER, 0, R.string.create_after_key); menu.add(0, KEY_CONTEXT_MENU_DELETE, 0, R.string.delete_key); menu.add(0, KEY_CONTEXT_MENU_EDIT, 0, R.string.edit_key); // should not use assign, i.e. minputKeyRefUnderOpt = v.getTag() // cause minputKeyRefUnderOpt and tag may change in different scenarios minputKeyRefUnderOpt.copy((InputKeyReference) v.getTag()); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { switch (v.getId()) { case R.id.listView: AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; NoteRef noteRef = mNoteRefList.get(info.position); boolean linked = noteRef.isLinked(); menu.setHeaderTitle(noteRef.getTitle()); String[] menuItems = getResources().getStringArray(R.array.notes_context_menu); for (int i = 0; i < menuItems.length; i++) { if (linked && (i == 0 || i == 3)) { // share public link and delete continue; } menu.add(Menu.NONE, i, i, menuItems[i]); } break; default: super.onCreateContextMenu(menu, v, menuInfo); break; } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); int id = v.getId(); switch (id) { case R.id.avatar: getMenuInflater().inflate(R.menu.activity_detail_teacher_change_avatar_context_menu, menu); menu.setHeaderTitle(R.string.change_avatar); view_ShowMenu = img_avatar; break; case R.id.background: getMenuInflater().inflate(R.menu.activity_detail_teacher_change_background_context_menu, menu); menu.setHeaderTitle(R.string.change_background); view_ShowMenu = img_background; break; } }
@Override @SuppressWarnings("unchecked") public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) menuInfo; } catch (ClassCastException e) { Log.e(THIS_FILE, "bad menuInfo", e); return; } HashMap<String, Object> codec = (HashMap<String, Object>) mAdapter.getItem(info.position); if (codec == null) { // If for some reason the requested item isn't available, do nothing return; } boolean isDisabled = ((Short)codec.get(CODEC_PRIORITY) == 0); menu.add(0, MENU_ITEM_ACTIVATE, 0, isDisabled ? R.string.activate : R.string.deactivate); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final SipProfile account = profileFromContextMenuInfo(menuInfo); if(account == null) { return; } WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard); // Setup the menu header menu.setHeaderTitle(account.display_name); if(wizardInfos != null) { menu.setHeaderIcon(wizardInfos.icon); } menu.add(0, MENU_ITEM_ACTIVATE, 0, account.active ? R.string.deactivate_account : R.string.activate_account); menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account); menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account); menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { mManager.getContextMenuManager().createContextMenu( menu, v, new ContextMenuManager.Delegate() { @Override public void openItem(int windowDisposition) { mManager.openMostVisitedItem(windowDisposition, MostVisitedItem.this); } @Override public void removeItem() { mManager.removeMostVisitedItem(MostVisitedItem.this); } @Override public String getUrl() { return MostVisitedItem.this.getUrl(); } @Override public boolean isItemSupported(@ContextMenuItemId int menuItemId) { return true; } }); }
public void initializeItems(ContextMenu menu) { TGContext context = findContext(); TGCaret caret = TGSongViewController.getInstance(context).getCaret(); TGTrack track = caret.getTrack(); boolean running = TuxGuitar.getInstance(context).getPlayer().isRunning(); this.initializeItem(menu, R.id.menu_track_add, this.createActionProcessor(TGAddNewTrackAction.NAME), !running); this.initializeItem(menu, R.id.menu_track_remove, this.createActionProcessor(TGRemoveTrackAction.NAME), !running); this.initializeItem(menu, R.id.menu_track_clone, this.createActionProcessor(TGCloneTrackAction.NAME), !running); this.initializeItem(menu, R.id.menu_track_move_up, this.createActionProcessor(TGMoveTrackUpAction.NAME), !running); this.initializeItem(menu, R.id.menu_track_move_down, this.createActionProcessor(TGMoveTrackDownAction.NAME), !running); this.initializeItem(menu, R.id.menu_track_change_solo, this.createActionProcessor(TGChangeTrackSoloAction.NAME), !running, track.isSolo()); this.initializeItem(menu, R.id.menu_track_change_mute, this.createActionProcessor(TGChangeTrackMuteAction.NAME), !running, track.isMute()); this.initializeItem(menu, R.id.menu_track_set_name, new TGTrackNameDialogController(), !running); this.initializeItem(menu, R.id.menu_track_set_channel, new TGTrackChannelDialogController(), !running); this.initializeItem(menu, R.id.menu_track_change_tuning, new TGTrackTuningDialogController(), !running); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; getMenuInflater().inflate(R.menu.folder_context, menu); FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position); menu.setHeaderTitle(folder.displayName); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); getActivity().getMenuInflater().inflate(R.menu.context_history, menu); if (mLastSelectedQuery != null) { menu.setHeaderTitle(mLastSelectedQuery.getData().from.getLocalizedName() + " - " + mLastSelectedQuery.getData().to.getLocalizedName()); } }
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { WebView.HitTestResult result = webView.getHitTestResult(); if (result != null) { int type = result.getType(); if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) { showLongPressedImageMenu(menu, result.getExtra()); } } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // Check if running boolean running = false; ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); for (RunningAppProcessInfo info : activityManager.getRunningAppProcesses()) if (info.uid == mAppInfo.getUid()) running = true; PackageManager pm = getPackageManager(); List<String> listPackageNames = mAppInfo.getPackageName(); List<String> listApplicationName = mAppInfo.getApplicationName(); for (int i = 0; i < listPackageNames.size(); i++) { Menu appMenu = (listPackageNames.size() == 1) ? menu : menu.addSubMenu(i, Menu.NONE, Menu.NONE, listApplicationName.get(i)); // Launch MenuItem launch = appMenu.add(i, MENU_LAUNCH, Menu.NONE, getString(R.string.menu_app_launch)); if (pm.getLaunchIntentForPackage(listPackageNames.get(i)) == null) launch.setEnabled(false); // Settings appMenu.add(i, MENU_SETTINGS, Menu.NONE, getString(R.string.menu_app_settings)); // Kill MenuItem kill = appMenu.add(i, MENU_KILL, Menu.NONE, getString(R.string.menu_app_kill)); kill.setEnabled(running && PrivacyManager.isApplication(mAppInfo.getUid())); // Play store MenuItem store = appMenu.add(i, MENU_STORE, Menu.NONE, getString(R.string.menu_app_store)); if (!Util.hasMarketLink(this, listPackageNames.get(i))) store.setEnabled(false); } }
public void initializeItems(ContextMenu menu) { boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning(); this.initializeItem(menu, R.id.menu_composition_change_tempo, new TGTempoDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_change_clef, new TGClefDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_change_key_signature, new TGKeySignatureDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_change_time_signature, new TGTimeSignatureDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_change_triplet_feel, new TGTripletFeelDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_change_info, new TGSongInfoDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_repeat_alternative, new TGRepeatAlternativeDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_repeat_close, new TGRepeatCloseDialogController(), !running); this.initializeItem(menu, R.id.menu_composition_repeat_open, this.createActionProcessor(TGRepeatOpenAction.NAME), !running); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(R.string.go_to); ContextMenuRecyclerView.RecyclerViewContextMenuInfo info = (ContextMenuRecyclerView.RecyclerViewContextMenuInfo) menuInfo; Event event = adapter.getData().get(info.getPosition()); ArrayList<ActivityRedirectionModel> redirectionModels = mPresenter.getRedirectionList(event); for (ActivityRedirectionModel model : redirectionModels) { addRedirectionMenuItem(menu, model); } }
public void initializeItems(ContextMenu menu) { boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning(); this.initializeItem(menu, R.id.menu_caret_go_left, this.createActionProcessor(TGGoLeftAction.NAME), !running); this.initializeItem(menu, R.id.menu_caret_go_right, this.createActionProcessor(TGGoRightAction.NAME), !running); this.initializeItem(menu, R.id.menu_caret_go_up, this.createActionProcessor(TGGoUpAction.NAME), !running); this.initializeItem(menu, R.id.menu_caret_go_down, this.createActionProcessor(TGGoDownAction.NAME), !running); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); toBeProcessUser = (EaseUser) listView.getItemAtPosition(((AdapterContextMenuInfo) menuInfo).position); toBeProcessUsername = toBeProcessUser.getUsername(); getActivity().getMenuInflater().inflate(R.menu.em_context_contact_list, menu); }
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; MusicDirectory.Entry entry = (MusicDirectory.Entry) albumListView.getItemAtPosition(info.position); if (entry != null && entry.isDirectory()) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.select_album_context, menu); } shareButton = menu.findItem(R.id.menu_item_share); if (shareButton != null) { shareButton.setVisible(!Util.isOffline(this)); } MenuItem downloadMenuItem = menu.findItem(R.id.album_menu_download); if (downloadMenuItem != null) { downloadMenuItem.setVisible(!Util.isOffline(this)); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // 获取环信id int position = ((AdapterView.AdapterContextMenuInfo) menuInfo).position; EaseUser easeUser = (EaseUser) listView.getItemAtPosition(position); mHxid = easeUser.getUsername(); // 添加布局 getActivity().getMenuInflater().inflate(R.menu.delete, menu); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.context_menu_lisview_groups_operation, menu); }
public void initializeItems(ContextMenu menu) { boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning(); this.initializeItem(menu, R.id.menu_edit_undo, this.createActionProcessor(TGUndoAction.NAME), !running); this.initializeItem(menu, R.id.menu_edit_redo, this.createActionProcessor(TGRedoAction.NAME), !running); this.initializeItem(menu, R.id.menu_edit_set_voice_1, this.createActionProcessor(TGSetVoice1Action.NAME), true); this.initializeItem(menu, R.id.menu_edit_set_voice_2, this.createActionProcessor(TGSetVoice2Action.NAME), true); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.setHeaderTitle(R.string.wallet_menu_title); menu.add(0, 200, 0, R.string.wallet_menu_changename); menu.add(0, 201, 0, R.string.wallet_menu_copyadd); menu.add(0, 202, 0, R.string.wallet_menu_share); menu.add(0, 203, 0, R.string.wallet_menu_export); menu.add(0, 204, 0, R.string.wallet_menu_private_key); menu.add(0, 205, 0, R.string.wallet_menu_delete); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if(isNull(recyclerView)) return; int position = recyclerView.getChildAdapterPosition(v) - getHeadersCount(); if(listener != null){ listener.populateCommentContextMenu(menu, getItem(position)); } }
public void createContextMenu(Activity activity, ContextMenu menu) { if(DBG) Log.d(TAG,"createContextMenu"); final Cover cover = mLayout.getFrontCover(); if (cover==null) { return; } menu.setHeaderTitle(cover.getDescriptionName()); // Animate the front cover to help understand it is the one the menu is referring to // The 200ms delay help to have a not-too-jerky animation despite GL animation and ContextMenu animation at the same time mAnimHandler.startItemClickAnimation(mLayout.getFrontCoverIndex(), null, 200); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if (v.getId() == R.id.room_listview) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle(roomList.get(info.position)); String[] menuItems = getResources().getStringArray(R.array.roomListContextMenu); for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); } } else { super.onCreateContextMenu(menu, v, menuInfo); } }
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.verify_display_fragment_context_menu, menu); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if (v.getId() == mUploadFile.getId()) { menu.add(0, TAKE_PHOTO, 0, R.string.take_photo); menu.add(0, FILE_EXPLORER, 0, R.string.file_explorer); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = mActivity.getMenuInflater(); if(mData.get(itemNow).type.equals("福利")) inflater.inflate(R.menu.menu_girl, menu); else inflater.inflate(R.menu.menu_item, menu); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if (v.getId() == R.id.hosts_listview) { String[] menuItems = getResources().getStringArray(R.array.list_hosts_actions); for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); } } }
private void setListViewContextMenuWithDel() { lvMang.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { intCurrDataPos = ((AdapterContextMenuInfo) menuInfo).position; menu.add(0, 0, 0, "删除"); } }); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add(0, R.id.rest_copy_request, 0, "Copy"); menu.add(0, R.id.rest_delete, 0, "Remove");//groupId, itemId, order, title menu.add(0, R.id.rest_sort_up, 0, "Move Up"); menu.add(0, R.id.rest_sort_down, 0, "Move Down"); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Select action"); menu.add(0, 1, 1, "Edit"); menu.add(0, 2, 2, "Delete"); }
@Override public void onCreateContextMenu(ContextMenu menu) { MenuHandler handler = new MenuHandler(); if (mMenuItemsStrings == null) { Resources resources = getResources(); mMenuItemsStrings = new String[4]; mMenuItemsStrings[COPY] = String.format(resources.getString(R.string.copy), mHistoryEntry.getFormula() + "=" + mHistoryEntry.getResult()); mMenuItemsStrings[COPY_BASE] = String.format(resources.getString(R.string.copy), mHistoryEntry.getFormula()); mMenuItemsStrings[COPY_EDITED] = String.format(resources.getString(R.string.copy), mHistoryEntry.getResult()); mMenuItemsStrings[REMOVE] = resources.getString(R.string.remove_from_history); } for (int i = 0; i < mMenuItemsStrings.length; i++) { menu.add(Menu.NONE, i, i, mMenuItemsStrings[i]).setOnMenuItemClickListener(handler); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { int position = ((AdapterView.AdapterContextMenuInfo) menuInfo).position; if (position >= adapter.getCount() || adapter.getItem(position).getResult() != null) { menu.add(Menu.NONE, position, position, R.string.history_clear_one_history_text); } // else it's just that dummy "Empty" message }