mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-07 04:49:41 +01:00
(as it also colors the navigation bar buttons..) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
37 lines
1.2 KiB
Kotlin
37 lines
1.2 KiB
Kotlin
/*
|
|
* Nextcloud Talk - Android Client
|
|
*
|
|
* SPDX-FileCopyrightText: 2024 Sowjanya Kota <sowjanya.kch@gmail.com>
|
|
* SPDX-FileCopyrightText: 2025 Marcel Hibbe <dev@mhibbe.de>
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
package com.nextcloud.talk.components
|
|
|
|
import android.app.Activity
|
|
import androidx.compose.foundation.isSystemInDarkTheme
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.DisposableEffect
|
|
import androidx.compose.ui.graphics.toArgb
|
|
import androidx.compose.ui.platform.LocalView
|
|
import androidx.core.view.WindowCompat
|
|
|
|
@Composable
|
|
fun SetupSystemBars() {
|
|
val view = LocalView.current
|
|
val isDarkMode = isSystemInDarkTheme()
|
|
val statusBarColor = MaterialTheme.colorScheme.surface.toArgb()
|
|
|
|
DisposableEffect(isDarkMode) {
|
|
val activity = view.context as Activity
|
|
activity.window.statusBarColor = statusBarColor
|
|
|
|
WindowCompat.getInsetsController(activity.window, activity.window.decorView).apply {
|
|
isAppearanceLightStatusBars = !isDarkMode
|
|
isAppearanceLightNavigationBars = !isDarkMode
|
|
}
|
|
onDispose { }
|
|
}
|
|
}
|