diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt index 18e5a1e71..b8aed28bd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt @@ -243,8 +243,8 @@ class SettingsDownloadController : SettingsController() { return MaterialAlertDialogBuilder(activity!!) .setTitle(R.string.categories) - .setMessage(R.string.pref_download_new_categories_details) .setQuadStateMultiChoiceItems( + message = R.string.pref_download_new_categories_details, items = items, initialSelected = selected ) { selections -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index 892e440be..25f2650fe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -355,8 +355,11 @@ class SettingsLibraryController : SettingsController() { return MaterialAlertDialogBuilder(activity!!) .setTitle(R.string.categories) - .setMessage(R.string.pref_library_update_categories_details) - .setQuadStateMultiChoiceItems(items = items, initialSelected = selected) { selections -> + .setQuadStateMultiChoiceItems( + message = R.string.pref_library_update_categories_details, + items = items, + initialSelected = selected + ) { selections -> selected = selections } .setPositiveButton(android.R.string.ok) { _, _ -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/materialdialogs/MaterialAlertDialogBuilderExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/materialdialogs/MaterialAlertDialogBuilderExtensions.kt index ea2f66c7f..7c98756d2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/materialdialogs/MaterialAlertDialogBuilderExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/materialdialogs/MaterialAlertDialogBuilderExtensions.kt @@ -3,7 +3,9 @@ package eu.kanade.tachiyomi.widget.materialdialogs import android.view.LayoutInflater import android.view.inputmethod.InputMethodManager import android.widget.TextView +import androidx.annotation.StringRes import androidx.core.content.getSystemService +import androidx.core.view.isVisible import androidx.core.widget.doAfterTextChanged import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -36,6 +38,7 @@ fun MaterialAlertDialogBuilder.setTextInput( * @see eu.kanade.tachiyomi.widget.materialdialogs.QuadStateTextView */ fun MaterialAlertDialogBuilder.setQuadStateMultiChoiceItems( + @StringRes message: Int? = null, items: List, initialSelected: IntArray, disabledIndices: IntArray? = null, @@ -49,6 +52,20 @@ fun MaterialAlertDialogBuilder.setQuadStateMultiChoiceItems( initialSelected = initialSelected, listener = selection ) - setView(binding.root) - return this + val updateScrollIndicators = { + binding.scrollIndicatorUp.isVisible = binding.list.canScrollVertically(-1) + binding.scrollIndicatorDown.isVisible = binding.list.canScrollVertically(1) + } + binding.list.setOnScrollChangeListener { _, _, _, _, _ -> + updateScrollIndicators() + } + binding.list.post { + updateScrollIndicators() + } + + if (message != null) { + binding.message.setText(message) + binding.message.isVisible = true + } + return setView(binding.root) } diff --git a/app/src/main/res/layout/dialog_stub_quadstatemultichoice.xml b/app/src/main/res/layout/dialog_stub_quadstatemultichoice.xml index a79a4ac8e..15e74f734 100644 --- a/app/src/main/res/layout/dialog_stub_quadstatemultichoice.xml +++ b/app/src/main/res/layout/dialog_stub_quadstatemultichoice.xml @@ -1,9 +1,49 @@ - + android:orientation="vertical" + android:minHeight="48dp"> + + + + + + + + + + + + + + + +