mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 04:41:47 +01:00
Remove categories for multi language "single" sources
This commit is contained in:
parent
749b240897
commit
ff5f13eafe
@ -114,17 +114,14 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
preferenceScreen = screen
|
preferenceScreen = screen
|
||||||
|
|
||||||
val isMultiSource = extension.sources.size > 1
|
val isMultiSource = extension.sources.size > 1
|
||||||
|
val isMultiLangSingleSource = isMultiSource && extension.sources.map { it.name }.distinct().size == 1
|
||||||
|
|
||||||
with(screen) {
|
with(screen) {
|
||||||
extension.sources
|
extension.sources
|
||||||
.groupBy { (it as CatalogueSource).lang }
|
.groupBy { (it as CatalogueSource).lang }
|
||||||
.toSortedMap(compareBy { LocaleHelper.getSourceDisplayName(it, context) })
|
.toSortedMap(compareBy { LocaleHelper.getSourceDisplayName(it, context) })
|
||||||
.forEach {
|
.forEach {
|
||||||
preferenceCategory {
|
val preferenceBlock = {
|
||||||
if (isMultiSource) {
|
|
||||||
title = LocaleHelper.getSourceDisplayName(it.key, context)
|
|
||||||
}
|
|
||||||
|
|
||||||
it.value
|
it.value
|
||||||
.sortedWith(compareBy({ !it.isEnabled() }, { it.name }))
|
.sortedWith(compareBy({ !it.isEnabled() }, { it.name }))
|
||||||
.forEach { source ->
|
.forEach { source ->
|
||||||
@ -132,10 +129,9 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
|
|
||||||
val block: (@DSL SwitchPreferenceCompat).() -> Unit = {
|
val block: (@DSL SwitchPreferenceCompat).() -> Unit = {
|
||||||
key = getSourceKey(source.id)
|
key = getSourceKey(source.id)
|
||||||
title = if (isMultiSource) {
|
title = when {
|
||||||
source.toString()
|
isMultiSource && !isMultiLangSingleSource -> source.toString()
|
||||||
} else {
|
else -> LocaleHelper.getSourceDisplayName(it.key, context)
|
||||||
context.getString(R.string.enabled)
|
|
||||||
}
|
}
|
||||||
isPersistent = false
|
isPersistent = false
|
||||||
isChecked = source.isEnabled()
|
isChecked = source.isEnabled()
|
||||||
@ -171,6 +167,16 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMultiSource && !isMultiLangSingleSource) {
|
||||||
|
preferenceCategory {
|
||||||
|
title = LocaleHelper.getSourceDisplayName(it.key, context)
|
||||||
|
|
||||||
|
preferenceBlock()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
preferenceBlock()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,6 @@
|
|||||||
<string name="unofficial_extension_message">This extension is not from the official Tachiyomi extensions list.</string>
|
<string name="unofficial_extension_message">This extension is not from the official Tachiyomi extensions list.</string>
|
||||||
<string name="ext_version_info">Version: %1$s</string>
|
<string name="ext_version_info">Version: %1$s</string>
|
||||||
<string name="ext_language_info">Language: %1$s</string>
|
<string name="ext_language_info">Language: %1$s</string>
|
||||||
<string name="enabled">Enabled</string>
|
|
||||||
|
|
||||||
<!-- Reader section -->
|
<!-- Reader section -->
|
||||||
<string name="pref_fullscreen">Fullscreen</string>
|
<string name="pref_fullscreen">Fullscreen</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user