Java Code Examples for android.view.ContextMenu#ContextMenuInfo
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: ListFragmentTag.java From rss with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); boolean hasImage = ((ViewFeedItem) ((AdapterView.AdapterContextMenuInfo) menuInfo).targetView).m_hasImage; // Inflate the context menu from the xml file. Activity activity = getActivity(); MenuInflater inflater = activity.getMenuInflater(); inflater.inflate(R.menu.context_menu, menu); // Show the 'Save image' option only when the view has an image. menu.findItem(R.id.save_image).setVisible(hasImage); // Set the title of the context menu to the feed item's title. AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; FeedItem view = (FeedItem) ((AdapterView<ListAdapter>) v).getAdapter() .getItem(info.position); menu.setHeaderTitle(view.m_title); }
Example 2
Source File: SearchActivity.java From Conversations with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo; final Message message = this.messages.get(acmi.position); this.selectedMessageReference = new WeakReference<>(message); getMenuInflater().inflate(R.menu.search_result_context, menu); MenuItem copy = menu.findItem(R.id.copy_message); MenuItem quote = menu.findItem(R.id.quote_message); MenuItem copyUrl = menu.findItem(R.id.copy_url); if (message.isGeoUri()) { copy.setVisible(false); quote.setVisible(false); } else { copyUrl.setVisible(false); } super.onCreateContextMenu(menu, v, menuInfo); }
Example 3
Source File: RouteParamFragment.java From pandora with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (menuInfo instanceof MenuRecyclerView.RvContextMenuInfo) { MenuRecyclerView.RvContextMenuInfo info = (MenuRecyclerView.RvContextMenuInfo) menuInfo; RouteParamItem paramItem = getAdapter().getItem(info.position); if (paramItem.data != RouteParamItem.Type.NONE) { menu.add(-1, R.id.pd_menu_id_1, 0, R.string.pd_name_add); } menu.add(-1, R.id.pd_menu_id_2, 0, R.string.pd_name_delete_key); } }
Example 4
Source File: AppAdapter.java From NanoIconPack with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) { contextMenu.setHeaderTitle(dataList.get(contextMenuActiveItemPos).getLabel()); contextMenu.add(Menu.NONE, 0, Menu.NONE, R.string.menu_request_icon); contextMenu.add(Menu.NONE, 1, Menu.NONE, R.string.menu_copy_code); contextMenu.add(Menu.NONE, 2, Menu.NONE, R.string.menu_save_icon); contextMenu.getItem(0).setOnMenuItemClickListener(this); contextMenu.getItem(1).setOnMenuItemClickListener(this); contextMenu.getItem(2).setOnMenuItemClickListener(this); contextMenu.getItem(0).setVisible(enableStatsModule); }
Example 5
Source File: CloudChatRecordActivity.java From imsdk-android with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if (v instanceof LinearLayout) { IMMessage message = (IMMessage) v.getTag(); Intent intent = new Intent(); intent.putExtra(Constants.BundleKey.MESSAGE, message); if (message.getMsgType() != ProtoMessageOuterClass.MessageType.MessageTypeBurnAfterRead_VALUE) { // if (message.getReadState() == MessageStatus.STATUS_SUCCESS) { menu.add(0, MENU1, 0, getText(R.string.atom_ui_menu_copy)).setIntent(intent); // } } } }
Example 6
Source File: UserAdapter.java From BrainPhaser with GNU General Public License v3.0 | 5 votes |
/** * Creates a context menu to delete and edit an user * * @param menu The context menu which contains the different items * @param v Ignored * @param menuInfo Ignored */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { MenuItem editItem = menu.add(mApplication.getString(R.string.user_context_menu_button_edit)); editItem.setOnMenuItemClickListener(this); if (!mUsers.get(getPosition()).getId().equals(mUserManager.getCurrentUser().getId())) { MenuItem deleteItem = menu.add(mApplication.getString(R.string.user_context_menu_button_delete)); deleteItem.setOnMenuItemClickListener(this); } }
Example 7
Source File: List.java From J2ME-Loader with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.clear(); for (Command cmd : getCommands()) { menu.add(hashCode(), cmd.hashCode(), cmd.getPriority(), cmd.getAndroidLabel()); } }
Example 8
Source File: HistoryActivity.java From ZXing-Standalone-library with Apache License 2.0 | 5 votes |
@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 }
Example 9
Source File: Item.java From J2ME-Loader with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.clear(); for (Command cmd : commands) { menu.add(hashCode(), cmd.hashCode(), cmd.getPriority(), cmd.getAndroidLabel()); } }
Example 10
Source File: FilterFriendsChooseLeadersFragment.java From PADListener with GNU General Public License v2.0 | 5 votes |
private MonsterInfoModel getGroupMonsterItem(ContextMenu.ContextMenuInfo menuInfo) { MyLog.entry("menuInfo = " + menuInfo); final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; final int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition); final MonsterInfoModel result = mAdapter.getGroup(groupPosition); MyLog.exit(); return result; }
Example 11
Source File: SPFragment.java From pandora with Apache License 2.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (menuInfo instanceof MenuRecyclerView.RvContextMenuInfo) { MenuRecyclerView.RvContextMenuInfo info = (MenuRecyclerView.RvContextMenuInfo) menuInfo; if (getAdapter().getItems().get(info.position) instanceof KeyValueItem) { if (!((KeyValueItem) getAdapter().getItems().get(info.position)).isTitle) { menu.add(-1, 0, 0, R.string.pd_name_copy_value); menu.add(-1, 0, 1, R.string.pd_name_delete_key); } } } }
Example 12
Source File: ApiariesAdapter.java From go-bees with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) { // Inflate menu menuInflater.inflate(R.menu.apiary_item_menu, contextMenu); // Set click listener for (int i = 0; i < contextMenu.size(); i++) { contextMenu.getItem(i).setOnMenuItemClickListener(this); } }
Example 13
Source File: CheckingFragment.java From android-sholi with GNU General Public License v3.0 | 4 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.checking_context, menu); }
Example 14
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 4 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { getMenuInflater().inflate(R.menu.menu_main, menu); super.onCreateContextMenu(menu, v, menuInfo); }
Example 15
Source File: ModulesBookmark.java From EdXposedManager with GNU General Public License v3.0 | 4 votes |
private Module getItemFromContextMenuInfo(ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; int position = info.position - getListView().getHeaderViewsCount(); return (position >= 0) ? (Module) getListView().getAdapter().getItem(position) : null; }
Example 16
Source File: MenuItemInfo.java From 920-text-editor-v2 with Apache License 2.0 | 4 votes |
@Override public ContextMenu.ContextMenuInfo getMenuInfo() { return null; }
Example 17
Source File: PatchedRecyclerView.java From ExpandableRecyclerView with Apache License 2.0 | 4 votes |
@Override protected ContextMenu.ContextMenuInfo getContextMenuInfo() { return mContextMenuInfo; }
Example 18
Source File: OverviewFragment.java From AndroidAPS with GNU Affero General Public License v3.0 | 4 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v == apsModeView) { final LoopPlugin loopPlugin = LoopPlugin.getPlugin(); final PumpDescription pumpDescription = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription(); if (!ProfileFunctions.getInstance().isProfileValid("ContexMenuCreation")) return; menu.setHeaderTitle(MainApp.gs(R.string.loop)); if (loopPlugin.isEnabled(PluginType.LOOP)) { menu.add(MainApp.gs(R.string.disableloop)); if (!loopPlugin.isSuspended()) { menu.add(MainApp.gs(R.string.suspendloopfor1h)); menu.add(MainApp.gs(R.string.suspendloopfor2h)); menu.add(MainApp.gs(R.string.suspendloopfor3h)); menu.add(MainApp.gs(R.string.suspendloopfor10h)); } else { if (!loopPlugin.isDisconnected()) { menu.add(MainApp.gs(R.string.resume)); } } } if (!loopPlugin.isEnabled(PluginType.LOOP)) { menu.add(MainApp.gs(R.string.enableloop)); } if (!loopPlugin.isDisconnected()) { showSuspendtPump(menu, pumpDescription); } else { menu.add(MainApp.gs(R.string.reconnect)); } } else if (v == activeProfileView) { menu.setHeaderTitle(MainApp.gs(R.string.profile)); menu.add(MainApp.gs(R.string.danar_viewprofile)); if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null && ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getProfile() != null) { menu.add(MainApp.gs(R.string.careportal_profileswitch)); } } else if (v == tempTargetView) { menu.setHeaderTitle(MainApp.gs(R.string.careportal_temporarytarget)); menu.add(MainApp.gs(R.string.custom)); menu.add(MainApp.gs(R.string.eatingsoon)); menu.add(MainApp.gs(R.string.activity)); menu.add(MainApp.gs(R.string.hypo)); if (TreatmentsPlugin.getPlugin().getTempTargetFromHistory() != null) { menu.add(MainApp.gs(R.string.cancel)); } } }
Example 19
Source File: FragmentChooseRecipient.java From bcm-android with GNU General Public License v3.0 | 4 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.setHeaderTitle(R.string.addressbook_menu_title); menu.add(0, 400, 0, R.string.addressbook_menu_remove); }
Example 20
Source File: ChooseSyncMonstersSimpleFragment.java From PADListener with GNU General Public License v2.0 | 4 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menuHelper.createContextMenu(menu, menuInfo); }