update color scheme
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
||||
alias(libs.plugins.convention.serialization)
|
||||
}
|
||||
|
||||
val appVersion = "1.0.2"
|
||||
val appVersion = "1.0.3"
|
||||
|
||||
android {
|
||||
buildFeatures { buildConfig = true }
|
||||
|
||||
+5
-17
@@ -1,11 +1,8 @@
|
||||
package ru.shadowsparky.gigawear.presentation
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import com.arkivanov.decompose.retainedComponent
|
||||
import org.koin.android.ext.android.inject
|
||||
import ru.shadowsparky.gigawear.presentation.auth.AuthScreen
|
||||
@@ -13,8 +10,6 @@ import ru.shadowsparky.gigawear.presentation.chat.ChatScreen
|
||||
import ru.shadowsparky.gigawear.presentation.nav.Child
|
||||
import ru.shadowsparky.gigawear.presentation.routing.RoutingScreen
|
||||
import ru.shadowsparky.ui.nav.Nav
|
||||
import ru.shadowsparky.ui.theme.LocalColorSchemeProvider
|
||||
import ru.shadowsparky.ui.theme.darkScheme
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private val rootFactory by inject<RootComponentFactory>()
|
||||
@@ -23,18 +18,11 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
val root = retainedComponent { rootFactory.create(it) }
|
||||
setContent {
|
||||
val scheme = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
dynamicDarkColorScheme(this)
|
||||
} else {
|
||||
darkScheme
|
||||
}
|
||||
CompositionLocalProvider(LocalColorSchemeProvider provides scheme) {
|
||||
Nav(root) { child, _ ->
|
||||
when (child) {
|
||||
is Child.MainChild -> ChatScreen(child.component)
|
||||
is Child.AuthChild -> AuthScreen(child.component)
|
||||
is Child.RoutingChild -> RoutingScreen(child.component)
|
||||
}
|
||||
Nav(root) { child, _ ->
|
||||
when (child) {
|
||||
is Child.MainChild -> ChatScreen(child.component)
|
||||
is Child.AuthChild -> AuthScreen(child.component)
|
||||
is Child.RoutingChild -> RoutingScreen(child.component)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import ru.shadowsparky.ui.theme.getColorScheme
|
||||
import ru.shadowsparky.ui.util.isWear
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||
@Composable
|
||||
@@ -45,7 +44,7 @@ fun AlertContent(
|
||||
}
|
||||
}
|
||||
MaterialExpressiveTheme(getColorScheme()) {
|
||||
if (isTv() || isWear()) {
|
||||
if (isTv()) {
|
||||
BasicAlertDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
modifier = modifier,
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.compositionLocalOf
|
||||
import ru.shadowsparky.ui.util.isWear
|
||||
|
||||
val lightScheme = lightColorScheme(
|
||||
primary = primaryLight,
|
||||
@@ -88,7 +89,7 @@ val LocalColorSchemeProvider = compositionLocalOf<ColorScheme?> { null }
|
||||
@Composable
|
||||
fun getColorScheme(): ColorScheme {
|
||||
return LocalColorSchemeProvider.current ?: when {
|
||||
isSystemInDarkTheme() -> darkDynamicScheme() ?: darkScheme
|
||||
isSystemInDarkTheme() || isWear() -> darkDynamicScheme() ?: darkScheme
|
||||
else -> lightDynamicScheme() ?: lightScheme
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user