fix (workaround) a crash in MediaFragment if one opens and closes multiple new MediaFragment via the similar tab

This commit is contained in:
Jannik 2022-04-03 17:33:29 +02:00
parent 7abb5cd3e8
commit aa49169034
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
2 changed files with 9 additions and 1 deletions

View File

@ -78,6 +78,12 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
super.onResume()
if (runOnResume) {
/**
* FIXME
* this is currently also run on back press when multiple MediaFragments have
* been open and closed via similar tab
*/
lifecycleScope.launch {
model.updateOnResume()

View File

@ -62,8 +62,10 @@ class MediaFragmentEpisodes : Fragment() {
@SuppressLint("NotifyDataSetChanged")
fun updateWatchedState() {
// model.currentPlayheads is a val mutable map -> notify dataset changed
if (this::adapterRecEpisodes.isInitialized) {
adapterRecEpisodes.notifyDataSetChanged()
}
}
private fun showSeasonSelection(v: View) {
// TODO replace with Exposed dropdown menu: https://material.io/components/menus/android#exposed-dropdown-menus