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:
Jannik 2022-07-21 18:49:29 +02:00
parent 127bd030b9
commit 0028cb6dd7
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
1 changed files with 2 additions and 2 deletions

View File

@ -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)