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"
|
implementation "androidx.preference:preference-ktx:1.2.0"
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
def room_version = '2.6.0-alpha01'
|
def room_version = '2.6.0-alpha02'
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
kapt "androidx.room:room-compiler:$room_version"
|
kapt "androidx.room:room-compiler:$room_version"
|
||||||
implementation "androidx.room:room-ktx:$room_version"
|
implementation "androidx.room:room-ktx:$room_version"
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ class AlbumDetailFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateToParentArtist() {
|
override fun onNavigateToParentArtist() {
|
||||||
detailModel.showAlbum(unlikelyToBeNull(detailModel.currentAlbum.value))
|
detailModel.showArtist(unlikelyToBeNull(detailModel.currentAlbum.value))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateAlbum(album: Album?) {
|
private fun updateAlbum(album: Album?) {
|
||||||
|
|
@ -314,18 +314,17 @@ class AlbumDetailFragment :
|
||||||
|
|
||||||
private fun handleDecision(decision: PlaylistDecision?) {
|
private fun handleDecision(decision: PlaylistDecision?) {
|
||||||
when (decision) {
|
when (decision) {
|
||||||
is PlaylistDecision.Add ->{
|
is PlaylistDecision.Add -> {
|
||||||
logD("Adding ${decision.songs.size} songs to a playlist")
|
logD("Adding ${decision.songs.size} songs to a playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
AlbumDetailFragmentDirections.addToPlaylist(
|
.navigateSafe(
|
||||||
decision.songs.map { it.uid }.toTypedArray())
|
AlbumDetailFragmentDirections.addToPlaylist(
|
||||||
)
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
musicModel.playlistDecision.consume()
|
musicModel.playlistDecision.consume()
|
||||||
}
|
}
|
||||||
|
is PlaylistDecision.New,
|
||||||
is PlaylistDecision.New, is PlaylistDecision.Rename, is PlaylistDecision.Delete ->
|
is PlaylistDecision.Rename,
|
||||||
error("Unexpected decision $decision")
|
is PlaylistDecision.Delete -> error("Unexpected decision $decision")
|
||||||
|
|
||||||
null -> {}
|
null -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,18 +324,17 @@ class ArtistDetailFragment :
|
||||||
|
|
||||||
private fun handleDecision(decision: PlaylistDecision?) {
|
private fun handleDecision(decision: PlaylistDecision?) {
|
||||||
when (decision) {
|
when (decision) {
|
||||||
is PlaylistDecision.Add ->{
|
is PlaylistDecision.Add -> {
|
||||||
logD("Adding ${decision.songs.size} songs to a playlist")
|
logD("Adding ${decision.songs.size} songs to a playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
ArtistDetailFragmentDirections.addToPlaylist(
|
.navigateSafe(
|
||||||
decision.songs.map { it.uid }.toTypedArray())
|
ArtistDetailFragmentDirections.addToPlaylist(
|
||||||
)
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
musicModel.playlistDecision.consume()
|
musicModel.playlistDecision.consume()
|
||||||
}
|
}
|
||||||
|
is PlaylistDecision.New,
|
||||||
is PlaylistDecision.New, is PlaylistDecision.Rename, is PlaylistDecision.Delete ->
|
is PlaylistDecision.Rename,
|
||||||
error("Unexpected decision $decision")
|
is PlaylistDecision.Delete -> error("Unexpected decision $decision")
|
||||||
|
|
||||||
null -> {}
|
null -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,7 @@ class GenreDetailFragment :
|
||||||
}
|
}
|
||||||
is Show.GenreDetails -> {
|
is Show.GenreDetails -> {
|
||||||
logD("Navigated to this genre")
|
logD("Navigated to this genre")
|
||||||
|
detailModel.toShow.consume()
|
||||||
}
|
}
|
||||||
is Show.PlaylistDetails -> {
|
is Show.PlaylistDetails -> {
|
||||||
error("Unexpected show command $show")
|
error("Unexpected show command $show")
|
||||||
|
|
@ -311,18 +312,17 @@ class GenreDetailFragment :
|
||||||
|
|
||||||
private fun handleDecision(decision: PlaylistDecision?) {
|
private fun handleDecision(decision: PlaylistDecision?) {
|
||||||
when (decision) {
|
when (decision) {
|
||||||
is PlaylistDecision.Add ->{
|
is PlaylistDecision.Add -> {
|
||||||
logD("Adding ${decision.songs.size} songs to a playlist")
|
logD("Adding ${decision.songs.size} songs to a playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
GenreDetailFragmentDirections.addToPlaylist(
|
.navigateSafe(
|
||||||
decision.songs.map { it.uid }.toTypedArray())
|
GenreDetailFragmentDirections.addToPlaylist(
|
||||||
)
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
musicModel.playlistDecision.consume()
|
musicModel.playlistDecision.consume()
|
||||||
}
|
}
|
||||||
|
is PlaylistDecision.New,
|
||||||
is PlaylistDecision.New, is PlaylistDecision.Rename, is PlaylistDecision.Delete ->
|
is PlaylistDecision.Rename,
|
||||||
error("Unexpected decision $decision")
|
is PlaylistDecision.Delete -> error("Unexpected decision $decision")
|
||||||
|
|
||||||
null -> {}
|
null -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,7 @@ class PlaylistDetailFragment :
|
||||||
}
|
}
|
||||||
is Show.PlaylistDetails -> {
|
is Show.PlaylistDetails -> {
|
||||||
logD("Navigated to this playlist")
|
logD("Navigated to this playlist")
|
||||||
|
detailModel.toShow.consume()
|
||||||
}
|
}
|
||||||
is Show.GenreDetails -> {
|
is Show.GenreDetails -> {
|
||||||
error("Unexpected show command $show")
|
error("Unexpected show command $show")
|
||||||
|
|
@ -359,19 +360,18 @@ class PlaylistDetailFragment :
|
||||||
when (decision) {
|
when (decision) {
|
||||||
is PlaylistDecision.Rename -> {
|
is PlaylistDecision.Rename -> {
|
||||||
logD("Renaming ${decision.playlist}")
|
logD("Renaming ${decision.playlist}")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
PlaylistDetailFragmentDirections.renamePlaylist(decision.playlist.uid)
|
.navigateSafe(
|
||||||
)
|
PlaylistDetailFragmentDirections.renamePlaylist(decision.playlist.uid))
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Delete -> {
|
is PlaylistDecision.Delete -> {
|
||||||
logD("Deleting ${decision.playlist}")
|
logD("Deleting ${decision.playlist}")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
PlaylistDetailFragmentDirections.deletePlaylist(decision.playlist.uid)
|
.navigateSafe(
|
||||||
)
|
PlaylistDetailFragmentDirections.deletePlaylist(decision.playlist.uid))
|
||||||
}
|
}
|
||||||
|
is PlaylistDecision.Add,
|
||||||
is PlaylistDecision.Add, is PlaylistDecision.New -> error("Unexpected decision $decision")
|
is PlaylistDecision.New -> error("Unexpected decision $decision")
|
||||||
}
|
}
|
||||||
musicModel.playlistDecision.consume()
|
musicModel.playlistDecision.consume()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -486,29 +486,27 @@ class HomeFragment :
|
||||||
when (decision) {
|
when (decision) {
|
||||||
is PlaylistDecision.New -> {
|
is PlaylistDecision.New -> {
|
||||||
logD("Creating new playlist")
|
logD("Creating new playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.newPlaylist(decision.songs.map { it.uid }.toTypedArray()))
|
.navigateSafe(
|
||||||
|
HomeFragmentDirections.newPlaylist(
|
||||||
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Rename -> {
|
is PlaylistDecision.Rename -> {
|
||||||
logD("Renaming ${decision.playlist}")
|
logD("Renaming ${decision.playlist}")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.renamePlaylist(decision.playlist.uid)
|
.navigateSafe(HomeFragmentDirections.renamePlaylist(decision.playlist.uid))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Delete -> {
|
is PlaylistDecision.Delete -> {
|
||||||
logD("Deleting ${decision.playlist}")
|
logD("Deleting ${decision.playlist}")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.deletePlaylist(decision.playlist.uid)
|
.navigateSafe(HomeFragmentDirections.deletePlaylist(decision.playlist.uid))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Add -> {
|
is PlaylistDecision.Add -> {
|
||||||
logD("Adding ${decision.songs.size} to a playlist")
|
logD("Adding ${decision.songs.size} to a playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.addToPlaylist(decision.songs.map { it.uid }.toTypedArray())
|
.navigateSafe(
|
||||||
)
|
HomeFragmentDirections.addToPlaylist(
|
||||||
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
musicModel.playlistDecision.consume()
|
musicModel.playlistDecision.consume()
|
||||||
|
|
@ -560,11 +558,11 @@ class HomeFragment :
|
||||||
}
|
}
|
||||||
is Show.SongArtistDetails -> {
|
is Show.SongArtistDetails -> {
|
||||||
logD("Navigating to artist choices for ${show.song}")
|
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 -> {
|
is Show.AlbumArtistDetails -> {
|
||||||
logD("Navigating to artist choices for ${show.album}")
|
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 -> {
|
is Show.GenreDetails -> {
|
||||||
logD("Navigating to ${show.genre}")
|
logD("Navigating to ${show.genre}")
|
||||||
|
|
@ -573,7 +571,7 @@ class HomeFragment :
|
||||||
is Show.PlaylistDetails -> {
|
is Show.PlaylistDetails -> {
|
||||||
logD("Navigating to ${show.playlist}")
|
logD("Navigating to ${show.playlist}")
|
||||||
findNavController()
|
findNavController()
|
||||||
.navigateSafe(HomeFragmentDirections.showGenre(show.playlist.uid))
|
.navigateSafe(HomeFragmentDirections.showPlaylist(show.playlist.uid))
|
||||||
}
|
}
|
||||||
null -> {}
|
null -> {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ constructor(
|
||||||
get() = _statistics
|
get() = _statistics
|
||||||
|
|
||||||
private val _playlistDecision = MutableEvent<PlaylistDecision>()
|
private val _playlistDecision = MutableEvent<PlaylistDecision>()
|
||||||
val playlistDecision: Event<PlaylistDecision> get() = _playlistDecision
|
val playlistDecision: Event<PlaylistDecision>
|
||||||
|
get() = _playlistDecision
|
||||||
|
|
||||||
init {
|
init {
|
||||||
musicRepository.addUpdateListener(this)
|
musicRepository.addUpdateListener(this)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,12 @@ class PlaybackPanelFragment :
|
||||||
// respective item.
|
// respective item.
|
||||||
binding.playbackSong.apply {
|
binding.playbackSong.apply {
|
||||||
isSelected = true
|
isSelected = true
|
||||||
setOnClickListener { playbackModel.song.value?.let(detailModel::showAlbum) }
|
setOnClickListener {
|
||||||
|
playbackModel.song.value?.let {
|
||||||
|
detailModel.showAlbum(it)
|
||||||
|
playbackModel.openMain()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
binding.playbackArtist.apply {
|
binding.playbackArtist.apply {
|
||||||
isSelected = true
|
isSelected = true
|
||||||
|
|
@ -229,10 +234,16 @@ class PlaybackPanelFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToCurrentArtist() {
|
private fun navigateToCurrentArtist() {
|
||||||
playbackModel.song.value?.let(detailModel::showArtist)
|
playbackModel.song.value?.let {
|
||||||
|
detailModel.showArtist(it)
|
||||||
|
playbackModel.openMain()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToCurrentAlbum() {
|
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: 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
|
@Entity
|
||||||
data class PlaybackState(
|
data class PlaybackState(
|
||||||
@PrimaryKey val id: Int,
|
@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.
|
* Implements the fuzzy-ish searching algorithm used in the search view.
|
||||||
*
|
*
|
||||||
* @author Alexander Capehart
|
* @author Alexander Capehart
|
||||||
*
|
|
||||||
* TODO: Handle locale changes
|
|
||||||
*/
|
*/
|
||||||
interface SearchEngine {
|
interface SearchEngine {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import com.google.android.material.transition.MaterialSharedAxis
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.databinding.FragmentSearchBinding
|
import org.oxycblt.auxio.databinding.FragmentSearchBinding
|
||||||
import org.oxycblt.auxio.detail.ArtistDetailFragmentDirections
|
|
||||||
import org.oxycblt.auxio.detail.DetailViewModel
|
import org.oxycblt.auxio.detail.DetailViewModel
|
||||||
import org.oxycblt.auxio.detail.Show
|
import org.oxycblt.auxio.detail.Show
|
||||||
import org.oxycblt.auxio.home.HomeFragmentDirections
|
import org.oxycblt.auxio.home.HomeFragmentDirections
|
||||||
|
|
@ -204,8 +203,6 @@ class SearchFragment : ListFragment<Music, FragmentSearchBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun handleShow(show: Show?) {
|
private fun handleShow(show: Show?) {
|
||||||
when (show) {
|
when (show) {
|
||||||
is Show.SongDetails -> {
|
is Show.SongDetails -> {
|
||||||
|
|
@ -259,35 +256,32 @@ class SearchFragment : ListFragment<Music, FragmentSearchBinding>() {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun handleDecision(decision: PlaylistDecision?) {
|
private fun handleDecision(decision: PlaylistDecision?) {
|
||||||
if (decision == null) return
|
if (decision == null) return
|
||||||
when (decision) {
|
when (decision) {
|
||||||
is PlaylistDecision.New -> {
|
is PlaylistDecision.New -> {
|
||||||
logD("Creating new playlist")
|
logD("Creating new playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.newPlaylist(decision.songs.map { it.uid }.toTypedArray()))
|
.navigateSafe(
|
||||||
|
HomeFragmentDirections.newPlaylist(
|
||||||
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Rename -> {
|
is PlaylistDecision.Rename -> {
|
||||||
logD("Renaming ${decision.playlist}")
|
logD("Renaming ${decision.playlist}")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.renamePlaylist(decision.playlist.uid)
|
.navigateSafe(HomeFragmentDirections.renamePlaylist(decision.playlist.uid))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Delete -> {
|
is PlaylistDecision.Delete -> {
|
||||||
logD("Deleting ${decision.playlist}")
|
logD("Deleting ${decision.playlist}")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
SearchFragmentDirections.deletePlaylist(decision.playlist.uid)
|
.navigateSafe(SearchFragmentDirections.deletePlaylist(decision.playlist.uid))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is PlaylistDecision.Add -> {
|
is PlaylistDecision.Add -> {
|
||||||
logD("Adding ${decision.songs.size} to a playlist")
|
logD("Adding ${decision.songs.size} to a playlist")
|
||||||
findNavController().navigateSafe(
|
findNavController()
|
||||||
HomeFragmentDirections.addToPlaylist(decision.songs.map { it.uid }.toTypedArray())
|
.navigateSafe(
|
||||||
)
|
HomeFragmentDirections.addToPlaylist(
|
||||||
|
decision.songs.map { it.uid }.toTypedArray()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
musicModel.playlistDecision.consume()
|
musicModel.playlistDecision.consume()
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class RootPreferenceFragment : BasePreferenceFragment(R.xml.preferences_root) {
|
||||||
|
|
||||||
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
||||||
if (preference.key == getString(R.string.set_key_music_dirs)) {
|
if (preference.key == getString(R.string.set_key_music_dirs)) {
|
||||||
findNavController().navigate(RootPreferenceFragmentDirections.musicDirsSettings())
|
findNavController().navigateSafe(RootPreferenceFragmentDirections.musicDirsSettings())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue