Skip to content

Commit

Permalink
detail: fix broken playing state updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OxygenCobalt committed Oct 23, 2024
1 parent 82ddd3a commit d7f3c58
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentAlbum.value))
}
updatePlayback(
playbackModel.song.value, playbackModel.parent.value, playbackModel.isPlaying.value)
}

private fun updateList(list: List<Item>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentArtist.value))
}
updatePlayback(
playbackModel.song.value, playbackModel.parent.value, playbackModel.isPlaying.value)
}

private fun updateList(list: List<Item>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentGenre.value))
}
updatePlayback(
playbackModel.song.value, playbackModel.parent.value, playbackModel.isPlaying.value)
}

private fun updateList(list: List<Item>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ class PlaylistDetailFragment :
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentPlaylist.value))
}
}
updatePlayback(
playbackModel.song.value, playbackModel.parent.value, playbackModel.isPlaying.value)
}

private fun updateList(list: List<Item>) {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/org/oxycblt/auxio/home/HomeGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ private class HomeGeneratorImpl(
} else {
sorted
}
}
?: emptyList()
} ?: emptyList()

override fun genres() =
musicRepository.deviceLibrary?.let { listSettings.genreSort.genres(it.genres) }
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/oxycblt/auxio/music/service/Indexer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.oxycblt.auxio.BuildConfig
import org.oxycblt.auxio.ForegroundListener
import org.oxycblt.auxio.ForegroundServiceNotification
import org.oxycblt.auxio.music.IndexingState
import org.oxycblt.auxio.music.MusicParent
import org.oxycblt.auxio.music.MusicRepository
import org.oxycblt.auxio.music.MusicSettings
import org.oxycblt.auxio.playback.state.PlaybackStateManager
Expand Down Expand Up @@ -155,6 +156,8 @@ private constructor(
playbackManager.toSavedState()?.let { savedState ->
playbackManager.applySavedState(
savedState.copy(
parent =
savedState.parent?.let { musicRepository.find(it.uid) as? MusicParent? },
heap =
savedState.heap.map { song ->
song?.let { deviceLibrary.findSong(it.uid) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ class ExoPlaybackStateHolder(
) {
var sendNewPlaybackEvent = false
var shouldSeek = false
L.d("invalidating parent ${this.parent?.songs} ${parent?.songs}")
if (this.parent != parent) {
this.parent = parent
sendNewPlaybackEvent = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class WidgetProvider : AppWidgetProvider() {
fun reset(context: Context, uiSettings: UISettings) {
L.d("Using default layout")
val layout = newDefaultLayout(context, uiSettings)
AppWidgetManager.getInstance(context).updateAppWidget(ComponentName(context, this::class.java), layout)
AppWidgetManager.getInstance(context)
.updateAppWidget(ComponentName(context, this::class.java), layout)
}

// --- INTERNAL METHODS ---
Expand Down

0 comments on commit d7f3c58

Please sign in to comment.