style: extend edge-to-edge on all versions

Extend edge-to-edge to versions below Android Oreo. This is done
through tinting the navigation bar colors on those versions,
circumventing the coloring issue.
This commit is contained in:
OxygenCobalt
2022-01-15 20:12:23 -07:00
parent 4dcc3c3b69
commit 95e8b06f19
11 changed files with 29 additions and 36 deletions
@@ -54,11 +54,7 @@ class MainActivity : AppCompatActivity() {
this, R.layout.activity_main
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
applyEdgeToEdgeWindow(binding)
} else {
binding.root.fitsSystemWindows = true
}
applyEdgeToEdgeWindow(binding)
logD("Activity created.")
}
@@ -130,7 +130,7 @@ val WindowInsets.systemBarsCompat: Rect get() {
}
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 -> {
else -> {
@Suppress("DEPRECATION")
Rect(
systemWindowInsetLeft,
@@ -139,8 +139,6 @@ val WindowInsets.systemBarsCompat: Rect get() {
systemWindowInsetBottom
)
}
else -> Rect(0, 0, 0, 0)
}
}
@@ -155,13 +153,11 @@ fun WindowInsets.replaceInsetsCompat(left: Int, top: Int, right: Int, bottom: In
.build()
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 -> {
else -> {
@Suppress("DEPRECATION")
replaceSystemWindowInsets(
left, top, right, bottom
)
}
else -> this
}
}
@@ -3,7 +3,7 @@
<!-- 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/nav_bar</item>
<item name="android:navigationBarColor">@color/chrome_transparent</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="nav_bar">#01151515</color>
<color name="chrome_transparent">#01151515</color>
<color name="red_primary">#FFB4A8</color>
<color name="red_on_primary">#680001</color>
+1 -1
View File
@@ -2,7 +2,7 @@
<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/nav_bar</item>
<item name="android:navigationBarColor">@color/chrome_transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
+2 -1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="nav_bar">#01fafafa</color>
<color name="chrome_transparent">#01fafafa</color>
<color name="chrome_translucent">#80000000</color>
<color name="red_primary">#BC1714</color>
<color name="red_on_primary">#FFFFFF</color>
+2 -1
View File
@@ -4,7 +4,8 @@
<style name="Theme.Auxio" parent="Theme.Material3.DayNight.NoActionBar" />
<!-- 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/black</item>
<item name="android:statusBarColor">@color/chrome_translucent</item>
<item name="android:navigationBarColor">@color/chrome_translucent</item>
</style>
<!-- Android 12 configuration -->
<style name="Theme.Auxio.V31" parent="Theme.Auxio.V27" />