From e8755f8ae0086492fb3c39d1f0c6821ae3da856e Mon Sep 17 00:00:00 2001 From: weishu Date: Mon, 5 Jun 2023 08:29:24 +0800 Subject: [PATCH] manager: Fix groups and caps selection, close #592 --- .../kernelsu/ui/component/profile/RootProfileConfig.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 8a51c11e..5e1ff4f3 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 @@ -181,7 +181,7 @@ fun RootProfileConfig( @OptIn(ExperimentalLayoutApi::class) @Composable -fun GroupsPanel(selected: List, closeSelection: (selection: List) -> Unit) { +fun GroupsPanel(selected: List, closeSelection: (selection: Set) -> Unit) { var showDialog by remember { mutableStateOf(false) } @@ -194,7 +194,7 @@ fun GroupsPanel(selected: List, closeSelection: (selection: List ) } - val selection = ArrayList(selected) + val selection = HashSet(selected) ListDialog( state = rememberUseCaseState(visible = true, onFinishedRequest = { closeSelection(selection) @@ -206,6 +206,7 @@ fun GroupsPanel(selected: List, closeSelection: (selection: List options = options, ) { indecies, _ -> // Handle selection + selection.clear() indecies.forEach { index -> val group = groups[index] selection.add(group) @@ -240,7 +241,7 @@ fun GroupsPanel(selected: List, closeSelection: (selection: List @Composable fun CapsPanel( selected: Collection, - closeSelection: (selection: List) -> Unit + closeSelection: (selection: Set) -> Unit ) { var showDialog by remember { mutableStateOf(false) } @@ -254,7 +255,7 @@ fun CapsPanel( ) } - val selection = ArrayList(selected) + val selection = HashSet(selected) ListDialog( state = rememberUseCaseState(visible = true, onFinishedRequest = { closeSelection(selection) @@ -266,6 +267,7 @@ fun CapsPanel( options = options ) { indecies, _ -> // Handle selection + selection.clear() indecies.forEach { index -> val group = caps[index] selection.add(group)