android.view.ContextMenu.ContextMenuInfo Java Examples
The following examples show how to use
android.view.ContextMenu.ContextMenuInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecentTabsPage.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // Would prefer to have this context menu view managed internal to RecentTabsGroupView // Unfortunately, setting either onCreateContextMenuListener or onLongClickListener // disables the native onClick (expand/collapse) behaviour of the group view. ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { mAdapter.getGroup(groupPosition).onCreateContextMenuForGroup(menu, mActivity); } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); mAdapter.getGroup(groupPosition).onCreateContextMenuForChild(childPosition, menu, mActivity); } }
Example #2
Source File: DragSortListViewFragment.java From mobile-manager-tool with MIT License | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if( mFragmentGroupId != 0 ){ menu.add(mFragmentGroupId, PLAY_SELECTION, 0, getResources().getString(R.string.play_all)); menu.add(mFragmentGroupId, ADD_TO_PLAYLIST, 0, getResources().getString(R.string.add_to_playlist)); menu.add(mFragmentGroupId, USE_AS_RINGTONE, 0, getResources().getString(R.string.use_as_ringtone)); menu.add(mFragmentGroupId, REMOVE, 0, R.string.remove); menu.add(mFragmentGroupId, SEARCH, 0, getResources().getString(R.string.search)); AdapterContextMenuInfo mi = (AdapterContextMenuInfo)menuInfo; mSelectedPosition = mi.position; mCursor.moveToPosition(mSelectedPosition); try { mSelectedId = mCursor.getLong(mCursor.getColumnIndexOrThrow(mMediaIdColumn)); } catch (IllegalArgumentException ex) { mSelectedId = mi.id; } String title = mCursor.getString(mCursor.getColumnIndexOrThrow(MediaColumns.TITLE)); menu.setHeaderTitle(title); } }
Example #3
Source File: PreventFragment.java From prevent with Do What The F*ck You Want To Public License | 6 votes |
@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); } }
Example #4
Source File: PlayActivity.java From shortyz with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) { // System.out.println("CCM " + view); // if (view == boardView) { // Menu clueSize = menu.addSubMenu("Clue Text Size"); // clueSize.add("Small"); // clueSize.add("Medium"); // clueSize.add("Large"); // // menu.add("Zoom In"); // // if (getRenderer().getScale() < getRenderer().getDeviceMaxScale()) // menu.add("Zoom In Max"); // // menu.add("Zoom Out"); // menu.add("Fit to Screen"); // menu.add("Zoom Reset"); // } }
Example #5
Source File: AccountsEditListFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@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); }
Example #6
Source File: CodecsFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@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); }
Example #7
Source File: MenuMainDemoFragment.java From material-components-android with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { TextView contextMenuTextView = (TextView) v; Context context = getContext(); menu.add(android.R.string.copy) .setOnMenuItemClickListener( item -> { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE); clipboard.setPrimaryClip( ClipData.newPlainText(CLIP_DATA_LABEL, contextMenuTextView.getText())); return true; }); menu.add(R.string.context_menu_highlight) .setOnMenuItemClickListener( item -> { highlightText(contextMenuTextView); return true; }); }
Example #8
Source File: ExpandableListView.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override ContextMenuInfo createContextMenuInfo(View view, int flatListPosition, long id) { if (isHeaderOrFooterPosition(flatListPosition)) { // Return normal info for header/footer view context menus return new AdapterContextMenuInfo(view, flatListPosition, id); } final int adjustedPosition = getFlatPositionForConnector(flatListPosition); PositionMetadata pm = mConnector.getUnflattenedPos(adjustedPosition); ExpandableListPosition pos = pm.position; id = getChildOrGroupId(pos); long packedPosition = pos.getPackedPosition(); pm.recycle(); return new ExpandableListContextMenuInfo(view, packedPosition, id); }
Example #9
Source File: AdbShell.java From RemoteAdbShell with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v == commandBox) { commandHistory.populateMenu(menu); } else { menu.add(Menu.NONE, MENU_ID_CTRL_C, Menu.NONE, "Send Ctrl+C"); MenuItem autoscroll = menu.add(Menu.NONE, MENU_ID_AUTOSCROLL, Menu.NONE, "Auto-scroll terminal"); autoscroll.setCheckable(true); autoscroll.setChecked(autoScrollEnabled); menu.add(Menu.NONE, MENU_ID_EXIT, Menu.NONE, "Exit Terminal"); } }
Example #10
Source File: ArtistAlbumsFragment.java From mobile-manager-tool with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(mFragmentGroupId, PLAY_SELECTION, 0, getResources().getString(R.string.play_all)); menu.add(mFragmentGroupId, ADD_TO_PLAYLIST, 0, getResources().getString(R.string.add_to_playlist)); menu.add(mFragmentGroupId, SEARCH, 0, getResources().getString(R.string.search)); mCurrentId = mCursor.getString( mCursor.getColumnIndexOrThrow( BaseColumns._ID ) ); menu.setHeaderView( ApolloUtils.setHeaderLayout( mType, mCursor, getActivity() ) ); }
Example #11
Source File: AccountFiltersListFragment.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
/** * Retrieve filter id from a given context menu info pressed * @param cmi The context menu info to retrieve infos from * @return corresponding filter id if everything goes well, -1 if not able to retrieve filter */ private long filterIdFromContextMenuInfo(ContextMenuInfo cmi) { AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) cmi; } catch (ClassCastException e) { Log.e(THIS_FILE, "bad menuInfo", e); return -1; } return info.id; }
Example #12
Source File: PlaylistsFragment.java From mobile-manager-tool with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterContextMenuInfo mi = (AdapterContextMenuInfo)menuInfo; menu.add(mFragmentGroupId, PLAY_SELECTION, 0, getResources().getString(R.string.play_all)); if (mi.id >= 0) { menu.add(mFragmentGroupId, RENAME_PLAYLIST, 0, getResources().getString(R.string.rename_playlist)); menu.add(mFragmentGroupId, DELETE_PLAYLIST, 0, getResources().getString(R.string.delete_playlist)); } mCurrentId = mCursor.getString(mCursor.getColumnIndexOrThrow(BaseColumns._ID)); String title = mCursor.getString(mCursor.getColumnIndexOrThrow(PlaylistsColumns.NAME)); menu.setHeaderTitle(title); }
Example #13
Source File: MonitorMangAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
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, "删除"); } }); }
Example #14
Source File: GenresFragment.java From mobile-manager-tool with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(mFragmentGroupId, ADD_TO_LOVE, 0, getResources().getString(R.string.play_all)); mCurrentId = mCursor.getString(mCursor.getColumnIndexOrThrow(BaseColumns._ID)); String title = mCursor.getString(mCursor.getColumnIndexOrThrow(Audio.Genres.NAME)); menu.setHeaderTitle(title); }
Example #15
Source File: MarkerListActivity.java From mytracks with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); getMenuInflater().inflate(R.menu.list_context_menu, menu); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; contextualActionModeCallback.onPrepare( menu, new int[] { info.position }, new long[] { info.id }, false); }
Example #16
Source File: AccountFiltersListFragment.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final long filterId = filterIdFromContextMenuInfo(menuInfo); if(filterId == -1) { return; } menu.add(0, MENU_ITEM_MODIFY, 0, R.string.edit); menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_filter); }
Example #17
Source File: SearchActivity.java From HayaiLauncher with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (menuInfo instanceof AdapterContextMenuInfo) { AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle( ((LaunchableActivity) adapterMenuInfo.targetView .findViewById(R.id.appIcon).getTag()).getActivityLabel()); } final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.app, menu); }
Example #18
Source File: FragmentPlugin.java From CompositeAndroid with Apache License 2.0 | 5 votes |
void onCreateContextMenu(final CallVoid3<ContextMenu, View, ContextMenuInfo> superCall, ContextMenu menu, View v, ContextMenuInfo menuInfo) { synchronized (mSuperListeners) { mSuperListeners.push(superCall); onCreateContextMenu(menu, v, menuInfo); } }
Example #19
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub super.onCreateContextMenu(menu, v, menuInfo); // ���3���˵�ѡ�� menu.add(1, 1, 0, "���"); menu.add(1, 2, 0, "ɾ��"); menu.add(1, 3, 0, "����"); }
Example #20
Source File: CaptureActivity.java From android-mrz-reader with Apache License 2.0 | 5 votes |
@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"); } }
Example #21
Source File: QuickQueueFragment.java From mobile-manager-tool with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(0, PLAY_SELECTION, 0, getResources().getString(R.string.play_all)); menu.add(0, REMOVE, 0, getResources().getString(R.string.remove)); AdapterContextMenuInfo mi = (AdapterContextMenuInfo)menuInfo; mSelectedPosition = mi.position; mCursor.moveToPosition(mSelectedPosition); String title = mCursor.getString(mTitleIndex); menu.setHeaderTitle(title); super.onCreateContextMenu(menu, v, menuInfo); }
Example #22
Source File: FidoMain.java From FidoCadJ with GNU General Public License v3.0 | 5 votes |
/** Create the contextual menu. */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.popupmenu, menu); }
Example #23
Source File: ContextMenuHelper.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { List<Pair<Integer, List<ContextMenuItem>>> items = mPopulator.buildContextMenu(menu, v.getContext(), mCurrentContextMenuParams); if (items.isEmpty()) { ThreadUtils.postOnUiThread(mOnMenuClosed); return; } ContextMenuUi menuUi = new PlatformContextMenuUi(menu); menuUi.displayMenu(mActivity, mCurrentContextMenuParams, items, mCallback, mOnMenuShown, mOnMenuClosed); }
Example #24
Source File: LyricExplorerFragment.java From LyricHere with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater m = getActivity().getMenuInflater(); menu.setHeaderTitle(R.string.menu_encoding_title); m.inflate(R.menu.context_menu, menu); }
Example #25
Source File: DictEntryListActions.java From aedict with GNU General Public License v3.0 | 5 votes |
public DictEntryListActions register(final ListView lv) { lv.setOnCreateContextMenuListener(AndroidUtils.safe(activity, new View.OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { final int position = ((AdapterContextMenuInfo) menuInfo).position; final DictEntry ee = (DictEntry) lv.getAdapter().getItem(position); register(menu, ee, position); } })); return this; }
Example #26
Source File: PartFileSourceNamesFragment.java From aMuleRemote with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // For context menu, the standard menu inflater must be used // https://groups.google.com/forum/?fromgroups=#!topic/actionbarsherlock/wQlIvR-jUYQ android.view.MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.sourcenames_context, menu); AdapterView.AdapterContextMenuInfo aMenuInfo = (AdapterView.AdapterContextMenuInfo) menuInfo; mLastSelected = mPartFile.getSourceNames().get(aMenuInfo.position).getName(); }
Example #27
Source File: ChatAllHistoryActivity.java From school_shop with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // if(((AdapterContextMenuInfo)menuInfo).position > 0){ m, getMenuInflater().inflate(R.menu.delete_message, menu); // } }
Example #28
Source File: ContextMenuHelper.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { assert mPopulator != null; mPopulator.buildContextMenu(menu, v.getContext(), mCurrentContextMenuParams); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setOnMenuItemClickListener(this); } }
Example #29
Source File: MainActivity.java From Overchan-Android with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == R.id.sidebar_tabs_list) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; TabModel model = tabsAdapter.getItem(info.position); if (tabsAdapter.getCount() > 1) { menu.add(Menu.NONE, R.id.context_menu_move, 1, R.string.context_menu_move); } if (model.webUrl != null) { menu.add(Menu.NONE, R.id.context_menu_copy_url, 2, R.string.context_menu_copy_url); menu.add(Menu.NONE, R.id.context_menu_share_link, 3, R.string.context_menu_share_link); } if (canFavorite(model)) { menu.add(Menu.NONE, R.id.context_menu_favorites, 4, isFavorite(model) ? R.string.context_menu_remove_favorites : R.string.context_menu_add_favorites); } if (model.type == TabModel.TYPE_NORMAL && model.pageModel != null && model.pageModel.type == UrlPageModel.TYPE_THREADPAGE) { boolean backgroundAutoupdateEnabled = MainApplication.getInstance().settings.isAutoupdateEnabled() && MainApplication.getInstance().settings.isAutoupdateBackground(); menu.add(Menu.NONE, R.id.context_menu_autoupdate_background, 5, backgroundAutoupdateEnabled ? R.string.context_menu_autoupdate_background : R.string.context_menu_autoupdate_background_off). setCheckable(true).setChecked(model.autoupdateBackground); } if (model.autoupdateBackground && TabsTrackerService.getCurrentUpdatingTabId() == -1) { menu.add(Menu.NONE, R.id.context_menu_autoupdate_now, 6, R.string.context_menu_autoupdate_now); } } }
Example #30
Source File: TrackListActivity.java From mytracks with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); getMenuInflater().inflate(R.menu.list_context_menu, menu); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; contextualActionModeCallback.onPrepare( menu, new int[] { info.position }, new long[] { info.id }, false); }