Skip to content

Commit 222089a

Browse files
CnC-RobertoSumAtrIX
authored andcommitted
feat: Order bundles by number of patches
1 parent eff5c48 commit 222089a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/app/revanced/manager/ui/screen/BundleListScreen.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.foundation.layout.fillMaxSize
55
import androidx.compose.foundation.lazy.items
66
import androidx.compose.runtime.Composable
7+
import androidx.compose.runtime.remember
78
import androidx.compose.runtime.snapshots.SnapshotStateList
89
import androidx.compose.ui.Alignment
910
import androidx.compose.ui.Modifier
@@ -19,13 +20,19 @@ fun BundleListScreen(
1920
selectedSources: SnapshotStateList<PatchBundleSource>,
2021
bundlesSelectable: Boolean,
2122
) {
23+
val sortedSources = remember(sources) {
24+
sources.sortedByDescending { source ->
25+
source.state.value.patchBundleOrNull()?.patches?.size ?: 0
26+
}
27+
}
28+
2229
LazyColumnWithScrollbar(
2330
modifier = Modifier.fillMaxSize(),
2431
horizontalAlignment = Alignment.CenterHorizontally,
2532
verticalArrangement = Arrangement.Top,
2633
) {
2734
items(
28-
sources,
35+
sortedSources,
2936
key = { it.uid }
3037
) { source ->
3138
BundleItem(

0 commit comments

Comments
 (0)