List of usage examples for android.view MenuItem getMenuInfo
public ContextMenuInfo getMenuInfo();
From source file:com.andrew.apollo.ui.fragments.PlaylistFragment.java
/** * {@inheritDoc}/*from w w w . j a v a2s .c o m*/ */ @Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: if (info.position == 0) { MusicUtils.playFavorites(getSherlockActivity()); } else if (info.position == 1) { MusicUtils.playLastAdded(getSherlockActivity()); } else { MusicUtils.playPlaylist(getSherlockActivity(), mPlaylist.mPlaylistId); } return true; case FragmentMenuItems.ADD_TO_QUEUE: long[] list = null; if (info.position == 0) { list = MusicUtils.getSongListForFavorites(getSherlockActivity()); } else if (info.position == 1) { list = MusicUtils.getSongListForLastAdded(getSherlockActivity()); } else { list = MusicUtils.getSongListForPlaylist(getSherlockActivity(), mPlaylist.mPlaylistId); } MusicUtils.addToQueue(getSherlockActivity(), list); return true; case FragmentMenuItems.RENAME_PLAYLIST: RenamePlaylist.getInstance(Long.valueOf(mPlaylist.mPlaylistId)).show(getFragmentManager(), "RenameDialog"); return true; case FragmentMenuItems.DELETE: buildDeleteDialog().show(); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.yandex.disk.rest.example.ListExampleFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { ListItem listItem = getListItem(item.getMenuInfo()); switch (item.getItemId()) { case R.id.example_context_publish: Log.d(TAG, "onContextItemSelected: publish: listItem=" + listItem); if (listItem.getPublicUrl() != null) { ShowPublicUrlDialogFragment.newInstance(credentials, listItem).show(getFragmentManager(), "showPublicUrlDialog"); } else {//ww w. ja v a 2s . com MakeItemPublicFragment.newInstance(credentials, listItem.getPath(), true).show(getFragmentManager(), "makeItemPublic"); } return true; case R.id.example_context_move: RenameMoveDialogFragment.newInstance(credentials, listItem).show(getFragmentManager(), "renameMoveDialog"); return true; case R.id.example_context_delete: DeleteItemDialogFragment.newInstance(credentials, listItem).show(getFragmentManager(), "deleteItemDialog"); return true; default: return super.onContextItemSelected(item); } }
From source file:com.limewoodmedia.nsdroid.fragments.RMBFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); if (info == null) { return super.onContextItemSelected(item); }/*from ww w. j av a2 s . c o m*/ switch (item.getItemId()) { case R.id.context_menu_quote: // Quote RMB post RMBMessage post = listAdapter.getItem(info.position); messageBox.setText(messageBox.getText() + "[quote=" + post.nation + ";" + post.id + "]" + post.message + "[/quote]\n"); postArea.setVisibility(View.VISIBLE); messageBox.requestFocus(); return true; default: return super.onContextItemSelected(item); } }
From source file:com.boko.vimusic.ui.fragments.PlaylistFragment.java
/** * {@inheritDoc}/* www . j av a 2s. co m*/ */ @Override public boolean onContextItemSelected(final android.view.MenuItem item) { if (item.getGroupId() == GROUP_ID) { final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case FragmentMenuItems.PLAY_SELECTION: if (info.position == 0) { MusicUtils.playFavorites(getActivity()); } else if (info.position == 1) { MusicUtils.playLastAdded(getActivity()); } else { MusicUtils.playPlaylist(getActivity(), mPlaylist.getId()); } return true; case FragmentMenuItems.ADD_TO_QUEUE: Song[] list = null; if (info.position == 0) { list = MusicUtils.getSongListForFavorites(getActivity()); } else if (info.position == 1) { list = MusicUtils.getSongListForLastAdded(getActivity()); } else { list = MusicUtils.getSongListForPlaylist(getActivity(), mPlaylist.getId()); } MusicUtils.addToQueue(getActivity(), list); return true; case FragmentMenuItems.RENAME_PLAYLIST: RenamePlaylist.getInstance(mPlaylist.getId()).show(getFragmentManager(), "RenameDialog"); return true; case FragmentMenuItems.DELETE: buildDeleteDialog().show(); return true; default: break; } } return super.onContextItemSelected(item); }
From source file:com.orangelabs.rcs.ri.sharing.video.VideoSharingList.java
@Override public boolean onContextItemSelected(MenuItem item) { /* Get selected item */ AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); Cursor cursor = (Cursor) (mListView.getAdapter()).getItem(info.position); String sharingId = cursor.getString(cursor.getColumnIndexOrThrow(VideoSharingLog.SHARING_ID)); if (LogUtils.isActive) { Log.d(LOGTAG, "onContextItemSelected sharing ID=".concat(sharingId)); }//from ww w .j a v a2 s. co m switch (item.getItemId()) { case MENU_ITEM_DELETE: if (!isServiceConnected(RcsServiceName.VIDEO_SHARING)) { showMessage(R.string.label_service_not_available); return true; } /* Delete messages for contact */ try { if (!mVideoSharingListenerSet) { mVideoSharingService.addEventListener(mVideoSharingListener); mVideoSharingListenerSet = true; } if (LogUtils.isActive) { Log.d(LOGTAG, "Delete video sharing ID=".concat(sharingId)); } mVideoSharingService.deleteVideoSharing(sharingId); } catch (RcsServiceException e) { showExceptionThenExit(e); } return true; default: return super.onContextItemSelected(item); } }
From source file:com.nxt.njitong.ContactlistActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_contact) { User tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); // ?//from ww w .j a v a 2 s .c o m deleteContact(tobeDeleteUser); // ? InviteMessgeDao dao = new InviteMessgeDao(context); dao.deleteMessage(tobeDeleteUser.getUsername()); return true; } else if (item.getItemId() == R.id.add_to_blacklist) { User user = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); moveToBlacklist(user.getUsername()); return true; } return super.onContextItemSelected(item); }
From source file:org.linphone.HistorySimpleFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); LinphoneCallLog log = mLogs.get(info.position); LinphoneManager.getLc().removeCallLog(log); mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); if (!hideHistoryListAndDisplayMessageIfEmpty()) { historyList.setAdapter(new CallHistoryAdapter(getActivity())); }/*from w w w .j av a 2 s . co m*/ return true; }
From source file:net.sourceforge.kalimbaradio.androidapp.activity.SelectPlaylistActivity.java
@Override public boolean onContextItemSelected(MenuItem menuItem) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo(); Playlist playlist = (Playlist) list.getItemAtPosition(info.position); switch (menuItem.getItemId()) { case MENU_ITEM_PLAY_ALL: Intent intent = new Intent(SelectPlaylistActivity.this, SelectAlbumActivity.class); intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId()); intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName()); intent.putExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true); Util.startActivityWithoutTransition(SelectPlaylistActivity.this, intent); break;/*from w w w . ja va 2 s . c om*/ default: return super.onContextItemSelected(menuItem); } return true; }
From source file:com.pindroid.fragment.BrowseBookmarksFragment.java
@Override public boolean onContextItemSelected(MenuItem aItem) { AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) aItem.getMenuInfo(); final Cursor c = (Cursor) lv.getItemAtPosition(menuInfo.position); Bookmark b = BookmarkManager.CursorToBookmark(c); switch (aItem.getItemId()) { case R.id.menu_bookmark_context_open: openBookmarkInBrowser(b);/* ww w .j a v a2s. c o m*/ return true; case R.id.menu_bookmark_context_view: viewBookmark(b); return true; case R.id.menu_bookmark_context_edit: bookmarkSelectedListener.onBookmarkSelected(b, BookmarkViewType.EDIT); return true; case R.id.menu_bookmark_context_delete: bookmarkSelectedListener.onBookmarkDelete(b); return true; case R.id.menu_bookmark_context_share: Log.d("share", "browse"); bookmarkSelectedListener.onBookmarkShare(b); return true; case R.id.menu_bookmark_context_read: readBookmark(b); return true; case R.id.menu_bookmark_context_markread: markBookmark(b); return true; } return false; }
From source file:com.code.android.vibevault.FeaturedShowsScreen.java
/** Handle user's long-click selection. * *//* w w w.j a v a2s. c o m*/ @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo(); if (menuInfo != null) { ArchiveShowObj selShow = (ArchiveShowObj) featuredShowsList.getAdapter().getItem(menuInfo.position); switch (item.getItemId()) { case VibeVault.EMAIL_LINK: final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Great show on archive.org: " + selShow.getArtistAndTitle()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hey,\n\nYou should listen to " + selShow.getArtistAndTitle() + ". You can find it here: " + selShow.getShowURL() + "\n\nSent using VibeVault for Android."); startActivity(Intent.createChooser(emailIntent, "Send mail...")); return true; case (VibeVault.ADD_TO_FAVORITE_LIST): VibeVault.db.insertFavoriteShow(selShow); return true; default: break; } return false; } return true; }