From c52d1289681c9c8979af120dac966b8040fcaf4e Mon Sep 17 00:00:00 2001 From: Rifat Azad Date: Sat, 14 Dec 2024 21:19:28 +0600 Subject: [PATCH] manager: Improved UI --- .../ui/screen/BottomBarDestination.kt | 4 +- .../java/me/weishu/kernelsu/ui/screen/Home.kt | 58 +++++++++++++++---- .../me/weishu/kernelsu/ui/screen/Settings.kt | 12 ---- manager/app/src/main/res/values/strings.xml | 6 ++ 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt index c9637ed2..324e09cb 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt @@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.vector.ImageVector import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination import com.ramcosta.composedestinations.generated.destinations.ModuleScreenDestination import com.ramcosta.composedestinations.generated.destinations.SuperUserScreenDestination +import com.ramcosta.composedestinations.generated.destinations.SettingScreenDestination import com.ramcosta.composedestinations.spec.DirectionDestinationSpec import me.weishu.kernelsu.R @@ -20,5 +21,6 @@ enum class BottomBarDestination( ) { Home(HomeScreenDestination, R.string.home, Icons.Filled.Home, Icons.Outlined.Home, false), SuperUser(SuperUserScreenDestination, R.string.superuser, Icons.Filled.Security, Icons.Outlined.Security, true), - Module(ModuleScreenDestination, R.string.module, Icons.Filled.Apps, Icons.Outlined.Apps, true) + Module(ModuleScreenDestination, R.string.module, Icons.Filled.Layers, Icons.Outlined.Layers, true), + Settings(SettingScreenDestination, R.string.module, Icons.Filled.Settings, Icons.Outlined.Settings, true) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt index 0b65fbd8..06bd45f2 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt @@ -32,7 +32,6 @@ import androidx.core.content.pm.PackageInfoCompat import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.destinations.InstallScreenDestination -import com.ramcosta.composedestinations.generated.destinations.SettingScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -53,9 +52,6 @@ fun HomeScreen(navigator: DestinationsNavigator) { topBar = { TopBar( kernelVersion, - onSettingsClick = { - navigator.navigate(SettingScreenDestination) - }, onInstallClick = { navigator.navigate(InstallScreenDestination) }, @@ -104,6 +100,7 @@ fun HomeScreen(navigator: DestinationsNavigator) { } NextCard() InfoCard() + EXperimentalCard() Spacer(Modifier) } } @@ -166,7 +163,6 @@ fun RebootDropdownItem(@StringRes id: Int, reason: String = "") { private fun TopBar( kernelVersion: KernelVersion, onInstallClick: () -> Unit, - onSettingsClick: () -> Unit, scrollBehavior: TopAppBarScrollBehavior? = null ) { TopAppBar( @@ -207,13 +203,6 @@ private fun TopBar( RebootDropdownItem(id = R.string.reboot_edl, reason = "edl") } } - - IconButton(onClick = onSettingsClick) { - Icon( - imageVector = Icons.Filled.Settings, - contentDescription = stringResource(id = R.string.settings) - ) - } }, windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), scrollBehavior = scrollBehavior @@ -407,6 +396,51 @@ fun NextCard() { } } +@Composable +fun EXperimentalCard() { + /*val uriHandler = LocalUriHandler.current + val url = stringResource(R.string.home_experimental_kernelsu_repo) + */ + + ElevatedCard { + + Row(modifier = Modifier + .fillMaxWidth() + /*.clickable { + uriHandler.openUri(url) + } + */ + .padding(24.dp), verticalAlignment = Alignment.CenterVertically) { + Column { + Text( + text = stringResource(R.string.home_experimental_kernelsu), + style = MaterialTheme.typography.titleSmall + ) + Spacer(Modifier.height(4.dp)) + Text( + text = stringResource(R.string.home_experimental_kernelsu_body), + style = MaterialTheme.typography.bodyMedium + ) + Spacer(Modifier.height(4.dp)) + Text( + text = stringResource(R.string.home_experimental_kernelsu_body_point_1), + style = MaterialTheme.typography.bodyMedium + ) + Spacer(Modifier.height(2.dp)) + Text( + text = stringResource(R.string.home_experimental_kernelsu_body_point_2), + style = MaterialTheme.typography.bodyMedium + ) + Spacer(Modifier.height(2.dp)) + Text( + text = stringResource(R.string.home_experimental_kernelsu_body_point_3), + style = MaterialTheme.typography.bodyMedium + ) + } + } + } +} + fun getManagerVersion(context: Context): Pair { val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!! val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt index 3b7fc10b..1b2b5e89 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt @@ -18,7 +18,6 @@ import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.Undo import androidx.compose.material.icons.filled.BugReport import androidx.compose.material.icons.filled.Compress @@ -105,9 +104,6 @@ fun SettingScreen(navigator: DestinationsNavigator) { Scaffold( topBar = { TopBar( - onBack = { - navigator.popBackStack() - }, scrollBehavior = scrollBehavior ) }, @@ -438,18 +434,10 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle { @OptIn(ExperimentalMaterial3Api::class) @Composable private fun TopBar( - onBack: () -> Unit = {}, scrollBehavior: TopAppBarScrollBehavior? = null ) { TopAppBar( title = { Text(stringResource(R.string.settings)) }, - navigationIcon = { - IconButton( - onClick = onBack - ) { - Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) - } - }, windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), scrollBehavior = scrollBehavior ) diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml index 20177573..f23d4aa9 100644 --- a/manager/app/src/main/res/values/strings.xml +++ b/manager/app/src/main/res/values/strings.xml @@ -49,6 +49,12 @@ 🔥 Next Build https://github.com/rifsxd/KernelSU Next modifications branch. Check it out on GitHub! + ⚠️ Experimental Development Warning! + 127.0.0.1 + Next is a non-official build which is always under active experimental development. It is provided as-is, with no guarantees of stability, performance, or reliability. + • Use at Your Own Risk: It may experience crashes, unexpected behavior, or cause system issues. + • No Warranty: The developers are not responsible for any data loss, system damage, or other consequences arising from its use. + • For Testing Purposes Only: It is intended for users who understand the risks and are comfortable troubleshooting issues. App Profile Default