From 64be5dcc2e46bf38778819283cc390a224b03d0d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 30 Aug 2026 21:04:52 -0700 Subject: [PATCH] app-ng: move uninstall button to top app bar Remove the oversized uninstall button from the home screen content and place an uninstall action icon in the top app bar next to the reboot button. Assisted-by: Gemini 3.7 Flash --- .../topjohnwu/magisk/ui/home/HomeScreen.kt | 42 ++++--------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt b/app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt index 7591d3cd1..5ce5d95d1 100644 --- a/app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt +++ b/app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt @@ -244,6 +244,14 @@ fun HomeScreen( title = { Text(stringResource(CoreR.string.section_home)) }, scrollBehavior = scrollBehavior, actions = { + if (Info.env.isActive) { + IconButton(onClick = { viewModel.onDeletePressed() }) { + Icon( + imageVector = Icons.Default.Delete, + contentDescription = stringResource(CoreR.string.uninstall_magisk_title), + ) + } + } if (Info.isRooted) { RebootButton() } @@ -286,11 +294,6 @@ fun HomeScreen( onHideRestorePressed = viewModel::onHideRestorePressed, ) - UninstallButton( - onClick = { viewModel.onDeletePressed() }, - enabled = Info.env.isActive - ) - Text( text = stringResource(CoreR.string.home_support_title), style = MaterialTheme.typography.titleMedium, @@ -502,35 +505,6 @@ private fun CoreCard( } } -@Composable -private fun UninstallButton( - onClick: () -> Unit, - enabled: Boolean, - modifier: Modifier = Modifier -) { - Button( - onClick = onClick, - enabled = enabled, - colors = ButtonDefaults.buttonColors( - containerColor = MaterialTheme.colorScheme.errorContainer, - contentColor = MaterialTheme.colorScheme.onErrorContainer - ), - shape = RoundedCornerShape(20.dp), - contentPadding = PaddingValues(vertical = 12.dp), - modifier = modifier.fillMaxWidth() - ) { - Icon( - imageVector = Icons.Default.Delete, - contentDescription = null, - modifier = Modifier.size(18.dp) - ) - Spacer(Modifier.width(8.dp)) - Text( - text = stringResource(CoreR.string.uninstall_magisk_title), - style = MaterialTheme.typography.labelLarge, - ) - } -} @Composable private fun AppCard(