List of usage examples for android.view MenuItem getMenuInfo
public ContextMenuInfo getMenuInfo();
From source file:com.ayuget.redface.ui.fragment.TopicListFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { ContextMenuRecyclerView.RecyclerContextMenuInfo info = (ContextMenuRecyclerView.RecyclerContextMenuInfo) item .getMenuInfo();//from w ww . ja va 2 s . c o m bus.post(new TopicContextItemSelectedEvent(topicsAdapter.getItem(info.getPosition()), item.getItemId())); return true; }
From source file:org.gateshipone.odyssey.fragments.FilesFragment.java
/** * Hook called when an menu item in the context menu is selected. * * @param item The menu item that was selected. * @return True if the hook was consumed here. *///from ww w . j a v a 2s . c o m @Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); if (info == null) { return super.onContextItemSelected(item); } switch (item.getItemId()) { case R.id.fragment_files_action_add_folder: enqueueFolderAndSubFolders(info.position); return true; case R.id.fragment_files_action_play_folder: playFolderAndSubFolders(info.position); return true; case R.id.fragment_files_action_add_file: enqueueFile(info.position, false); return true; case R.id.fragment_files_action_enqueueasnext: enqueueFile(info.position, true); return true; case R.id.fragment_files_action_play_file: playFile(info.position); return true; default: return super.onContextItemSelected(item); } }
From source file:ru.yandex.subtitles.ui.fragment.conversations.ConversationFragment.java
@Override public boolean onContextItemSelected(final MenuItem item) { final ContextableRecyclerView.RecyclerContextMenuInfo recyclerInfo = (ContextableRecyclerView.RecyclerContextMenuInfo) item .getMenuInfo();/*from www . ja va 2s . c o m*/ final Message message = (Message) recyclerInfo.getData(); switch (item.getItemId()) { case R.id.action_fullscreen_message: onMessageClick(message); return true; case R.id.action_pin_message: MessagingService.pinMessage(getActivity(), message.getId()); return true; case R.id.action_unpin_message: MessagingService.unpinMessage(getActivity(), message.getId()); return true; case R.id.action_copy_message: onCopyMessageClick(message); return true; case R.id.action_delete_message: MessagingService.deleteMessage(getActivity(), message.getId()); return true; default: return super.onContextItemSelected(item); } }
From source file:com.jbirdvegas.mgerrit.CardsFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); View targetView = info.targetView; String webAddress = (String) targetView.getTag(R.id.webAddress); switch (item.getItemId()) { case R.id.menu_change_details: mListView.getWrappedList().performItemClick(targetView, info.position, info.id); return true; case R.id.menu_change_browser: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webAddress)); mParent.startActivity(browserIntent); return true; case R.id.menu_change_track_user: int user = (int) targetView.getTag(R.id.user); Prefs.setTrackingUser(mParent, user); return true; case R.id.menu_change_track_project: String project = (String) targetView.getTag(R.id.project); Prefs.setCurrentProject(mParent, project); return true; case R.id.menu_change_share: String changeid = (String) targetView.getTag(R.id.changeID); Intent intent = Tools.createShareIntent(mParent, changeid, webAddress); mParent.startActivity(intent);/* w w w . j av a 2 s . c om*/ return true; default: return super.onContextItemSelected(item); } }
From source file:com.customprogrammingsolutions.MediaStreamer.MainActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); String url;/*from w ww .j ava 2 s. c o m*/ String name; long rowId; switch (item.getItemId()) { case R.id.delete_recent: url = ((TextView) recents.getChildAt(info.position).findViewById(R.id.recent_url)).getText().toString(); RecentsDBHelper rdb = new RecentsDBHelper(MainActivity.this).open(); rdb.deleteRecent(url); rdb.close(); getSupportLoaderManager().restartLoader(0, null, MainActivity.this); getSupportLoaderManager().restartLoader(1, null, MainActivity.this); return true; case R.id.delete_favorite: url = ((TextView) favorites.getChildAt(info.position).findViewById(R.id.favorite_url)).getText() .toString(); FavoritesDBHelper fdb = new FavoritesDBHelper(MainActivity.this).open(); fdb.deleteFavorite(url); fdb.close(); getSupportLoaderManager().restartLoader(0, null, MainActivity.this); getSupportLoaderManager().restartLoader(1, null, MainActivity.this); return true; case R.id.add_recent_to_favorites: url = ((TextView) recents.getChildAt(info.position).findViewById(R.id.recent_url)).getText().toString(); showFavoritesDialog(true, false, false, "", url, -1); return true; case R.id.edit_favorite: url = ((TextView) favorites.getChildAt(info.position).findViewById(R.id.favorite_url)).getText() .toString(); name = ((TextView) favorites.getChildAt(info.position).findViewById(R.id.favorite_name)).getText() .toString(); rowId = Long .parseLong(((TextView) favorites.getChildAt(info.position).findViewById(R.id.favorite_row_id)) .getText().toString()); showFavoritesDialog(false, false, true, name, url, rowId); return true; default: return super.onContextItemSelected(item); } }
From source file:org.braiden.fpm2.PasswordItemListActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.context_menu_view: viewItem(this, info.id); return true; case R.id.context_menu_launch: launchItem(this, info.id); return true; case R.id.context_menu_copy_password: copyItemProperty(this, info.id, FpmCrypt.PROPERTY_PASSWORD); return true; case R.id.context_menu_copy_user: copyItemProperty(this, info.id, FpmCrypt.PROPERTY_USER); return true; default:// ww w . j av a 2s . com return super.onContextItemSelected(item); } }
From source file:com.josecarlos.couplecounters.MainActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.counter_delete) { Log.i("CC", "Entered onContextItemSelected - delete"); final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); String counter = Utils.checkParameter(listAdapter.getItem(info.position).getCounterName()); RequestParams params = new RequestParams(); AsyncHttpClient client = new AsyncHttpClient(); client.delete("http://josecarlosroman.com/counters/" + currentPartner1 + "/" + currentPartner2 + "/" + counter, params, new AsyncHttpResponseHandler() { @Override/* w w w .jav a2 s .c o m*/ public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { Log.i("CC", "Entered onSuccess, counter deleted"); listAdapter.remove(listAdapter.getItem(info.position)); } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { Log.i("CC", "counter not deleted"); } }); } else if (id == R.id.counter_change) { final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); CounterItem counterItem = listAdapter.getItem(info.position); if (counterItem.isCommon()) { Utils.setCounterType(currentPartner1, currentPartner2, Utils.checkParameter(counterItem.getCounterName()), "0"); counterItem.setCommon(false); } else { Utils.setCounterType(currentPartner1, currentPartner2, Utils.checkParameter(counterItem.getCounterName()), "1"); counterItem.setCommon(true); } listAdapter.set(info.position, counterItem); } return super.onContextItemSelected(item); }
From source file:com.akop.bach.fragment.xboxlive.GamesFragment.java
@Override public boolean onContextItemSelected(MenuItem menuItem) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo(); if (info.targetView.getTag() instanceof ViewHolder) { ViewHolder vh = (ViewHolder) info.targetView.getTag(); switch (menuItem.getItemId()) { case R.id.menu_game_overview: GameOverview.actionShow(getActivity(), mAccount, vh.gameUrl); return true; case R.id.google_achievements: Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH); searchIntent.putExtra(SearchManager.QUERY, getString(R.string.google_achievements_f, vh.title.getText())); startActivity(searchIntent); return true; case R.id.menu_visit_webpage: Intent wwwIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(vh.gameUrl)); startActivity(wwwIntent);/*www . java2 s . c o m*/ return true; } } return super.onContextItemSelected(menuItem); }
From source file:prince.app.sphotos.Fragment_Albums.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.album_open: // Launch the album onItemClickX(null, info.targetView, info.position, info.id); return true; case R.id.album_details: //TODO: Show details of the album //Inflate the details dialog FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment aX = getFragmentManager().findFragmentByTag(PROPERTIES); if (aX != null) ft.remove(aX);/*from w w w . j a v a 2 s . c o m*/ ft.addToBackStack(null); DialogFragment details = AlbumProperties.newInstance(info.position); details.show(ft, PROPERTIES); return true; case R.id.album_add: //TODO: Launch intent to add photos to album Toast.makeText(getActivity(), "Add photos", Toast.LENGTH_SHORT).show(); return true; case R.id.album_delete: //TODO: Delete album from facebook DialogFragment aT = AlertDialogX.newInstance( "delete " + FBINIT.sAlbumsArray.get(info.position).mAlbumName + " ?", getActivity().getResources().getString(R.string.warning_delete_album), R.string.go_on, R.string.cancel, DEL_ALBUM); aT.show(getFragmentManager(), DEL_ALBUM); return true; case R.id.album_download: //TODO: Launch intent to add photos to album //TODO: Delete album from facebook DialogFragment aY = AlertDialogX.newInstance( "download " + FBINIT.sAlbumsArray.get(info.position).mAlbumName + " ?", getActivity().getResources().getString(R.string.warning_download_albums), R.string.go_on, R.string.cancel, GET_ALBUM); aY.show(getFragmentManager(), DEL_ALBUM); return true; default: return super.onContextItemSelected(item); } }
From source file:com.univ.helsinki.app.MainActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int menuItemIndex = item.getItemId(); String[] menuItems = getResources().getStringArray(R.array.listitem_menu_array); String menuItemName = menuItems[menuItemIndex]; if (menuItemName.equalsIgnoreCase("Delete")) { FeedResource.getInstance().removeRecentFeed(info.position); } else if (menuItemName.contains("View")) { Intent intent = new Intent(MainActivity.this, ViewActivity.class); intent.putExtra(ViewActivity.EXTRAS_ROW_ID, info.position); startActivity(intent);//from ww w . ja va2 s . c o m } return true; }