You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
manager: Improved UI
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
|||||||
import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination
|
import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination
|
||||||
import com.ramcosta.composedestinations.generated.destinations.ModuleScreenDestination
|
import com.ramcosta.composedestinations.generated.destinations.ModuleScreenDestination
|
||||||
import com.ramcosta.composedestinations.generated.destinations.SuperUserScreenDestination
|
import com.ramcosta.composedestinations.generated.destinations.SuperUserScreenDestination
|
||||||
|
import com.ramcosta.composedestinations.generated.destinations.SettingScreenDestination
|
||||||
import com.ramcosta.composedestinations.spec.DirectionDestinationSpec
|
import com.ramcosta.composedestinations.spec.DirectionDestinationSpec
|
||||||
import me.weishu.kernelsu.R
|
import me.weishu.kernelsu.R
|
||||||
|
|
||||||
@@ -20,5 +21,6 @@ enum class BottomBarDestination(
|
|||||||
) {
|
) {
|
||||||
Home(HomeScreenDestination, R.string.home, Icons.Filled.Home, Icons.Outlined.Home, false),
|
Home(HomeScreenDestination, R.string.home, Icons.Filled.Home, Icons.Outlined.Home, false),
|
||||||
SuperUser(SuperUserScreenDestination, R.string.superuser, Icons.Filled.Security, Icons.Outlined.Security, true),
|
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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import androidx.core.content.pm.PackageInfoCompat
|
|||||||
import com.ramcosta.composedestinations.annotation.Destination
|
import com.ramcosta.composedestinations.annotation.Destination
|
||||||
import com.ramcosta.composedestinations.annotation.RootGraph
|
import com.ramcosta.composedestinations.annotation.RootGraph
|
||||||
import com.ramcosta.composedestinations.generated.destinations.InstallScreenDestination
|
import com.ramcosta.composedestinations.generated.destinations.InstallScreenDestination
|
||||||
import com.ramcosta.composedestinations.generated.destinations.SettingScreenDestination
|
|
||||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
@@ -53,9 +52,6 @@ fun HomeScreen(navigator: DestinationsNavigator) {
|
|||||||
topBar = {
|
topBar = {
|
||||||
TopBar(
|
TopBar(
|
||||||
kernelVersion,
|
kernelVersion,
|
||||||
onSettingsClick = {
|
|
||||||
navigator.navigate(SettingScreenDestination)
|
|
||||||
},
|
|
||||||
onInstallClick = {
|
onInstallClick = {
|
||||||
navigator.navigate(InstallScreenDestination)
|
navigator.navigate(InstallScreenDestination)
|
||||||
},
|
},
|
||||||
@@ -104,6 +100,7 @@ fun HomeScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
NextCard()
|
NextCard()
|
||||||
InfoCard()
|
InfoCard()
|
||||||
|
EXperimentalCard()
|
||||||
Spacer(Modifier)
|
Spacer(Modifier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +163,6 @@ fun RebootDropdownItem(@StringRes id: Int, reason: String = "") {
|
|||||||
private fun TopBar(
|
private fun TopBar(
|
||||||
kernelVersion: KernelVersion,
|
kernelVersion: KernelVersion,
|
||||||
onInstallClick: () -> Unit,
|
onInstallClick: () -> Unit,
|
||||||
onSettingsClick: () -> Unit,
|
|
||||||
scrollBehavior: TopAppBarScrollBehavior? = null
|
scrollBehavior: TopAppBarScrollBehavior? = null
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
@@ -207,13 +203,6 @@ private fun TopBar(
|
|||||||
RebootDropdownItem(id = R.string.reboot_edl, reason = "edl")
|
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),
|
windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
|
||||||
scrollBehavior = scrollBehavior
|
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<String, Long> {
|
fun getManagerVersion(context: Context): Pair<String, Long> {
|
||||||
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!!
|
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!!
|
||||||
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo)
|
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import androidx.compose.foundation.layout.safeDrawing
|
|||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
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.automirrored.filled.Undo
|
||||||
import androidx.compose.material.icons.filled.BugReport
|
import androidx.compose.material.icons.filled.BugReport
|
||||||
import androidx.compose.material.icons.filled.Compress
|
import androidx.compose.material.icons.filled.Compress
|
||||||
@@ -105,9 +104,6 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopBar(
|
TopBar(
|
||||||
onBack = {
|
|
||||||
navigator.popBackStack()
|
|
||||||
},
|
|
||||||
scrollBehavior = scrollBehavior
|
scrollBehavior = scrollBehavior
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -438,18 +434,10 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun TopBar(
|
private fun TopBar(
|
||||||
onBack: () -> Unit = {},
|
|
||||||
scrollBehavior: TopAppBarScrollBehavior? = null
|
scrollBehavior: TopAppBarScrollBehavior? = null
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text(stringResource(R.string.settings)) },
|
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),
|
windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
|
||||||
scrollBehavior = scrollBehavior
|
scrollBehavior = scrollBehavior
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,6 +49,12 @@
|
|||||||
<string name="home_next_kernelsu">🔥 Next Build</string>
|
<string name="home_next_kernelsu">🔥 Next Build</string>
|
||||||
<string name="home_next_kernelsu_repo">https://github.com/rifsxd/KernelSU</string>
|
<string name="home_next_kernelsu_repo">https://github.com/rifsxd/KernelSU</string>
|
||||||
<string name="home_next_kernelsu_body">Next modifications branch. Check it out on GitHub!</string>
|
<string name="home_next_kernelsu_body">Next modifications branch. Check it out on GitHub!</string>
|
||||||
|
<string name="home_experimental_kernelsu">⚠️ Experimental Development Warning!</string>
|
||||||
|
<string name="home_experimental_kernelsu_repo">127.0.0.1</string>
|
||||||
|
<string name="home_experimental_kernelsu_body">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.</string>
|
||||||
|
<string name="home_experimental_kernelsu_body_point_1"> • Use at Your Own Risk: It may experience crashes, unexpected behavior, or cause system issues.</string>
|
||||||
|
<string name="home_experimental_kernelsu_body_point_2"> • No Warranty: The developers are not responsible for any data loss, system damage, or other consequences arising from its use.</string>
|
||||||
|
<string name="home_experimental_kernelsu_body_point_3"> • For Testing Purposes Only: It is intended for users who understand the risks and are comfortable troubleshooting issues.</string>
|
||||||
<string name="about_source_code"><![CDATA[View source code at %1$s]]></string>
|
<string name="about_source_code"><![CDATA[View source code at %1$s]]></string>
|
||||||
<string name="profile" translatable="false">App Profile</string>
|
<string name="profile" translatable="false">App Profile</string>
|
||||||
<string name="profile_default">Default</string>
|
<string name="profile_default">Default</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user