Java Code Examples for androidx.appcompat.widget.PopupMenu#OnMenuItemClickListener
The following examples show how to use
androidx.appcompat.widget.PopupMenu#OnMenuItemClickListener .
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: QueueSongItemViewModel.java From Jockey with Apache License 2.0 | 6 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick(View view) { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_navigate_to_artist: navigateToArtist(); return true; case R.id.menu_item_navigate_to_album: navigateToAlbum(); return true; case R.id.menu_item_navigate_to_folder: getContext().startActivity(MusicBrowserActivity.newIntent(getContext(), getReference())); return true; case R.id.menu_item_add_to_playlist: addToPlaylist(); return true; case R.id.menu_item_remove: removeFromQueue(view); return true; } return false; }; }
Example 2
Source File: PlaylistItemViewModel.java From Jockey with Apache License 2.0 | 6 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick(View view) { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_queue_item_next: queuePlaylistNext(); return true; case R.id.menu_item_queue_item_last: queuePlaylistLast(); return true; case R.id.menu_item_edit: editThisAsAutoPlaylist(); return true; case R.id.menu_item_delete: if (mPlaylist instanceof AutoPlaylist) { deleteAutoPlaylist(view); } else { deletePlaylist(view); } return true; } return false; }; }
Example 3
Source File: MysplashPopupWindow.java From Mysplash with GNU Lesser General Public License v3.0 | 5 votes |
public static void show(MysplashActivity activity, View anchor, @MenuRes int resId, @NonNull PopupMenu.OnMenuItemClickListener l) { PopupMenu popupMenu = new PopupMenu(activity, anchor); popupMenu.getMenuInflater().inflate(resId, popupMenu.getMenu()); popupMenu.show(); popupMenu.setOnMenuItemClickListener(l); // DisplayUtils.setOverflowMenuIconsVisible(popupMenu.getMenu()); popupMenu.show(); }
Example 4
Source File: NowPlayingControllerViewModel.java From Jockey with Apache License 2.0 | 5 votes |
private PopupMenu.OnMenuItemClickListener onMoreInfoItemClick(Song song) { return item -> { switch (item.getItemId()) { case R.id.menu_item_navigate_to_artist: mMusicStore.findArtistById(song.getArtistId()).take(1).subscribe( artist -> { startActivity(ArtistActivity.newIntent(getContext(), artist)); }, throwable -> { Timber.e(throwable, "Failed to find artist"); }); return true; case R.id.menu_item_navigate_to_album: mMusicStore.findAlbumById(song.getAlbumId()).take(1).subscribe( album -> { startActivity(AlbumActivity.newIntent(getContext(), album)); }, throwable -> { Timber.e(throwable, "Failed to find album"); }); return true; case R.id.menu_item_navigate_to_folder: getContext().startActivity(MusicBrowserActivity.newIntent(getContext(), song)); return true; case R.id.menu_item_add_to_playlist: new AppendPlaylistDialogFragment.Builder(getContext(), mFragmentManager) .setSongs(song) .showSnackbarIn(R.id.now_playing_artwork) .show(TAG_PLAYLIST_DIALOG, mPlaylistStore); return true; } return false; }; }
Example 5
Source File: SongItemViewModel.java From Jockey with Apache License 2.0 | 5 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick() { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_queue_item_next: mPlayerController.queueNext(mReference); return true; case R.id.menu_item_queue_item_last: mPlayerController.queueLast(mReference); return true; case R.id.menu_item_navigate_to_artist: mMusicStore.findArtistById(mReference.getArtistId()).subscribe( artist -> { startActivity(ArtistActivity.newIntent(getContext(), artist)); }, throwable -> { Timber.e(throwable, "Failed to find artist"); }); return true; case R.id.menu_item_navigate_to_album: mMusicStore.findAlbumById(mReference.getAlbumId()).subscribe( album -> { startActivity(AlbumActivity.newIntent(getContext(), album)); }, throwable -> { Timber.e(throwable, "Failed to find album", throwable); }); return true; case R.id.menu_item_navigate_to_folder: getContext().startActivity(MusicBrowserActivity.newIntent(getContext(), mReference)); return true; case R.id.menu_item_add_to_playlist: new AppendPlaylistDialogFragment.Builder(getContext(), mFragmentManager) .setSongs(mReference) .showSnackbarIn(R.id.list) .show(TAG_PLAYLIST_DIALOG, mPlaylistStore); return true; } return false; }; }
Example 6
Source File: PlaylistSongItemViewModel.java From Jockey with Apache License 2.0 | 5 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick(View view) { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_queue_item_next: mPlayerController.queueNext(getReference()); return true; case R.id.menu_item_queue_item_last: mPlayerController.queueLast(getReference()); return true; case R.id.menu_item_navigate_to_artist: mMusicStore.findArtistById(getReference().getArtistId()).subscribe( artist -> { startActivity(ArtistActivity.newIntent(getContext(), artist)); }, throwable -> { Timber.e(throwable, "Failed to find artist"); }); return true; case R.id.menu_item_navigate_to_album: mMusicStore.findAlbumById(getReference().getAlbumId()).subscribe( album -> { startActivity(AlbumActivity.newIntent(getContext(), album)); }, throwable -> { Timber.e(throwable, "Failed to find album"); }); return true; case R.id.menu_item_navigate_to_folder: getContext().startActivity(MusicBrowserActivity.newIntent(getContext(), getReference())); return true; case R.id.menu_item_remove: removeFromPlaylist(view); return true; } return false; }; }
Example 7
Source File: ArtistItemViewModel.java From Jockey with Apache License 2.0 | 5 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick() { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_queue_item_next: mMusicStore.getSongs(mArtist).subscribe( mPlayerController::queueNext, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; case R.id.menu_item_queue_item_last: mMusicStore.getSongs(mArtist).subscribe( mPlayerController::queueLast, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; case R.id.menu_item_add_to_playlist: mMusicStore.getSongs(mArtist).subscribe( songs -> { new AppendPlaylistDialogFragment.Builder(mContext, mFragmentManager) .setSongs(songs, mArtist.getArtistName()) .showSnackbarIn(R.id.list) .show(TAG_PLAYLIST_DIALOG, mPlaylistStore); }, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; } return false; }; }
Example 8
Source File: GenreItemViewModel.java From Jockey with Apache License 2.0 | 5 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick() { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_queue_item_next: mMusicStore.getSongs(mGenre).subscribe( mPlayerController::queueNext, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; case R.id.menu_item_queue_item_last: mMusicStore.getSongs(mGenre).subscribe( mPlayerController::queueLast, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; case R.id.menu_item_add_to_playlist: mMusicStore.getSongs(mGenre).subscribe( songs -> { new AppendPlaylistDialogFragment.Builder(mContext, mFragmentManager) .setSongs(songs, mGenre.getGenreName()) .showSnackbarIn(R.id.list) .show(TAG_PLAYLIST_DIALOG, mPlaylistStore); }, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; } return false; }; }
Example 9
Source File: AlbumItemViewModel.java From Jockey with Apache License 2.0 | 4 votes |
private PopupMenu.OnMenuItemClickListener onMenuItemClick() { return menuItem -> { switch (menuItem.getItemId()) { case R.id.menu_item_queue_item_next: mMusicStore.getSongs(mAlbum).subscribe( mPlayerController::queueNext, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; case R.id.menu_item_queue_item_last: mMusicStore.getSongs(mAlbum).subscribe( mPlayerController::queueLast, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; case R.id.menu_item_navigate_to_artist: mMusicStore.findArtistById(mAlbum.getArtistId()).subscribe( artist -> { mContext.startActivity(ArtistActivity.newIntent(mContext, artist)); }, throwable -> { Timber.e(throwable, "Failed to find artist"); }); return true; case R.id.menu_item_add_to_playlist: mMusicStore.getSongs(mAlbum).subscribe( songs -> { new AppendPlaylistDialogFragment.Builder(mContext, mFragmentManager) .setSongs(songs, mAlbum.getAlbumName()) .showSnackbarIn(R.id.list) .show(TAG_PLAYLIST_DIALOG, mPlaylistStore); }, throwable -> { Timber.e(throwable, "Failed to get songs"); }); return true; } return false; }; }