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:
parent
b7726607ff
commit
28bb4e61c4
3 changed files with 5 additions and 9 deletions
|
@ -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}")
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue