mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 10:37:05 +05:30
android: set system bar colors
This commit is contained in:
parent
a5b04b9530
commit
6bbd236203
3 changed files with 14 additions and 0 deletions
|
@ -12,6 +12,7 @@ dependencies {
|
|||
kapt(libs.dagger.hilt.compiler)
|
||||
implementation(projects.api)
|
||||
implementation(projects.common)
|
||||
implementation(libs.accompanist.sysuicontroller)
|
||||
implementation(libs.androidx.activity.compose)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.paging.compose)
|
||||
|
|
|
@ -8,14 +8,17 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Scaffold
|
||||
import androidx.compose.material.primarySurface
|
||||
import androidx.compose.material.rememberScaffoldState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.paging.LoadState
|
||||
import androidx.paging.Pager
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import dev.msfjarvis.claw.api.model.LobstersPost
|
||||
import dev.msfjarvis.claw.common.theme.LobstersTheme
|
||||
import dev.msfjarvis.claw.common.urllauncher.UrlLauncher
|
||||
|
@ -25,8 +28,15 @@ fun LobstersApp(
|
|||
pager: Pager<Int, LobstersPost>,
|
||||
urlLauncher: UrlLauncher,
|
||||
) {
|
||||
val systemUiController = rememberSystemUiController()
|
||||
val scaffoldState = rememberScaffoldState()
|
||||
LobstersTheme(darkTheme = isSystemInDarkTheme()) {
|
||||
val useDarkIcons = MaterialTheme.colors.isLight
|
||||
val systemBarsColor = MaterialTheme.colors.primarySurface
|
||||
|
||||
SideEffect {
|
||||
systemUiController.setSystemBarsColor(color = systemBarsColor, darkIcons = useDarkIcons)
|
||||
}
|
||||
val items = pager.flow.collectAsLazyPagingItems()
|
||||
Scaffold(
|
||||
scaffoldState = scaffoldState,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[versions]
|
||||
accompanist = "0.18.0"
|
||||
coroutines = "1.5.2"
|
||||
hilt = "2.38.1"
|
||||
moshix = "0.14.1"
|
||||
|
@ -11,6 +12,8 @@ kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines
|
|||
kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||
kotlin-coroutines-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "coroutines" }
|
||||
|
||||
accompanist-sysuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
|
||||
|
||||
androidx-activity-compose = "androidx.activity:activity-compose:1.4.0-alpha02"
|
||||
androidx-appcompat = "androidx.appcompat:appcompat:1.4.0-alpha03"
|
||||
androidx-browser = "androidx.browser:browser:1.4.0-alpha01"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue