manager: ui changes

This commit is contained in:
tiann
2022-12-10 23:40:31 +08:00
parent e77ac86e95
commit b2e6f5cace
3 changed files with 14 additions and 9 deletions

View File

@@ -72,6 +72,8 @@ dependencies {
implementation "androidx.navigation:navigation-compose:$nav_version" implementation "androidx.navigation:navigation-compose:$nav_version"
implementation "com.google.accompanist:accompanist-drawablepainter:0.28.0" implementation "com.google.accompanist:accompanist-drawablepainter:0.28.0"
implementation "com.google.accompanist:accompanist-systemuicontroller:0.28.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1" implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"

View File

@@ -24,16 +24,17 @@ import me.weishu.kernelsu.getKernelVersion
@Composable @Composable
fun Info(label: String, value: String) { fun Info(label: String, value: String) {
Text( Text(
buildAnnotatedString { text = buildAnnotatedString {
append("$label: ") append("$label: ")
withStyle( withStyle(
style = SpanStyle( style = SpanStyle(
fontWeight = FontWeight.W900, fontWeight = FontWeight.W500,
) )
) { ) {
append(value) append(value)
} }
} },
softWrap = true,
) )
} }

View File

@@ -11,6 +11,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalView
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import com.google.accompanist.systemuicontroller.rememberSystemUiController
private val DarkColorScheme = darkColorScheme( private val DarkColorScheme = darkColorScheme(
primary = YELLOW, primary = YELLOW,
@@ -39,12 +40,13 @@ fun KernelSUTheme(
darkTheme -> DarkColorScheme darkTheme -> DarkColorScheme
else -> LightColorScheme else -> LightColorScheme
} }
val view = LocalView.current
if (!view.isInEditMode) { val systemUiController = rememberSystemUiController()
SideEffect { SideEffect {
(view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb() systemUiController.setStatusBarColor(
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme color = colorScheme.surface,
} darkIcons = !darkTheme
)
} }
MaterialTheme( MaterialTheme(