mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Filter scanlator group dialog now disabled the filter button if all scanlators are selected
was already handled in code but now its visually handled too
This commit is contained in:
parent
f3f906ebf0
commit
50859c404e
1 changed files with 9 additions and 1 deletions
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.manga.chapter
|
|||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.WindowInsetsCompat.Type.systemBars
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
|
@ -168,6 +169,7 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) :
|
|||
?: mutableSetOf()
|
||||
)
|
||||
val preselected = scanlators.map { it in filteredScanlators }.toBooleanArray()
|
||||
var alertDialog: AlertDialog? = null
|
||||
activity.materialAlertDialog()
|
||||
.setTitle(R.string.filter_groups)
|
||||
.setNegativeStateItems(scanlators, preselected) { _, pos, checked ->
|
||||
|
@ -176,6 +178,8 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) :
|
|||
} else {
|
||||
filteredScanlators.remove(scanlators[pos])
|
||||
}
|
||||
alertDialog?.getButton(BUTTON_POSITIVE)?.isEnabled =
|
||||
scanlators.size != filteredScanlators.size
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.filter) { _, _ ->
|
||||
|
@ -184,7 +188,11 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) :
|
|||
.setNeutralButton(R.string.reset) { _, _, ->
|
||||
presenter.setScanlatorFilter(emptySet())
|
||||
}
|
||||
.show()
|
||||
.show().apply {
|
||||
alertDialog = this
|
||||
setOnCancelListener { alertDialog = null }
|
||||
setOnDismissListener { alertDialog = null }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue