Skip to content

Commit bbe8c4e

Browse files
committed
fix title bar color on chromeos
1 parent 0b5bff0 commit bbe8c4e

7 files changed

Lines changed: 35 additions & 20 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
minSdk 27
1515
targetSdk 36
1616
versionCode = date.format("yyyyMMdd").toInteger()
17-
versionName "1.8.1"
17+
versionName "1.8.2"
1818

1919
ksp {
2020
arg("room.schemaLocation", "$projectDir/schemas")

app/src/main/java/cn/ac/lz233/tarnhelm/App.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class App : Application() {
114114
.setPrecondition { activity, theme ->
115115
!(activity.localClassName.startsWith("ui.process") or activity.localClassName.startsWith("ui.settings.backup"))
116116
}
117-
.setThemeOverlay(R.style.Theme_Tarnhelm_DynamicColors)
117+
.setThemeOverlay(R.style.ThemeOverlay_Tarnhelm_DynamicColors)
118118
.build()
119119
)
120120
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<resources>
2+
3+
<style name="Base.Tarnhelm.DayNight.DynamicColors" parent="Base.Tarnhelm.DayNight">
4+
<!-- Fix title bar color on ChromeOS. On devices that support dynamic colors, the app bar will not change color when scrolling, so it is safe to fix . -->
5+
<item name="android:statusBarColor">@android:color/system_neutral1_900</item>
6+
<item name="android:colorBackground">@android:color/system_neutral1_900</item>
7+
<item name="android:windowBackground">@android:color/system_neutral1_900</item>
8+
</style>
9+
10+
<style name="ThemeOverlay.Tarnhelm.DynamicColors" parent="Theme.Tarnhelm">
11+
<item name="colorSurface">@android:color/system_neutral1_900</item>
12+
</style>
13+
</resources>

app/src/main/res/values-night-v32/themes.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<style name="Base.Tarnhelm.DayNight.DynamicColors" parent="Base.Tarnhelm.DayNight">
5+
<!-- Fix title bar color on ChromeOS. On devices that support dynamic colors, the app bar will not change color when scrolling, so it is safe to fix . -->
6+
<item name="android:statusBarColor">@android:color/system_neutral1_50</item>
7+
<item name="android:colorBackground">@android:color/system_neutral1_50</item>
8+
<item name="android:windowBackground">@android:color/system_neutral1_50</item>
9+
</style>
10+
11+
<style name="ThemeOverlay.Tarnhelm.DynamicColors" parent="Theme.Tarnhelm">
12+
<item name="colorSurface">@android:color/system_neutral1_50</item>
13+
</style>
14+
</resources>

app/src/main/res/values-v32/themes.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

app/src/main/res/values/themes.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
<item name="android:windowLightNavigationBar">true</item>
2323
</style>
2424

25-
<style name="Theme.Tarnhelm" parent="Base.Tarnhelm.DayNight">
25+
<style name="Base.Tarnhelm.DayNight.DynamicColors" parent="Base.Tarnhelm.DayNight">
26+
27+
</style>
28+
29+
<style name="Theme.Tarnhelm" parent="Base.Tarnhelm.DayNight.DynamicColors">
2630
<item name="colorPrimary">@color/md_theme_primary</item>
2731
<item name="colorOnPrimary">@color/md_theme_onPrimary</item>
2832
<item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item>
@@ -50,7 +54,7 @@
5054
<item name="colorPrimaryInverse">@color/md_theme_inversePrimary</item>
5155
</style>
5256

53-
<style name="Theme.Tarnhelm.NoDisplay" parent="Base.Tarnhelm.DayNight">
57+
<style name="Theme.Tarnhelm.NoDisplay" parent="Base.Tarnhelm.DayNight.DynamicColors">
5458
<item name="windowActionBar">false</item>
5559
<item name="windowNoTitle">true</item>
5660
<item name="android:windowBackground">@android:color/transparent</item>

0 commit comments

Comments
 (0)