List of usage examples for android.view MenuItem getMenuInfo
public ContextMenuInfo getMenuInfo();
From source file:com.ratebeer.android.gui.fragments.CellarViewFragment.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) { AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) item.getMenuInfo(); final CellarBeer beer = (CellarBeer) lastUsedListView.getItem(acmi.position); new ConfirmDialogFragment(new OnDialogResult() { @Override/*w w w . j a v a2 s . co m*/ public void onConfirmed() { removeBeerFromCellar(beer); } }, R.string.cellar_confirmremoval, beer.beerName).show(getFragmentManager(), "dialog"); return super.onContextItemSelected(item); }
From source file:org.sensapp.android.sensappdroid.fragments.CompositeListFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); Cursor c = adapter.getCursor(); c.moveToPosition(info.position);// ww w.j a v a 2 s. c om String name = c.getString(c.getColumnIndexOrThrow(SensAppContract.Composite.NAME)); switch (item.getItemId()) { case MENU_DELETE_ID: new DeleteCompositeTask(getActivity()).execute(name); return true; case MENU_MANAGESENSORS_ID: ManageCompositeDialogFragment.newInstance(name).show(getFragmentManager(), "ManageCompositeDialog"); return true; case MENU_UPLOAD_ID: new PostComposite(PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext()), getResources(), getActivity(), name); return true; } return super.onContextItemSelected(item); }
From source file:com.sandklef.coachapp.fragments.TrainingPhasesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int position = acmi.position; String fileName = LocalStorage.getInstance().getNewMediaDir() + "/tp-" + currentTPId + JsonSettings.SERVER_VIDEO_SUFFIX; Media m = Media.newInstructionVideo(fileName, currentTPId); currentTPId = null;/* w ww .j a v a 2 s . c o m*/ Uri uri = Uri.fromFile(new File(fileName)); if (m != null) { Log.d(LOG_TAG, " instruction video item: " + fileName); Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); Log.d(LOG_TAG, " file: " + fileName + " uri: " + uri); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); intent.putExtra("android.intent.extra.durationLimit", 5); intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION, true); intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 5); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high // start the image capture Intent //context.startActivity(intent); // activity.startActivityForResult(intent, com.sandklef.coachapp.fragments.VideoCapture.VIDEO_CAPTURE); ((Activity) getContext()).startActivityForResult(intent, VIDEO_CAPTURE); } Log.d(LOG_TAG, " new instruction video wanted creation: " + fileName); return true; }
From source file:com.nttec.everychan.ui.FavoritesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { View v = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).targetView; Database.FavoritesEntry entry = (FavoritesEntry) v.getTag(); switch (item.getItemId()) { case R.id.context_menu_remove_favorites: MainApplication.getInstance().database.removeFavorite(entry.chan, entry.board, entry.boardPage, entry.thread);// ww w . j ava 2 s . c om for (Pair<ListView, String> p : listViews) ((FavoritesAdapter) p.getLeft().getAdapter()).remove(entry); return true; case R.id.context_menu_open_browser: UrlHandler.launchExternalBrowser(activity, entry.url); return true; } return false; }
From source file:de.androvdr.fragments.ChannelsFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.cm_switch: mController.action(ChannelController.CHANNEL_ACTION_SWITCH, info.position); return true; case R.id.cm_overview: mController.action(ChannelController.CHANNEL_ACTION_PROGRAMINFOS, info.position); return true; case R.id.cm_overviewfull: mController.action(ChannelController.CHANNEL_ACTION_PROGRAMINFOS_ALL, info.position); return true; case R.id.cm_remote: mController.action(ChannelController.CHANNEL_ACTION_REMOTECONTROL, info.position); return true; case R.id.cm_record: mController.action(ChannelController.CHANNEL_ACTION_RECORD, info.position); return true; case R.id.cm_livetv: mController.action(ChannelController.CHANNEL_ACTION_LIVETV, info.position); return true; }/*from w w w. j a v a 2 s . com*/ return false; }
From source file:net.olejon.mdapp.MedicationsFavoritesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo adapterContextMenuInfo = (AdapterView.AdapterContextMenuInfo) item .getMenuInfo();/*from w w w. j ava 2s. com*/ int id = item.getItemId(); if (id == R.id.medications_favorites_menu_context_remove) { removeFromFavorites(adapterContextMenuInfo.id); return true; } return super.onContextItemSelected(item); }
From source file:org.gateshipone.odyssey.fragments.SavedPlaylistsFragment.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 www.java 2 s . co 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.saved_playlists_context_menu_action_play: playPlaylist(info.position); return true; case R.id.saved_playlists_context_menu_action_enqueue: enqueuePlaylist(info.position); return true; case R.id.saved_playlists_context_menu_action_delete: deletePlaylist(info.position); return true; default: return super.onContextItemSelected(item); } }
From source file:org.gateshipone.malp.application.fragments.ProfilesFragment.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. *//* w w w. j av a 2 s.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.action_profile_connect: connectProfile(info.position); return true; case R.id.action_profile_edit: editProfile(info.position); return true; case R.id.action_profile_remove: removeProfile(info.position); return true; default: return super.onContextItemSelected(item); } }
From source file:com.sandklef.coachapp.fragments.MemberFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int position = acmi.position; Log.d(LOG_TAG, " context menu item, position: " + position); Log.d(LOG_TAG, " item: " + item.getTitle().toString()); Media m = Storage.getInstance().getMediaDate(item.getTitle().toString()); if (m != null) { Log.d(LOG_TAG, " video item: " + m.fileName() + ", " + m.getUuid() + ", " + m.getClubUuid() + ", "); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(m.fileName())), "video/*"); startActivity(intent);/*from ww w . j av a 2 s . c o m*/ } return true; }
From source file:com.filepager.afilechooser.FileListFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { // TODO Auto-generated method stub AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); FileListAdapter adapter = (FileListAdapter) getListView().getAdapter(); File file = (File) adapter.getItem(info.position); switch (item.getItemId()) { case 0:/*ww w . j av a 2 s .c o m*/ if (adapter != null) { FilesHolder fh = adapter.getFH(); mPath = file.getAbsolutePath(); ((FileChooserActivity) getActivity()).onFileSelected(file); } break; case 1: Intent intent123 = new Intent(Intent.ACTION_VIEW); intent123.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri123 = Uri.fromFile(file); intent123.setDataAndType(uri123, Utils.getMimeType(file.getAbsolutePath())); try { getActivity().startActivity(intent123); } catch (Exception e) { Toast.makeText(getActivity(), R.string.file_type_not_supported, Toast.LENGTH_SHORT).show(); } break; default: break; } return super.onContextItemSelected(item); }