Use tristate checkbox for denylist package toggle

Bump miuix to 0.8.6 and migrate Checkbox to the new ToggleableState
API. The package-level checkbox now shows indeterminate state when
only some processes are selected.

Made-with: Cursor
This commit is contained in:
LoveSy
2026-03-05 22:46:55 +08:00
committed by topjohnwu
parent 4d758f871b
commit a211541fc3
2 changed files with 10 additions and 5 deletions
@@ -29,6 +29,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.topjohnwu.magisk.ui.component.ListPopupDefaults.MenuPositionProvider
import com.topjohnwu.magisk.ui.util.rememberDrawablePainter
import androidx.compose.ui.state.ToggleableState
import top.yukonga.miuix.kmp.basic.Card
import top.yukonga.miuix.kmp.basic.Checkbox
import top.yukonga.miuix.kmp.basic.CircularProgressIndicator
@@ -272,8 +273,12 @@ private fun DenyAppCard(app: DenyAppState) {
}
Spacer(Modifier.width(8.dp))
Checkbox(
checked = app.isChecked,
onCheckedChange = { app.toggleAll() }
state = when {
app.itemsChecked == 0 -> ToggleableState.Off
app.checkedPercent < 1f -> ToggleableState.Indeterminate
else -> ToggleableState.On
},
onClick = { app.toggleAll() }
)
}
@@ -310,8 +315,8 @@ private fun ProcessRow(proc: DenyProcessState) {
)
Spacer(Modifier.width(8.dp))
Checkbox(
checked = proc.isEnabled,
onCheckedChange = { proc.toggle() }
state = ToggleableState(proc.isEnabled),
onClick = { proc.toggle() }
)
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ room = "2.8.4"
compose-bom = "2026.02.01"
lifecycle = "2.10.0"
activity-compose = "1.12.4"
miuix = "0.8.5"
miuix = "0.8.6"
navigation3 = "1.1.0-alpha05"
navigationevent = "1.0.2"
[libraries]