mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-31 14:57:32 +01:00
feat(YouTube - Settings): Sort preference screens below other types of preference
This commit is contained in:
parent
14ea9674c4
commit
9561db50a8
@ -32,17 +32,25 @@ abstract class AbstractPreferenceScreen(
|
|||||||
preferences: MutableList<BasePreference> = mutableListOf(),
|
preferences: MutableList<BasePreference> = mutableListOf(),
|
||||||
val categories: MutableList<Category> = mutableListOf()
|
val categories: MutableList<Category> = mutableListOf()
|
||||||
) : BasePreferenceCollection(key, title, preferences) {
|
) : BasePreferenceCollection(key, title, preferences) {
|
||||||
override fun transform(): PreferenceScreen {
|
override fun transform() = PreferenceScreen(
|
||||||
return PreferenceScreen(
|
|
||||||
key,
|
key,
|
||||||
StringResource("${key}_title", title),
|
StringResource(
|
||||||
preferences.sortedBy { it.title.value.removePunctuation().lowercase() } +
|
"${key}_title", title
|
||||||
categories.sortedBy { it.title.removePunctuation().lowercase() }.map { it.transform() },
|
),
|
||||||
|
preferences.sortedWith(
|
||||||
|
compareBy(
|
||||||
|
{ it is PreferenceScreen },
|
||||||
|
{ it.title.value.removePunctuation().lowercase() }
|
||||||
|
)
|
||||||
|
) + categories.sortedBy {
|
||||||
|
it.title.removePunctuation().lowercase()
|
||||||
|
}.map {
|
||||||
|
it.transform()
|
||||||
|
},
|
||||||
summary?.let { summary ->
|
summary?.let { summary ->
|
||||||
StringResource("${key}_summary", summary)
|
StringResource("${key}_summary", summary)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
private fun ensureScreenInserted() {
|
private fun ensureScreenInserted() {
|
||||||
// Add to screens if not yet done
|
// Add to screens if not yet done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user