mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 22:04:24 +01:00
fix to color status-bar with theming
SetStatusBarColor() was called outside of the MaterialTheme() block Also, "surface" has to be used to get the 'light primary color' Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
6fa7b8f177
commit
aeb50c6b68
@ -10,20 +10,18 @@ package com.nextcloud.talk.components
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
|
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.compose.ui.res.colorResource
|
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import com.nextcloud.talk.R
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SetStatusBarColor() {
|
fun SetStatusBarColor() {
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
val isDarkMod = isSystemInDarkTheme()
|
val isDarkMod = isSystemInDarkTheme()
|
||||||
val statusBarColor = colorResource(R.color.bg_default).toArgb()
|
val statusBarColor = MaterialTheme.colorScheme.surface.toArgb()
|
||||||
|
|
||||||
DisposableEffect(isDarkMod) {
|
DisposableEffect(isDarkMod) {
|
||||||
val activity = view.context as Activity
|
val activity = view.context as Activity
|
||||||
|
@ -68,12 +68,11 @@ class ContactsActivityCompose : BaseActivity() {
|
|||||||
contactsViewModel = contactsViewModel,
|
contactsViewModel = contactsViewModel,
|
||||||
uiState = uiState.value
|
uiState = uiState.value
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
SetStatusBarColor()
|
SetStatusBarColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class CompanionClass {
|
class CompanionClass {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -117,11 +117,10 @@ class DiagnoseActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
SetStatusBarColor()
|
SetStatusBarColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
Loading…
Reference in New Issue
Block a user