mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-24 06:05:49 +03:00
Hide irrelevant settings if global update isn't enabled
This commit is contained in:
parent
945afc71ef
commit
7d1f5c7383
1 changed files with 14 additions and 2 deletions
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
@ -163,7 +164,7 @@ class SettingsLibraryController : SettingsController() {
|
|||
entryValues = arrayOf(DEVICE_ONLY_ON_WIFI, DEVICE_CHARGING)
|
||||
defaultValue = preferences.libraryUpdateDeviceRestriction().defaultValue
|
||||
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
|
||||
onChange {
|
||||
// Post to event looper to allow the preference to be updated.
|
||||
|
@ -201,7 +202,7 @@ class SettingsLibraryController : SettingsController() {
|
|||
entryValues = arrayOf(MANGA_FULLY_READ, MANGA_ONGOING)
|
||||
defaultValue = preferences.libraryUpdateMangaRestriction().defaultValue
|
||||
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
|
||||
fun updateSummary() {
|
||||
val restrictions = preferences.libraryUpdateMangaRestriction().get()
|
||||
|
@ -229,6 +230,9 @@ class SettingsLibraryController : SettingsController() {
|
|||
preference {
|
||||
key = Keys.libraryUpdateCategories
|
||||
titleRes = R.string.categories
|
||||
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
|
||||
onClick {
|
||||
LibraryGlobalUpdateCategoriesDialog().showDialog(router)
|
||||
}
|
||||
|
@ -270,6 +274,8 @@ class SettingsLibraryController : SettingsController() {
|
|||
key = Keys.libraryUpdatePrioritization
|
||||
titleRes = R.string.pref_library_update_prioritization
|
||||
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
|
||||
// The following array lines up with the list rankingScheme in:
|
||||
// ../../data/library/LibraryUpdateRanker.kt
|
||||
val priorities = arrayOf(
|
||||
|
@ -297,6 +303,7 @@ class SettingsLibraryController : SettingsController() {
|
|||
titleRes = R.string.pref_library_update_refresh_metadata
|
||||
summaryRes = R.string.pref_library_update_refresh_metadata_summary
|
||||
defaultValue = false
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
}
|
||||
if (trackManager.hasLoggedServices()) {
|
||||
switchPreference {
|
||||
|
@ -304,11 +311,16 @@ class SettingsLibraryController : SettingsController() {
|
|||
titleRes = R.string.pref_library_update_refresh_trackers
|
||||
summaryRes = R.string.pref_library_update_refresh_trackers_summary
|
||||
defaultValue = false
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun Preference.visibleIfGlobalUpdateEnabled() {
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
}
|
||||
|
||||
class LibraryColumnsDialog : DialogController() {
|
||||
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
|
|
Loading…
Reference in a new issue