fix: dismiss after extractors loaded

This commit is contained in:
rebelonion 2024-03-15 21:13:03 -05:00
parent 34a9a55d4f
commit 96e29a8c59

View file

@ -181,16 +181,6 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
model.loadEpisodeVideos(ep, media!!.selected!!.sourceIndex) model.loadEpisodeVideos(ep, media!!.selected!!.sourceIndex)
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
binding.selectorProgressBar.visibility = View.GONE binding.selectorProgressBar.visibility = View.GONE
}
}
} else {
media!!.anime?.episodes?.set(media!!.anime?.selectedEpisode!!, ep)
adapter.addAll(ep.extractors)
if (model.watchSources!!.isDownloadedSource(media?.selected!!.sourceIndex)) {
adapter.performClick(0)
}
binding.selectorProgressBar.visibility = View.GONE
}
if (adapter.itemCount == 0) { if (adapter.itemCount == 0) {
snackString(getString(R.string.stream_selection_empty)) snackString(getString(R.string.stream_selection_empty))
tryWith { tryWith {
@ -199,6 +189,22 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
} }
} }
} }
} else {
media!!.anime?.episodes?.set(media!!.anime?.selectedEpisode!!, ep)
adapter.addAll(ep.extractors)
if (ep.extractors?.size == 0) {
snackString(getString(R.string.stream_selection_empty))
tryWith {
dismiss()
}
}
if (model.watchSources!!.isDownloadedSource(media?.selected!!.sourceIndex)) {
adapter.performClick(0)
}
binding.selectorProgressBar.visibility = View.GONE
}
}
}
} }
} }