mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-27 09:44:55 +03:00
Fix sources/extension filters toggles being indented
This commit is contained in:
parent
7be6ee9a68
commit
f4bb9b604a
3 changed files with 9 additions and 5 deletions
|
@ -1,12 +1,12 @@
|
|||
package eu.kanade.tachiyomi.ui.extension
|
||||
|
||||
import androidx.preference.PreferenceScreen
|
||||
import androidx.preference.SwitchPreference
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsController
|
||||
import eu.kanade.tachiyomi.ui.setting.onChange
|
||||
import eu.kanade.tachiyomi.ui.setting.switchPreference
|
||||
import eu.kanade.tachiyomi.ui.setting.titleRes
|
||||
import eu.kanade.tachiyomi.util.LocaleHelper
|
||||
import uy.kohesive.injekt.Injekt
|
||||
|
@ -29,7 +29,7 @@ class ExtensionFilterController: SettingsController() {
|
|||
}
|
||||
|
||||
availableLangs.forEach {
|
||||
SwitchPreference(context).apply {
|
||||
switchPreference {
|
||||
preferenceScreen.addPreference(this)
|
||||
title = LocaleHelper.getDisplayName(it, context)
|
||||
isPersistent = false
|
||||
|
|
|
@ -4,6 +4,7 @@ import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
|
|||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.preference.*
|
||||
import eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.SwitchPreferenceCategory
|
||||
|
||||
@DslMarker
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
|
@ -21,6 +22,10 @@ inline fun PreferenceGroup.switchPreference(block: (@DSL SwitchPreferenceCompat)
|
|||
return initThenAdd(SwitchPreferenceCompat(context), block)
|
||||
}
|
||||
|
||||
inline fun PreferenceGroup.switchPreferenceCategory(block: (@DSL SwitchPreferenceCategory).() -> Unit): SwitchPreferenceCategory {
|
||||
return initThenAdd(SwitchPreferenceCategory(context), block)
|
||||
}
|
||||
|
||||
inline fun PreferenceGroup.checkBoxPreference(block: (@DSL CheckBoxPreference).() -> Unit): CheckBoxPreference {
|
||||
return initThenAdd(CheckBoxPreference(context), block)
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@ import eu.kanade.tachiyomi.source.online.LoginSource
|
|||
import eu.kanade.tachiyomi.util.LocaleHelper
|
||||
import eu.kanade.tachiyomi.widget.preference.LoginCheckBoxPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.SourceLoginDialog
|
||||
import eu.kanade.tachiyomi.widget.preference.SwitchPreferenceCategory
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.*
|
||||
import java.util.TreeMap
|
||||
|
||||
class SettingsSourcesController : SettingsController(),
|
||||
SourceLoginDialog.Listener {
|
||||
|
@ -38,7 +37,7 @@ class SettingsSourcesController : SettingsController(),
|
|||
val sources = sourcesByLang[lang].orEmpty().sortedBy { it.name }
|
||||
|
||||
// Create a preference group and set initial state and change listener
|
||||
SwitchPreferenceCategory(context).apply {
|
||||
switchPreferenceCategory {
|
||||
preferenceScreen.addPreference(this)
|
||||
title = LocaleHelper.getDisplayName(lang, context)
|
||||
isPersistent = false
|
||||
|
|
Loading…
Reference in a new issue