mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
manager: pin the selected items to the top of the groups and capabilities list (#1285)
This commit is contained in:
parent
e934bfb648
commit
1637864636
@ -191,14 +191,19 @@ fun GroupsPanel(selected: List<Groups>, closeSelection: (selection: Set<Groups>)
|
|||||||
var showDialog by remember { mutableStateOf(false) }
|
var showDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
val groups = Groups.values().sortedWith(compareBy<Groups> {
|
val groups = Groups.values().sortedWith(
|
||||||
when (it) {
|
compareBy<Groups> { if (selected.contains(it)) 0 else 1 }
|
||||||
Groups.ROOT -> 0
|
.then(compareBy {
|
||||||
Groups.SYSTEM -> 1
|
when (it) {
|
||||||
Groups.SHELL -> 2
|
Groups.ROOT -> 0
|
||||||
else -> Int.MAX_VALUE
|
Groups.SYSTEM -> 1
|
||||||
}
|
Groups.SHELL -> 2
|
||||||
}.then(compareBy { it.name }))
|
else -> Int.MAX_VALUE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(compareBy { it.name })
|
||||||
|
|
||||||
|
)
|
||||||
val options = groups.map { value ->
|
val options = groups.map { value ->
|
||||||
ListOption(
|
ListOption(
|
||||||
titleText = value.display,
|
titleText = value.display,
|
||||||
@ -264,7 +269,10 @@ fun CapsPanel(
|
|||||||
var showDialog by remember { mutableStateOf(false) }
|
var showDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
val caps = Capabilities.values().sortedBy { it.name }
|
val caps = Capabilities.values().sortedWith(
|
||||||
|
compareBy<Capabilities> { if (selected.contains(it)) 0 else 1 }
|
||||||
|
.then(compareBy { it.name })
|
||||||
|
)
|
||||||
val options = caps.map { value ->
|
val options = caps.map { value ->
|
||||||
ListOption(
|
ListOption(
|
||||||
titleText = value.display,
|
titleText = value.display,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user