playback: fix playback progress bug
Fix an issue where I forgot to call executePendingBindings when updating progress, resulting in strange behavior with the progress bar.
This commit is contained in:
@@ -66,7 +66,6 @@ class MainFragment : Fragment(), PlaybackBarLayout.ActionCallback {
|
|||||||
binding.lifecycleOwner = viewLifecycleOwner
|
binding.lifecycleOwner = viewLifecycleOwner
|
||||||
|
|
||||||
// --- VIEWMODEL SETUP ---
|
// --- VIEWMODEL SETUP ---
|
||||||
|
|
||||||
binding.mainBarLayout.setActionCallback(this)
|
binding.mainBarLayout.setActionCallback(this)
|
||||||
|
|
||||||
binding.mainBarLayout.setSong(playbackModel.song.value)
|
binding.mainBarLayout.setSong(playbackModel.song.value)
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class CompactPlaybackView @JvmOverloads constructor(
|
|||||||
|
|
||||||
fun setSong(song: Song) {
|
fun setSong(song: Song) {
|
||||||
binding.song = song
|
binding.song = song
|
||||||
|
binding.executePendingBindings()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setPlaying(isPlaying: Boolean) {
|
fun setPlaying(isPlaying: Boolean) {
|
||||||
@@ -91,11 +92,6 @@ class CompactPlaybackView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setPosition(position: Long) {
|
fun setPosition(position: Long) {
|
||||||
if (binding.song == null) {
|
|
||||||
binding.playbackProgressBar.progress = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.playbackProgressBar.progress = position.toInt()
|
binding.playbackProgressBar.progress = position.toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user