mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-05-26 03:22:10 +02:00
feat: Order bundles by number of patches
This commit is contained in:
parent
eff5c4860b
commit
222089a7ec
@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -19,13 +20,19 @@ fun BundleListScreen(
|
|||||||
selectedSources: SnapshotStateList<PatchBundleSource>,
|
selectedSources: SnapshotStateList<PatchBundleSource>,
|
||||||
bundlesSelectable: Boolean,
|
bundlesSelectable: Boolean,
|
||||||
) {
|
) {
|
||||||
|
val sortedSources = remember(sources) {
|
||||||
|
sources.sortedByDescending { source ->
|
||||||
|
source.state.value.patchBundleOrNull()?.patches?.size ?: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LazyColumnWithScrollbar(
|
LazyColumnWithScrollbar(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Top,
|
verticalArrangement = Arrangement.Top,
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
sources,
|
sortedSources,
|
||||||
key = { it.uid }
|
key = { it.uid }
|
||||||
) { source ->
|
) { source ->
|
||||||
BundleItem(
|
BundleItem(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user