Refactor Styles, disable colored navigation bar when we can't be sure that navigation bar buttons will have enough contrast (API < 27)

This commit is contained in:
krlvm 2021-03-28 22:51:44 +03:00
parent 8d64eac853
commit 8002cc2771
No known key found for this signature in database
GPG Key ID: B8552A91FD265536
4 changed files with 53 additions and 43 deletions

View File

@ -1,28 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Base.V21.OpeningTheme" parent="Base.V7.OpeningTheme"> <!-- Opening Theme -->
<style name="Base.V21.OpeningTheme" parent="Base.V19.OpeningTheme">
<item name="android:navigationBarColor">@color/light_youtube_primary_color</item> <item name="android:navigationBarColor">@color/light_youtube_primary_color</item>
</style> </style>
<style name="Base.OpeningTheme" parent="Base.V21.OpeningTheme" /> <style name="Base.OpeningTheme" parent="Base.V21.OpeningTheme" />
<style name="Base.V21.LightTheme" parent="Base.V7.LightTheme"> <!-- Base Theme -->
<item name="android:navigationBarColor">@android:color/transparent</item> <style name="Base.V21" parent="Base.V19"/>
</style> <style name="Base" parent="Base.V21"/>
<!-- Light Theme -->
<style name="Base.V21.LightTheme" parent="Base.V19.LightTheme">
</style>
<style name="Base.LightTheme" parent="Base.V21.LightTheme" /> <style name="Base.LightTheme" parent="Base.V21.LightTheme" />
<style name="Base.V21.DarkTheme" parent="Base.V7.DarkTheme"> <!-- Dark Theme -->
<item name="android:navigationBarColor">@android:color/transparent</item> <style name="Base.V21.DarkTheme" parent="Base.V19.DarkTheme">
</style>
</style>
<style name="Base.DarkTheme" parent="Base.V21.DarkTheme" /> <style name="Base.DarkTheme" parent="Base.V21.DarkTheme" />
<style name="Base.V21.BlackTheme" parent="Base.V7.BlackTheme"> <!-- Black Theme -->
<item name="android:navigationBarColor">@android:color/transparent</item> <style name="Base.V21.BlackTheme" parent="Base.V19.BlackTheme">
</style>
</style>
<style name="Base.BlackTheme" parent="Base.V21.BlackTheme" /> <style name="Base.BlackTheme" parent="Base.V21.BlackTheme" />
</resources> </resources>

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Base Theme -->
<style name="Base.V27" parent="Base.V21">
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Base" parent="Base.V27"/>
<!-- Light Theme -->
<style name="Base.V27.LightTheme" parent="Base.V21.LightTheme"> <style name="Base.V27.LightTheme" parent="Base.V21.LightTheme">
<item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightNavigationBar">true</item>
</style> </style>
<style name="Base.LightTheme" parent="Base.V27.LightTheme" /> <style name="Base.LightTheme" parent="Base.V27.LightTheme" />
<!-- Dark Theme -->
<style name="Base.V27.DarkTheme" parent="Base.V21.DarkTheme"> <style name="Base.V27.DarkTheme" parent="Base.V21.DarkTheme">
<item name="android:windowLightNavigationBar">false</item> <item name="android:windowLightNavigationBar">false</item>
</style> </style>
<style name="Base.DarkTheme" parent="Base.V27.DarkTheme" /> <style name="Base.DarkTheme" parent="Base.V27.DarkTheme" />
<!-- Black Theme -->
<style name="Base.V27.BlackTheme" parent="Base.V21.BlackTheme"> <style name="Base.V27.BlackTheme" parent="Base.V21.BlackTheme">
<item name="android:windowLightNavigationBar">false</item> <!-- BlackTheme inherits DarkTheme, so no need to specify windowLightNavigationBar here -->
</style> </style>
<style name="Base.BlackTheme" parent="Base.V27.BlackTheme" /> <style name="Base.BlackTheme" parent="Base.V27.BlackTheme" />
</resources> </resources>

View File

@ -1,22 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Base.V29.LightTheme" parent="Base.V27.LightTheme"> <!-- Base Theme -->
<style name="Base.V29" parent="Base.V27">
<item name="android:enforceNavigationBarContrast">false</item> <item name="android:enforceNavigationBarContrast">false</item>
</style> </style>
<style name="Base" parent="Base.V29"/>
<!-- Light Theme -->
<style name="Base.V29.LightTheme" parent="Base.V27.LightTheme">
</style>
<style name="Base.LightTheme" parent="Base.V29.LightTheme" /> <style name="Base.LightTheme" parent="Base.V29.LightTheme" />
<!-- Dark Theme -->
<style name="Base.V29.DarkTheme" parent="Base.V27.DarkTheme"> <style name="Base.V29.DarkTheme" parent="Base.V27.DarkTheme">
<item name="android:enforceNavigationBarContrast">false</item>
</style>
</style>
<style name="Base.DarkTheme" parent="Base.V29.DarkTheme" /> <style name="Base.DarkTheme" parent="Base.V29.DarkTheme" />
<!-- Black Theme -->
<style name="Base.V29.BlackTheme" parent="Base.V27.BlackTheme"> <style name="Base.V29.BlackTheme" parent="Base.V27.BlackTheme">
<item name="android:enforceNavigationBarContrast">false</item>
</style>
</style>
<style name="Base.BlackTheme" parent="Base.V29.BlackTheme" /> <style name="Base.BlackTheme" parent="Base.V29.BlackTheme" />
</resources> </resources>

View File

@ -1,9 +1,8 @@
<resources> <resources>
<style name="Base.V7.OpeningTheme" parent="Theme.AppCompat.DayNight.NoActionBar"/> <!-- Opening Theme -->
<style name="Base.V19.OpeningTheme" parent="Theme.AppCompat.DayNight.NoActionBar"/>
<style name="Base.OpeningTheme" parent="Base.V7.OpeningTheme"/> <style name="Base.OpeningTheme" parent="Base.V19.OpeningTheme"/>
<style name="OpeningTheme" parent="Base.OpeningTheme"> <style name="OpeningTheme" parent="Base.OpeningTheme">
<item name="colorPrimary">@android:color/transparent</item> <item name="colorPrimary">@android:color/transparent</item>
<item name="colorPrimaryDark">@android:color/transparent</item> <item name="colorPrimaryDark">@android:color/transparent</item>
@ -12,18 +11,14 @@
<item name="android:windowBackground">@drawable/splash_background</item> <item name="android:windowBackground">@drawable/splash_background</item>
</style> </style>
<!-- Base themes --> <!-- Base Theme -->
<style name="Base.V7" parent="Theme.AppCompat.DayNight.NoActionBar"> <style name="Base.V19" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
</style> </style>
<style name="Base" parent="Base.V19"/>
<style name="Base" parent="Base.V7"/> <!-- Light Theme -->
<style name="Base.V19.LightTheme" parent="Base">
<style name="Base.V7.LightTheme" parent="Base" />
<style name="Base.LightTheme" parent="Base.V7.LightTheme" />
<style name="LightTheme" parent="Base.LightTheme">
<item name="colorPrimary">@color/light_youtube_primary_color</item> <item name="colorPrimary">@color/light_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/light_youtube_primary_color</item> <item name="colorPrimaryDark">@color/light_youtube_primary_color</item>
<item name="colorAccent">@color/light_youtube_accent_color</item> <item name="colorAccent">@color/light_youtube_accent_color</item>
@ -43,12 +38,11 @@
<item name="border_color">@color/light_border_color</item> <item name="border_color">@color/light_border_color</item>
<item name="dashed_border">@drawable/dashed_border_light</item> <item name="dashed_border">@drawable/dashed_border_light</item>
</style> </style>
<style name="Base.LightTheme" parent="Base.V19.LightTheme" />
<style name="LightTheme" parent="Base.LightTheme"/>
<style name="Base.V7.DarkTheme" parent="Base" /> <!-- Dark Theme -->
<style name="Base.V19.DarkTheme" parent="Base">
<style name="Base.DarkTheme" parent="Base.V7.DarkTheme" />
<style name="DarkTheme" parent="Base.DarkTheme">
<item name="colorPrimary">@color/dark_youtube_primary_color</item> <item name="colorPrimary">@color/dark_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/dark_youtube_primary_color</item> <item name="colorPrimaryDark">@color/dark_youtube_primary_color</item>
<item name="colorAccent">@color/dark_youtube_accent_color</item> <item name="colorAccent">@color/dark_youtube_accent_color</item>
@ -68,12 +62,11 @@
<item name="border_color">@color/dark_border_color</item> <item name="border_color">@color/dark_border_color</item>
<item name="dashed_border">@drawable/dashed_border_dark</item> <item name="dashed_border">@drawable/dashed_border_dark</item>
</style> </style>
<style name="Base.DarkTheme" parent="Base.V19.DarkTheme" />
<style name="DarkTheme" parent="Base.DarkTheme"/>
<style name="Base.V7.BlackTheme" parent="DarkTheme" /> <!-- Black Theme -->
<style name="Base.V19.BlackTheme" parent="DarkTheme">
<style name="Base.BlackTheme" parent="Base.V7.BlackTheme" />
<style name="BlackTheme" parent="Base.BlackTheme">
<item name="android:windowBackground">@color/black_background_color</item> <item name="android:windowBackground">@color/black_background_color</item>
<item name="windowBackground">@color/black_background_color</item> <item name="windowBackground">@color/black_background_color</item>
@ -85,6 +78,8 @@
<item name="border_color">@color/black_border_color</item> <item name="border_color">@color/black_border_color</item>
<item name="dashed_border">@drawable/dashed_border_black</item> <item name="dashed_border">@drawable/dashed_border_black</item>
</style> </style>
<style name="Base.BlackTheme" parent="Base.V19.BlackTheme" />
<style name="BlackTheme" parent="Base.BlackTheme"/>
<!-- Dialogs --> <!-- Dialogs -->
<style name="LightDialogTheme" parent="Theme.AppCompat.DayNight.Dialog"> <style name="LightDialogTheme" parent="Theme.AppCompat.DayNight.Dialog">