diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt index 803d33df..682ff9e9 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt @@ -191,14 +191,19 @@ fun GroupsPanel(selected: List, closeSelection: (selection: Set) var showDialog by remember { mutableStateOf(false) } if (showDialog) { - val groups = Groups.values().sortedWith(compareBy { - when (it) { - Groups.ROOT -> 0 - Groups.SYSTEM -> 1 - Groups.SHELL -> 2 - else -> Int.MAX_VALUE - } - }.then(compareBy { it.name })) + val groups = Groups.values().sortedWith( + compareBy { if (selected.contains(it)) 0 else 1 } + .then(compareBy { + when (it) { + Groups.ROOT -> 0 + Groups.SYSTEM -> 1 + Groups.SHELL -> 2 + else -> Int.MAX_VALUE + } + }) + .then(compareBy { it.name }) + + ) val options = groups.map { value -> ListOption( titleText = value.display, @@ -264,7 +269,10 @@ fun CapsPanel( var showDialog by remember { mutableStateOf(false) } if (showDialog) { - val caps = Capabilities.values().sortedBy { it.name } + val caps = Capabilities.values().sortedWith( + compareBy { if (selected.contains(it)) 0 else 1 } + .then(compareBy { it.name }) + ) val options = caps.map { value -> ListOption( titleText = value.display,