Skip to content

Commit

Permalink
Change status and navigation bar colors to surfaceContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
wmontwe committed Apr 29, 2024
1 parent 35d1b45 commit fafb40d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ package app.k9mail.ui.catalog

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.enableEdgeToEdge
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import app.k9mail.core.ui.compose.common.activity.setActivityContent
import app.k9mail.ui.catalog.ui.CatalogScreen

class CatalogActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
enableEdgeToEdge()

super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)

setActivityContent {
CatalogScreen()
}
Expand Down
10 changes: 6 additions & 4 deletions app/ui/legacy/src/main/res/values-v23/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
<resources>

<style name="Theme.K9.Light" parent="Theme.K9.Light.Common">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">?attr/colorSurfaceContainer</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>

<item name="android:navigationBarColor">?attr/colorSurfaceInverse</item>
</style>

<style name="Theme.K9.Dark" parent="Theme.K9.Dark.Common">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">?attr/colorSurfaceContainer</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>

<item name="android:navigationBarColor">?attr/colorSurfaceContainer</item>
</style>

</resources>
8 changes: 4 additions & 4 deletions app/ui/legacy/src/main/res/values-v27/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<resources>

<style name="Theme.K9.Light" parent="Theme.K9.Light.Common">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">?attr/colorSurfaceContainer</item>
<item name="android:windowLightStatusBar">true</item>

<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">?attr/colorSurfaceContainer</item>
<item name="android:windowLightNavigationBar">true</item>
</style>

<style name="Theme.K9.Dark" parent="Theme.K9.Dark.Common">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">?attr/colorSurfaceContainer</item>
<item name="android:windowLightStatusBar">false</item>

<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">?attr/colorSurfaceContainer</item>
<item name="android:windowLightNavigationBar">false</item>
</style>

Expand Down
8 changes: 4 additions & 4 deletions app/ui/legacy/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@
</style>

<style name="Theme.K9.Light" parent="Theme.K9.Light.Common">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">?attr/colorSurfaceInverse</item>
<item name="android:navigationBarColor">?attr/colorSurfaceInverse</item>
</style>

<style name="Theme.K9.Dark" parent="Theme.K9.Dark.Common">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">?attr/colorSurfaceContainer</item>
<item name="android:navigationBarColor">?attr/colorSurfaceContainer</item>
</style>

<style name="Theme.K9.Dark.Common" parent="Theme.K9.Dark.Base">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ fun SystemBar(
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.surface.toArgb()
window.navigationBarColor = colorScheme.surface.toArgb()
window.statusBarColor = colorScheme.surfaceContainer.toArgb()
window.navigationBarColor = colorScheme.surfaceContainer.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}
Expand Down

0 comments on commit fafb40d

Please sign in to comment.