home: handle playback decision event
Forgot to add this. Resolves #734.
This commit is contained in:
parent
a920da3fbd
commit
dc51c84c54
6 changed files with 31 additions and 11 deletions
|
@ -1,5 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## dev
|
||||
|
||||
#### What's Fixed
|
||||
- Fixed crash when using play next on the end of a queue or with a single-song queue
|
||||
- Fixed weird behavior if using play next on the end of a queue with repeat all enabled
|
||||
- Fixed artist choice dialog not showing up on home screen if playing from artist/genre was enabled
|
||||
|
||||
## 3.4.2
|
||||
|
||||
#### What's Fixed
|
||||
|
|
|
@ -75,6 +75,7 @@ import org.oxycblt.auxio.music.PlaylistDecision
|
|||
import org.oxycblt.auxio.music.PlaylistMessage
|
||||
import org.oxycblt.auxio.music.Song
|
||||
import org.oxycblt.auxio.music.external.M3U
|
||||
import org.oxycblt.auxio.playback.PlaybackDecision
|
||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||
import org.oxycblt.auxio.util.collect
|
||||
import org.oxycblt.auxio.util.collectImmediately
|
||||
|
@ -214,12 +215,13 @@ class HomeFragment :
|
|||
collectImmediately(homeModel.currentTabType, ::updateCurrentTab)
|
||||
collectImmediately(homeModel.songList, homeModel.isFastScrolling, ::updateFab)
|
||||
collect(homeModel.speedDialOpen, ::updateSpeedDial)
|
||||
collect(detailModel.toShow.flow, ::handleShow)
|
||||
collect(listModel.menu.flow, ::handleMenu)
|
||||
collectImmediately(listModel.selected, ::updateSelection)
|
||||
collectImmediately(musicModel.indexingState, ::updateIndexerState)
|
||||
collect(musicModel.playlistDecision.flow, ::handleDecision)
|
||||
collect(musicModel.playlistDecision.flow, ::handlePlaylistDecision)
|
||||
collectImmediately(musicModel.playlistMessage.flow, ::handlePlaylistMessage)
|
||||
collect(detailModel.toShow.flow, ::handleShow)
|
||||
collect(playbackModel.playbackDecision.flow, ::handlePlaybackDecision)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -487,7 +489,7 @@ class HomeFragment :
|
|||
}
|
||||
}
|
||||
|
||||
private fun handleDecision(decision: PlaylistDecision?) {
|
||||
private fun handlePlaylistDecision(decision: PlaylistDecision?) {
|
||||
if (decision == null) return
|
||||
val directions =
|
||||
when (decision) {
|
||||
|
@ -539,6 +541,20 @@ class HomeFragment :
|
|||
musicModel.playlistMessage.consume()
|
||||
}
|
||||
|
||||
private fun handlePlaybackDecision(decision: PlaybackDecision?) {
|
||||
when (decision) {
|
||||
is PlaybackDecision.PlayFromArtist -> {
|
||||
findNavController()
|
||||
.navigateSafe(HomeFragmentDirections.playFromArtist(decision.song.uid))
|
||||
}
|
||||
is PlaybackDecision.PlayFromGenre -> {
|
||||
findNavController()
|
||||
.navigateSafe(HomeFragmentDirections.playFromGenre(decision.song.uid))
|
||||
}
|
||||
null -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateFab(songs: List<Song>, isFastScrolling: Boolean) {
|
||||
updateFabVisibility(songs, isFastScrolling, homeModel.currentTabType.value)
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class PlayFromArtistDialog :
|
|||
}
|
||||
|
||||
playbackModel.playbackDecision.consume()
|
||||
pickerModel.setPickerSongUid(args.artistUid)
|
||||
pickerModel.setPickerSongUid(args.songUid)
|
||||
collectImmediately(pickerModel.currentPickerSong, ::updateSong)
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class PlayFromGenreDialog :
|
|||
}
|
||||
|
||||
playbackModel.playbackDecision.consume()
|
||||
pickerModel.setPickerSongUid(args.genreUid)
|
||||
pickerModel.setPickerSongUid(args.songUid)
|
||||
collectImmediately(pickerModel.currentPickerSong, ::updateSong)
|
||||
}
|
||||
|
||||
|
|
|
@ -368,10 +368,7 @@ constructor(
|
|||
C.INDEX_UNSET
|
||||
} else {
|
||||
currTimeline.getNextWindowIndex(
|
||||
player.currentMediaItemIndex,
|
||||
Player.REPEAT_MODE_OFF,
|
||||
player.shuffleModeEnabled
|
||||
)
|
||||
player.currentMediaItemIndex, Player.REPEAT_MODE_OFF, player.shuffleModeEnabled)
|
||||
}
|
||||
|
||||
if (nextIndex == C.INDEX_UNSET) {
|
||||
|
|
|
@ -491,7 +491,7 @@
|
|||
android:label="play_from_artist_dialog"
|
||||
tools:layout="@layout/dialog_music_choices">
|
||||
<argument
|
||||
android:name="artistUid"
|
||||
android:name="songUid"
|
||||
app:argType="org.oxycblt.auxio.music.Music$UID" />
|
||||
</dialog>
|
||||
|
||||
|
@ -501,7 +501,7 @@
|
|||
android:label="play_from_genre_dialog"
|
||||
tools:layout="@layout/dialog_music_choices">
|
||||
<argument
|
||||
android:name="genreUid"
|
||||
android:name="songUid"
|
||||
app:argType="org.oxycblt.auxio.music.Music$UID" />
|
||||
</dialog>
|
||||
|
||||
|
|
Loading…
Reference in a new issue