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:
Marcel Hibbe 2025-03-10 13:32:20 +01:00
parent 6fa7b8f177
commit aeb50c6b68
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
3 changed files with 4 additions and 8 deletions

View File

@ -10,20 +10,18 @@ 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.compose.ui.res.colorResource
import androidx.core.view.WindowCompat
import com.nextcloud.talk.R
@Composable
fun SetStatusBarColor() {
val view = LocalView.current
val isDarkMod = isSystemInDarkTheme()
val statusBarColor = colorResource(R.color.bg_default).toArgb()
val statusBarColor = MaterialTheme.colorScheme.surface.toArgb()
DisposableEffect(isDarkMod) {
val activity = view.context as Activity

View File

@ -68,12 +68,11 @@ class ContactsActivityCompose : BaseActivity() {
contactsViewModel = contactsViewModel,
uiState = uiState.value
)
}
SetStatusBarColor()
}
}
}
}
class CompanionClass {
companion object {

View File

@ -117,11 +117,10 @@ class DiagnoseActivity : BaseActivity() {
}
}
)
}
SetStatusBarColor()
}
}
}
override fun onResume() {
super.onResume()