ui: do not enforce contrast after api 29

Set the enforce*BarContrast methods to false above API 29, so we can
use fully transparent navigation and status bars.

Previously, we used a mostly transparent color for such, but now, we
can use a completely transparent color without it being changed to
match contrast.
This commit is contained in:
OxygenCobalt 2022-07-15 21:07:13 -06:00
parent 4d283bc91d
commit 863929fb64
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
7 changed files with 39 additions and 30 deletions

View file

@ -56,6 +56,7 @@ class MusicDirsDialog :
builder
.setTitle(R.string.set_dirs)
.setNeutralButton(R.string.lbl_add, null)
.setNegativeButton(R.string.lbl_cancel, null)
.setPositiveButton(R.string.lbl_save) { _, _ ->
val dirs = settings.getMusicDirs(storageManager)
val newDirs =
@ -67,7 +68,6 @@ class MusicDirsDialog :
settings.setMusicDirs(newDirs)
}
}
.setNegativeButton(R.string.lbl_cancel, null)
}
override fun onBindingCreated(binding: DialogMusicDirsBinding, savedInstanceState: Bundle?) {

View file

@ -2,8 +2,8 @@
<resources>
<!-- Template theme that handles edge-to-edge on other styles variants -->
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/chrome_transparent</item>
<item name="android:navigationBarColor">@color/chrome_transparent_ish</item>
<item name="android:statusBarColor">@color/chrome_transparent_ish</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar">false</item>
</style>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Note: Not actually transparent, making it transparent would actually make it translucent -->
<color name="chrome_transparent">#01151515</color>
<color name="chrome_transparent_ish">#01151515</color>
<color name="widget_surface">@color/material_dynamic_secondary20</color>
<color name="widget_surface_inverse">@color/material_dynamic_neutral90</color>

View file

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Template theme that handles edge-to-edge on other styles variants -->
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
<item name="android:navigationBarColor">@color/chrome_transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/chrome_transparent_ish</item>
<item name="android:statusBarColor">@color/chrome_transparent_ish</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
</style>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Auxio.V29" parent="Theme.Auxio.V27">
<!--
Android 10 finally allows you to use fully transparent system bars without it automatically
forcing contrast.
-->
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:enforceNavigationBarContrast">false</item>
<item name="android:enforceStatusBarContrast">false</item>
</style>
</resources>

View file

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Note: Not actually transparent, making it transparent would actually make it translucent
TODO: Can actually disable the contrast check on some newer versions -->
<color name="chrome_transparent">#01fafafa</color>
<!-- Used on devices when we cannot set dark/light mode on the system bars. -->
<color name="chrome_translucent">#80000000</color>
<color name="remote_translucent">#80ffffff</color>
<!--
Used on devices when we can use "transparent" system bars, but fully transparent colors
would cause the status bar to become translucent.
-->
<color name="chrome_transparent_ish">#01fafafa</color>
<color name="widget_surface">@color/material_dynamic_primary95</color>
<color name="widget_surface_inverse">@color/material_dynamic_neutral20</color>

View file

@ -1,34 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Master parent theme -->
<!-- TODO: Make the app theme blue before dynamic colors -->
<style name="Theme.Auxio" parent="Theme.Material3.DynamicColors.DayNight" />
<!-- Template theme that handles edge-to-edge on other styles variants -->
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
<item name="android:statusBarColor">@color/chrome_translucent</item>
<item name="android:navigationBarColor">@color/chrome_translucent</item>
</style>
<style name="Theme.Auxio.V29" parent="Theme.Auxio.V27" />
<!-- Base theme -->
<style name="Theme.Auxio.Base" parent="Theme.Auxio.V27">
<!-- Values -->
<item name="colorAccent">?attr/colorSecondary</item>
<item name="colorOutline">@color/overlay_stroke</item>
<item name="indicatorColor">?attr/colorPrimary</item>
<item name="colorControlActivated">?attr/colorPrimary</item>
<!-- Fix dumb default android behavior -->
<item name="android:colorBackground">?attr/colorSurface</item>
<item name="android:windowBackground">?attr/colorSurface</item>
<item name="android:scrollbars">none</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- Work around hard-coded text highlight colors in the default Material3 theme -->
<item name="android:textColorHighlight">@color/overlay_text_highlight</item>
<item name="android:textColorHighlightInverse">@color/overlay_text_highlight_inverse</item>
<style name="Theme.Auxio.Base" parent="Theme.Auxio.V29">
<!-- Material configuration -->
<item name="colorOutline">@color/overlay_stroke</item>
<item name="toolbarStyle">@style/Widget.Auxio.Toolbar</item>
<item name="materialAlertDialogTheme">@style/Theme.Auxio.Dialog</item>
<item name="sliderStyle">@style/Widget.Auxio.Slider</item>
@ -56,6 +40,16 @@
<item name="textAppearanceBodyLarge">@style/TextAppearance.Auxio.BodyLarge</item>
<item name="textAppearanceBodyMedium">@style/TextAppearance.Auxio.BodyMedium</item>
<item name="textAppearanceBodySmall">@style/TextAppearance.Auxio.BodySmall</item>
<!-- Fix dumb default android behavior -->
<item name="android:scrollbars">none</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorControlActivated">?attr/colorPrimary</item>
<!-- Work around hard-coded text highlight colors in the default Material3 theme -->
<item name="android:textColorHighlight">@color/overlay_text_highlight</item>
<item name="android:textColorHighlightInverse">@color/overlay_text_highlight_inverse</item>
</style>
<style name="Theme.Auxio.App" parent="@style/Theme.Auxio.Blue" />