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