detail: fix crash when playing genre song

Fix an issue where the genre detail view would crash when playing a
song.
This commit is contained in:
Alexander Capehart 2023-01-19 19:53:33 -07:00
parent b7726607ff
commit 28bb4e61c4
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 5 additions and 9 deletions

View file

@ -127,10 +127,10 @@ class GenreDetailFragment :
if (playbackMode != null) {
playbackModel.playFrom(item, playbackMode)
} else {
// When configured to play from the selected item, we already have an Artist
// When configured to play from the selected item, we already have an Genre
// to play from.
playbackModel.playFromArtist(
item, unlikelyToBeNull(detailModel.currentArtist.value))
playbackModel.playFromGenre(
item, unlikelyToBeNull(detailModel.currentGenre.value))
}
}
else -> error("Unexpected datatype: ${item::class.simpleName}")

View file

@ -36,7 +36,6 @@ import org.oxycblt.auxio.list.SelectableListListener
import org.oxycblt.auxio.list.adapter.ListDiffer
import org.oxycblt.auxio.list.adapter.SelectionIndicatorAdapter
import org.oxycblt.auxio.list.adapter.SimpleDiffCallback
import org.oxycblt.auxio.list.adapter.overwriteList
import org.oxycblt.auxio.list.recycler.*
import org.oxycblt.auxio.music.Music
import org.oxycblt.auxio.util.context
@ -142,10 +141,7 @@ private class DetailListDiffer<T>(
when (instructions) {
is DetailListInstructions.Diff -> inner.submitList(newList, onDone)
is DetailListInstructions.ReplaceRest -> {
val amount = newList.size - instructions.at
updateCallback.onRemoved(instructions.at, amount)
inner.overwriteList(newList)
updateCallback.onInserted(instructions.at, amount)
inner.submitList(newList.slice(0..instructions.at)) { inner.submitList(newList) }
}
}
}

View file

@ -95,7 +95,7 @@ enum class BasicListInstructions {
REPLACE
}
private abstract class BasicListDiffer<T>() : ListDiffer<T, BasicListInstructions> {
private abstract class BasicListDiffer<T> : ListDiffer<T, BasicListInstructions> {
override fun submitList(
newList: List<T>,
instructions: BasicListInstructions,