ui: fix issues from new nav
Fix miscellanious issues from the flattened nav graph system. Nowhere near enough, largely counting on the planned bottom sheet menus to eventually be able to ignore most of these issues.
This commit is contained in:
parent
9b0e39919b
commit
fcbce0fb98
12 changed files with 80 additions and 81 deletions
|
|
@ -116,7 +116,7 @@ dependencies {
|
|||
implementation "androidx.preference:preference-ktx:1.2.0"
|
||||
|
||||
// Database
|
||||
def room_version = '2.6.0-alpha01'
|
||||
def room_version = '2.6.0-alpha02'
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
kapt "androidx.room:room-compiler:$room_version"
|
||||
implementation "androidx.room:room-ktx:$room_version"
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ class AlbumDetailFragment :
|
|||
}
|
||||
|
||||
override fun onNavigateToParentArtist() {
|
||||
detailModel.showAlbum(unlikelyToBeNull(detailModel.currentAlbum.value))
|
||||
detailModel.showArtist(unlikelyToBeNull(detailModel.currentAlbum.value))
|
||||
}
|
||||
|
||||
private fun updateAlbum(album: Album?) {
|
||||
|
|
@ -314,18 +314,17 @@ class AlbumDetailFragment :
|
|||
|
||||
private fun handleDecision(decision: PlaylistDecision?) {
|
||||
when (decision) {
|
||||
is PlaylistDecision.Add ->{
|
||||
is PlaylistDecision.Add -> {
|
||||
logD("Adding ${decision.songs.size} songs to a playlist")
|
||||
findNavController().navigateSafe(
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
AlbumDetailFragmentDirections.addToPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray())
|
||||
)
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
musicModel.playlistDecision.consume()
|
||||
}
|
||||
|
||||
is PlaylistDecision.New, is PlaylistDecision.Rename, is PlaylistDecision.Delete ->
|
||||
error("Unexpected decision $decision")
|
||||
|
||||
is PlaylistDecision.New,
|
||||
is PlaylistDecision.Rename,
|
||||
is PlaylistDecision.Delete -> error("Unexpected decision $decision")
|
||||
null -> {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,18 +324,17 @@ class ArtistDetailFragment :
|
|||
|
||||
private fun handleDecision(decision: PlaylistDecision?) {
|
||||
when (decision) {
|
||||
is PlaylistDecision.Add ->{
|
||||
is PlaylistDecision.Add -> {
|
||||
logD("Adding ${decision.songs.size} songs to a playlist")
|
||||
findNavController().navigateSafe(
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
ArtistDetailFragmentDirections.addToPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray())
|
||||
)
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
musicModel.playlistDecision.consume()
|
||||
}
|
||||
|
||||
is PlaylistDecision.New, is PlaylistDecision.Rename, is PlaylistDecision.Delete ->
|
||||
error("Unexpected decision $decision")
|
||||
|
||||
is PlaylistDecision.New,
|
||||
is PlaylistDecision.Rename,
|
||||
is PlaylistDecision.Delete -> error("Unexpected decision $decision")
|
||||
null -> {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ class GenreDetailFragment :
|
|||
}
|
||||
is Show.GenreDetails -> {
|
||||
logD("Navigated to this genre")
|
||||
detailModel.toShow.consume()
|
||||
}
|
||||
is Show.PlaylistDetails -> {
|
||||
error("Unexpected show command $show")
|
||||
|
|
@ -311,18 +312,17 @@ class GenreDetailFragment :
|
|||
|
||||
private fun handleDecision(decision: PlaylistDecision?) {
|
||||
when (decision) {
|
||||
is PlaylistDecision.Add ->{
|
||||
is PlaylistDecision.Add -> {
|
||||
logD("Adding ${decision.songs.size} songs to a playlist")
|
||||
findNavController().navigateSafe(
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
GenreDetailFragmentDirections.addToPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray())
|
||||
)
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
musicModel.playlistDecision.consume()
|
||||
}
|
||||
|
||||
is PlaylistDecision.New, is PlaylistDecision.Rename, is PlaylistDecision.Delete ->
|
||||
error("Unexpected decision $decision")
|
||||
|
||||
is PlaylistDecision.New,
|
||||
is PlaylistDecision.Rename,
|
||||
is PlaylistDecision.Delete -> error("Unexpected decision $decision")
|
||||
null -> {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ class PlaylistDetailFragment :
|
|||
}
|
||||
is Show.PlaylistDetails -> {
|
||||
logD("Navigated to this playlist")
|
||||
detailModel.toShow.consume()
|
||||
}
|
||||
is Show.GenreDetails -> {
|
||||
error("Unexpected show command $show")
|
||||
|
|
@ -359,19 +360,18 @@ class PlaylistDetailFragment :
|
|||
when (decision) {
|
||||
is PlaylistDecision.Rename -> {
|
||||
logD("Renaming ${decision.playlist}")
|
||||
findNavController().navigateSafe(
|
||||
PlaylistDetailFragmentDirections.renamePlaylist(decision.playlist.uid)
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
PlaylistDetailFragmentDirections.renamePlaylist(decision.playlist.uid))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Delete -> {
|
||||
logD("Deleting ${decision.playlist}")
|
||||
findNavController().navigateSafe(
|
||||
PlaylistDetailFragmentDirections.deletePlaylist(decision.playlist.uid)
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
PlaylistDetailFragmentDirections.deletePlaylist(decision.playlist.uid))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Add, is PlaylistDecision.New -> error("Unexpected decision $decision")
|
||||
is PlaylistDecision.Add,
|
||||
is PlaylistDecision.New -> error("Unexpected decision $decision")
|
||||
}
|
||||
musicModel.playlistDecision.consume()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -486,29 +486,27 @@ class HomeFragment :
|
|||
when (decision) {
|
||||
is PlaylistDecision.New -> {
|
||||
logD("Creating new playlist")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.newPlaylist(decision.songs.map { it.uid }.toTypedArray()))
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
HomeFragmentDirections.newPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Rename -> {
|
||||
logD("Renaming ${decision.playlist}")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.renamePlaylist(decision.playlist.uid)
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(HomeFragmentDirections.renamePlaylist(decision.playlist.uid))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Delete -> {
|
||||
logD("Deleting ${decision.playlist}")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.deletePlaylist(decision.playlist.uid)
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(HomeFragmentDirections.deletePlaylist(decision.playlist.uid))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Add -> {
|
||||
logD("Adding ${decision.songs.size} to a playlist")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.addToPlaylist(decision.songs.map { it.uid }.toTypedArray())
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
HomeFragmentDirections.addToPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
}
|
||||
}
|
||||
musicModel.playlistDecision.consume()
|
||||
|
|
@ -560,11 +558,11 @@ class HomeFragment :
|
|||
}
|
||||
is Show.SongArtistDetails -> {
|
||||
logD("Navigating to artist choices for ${show.song}")
|
||||
findNavController().navigateSafe(HomeFragmentDirections.showArtist(show.song.uid))
|
||||
findNavController().navigateSafe(HomeFragmentDirections.showArtists(show.song.uid))
|
||||
}
|
||||
is Show.AlbumArtistDetails -> {
|
||||
logD("Navigating to artist choices for ${show.album}")
|
||||
findNavController().navigateSafe(HomeFragmentDirections.showArtist(show.album.uid))
|
||||
findNavController().navigateSafe(HomeFragmentDirections.showArtists(show.album.uid))
|
||||
}
|
||||
is Show.GenreDetails -> {
|
||||
logD("Navigating to ${show.genre}")
|
||||
|
|
@ -573,7 +571,7 @@ class HomeFragment :
|
|||
is Show.PlaylistDetails -> {
|
||||
logD("Navigating to ${show.playlist}")
|
||||
findNavController()
|
||||
.navigateSafe(HomeFragmentDirections.showGenre(show.playlist.uid))
|
||||
.navigateSafe(HomeFragmentDirections.showPlaylist(show.playlist.uid))
|
||||
}
|
||||
null -> {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ constructor(
|
|||
get() = _statistics
|
||||
|
||||
private val _playlistDecision = MutableEvent<PlaylistDecision>()
|
||||
val playlistDecision: Event<PlaylistDecision> get() = _playlistDecision
|
||||
val playlistDecision: Event<PlaylistDecision>
|
||||
get() = _playlistDecision
|
||||
|
||||
init {
|
||||
musicRepository.addUpdateListener(this)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,12 @@ class PlaybackPanelFragment :
|
|||
// respective item.
|
||||
binding.playbackSong.apply {
|
||||
isSelected = true
|
||||
setOnClickListener { playbackModel.song.value?.let(detailModel::showAlbum) }
|
||||
setOnClickListener {
|
||||
playbackModel.song.value?.let {
|
||||
detailModel.showAlbum(it)
|
||||
playbackModel.openMain()
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.playbackArtist.apply {
|
||||
isSelected = true
|
||||
|
|
@ -229,10 +234,16 @@ class PlaybackPanelFragment :
|
|||
}
|
||||
|
||||
private fun navigateToCurrentArtist() {
|
||||
playbackModel.song.value?.let(detailModel::showArtist)
|
||||
playbackModel.song.value?.let {
|
||||
detailModel.showArtist(it)
|
||||
playbackModel.openMain()
|
||||
}
|
||||
}
|
||||
|
||||
private fun navigateToCurrentAlbum() {
|
||||
playbackModel.song.value?.let(detailModel::showAlbum)
|
||||
playbackModel.song.value?.let {
|
||||
detailModel.showAlbum(it.album)
|
||||
playbackModel.openMain()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ interface QueueDao {
|
|||
}
|
||||
|
||||
// TODO: Figure out how to get RepeatMode to map to an int instead of a string
|
||||
// TODO: Use intrinsic table names rather than custom names
|
||||
@Entity
|
||||
data class PlaybackState(
|
||||
@PrimaryKey val id: Int,
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ import org.oxycblt.auxio.util.logD
|
|||
* Implements the fuzzy-ish searching algorithm used in the search view.
|
||||
*
|
||||
* @author Alexander Capehart
|
||||
*
|
||||
* TODO: Handle locale changes
|
||||
*/
|
||||
interface SearchEngine {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import com.google.android.material.transition.MaterialSharedAxis
|
|||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentSearchBinding
|
||||
import org.oxycblt.auxio.detail.ArtistDetailFragmentDirections
|
||||
import org.oxycblt.auxio.detail.DetailViewModel
|
||||
import org.oxycblt.auxio.detail.Show
|
||||
import org.oxycblt.auxio.home.HomeFragmentDirections
|
||||
|
|
@ -204,8 +203,6 @@ class SearchFragment : ListFragment<Music, FragmentSearchBinding>() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun handleShow(show: Show?) {
|
||||
when (show) {
|
||||
is Show.SongDetails -> {
|
||||
|
|
@ -259,35 +256,32 @@ class SearchFragment : ListFragment<Music, FragmentSearchBinding>() {
|
|||
hideKeyboard()
|
||||
}
|
||||
|
||||
|
||||
private fun handleDecision(decision: PlaylistDecision?) {
|
||||
if (decision == null) return
|
||||
when (decision) {
|
||||
is PlaylistDecision.New -> {
|
||||
logD("Creating new playlist")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.newPlaylist(decision.songs.map { it.uid }.toTypedArray()))
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
HomeFragmentDirections.newPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Rename -> {
|
||||
logD("Renaming ${decision.playlist}")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.renamePlaylist(decision.playlist.uid)
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(HomeFragmentDirections.renamePlaylist(decision.playlist.uid))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Delete -> {
|
||||
logD("Deleting ${decision.playlist}")
|
||||
findNavController().navigateSafe(
|
||||
SearchFragmentDirections.deletePlaylist(decision.playlist.uid)
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(SearchFragmentDirections.deletePlaylist(decision.playlist.uid))
|
||||
}
|
||||
|
||||
is PlaylistDecision.Add -> {
|
||||
logD("Adding ${decision.songs.size} to a playlist")
|
||||
findNavController().navigateSafe(
|
||||
HomeFragmentDirections.addToPlaylist(decision.songs.map { it.uid }.toTypedArray())
|
||||
)
|
||||
findNavController()
|
||||
.navigateSafe(
|
||||
HomeFragmentDirections.addToPlaylist(
|
||||
decision.songs.map { it.uid }.toTypedArray()))
|
||||
}
|
||||
}
|
||||
musicModel.playlistDecision.consume()
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class RootPreferenceFragment : BasePreferenceFragment(R.xml.preferences_root) {
|
|||
|
||||
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
||||
if (preference.key == getString(R.string.set_key_music_dirs)) {
|
||||
findNavController().navigate(RootPreferenceFragmentDirections.musicDirsSettings())
|
||||
findNavController().navigateSafe(RootPreferenceFragmentDirections.musicDirsSettings())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue