list: expand item menus
Bit of a megapatch that: - Adds dedicated play, shuffle, and view items to all item menus (songs haven't been fully implemented yet) - Adds icons to all item menus - Re-adds enabled/disabled items to menus - Makes menu action naming conventions more consistent with the rest of the app
This commit is contained in:
@@ -162,7 +162,7 @@ class AlbumDetailFragment :
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
true
|
||||
}
|
||||
R.id.action_go_artist -> {
|
||||
R.id.action_artist_details -> {
|
||||
onNavigateToParentArtist()
|
||||
true
|
||||
}
|
||||
@@ -187,7 +187,7 @@ class AlbumDetailFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Song, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_album_song, item)
|
||||
menuModel.open(R.menu.item_album_song, item)
|
||||
}
|
||||
|
||||
override fun onPlay() {
|
||||
|
||||
@@ -198,8 +198,8 @@ class ArtistDetailFragment :
|
||||
|
||||
override fun onOpenMenu(item: Music, anchor: View) {
|
||||
when (item) {
|
||||
is Song -> menuModel.openMenu(R.menu.item_artist_song, item)
|
||||
is Album -> menuModel.openMenu(R.menu.item_artist_album, item)
|
||||
is Song -> menuModel.open(R.menu.item_artist_song, item)
|
||||
is Album -> menuModel.open(R.menu.item_artist_album, item)
|
||||
else -> error("Unexpected datatype: ${item::class.simpleName}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,8 +196,8 @@ class GenreDetailFragment :
|
||||
|
||||
override fun onOpenMenu(item: Music, anchor: View) {
|
||||
when (item) {
|
||||
is Artist -> menuModel.openMenu(R.menu.item_parent, item)
|
||||
is Song -> menuModel.openMenu(R.menu.item_song, item)
|
||||
is Artist -> menuModel.open(R.menu.item_parent, item)
|
||||
is Song -> menuModel.open(R.menu.item_song, item)
|
||||
else -> error("Unexpected datatype: ${item::class.simpleName}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ class PlaylistDetailFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Song, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_playlist_song, item)
|
||||
menuModel.open(R.menu.item_playlist_song, item)
|
||||
}
|
||||
|
||||
override fun onPlay() {
|
||||
|
||||
@@ -144,7 +144,7 @@ class AlbumListFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Album, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_album, item)
|
||||
menuModel.open(R.menu.item_album, item)
|
||||
}
|
||||
|
||||
private fun updateAlbums(albums: List<Album>) {
|
||||
|
||||
@@ -120,7 +120,7 @@ class ArtistListFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Artist, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_parent, item)
|
||||
menuModel.open(R.menu.item_parent, item)
|
||||
}
|
||||
|
||||
private fun updateArtists(artists: List<Artist>) {
|
||||
|
||||
@@ -119,7 +119,7 @@ class GenreListFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Genre, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_parent, item)
|
||||
menuModel.open(R.menu.item_parent, item)
|
||||
}
|
||||
|
||||
private fun updateGenres(genres: List<Genre>) {
|
||||
|
||||
@@ -117,7 +117,7 @@ class PlaylistListFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Playlist, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_playlist, item)
|
||||
menuModel.open(R.menu.item_playlist, item)
|
||||
}
|
||||
|
||||
private fun updatePlaylists(playlists: List<Playlist>) {
|
||||
|
||||
@@ -145,7 +145,7 @@ class SongListFragment :
|
||||
}
|
||||
|
||||
override fun onOpenMenu(item: Song, anchor: View) {
|
||||
menuModel.openMenu(R.menu.item_song, item)
|
||||
menuModel.open(R.menu.item_song, item)
|
||||
}
|
||||
|
||||
private fun updateSongs(songs: List<Song>) {
|
||||
|
||||
@@ -40,18 +40,17 @@ import org.oxycblt.auxio.util.logD
|
||||
* options.
|
||||
*
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*
|
||||
* TODO: Handle enabled/disabled states
|
||||
*/
|
||||
abstract class MenuDialogFragment<T : Music> :
|
||||
ViewBindingBottomSheetDialogFragment<DialogMenuBinding>(), ClickableListListener<MenuItem> {
|
||||
protected abstract val menuModel: MenuViewModel
|
||||
private val menuAdapter = MenuOptionAdapter(@Suppress("LeakingThis") this)
|
||||
private val menuAdapter = MenuItemAdapter(@Suppress("LeakingThis") this)
|
||||
|
||||
abstract val menuRes: Int
|
||||
abstract val uid: Music.UID
|
||||
abstract fun getDisabledItemIds(music: T): Set<Int>
|
||||
abstract fun updateMusic(binding: DialogMenuBinding, music: T)
|
||||
abstract fun onClick(music: T, item: MenuItem)
|
||||
abstract fun onClick(item: MenuItem, music: T)
|
||||
|
||||
override fun onCreateBinding(inflater: LayoutInflater) = DialogMenuBinding.inflate(inflater)
|
||||
|
||||
@@ -66,11 +65,6 @@ abstract class MenuDialogFragment<T : Music> :
|
||||
itemAnimator = null
|
||||
}
|
||||
|
||||
// Avoid having to use a dummy view and just rely on what AndroidX Toolbar uses.
|
||||
@SuppressLint("RestrictedApi") val builder = MenuBuilder(requireContext())
|
||||
MenuInflater(requireContext()).inflate(menuRes, builder)
|
||||
menuAdapter.update(builder.children.toList(), UpdateInstructions.Diff)
|
||||
|
||||
// --- VIEWMODEL SETUP ---
|
||||
menuModel.setCurrentMenu(uid)
|
||||
collectImmediately(menuModel.currentMusic, this::updateMusic)
|
||||
@@ -88,11 +82,34 @@ abstract class MenuDialogFragment<T : Music> :
|
||||
logD("No music to show, navigating away")
|
||||
findNavController().navigateUp()
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST") updateMusic(requireBinding(), music as T)
|
||||
|
||||
@Suppress("UNCHECKED_CAST") val castedMusic = music as T
|
||||
|
||||
// We need to inflate the menu on every music update since it might have changed
|
||||
// what options are available (ex. if an artist with no songs has had new songs added).
|
||||
// Since we don't have (and don't want) a dummy view to inflate this menu, just
|
||||
// depend on the AndroidX Toolbar internal API and hope for the best.
|
||||
@SuppressLint("RestrictedApi") val builder = MenuBuilder(requireContext())
|
||||
MenuInflater(requireContext()).inflate(menuRes, builder)
|
||||
|
||||
// Disable any menu options as specified by the impl
|
||||
val disabledIds = getDisabledItemIds(castedMusic)
|
||||
val visible =
|
||||
builder.children.mapTo(mutableListOf()) {
|
||||
it.isEnabled = !disabledIds.contains(it.itemId)
|
||||
it
|
||||
}
|
||||
menuAdapter.update(visible, UpdateInstructions.Diff)
|
||||
|
||||
// Delegate to impl how to show music
|
||||
updateMusic(requireBinding(), castedMusic)
|
||||
}
|
||||
|
||||
final override fun onClick(item: MenuItem, viewHolder: RecyclerView.ViewHolder) {
|
||||
// All option selections close the dialog currently.
|
||||
// TODO: This should change if the app is 100% migrated to menu dialogs
|
||||
findNavController().navigateUp()
|
||||
@Suppress("UNCHECKED_CAST") onClick(menuModel.currentMusic.value as T, item)
|
||||
// Delegate to impl on how to handle items
|
||||
@Suppress("UNCHECKED_CAST") onClick(item, menuModel.currentMusic.value as T)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ class SongMenuDialogFragment : MenuDialogFragment<Song>() {
|
||||
override val uid: Music.UID
|
||||
get() = args.songUid
|
||||
|
||||
override fun getDisabledItemIds(music: Song) = setOf<Int>()
|
||||
|
||||
override fun updateMusic(binding: DialogMenuBinding, music: Song) {
|
||||
val context = requireContext()
|
||||
binding.menuCover.bind(music)
|
||||
@@ -59,7 +61,7 @@ class SongMenuDialogFragment : MenuDialogFragment<Song>() {
|
||||
binding.menuInfo.text = music.artists.resolveNames(context)
|
||||
}
|
||||
|
||||
override fun onClick(music: Song, item: MenuItem) {
|
||||
override fun onClick(item: MenuItem, music: Song) {
|
||||
when (item.itemId) {
|
||||
R.id.action_play_next -> {
|
||||
playbackModel.playNext(music)
|
||||
@@ -69,11 +71,11 @@ class SongMenuDialogFragment : MenuDialogFragment<Song>() {
|
||||
playbackModel.addToQueue(music)
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
}
|
||||
R.id.action_go_artist -> detailModel.showArtist(music)
|
||||
R.id.action_go_album -> detailModel.showAlbum(music)
|
||||
R.id.action_artist_details -> detailModel.showArtist(music)
|
||||
R.id.action_album_details -> detailModel.showAlbum(music)
|
||||
R.id.action_share -> requireContext().share(music)
|
||||
R.id.action_playlist_add -> musicModel.addToPlaylist(music)
|
||||
R.id.action_song_detail -> detailModel.showSong(music)
|
||||
R.id.action_detail -> detailModel.showSong(music)
|
||||
else -> error("Unexpected menu item selected $item")
|
||||
}
|
||||
}
|
||||
@@ -92,6 +94,8 @@ class AlbumMenuDialogFragment : MenuDialogFragment<Album>() {
|
||||
override val uid: Music.UID
|
||||
get() = args.albumUid
|
||||
|
||||
override fun getDisabledItemIds(music: Album) = setOf<Int>()
|
||||
|
||||
override fun updateMusic(binding: DialogMenuBinding, music: Album) {
|
||||
val context = requireContext()
|
||||
binding.menuCover.bind(music)
|
||||
@@ -100,10 +104,11 @@ class AlbumMenuDialogFragment : MenuDialogFragment<Album>() {
|
||||
binding.menuInfo.text = music.artists.resolveNames(context)
|
||||
}
|
||||
|
||||
override fun onClick(music: Album, item: MenuItem) {
|
||||
override fun onClick(item: MenuItem, music: Album) {
|
||||
when (item.itemId) {
|
||||
R.id.action_play -> playbackModel.play(music)
|
||||
R.id.action_shuffle -> playbackModel.shuffle(music)
|
||||
R.id.action_detail -> detailModel.showAlbum(music)
|
||||
R.id.action_play_next -> {
|
||||
playbackModel.playNext(music)
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
@@ -112,7 +117,7 @@ class AlbumMenuDialogFragment : MenuDialogFragment<Album>() {
|
||||
playbackModel.addToQueue(music)
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
}
|
||||
R.id.action_go_artist -> detailModel.showArtist(music)
|
||||
R.id.action_artist_details -> detailModel.showArtist(music)
|
||||
R.id.action_playlist_add -> musicModel.addToPlaylist(music)
|
||||
R.id.action_share -> requireContext().share(music)
|
||||
else -> error("Unexpected menu item selected $item")
|
||||
@@ -123,6 +128,7 @@ class AlbumMenuDialogFragment : MenuDialogFragment<Album>() {
|
||||
@AndroidEntryPoint
|
||||
class ArtistMenuDialogFragment : MenuDialogFragment<Artist>() {
|
||||
override val menuModel: MenuViewModel by activityViewModels()
|
||||
private val detailModel: DetailViewModel by activityViewModels()
|
||||
private val musicModel: MusicViewModel by activityViewModels()
|
||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||
private val args: ArtistMenuDialogFragmentArgs by navArgs()
|
||||
@@ -132,6 +138,19 @@ class ArtistMenuDialogFragment : MenuDialogFragment<Artist>() {
|
||||
override val uid: Music.UID
|
||||
get() = args.artistUid
|
||||
|
||||
override fun getDisabledItemIds(music: Artist) =
|
||||
if (music.songs.isEmpty()) {
|
||||
setOf(
|
||||
R.id.action_play,
|
||||
R.id.action_shuffle,
|
||||
R.id.action_play_next,
|
||||
R.id.action_queue_add,
|
||||
R.id.action_playlist_add,
|
||||
R.id.action_share)
|
||||
} else {
|
||||
setOf()
|
||||
}
|
||||
|
||||
override fun updateMusic(binding: DialogMenuBinding, music: Artist) {
|
||||
val context = requireContext()
|
||||
binding.menuCover.bind(music)
|
||||
@@ -148,10 +167,11 @@ class ArtistMenuDialogFragment : MenuDialogFragment<Artist>() {
|
||||
})
|
||||
}
|
||||
|
||||
override fun onClick(music: Artist, item: MenuItem) {
|
||||
override fun onClick(item: MenuItem, music: Artist) {
|
||||
when (item.itemId) {
|
||||
R.id.action_play -> playbackModel.play(music)
|
||||
R.id.action_shuffle -> playbackModel.shuffle(music)
|
||||
R.id.action_detail -> detailModel.showArtist(music)
|
||||
R.id.action_play_next -> {
|
||||
playbackModel.playNext(music)
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
@@ -170,6 +190,7 @@ class ArtistMenuDialogFragment : MenuDialogFragment<Artist>() {
|
||||
@AndroidEntryPoint
|
||||
class GenreMenuDialogFragment : MenuDialogFragment<Genre>() {
|
||||
override val menuModel: MenuViewModel by activityViewModels()
|
||||
private val detailModel: DetailViewModel by activityViewModels()
|
||||
private val musicModel: MusicViewModel by activityViewModels()
|
||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||
private val args: GenreMenuDialogFragmentArgs by navArgs()
|
||||
@@ -179,6 +200,8 @@ class GenreMenuDialogFragment : MenuDialogFragment<Genre>() {
|
||||
override val uid: Music.UID
|
||||
get() = args.genreUid
|
||||
|
||||
override fun getDisabledItemIds(music: Genre) = setOf<Int>()
|
||||
|
||||
override fun updateMusic(binding: DialogMenuBinding, music: Genre) {
|
||||
val context = requireContext()
|
||||
binding.menuCover.bind(music)
|
||||
@@ -191,10 +214,11 @@ class GenreMenuDialogFragment : MenuDialogFragment<Genre>() {
|
||||
context.getPlural(R.plurals.fmt_song_count, music.songs.size))
|
||||
}
|
||||
|
||||
override fun onClick(music: Genre, item: MenuItem) {
|
||||
override fun onClick(item: MenuItem, music: Genre) {
|
||||
when (item.itemId) {
|
||||
R.id.action_play -> playbackModel.play(music)
|
||||
R.id.action_shuffle -> playbackModel.shuffle(music)
|
||||
R.id.action_detail -> detailModel.showGenre(music)
|
||||
R.id.action_play_next -> {
|
||||
playbackModel.playNext(music)
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
@@ -213,6 +237,7 @@ class GenreMenuDialogFragment : MenuDialogFragment<Genre>() {
|
||||
@AndroidEntryPoint
|
||||
class PlaylistMenuDialogFragment : MenuDialogFragment<Playlist>() {
|
||||
override val menuModel: MenuViewModel by activityViewModels()
|
||||
private val detailModel: DetailViewModel by activityViewModels()
|
||||
private val musicModel: MusicViewModel by activityViewModels()
|
||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||
private val args: PlaylistMenuDialogFragmentArgs by navArgs()
|
||||
@@ -222,18 +247,37 @@ class PlaylistMenuDialogFragment : MenuDialogFragment<Playlist>() {
|
||||
override val uid: Music.UID
|
||||
get() = args.playlistUid
|
||||
|
||||
override fun getDisabledItemIds(music: Playlist) =
|
||||
if (music.songs.isEmpty()) {
|
||||
setOf(
|
||||
R.id.action_play,
|
||||
R.id.action_shuffle,
|
||||
R.id.action_play_next,
|
||||
R.id.action_queue_add,
|
||||
R.id.action_playlist_add,
|
||||
R.id.action_share)
|
||||
} else {
|
||||
setOf()
|
||||
}
|
||||
|
||||
override fun updateMusic(binding: DialogMenuBinding, music: Playlist) {
|
||||
val context = requireContext()
|
||||
binding.menuCover.bind(music)
|
||||
binding.menuType.text = getString(R.string.lbl_playlist)
|
||||
binding.menuName.text = music.name.resolve(context)
|
||||
binding.menuInfo.text = context.getPlural(R.plurals.fmt_song_count, music.songs.size)
|
||||
binding.menuInfo.text =
|
||||
if (music.songs.isNotEmpty()) {
|
||||
context.getPlural(R.plurals.fmt_song_count, music.songs.size)
|
||||
} else {
|
||||
getString(R.string.def_song_count)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(music: Playlist, item: MenuItem) {
|
||||
override fun onClick(item: MenuItem, music: Playlist) {
|
||||
when (item.itemId) {
|
||||
R.id.action_play -> playbackModel.play(music)
|
||||
R.id.action_shuffle -> playbackModel.shuffle(music)
|
||||
R.id.action_detail -> detailModel.showPlaylist(music)
|
||||
R.id.action_play_next -> {
|
||||
playbackModel.playNext(music)
|
||||
requireContext().showToast(R.string.lng_queue_added)
|
||||
|
||||
+19
-9
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Auxio Project
|
||||
* MenuOptionAdapter.kt is part of Auxio.
|
||||
* MenuItemAdapter.kt is part of Auxio.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,15 +30,15 @@ import org.oxycblt.auxio.util.inflater
|
||||
/**
|
||||
* Displays a list of [MenuItem]s as custom list items.
|
||||
*
|
||||
* @param listener A [MenuOptionAdapter] to bind interactions to.
|
||||
* @param listener A [ClickableListListener] to bind interactions to.
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
class MenuOptionAdapter(private val listener: ClickableListListener<MenuItem>) :
|
||||
FlexibleListAdapter<MenuItem, MenuOptionViewHolder>(MenuOptionViewHolder.DIFF_CALLBACK) {
|
||||
class MenuItemAdapter(private val listener: ClickableListListener<MenuItem>) :
|
||||
FlexibleListAdapter<MenuItem, MenuItemViewHolder>(MenuItemViewHolder.DIFF_CALLBACK) {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
|
||||
MenuOptionViewHolder.from(parent)
|
||||
MenuItemViewHolder.from(parent)
|
||||
|
||||
override fun onBindViewHolder(holder: MenuOptionViewHolder, position: Int) {
|
||||
override fun onBindViewHolder(holder: MenuItemViewHolder, position: Int) {
|
||||
holder.bind(getItem(position), listener)
|
||||
}
|
||||
}
|
||||
@@ -48,11 +48,21 @@ class MenuOptionAdapter(private val listener: ClickableListListener<MenuItem>) :
|
||||
*
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
class MenuOptionViewHolder private constructor(private val binding: ItemMenuOptionBinding) :
|
||||
class MenuItemViewHolder private constructor(private val binding: ItemMenuOptionBinding) :
|
||||
DialogRecyclerView.ViewHolder(binding.root) {
|
||||
/**
|
||||
* Bind new data to this instance.
|
||||
*
|
||||
* @param item The new [MenuItem] to bind.
|
||||
* @param listener An [ClickableListListener] to bind interactions to.
|
||||
*/
|
||||
fun bind(item: MenuItem, listener: ClickableListListener<MenuItem>) {
|
||||
listener.bind(item, this)
|
||||
binding.title.text = item.title
|
||||
binding.title.apply {
|
||||
text = item.title
|
||||
setCompoundDrawablesRelativeWithIntrinsicBounds(item.icon, null, null, null)
|
||||
isEnabled = item.isEnabled
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -63,7 +73,7 @@ class MenuOptionViewHolder private constructor(private val binding: ItemMenuOpti
|
||||
* @return A new instance.
|
||||
*/
|
||||
fun from(parent: ViewGroup) =
|
||||
MenuOptionViewHolder(ItemMenuOptionBinding.inflate(parent.context.inflater))
|
||||
MenuItemViewHolder(ItemMenuOptionBinding.inflate(parent.context.inflater))
|
||||
|
||||
/** A comparator that can be used with DiffUtil. */
|
||||
val DIFF_CALLBACK =
|
||||
@@ -56,22 +56,19 @@ class MenuViewModel @Inject constructor(private val musicRepository: MusicReposi
|
||||
musicRepository.removeUpdateListener(this)
|
||||
}
|
||||
|
||||
fun openMenu(@MenuRes menuRes: Int, song: Song) =
|
||||
openMenuImpl(PendingMenu.ForSong(menuRes, song))
|
||||
fun open(@MenuRes menuRes: Int, song: Song) = openImpl(PendingMenu.ForSong(menuRes, song))
|
||||
|
||||
fun openMenu(@MenuRes menuRes: Int, album: Album) =
|
||||
openMenuImpl(PendingMenu.ForAlbum(menuRes, album))
|
||||
fun open(@MenuRes menuRes: Int, album: Album) = openImpl(PendingMenu.ForAlbum(menuRes, album))
|
||||
|
||||
fun openMenu(@MenuRes menuRes: Int, artist: Artist) =
|
||||
openMenuImpl(PendingMenu.ForArtist(menuRes, artist))
|
||||
fun open(@MenuRes menuRes: Int, artist: Artist) =
|
||||
openImpl(PendingMenu.ForArtist(menuRes, artist))
|
||||
|
||||
fun openMenu(@MenuRes menuRes: Int, genre: Genre) =
|
||||
openMenuImpl(PendingMenu.ForGenre(menuRes, genre))
|
||||
fun open(@MenuRes menuRes: Int, genre: Genre) = openImpl(PendingMenu.ForGenre(menuRes, genre))
|
||||
|
||||
fun openMenu(@MenuRes menuRes: Int, playlist: Playlist) =
|
||||
openMenuImpl(PendingMenu.ForPlaylist(menuRes, playlist))
|
||||
fun open(@MenuRes menuRes: Int, playlist: Playlist) =
|
||||
openImpl(PendingMenu.ForPlaylist(menuRes, playlist))
|
||||
|
||||
private fun openMenuImpl(pendingMenu: PendingMenu) {
|
||||
private fun openImpl(pendingMenu: PendingMenu) {
|
||||
val existing = _pendingMenu.flow.value
|
||||
if (existing != null) {
|
||||
logW("Already opening $existing, ignoring $pendingMenu")
|
||||
|
||||
@@ -164,11 +164,11 @@ class PlaybackPanelFragment :
|
||||
}
|
||||
true
|
||||
}
|
||||
R.id.action_go_artist -> {
|
||||
R.id.action_artist_details -> {
|
||||
navigateToCurrentArtist()
|
||||
true
|
||||
}
|
||||
R.id.action_go_album -> {
|
||||
R.id.action_album_details -> {
|
||||
navigateToCurrentAlbum()
|
||||
true
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class PlaybackPanelFragment :
|
||||
playbackModel.song.value?.let(musicModel::addToPlaylist)
|
||||
true
|
||||
}
|
||||
R.id.action_song_detail -> {
|
||||
R.id.action_detail -> {
|
||||
playbackModel.song.value?.let(detailModel::showSong)
|
||||
true
|
||||
}
|
||||
|
||||
@@ -184,11 +184,11 @@ class SearchFragment : ListFragment<Music, FragmentSearchBinding>() {
|
||||
|
||||
override fun onOpenMenu(item: Music, anchor: View) {
|
||||
when (item) {
|
||||
is Song -> menuModel.openMenu(R.menu.item_song, item)
|
||||
is Album -> menuModel.openMenu(R.menu.item_album, item)
|
||||
is Artist -> menuModel.openMenu(R.menu.item_parent, item)
|
||||
is Genre -> menuModel.openMenu(R.menu.item_parent, item)
|
||||
is Playlist -> menuModel.openMenu(R.menu.item_playlist, item)
|
||||
is Song -> menuModel.open(R.menu.item_song, item)
|
||||
is Album -> menuModel.open(R.menu.item_album, item)
|
||||
is Artist -> menuModel.open(R.menu.item_parent, item)
|
||||
is Genre -> menuModel.open(R.menu.item_parent, item)
|
||||
is Playlist -> menuModel.open(R.menu.item_playlist, item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user