fix EpisodesListDialogFragment current episode selection
fix EpisodesListDialogFragment not selecting the correct episode, if the episode number doens't start at 0, if episodes are count across seasons
This commit is contained in:
@ -51,8 +51,8 @@ class EpisodeListDialogFragment : DialogFragment() {
|
||||
EpisodeItemAdapter.ViewType.PLAYER
|
||||
)
|
||||
|
||||
// episodeNumber starts at 1, we need the episode index -> - 1
|
||||
adapterRecEpisodes.currentSelected = model.currentEpisode.episodeNumber?.minus(1) ?: 0
|
||||
// get the position/index of the currently playing episode
|
||||
adapterRecEpisodes.currentSelected = model.episodes.items.indexOfFirst { it.id == model.currentEpisode.id }
|
||||
|
||||
binding.recyclerEpisodesPlayer.adapter = adapterRecEpisodes
|
||||
binding.recyclerEpisodesPlayer.scrollToPosition(adapterRecEpisodes.currentSelected)
|
||||
|
Reference in New Issue
Block a user