mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 03:55:06 +01:00
Fix extension source toggles not showing up for preferences without custom settings
This commit is contained in:
parent
801568950f
commit
203758dddd
@ -106,10 +106,8 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
val langauges = preferences.enabledLanguages().get()
|
val langauges = preferences.enabledLanguages().get()
|
||||||
|
|
||||||
for (source in extension.sources.sortedByDescending { it.isLangEnabled(langauges) }) {
|
for (source in extension.sources.sortedByDescending { it.isLangEnabled(langauges) }) {
|
||||||
if (source is ConfigurableSource) {
|
|
||||||
addPreferencesForSource(screen, source, multiSource, isMultiLangSingleSource)
|
addPreferencesForSource(screen, source, multiSource, isMultiLangSingleSource)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
manager.setPreferences(screen)
|
manager.setPreferences(screen)
|
||||||
|
|
||||||
@ -187,7 +185,6 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
context.getSharedPreferences("source_${source.id}", Context.MODE_PRIVATE)
|
context.getSharedPreferences("source_${source.id}", Context.MODE_PRIVATE)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (source is ConfigurableSource) {
|
|
||||||
val prefs = mutableListOf<Preference>()
|
val prefs = mutableListOf<Preference>()
|
||||||
val block: (@DSL SwitchPreferenceCompat).() -> Unit = {
|
val block: (@DSL SwitchPreferenceCompat).() -> Unit = {
|
||||||
key = source.getPreferenceKey()
|
key = source.getPreferenceKey()
|
||||||
@ -205,7 +202,12 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
prefs.forEach { it.isVisible = checked }
|
prefs.forEach { it.isVisible = checked }
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
binding.coordinator.snack(context.getString(R.string._must_be_enabled_first, title), Snackbar.LENGTH_LONG) {
|
binding.coordinator.snack(
|
||||||
|
context.getString(
|
||||||
|
R.string._must_be_enabled_first,
|
||||||
|
title
|
||||||
|
), Snackbar.LENGTH_LONG
|
||||||
|
) {
|
||||||
setAction(R.string.enable) {
|
setAction(R.string.enable) {
|
||||||
preferences.enabledLanguages() += source.lang
|
preferences.enabledLanguages() += source.lang
|
||||||
isChecked = true
|
isChecked = true
|
||||||
@ -226,8 +228,9 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
val newScreen = screen.preferenceManager.createPreferenceScreen(context)
|
|
||||||
screen.switchPreference(block)
|
screen.switchPreference(block)
|
||||||
|
if (source is ConfigurableSource) {
|
||||||
|
val newScreen = screen.preferenceManager.createPreferenceScreen(context)
|
||||||
source.setupPreferenceScreen(newScreen)
|
source.setupPreferenceScreen(newScreen)
|
||||||
|
|
||||||
// Reparent the preferences
|
// Reparent the preferences
|
||||||
|
Loading…
Reference in New Issue
Block a user