From 74df51fd1bb1f166a17f13755ae29ed3abf127c9 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 31 Aug 2026 10:54:59 -0700 Subject: [PATCH] app-ng: improve uninstalled state on home screen When Magisk is not installed: - Display "Not Installed" in error color instead of "N/A" - Use a prominent filled primary button for the Install action - Dim the Magisk icon tint to outline color Assisted-by: Gemini 3.7 Flash --- .../topjohnwu/magisk/ui/home/HomeScreen.kt | 46 +++++++++++++++---- app/core/src/main/res/values/strings.xml | 1 + 2 files changed, 37 insertions(+), 10 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 5fb55dbe6..e5bbf1bbe 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 @@ -424,14 +424,10 @@ private fun NoticeCard( private fun InstallButton( label: String, onClick: () -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, + isPrimary: Boolean = false, ) { - FilledTonalButton( - onClick = onClick, - shape = RoundedCornerShape(20.dp), - contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp), - modifier = modifier - ) { + val buttonContent = @Composable { Icon( painter = painterResource(R.drawable.ic_download), contentDescription = null, @@ -443,6 +439,26 @@ private fun InstallButton( style = MaterialTheme.typography.labelLarge, ) } + + if (isPrimary) { + Button( + onClick = onClick, + shape = RoundedCornerShape(20.dp), + contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp), + modifier = modifier, + ) { + buttonContent() + } + } else { + FilledTonalButton( + onClick = onClick, + shape = RoundedCornerShape(20.dp), + contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp), + modifier = modifier, + ) { + buttonContent() + } + } } @Composable @@ -452,6 +468,7 @@ private fun CoreCard( onInstallClicked: () -> Unit, modifier: Modifier = Modifier, ) { + val isInstalled = state != HomeViewModel.State.INVALID val actionLabel = when (state) { HomeViewModel.State.OUTDATED -> stringResource(CoreR.string.update) HomeViewModel.State.INVALID -> stringResource(CoreR.string.install) @@ -478,7 +495,7 @@ private fun CoreCard( Icon( painter = painterResource(CoreR.drawable.ic_magisk_outline), contentDescription = null, - tint = MaterialTheme.colorScheme.primary, + tint = if (isInstalled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline, modifier = Modifier.size(48.dp) ) Spacer(Modifier.width(16.dp)) @@ -488,9 +505,17 @@ private fun CoreCard( style = MaterialTheme.typography.titleLarge ) Text( - text = version.ifEmpty { stringResource(CoreR.string.not_available) }, + text = if (isInstalled) { + version.ifEmpty { stringResource(CoreR.string.not_available) } + } else { + stringResource(CoreR.string.not_installed) + }, style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = if (isInstalled) { + MaterialTheme.colorScheme.onSurfaceVariant + } else { + MaterialTheme.colorScheme.error + } ) } } @@ -499,6 +524,7 @@ private fun CoreCard( InstallButton( label = actionLabel, onClick = onInstallClicked, + isPrimary = !isInstalled, ) } } diff --git a/app/core/src/main/res/values/strings.xml b/app/core/src/main/res/values/strings.xml index 9d0846811..e83db2ebb 100644 --- a/app/core/src/main/res/values/strings.xml +++ b/app/core/src/main/res/values/strings.xml @@ -16,6 +16,7 @@ Loading… Update N/A + Not Installed Hide Package App