feat: show the episodic range with current selection checked (#851)

This commit is contained in:
coxju 2024-01-11 02:35:56 +05:30 committed by GitHub
parent 5e6272be3f
commit 6f1e0bef80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,6 +247,7 @@ open class ResultFragmentPhone : FullScreenPlayer() {
}
var selectSeason: String? = null
var selectEpisodeRange: String? = null
private fun setUrl(url: String?) {
if (url == null) {
@ -1027,6 +1028,8 @@ open class ResultFragmentPhone : FullScreenPlayer() {
observeNullable(viewModel.selectedRange) { range ->
resultBinding?.apply {
resultEpisodeSelect.setText(range)
selectEpisodeRange = range?.asStringNull(resultEpisodeSelect.context)
// If Season button is invisible then the bookmark button next focus is episode select
if (resultEpisodeSelect.isVisible && !resultSeasonButton.isVisible && resultResumeParent.isVisible) {
setFocusUpAndDown(resultResumeSeriesButton, resultEpisodeSelect)
@ -1060,9 +1063,12 @@ open class ResultFragmentPhone : FullScreenPlayer() {
r to (text?.asStringNull(ctx) ?: return@mapNotNull null)
}
view.popupMenuNoIconsAndNoStringRes(names.mapIndexed { index, (_, name) ->
index to name
}) {
activity?.showDialog(
names.map { it.second },
names.indexOfFirst { it.second == selectEpisodeRange },
"",
false,
{}) { itemId ->
viewModel.changeRange(names[itemId].first)
}
}