Skip to content

Commit

Permalink
Fix incorrect theme in older Android versions
Browse files Browse the repository at this point in the history
tools:targetApi is only used for the linter.
  • Loading branch information
mathiascode committed Feb 1, 2024
1 parent 4e4dc20 commit e70b27c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
8 changes: 8 additions & 0 deletions app/src/main/res/values-night-v23/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="BaseTheme.v23" />
<style name="BaseTheme.v23" parent="BaseTheme">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values-night-v27/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="BaseTheme.v27" />
<style name="BaseTheme.v27" parent="BaseTheme.v23">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
</resources>
9 changes: 2 additions & 7 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
<style name="AppTheme" parent="BaseTheme" />
<style name="BaseTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
Expand Down Expand Up @@ -29,11 +30,5 @@

<item name="android:indeterminateTint" tools:targetApi="lollipop">?attr/colorSecondary</item>
<item name="android:progressTint" tools:targetApi="lollipop">?attr/colorSecondary</item>

<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:navigationBarColor" tools:targetApi="o_mr1">@android:color/transparent</item>

<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
</style>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values-v23/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="BaseTheme.v23" />
<style name="BaseTheme.v23" parent="BaseTheme">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values-v27/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="BaseTheme.v27" />
<style name="BaseTheme.v27" parent="BaseTheme.v23">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</resources>
9 changes: 2 additions & 7 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
<style name="AppTheme" parent="BaseTheme" />
<style name="BaseTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
Expand Down Expand Up @@ -29,12 +30,6 @@

<item name="android:indeterminateTint" tools:targetApi="lollipop">?attr/colorSecondary</item>
<item name="android:progressTint" tools:targetApi="lollipop">?attr/colorSecondary</item>

<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:navigationBarColor" tools:targetApi="o_mr1">@android:color/transparent</item>

<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
</style>

<style name="Preference.SwitchPreferenceCompat">
Expand Down

0 comments on commit e70b27c

Please sign in to comment.