mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Prioritize "all" ("Multi") lang in extensions lists
Fixes #8811 Fixes #8812
This commit is contained in:
parent
91e282d7e5
commit
50d46fe7f6
4 changed files with 10 additions and 11 deletions
|
@ -25,10 +25,7 @@ class GetExtensionLanguages(
|
||||||
}
|
}
|
||||||
.distinct()
|
.distinct()
|
||||||
.sortedWith(
|
.sortedWith(
|
||||||
compareBy(
|
compareBy<String> { it !in enabledLanguage }.then(LocaleHelper.comparator),
|
||||||
{ it !in enabledLanguage },
|
|
||||||
{ LocaleHelper.getDisplayName(it) },
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,7 @@ class GetLanguagesWithSources(
|
||||||
|
|
||||||
sortedSources.groupBy { it.lang }
|
sortedSources.groupBy { it.lang }
|
||||||
.toSortedMap(
|
.toSortedMap(
|
||||||
compareBy(
|
compareBy<String> { it !in enabledLanguage }.then(LocaleHelper.comparator),
|
||||||
{ it !in enabledLanguage },
|
|
||||||
{ LocaleHelper.getDisplayName(it) },
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,11 +82,11 @@ class ExtensionsScreenModel(
|
||||||
|
|
||||||
val languagesWithExtensions = _available
|
val languagesWithExtensions = _available
|
||||||
.filter(queryFilter(searchQuery))
|
.filter(queryFilter(searchQuery))
|
||||||
.groupBy { LocaleHelper.getSourceDisplayName(it.lang, context) }
|
.groupBy { it.lang }
|
||||||
.toSortedMap()
|
.toSortedMap(LocaleHelper.comparator)
|
||||||
.flatMap { (lang, exts) ->
|
.flatMap { (lang, exts) ->
|
||||||
listOf(
|
listOf(
|
||||||
ExtensionUiModel.Header.Text(lang),
|
ExtensionUiModel.Header.Text(LocaleHelper.getSourceDisplayName(lang, context)),
|
||||||
*exts.map(extensionMapper(downloads)).toTypedArray(),
|
*exts.map(extensionMapper(downloads)).toTypedArray(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@ import java.util.Locale
|
||||||
*/
|
*/
|
||||||
object LocaleHelper {
|
object LocaleHelper {
|
||||||
|
|
||||||
|
val comparator = compareBy<String>(
|
||||||
|
{ getDisplayName(it) },
|
||||||
|
{ it == "all" },
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns display name of a string language code.
|
* Returns display name of a string language code.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue