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) {
|
if (playbackMode != null) {
|
||||||
playbackModel.playFrom(item, playbackMode)
|
playbackModel.playFrom(item, playbackMode)
|
||||||
} else {
|
} 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.
|
// to play from.
|
||||||
playbackModel.playFromArtist(
|
playbackModel.playFromGenre(
|
||||||
item, unlikelyToBeNull(detailModel.currentArtist.value))
|
item, unlikelyToBeNull(detailModel.currentGenre.value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> error("Unexpected datatype: ${item::class.simpleName}")
|
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.ListDiffer
|
||||||
import org.oxycblt.auxio.list.adapter.SelectionIndicatorAdapter
|
import org.oxycblt.auxio.list.adapter.SelectionIndicatorAdapter
|
||||||
import org.oxycblt.auxio.list.adapter.SimpleDiffCallback
|
import org.oxycblt.auxio.list.adapter.SimpleDiffCallback
|
||||||
import org.oxycblt.auxio.list.adapter.overwriteList
|
|
||||||
import org.oxycblt.auxio.list.recycler.*
|
import org.oxycblt.auxio.list.recycler.*
|
||||||
import org.oxycblt.auxio.music.Music
|
import org.oxycblt.auxio.music.Music
|
||||||
import org.oxycblt.auxio.util.context
|
import org.oxycblt.auxio.util.context
|
||||||
|
@ -142,10 +141,7 @@ private class DetailListDiffer<T>(
|
||||||
when (instructions) {
|
when (instructions) {
|
||||||
is DetailListInstructions.Diff -> inner.submitList(newList, onDone)
|
is DetailListInstructions.Diff -> inner.submitList(newList, onDone)
|
||||||
is DetailListInstructions.ReplaceRest -> {
|
is DetailListInstructions.ReplaceRest -> {
|
||||||
val amount = newList.size - instructions.at
|
inner.submitList(newList.slice(0..instructions.at)) { inner.submitList(newList) }
|
||||||
updateCallback.onRemoved(instructions.at, amount)
|
|
||||||
inner.overwriteList(newList)
|
|
||||||
updateCallback.onInserted(instructions.at, amount)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ enum class BasicListInstructions {
|
||||||
REPLACE
|
REPLACE
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class BasicListDiffer<T>() : ListDiffer<T, BasicListInstructions> {
|
private abstract class BasicListDiffer<T> : ListDiffer<T, BasicListInstructions> {
|
||||||
override fun submitList(
|
override fun submitList(
|
||||||
newList: List<T>,
|
newList: List<T>,
|
||||||
instructions: BasicListInstructions,
|
instructions: BasicListInstructions,
|
||||||
|
|
Loading…
Reference in a new issue