mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
fix: the navigation bar stays dark when the launcher is not fullscreen
From Android 14 the Material theme leaves the navigation bar transparent, so with launcher fullscreen off a white system bar showed under the dark launcher. AppTheme now sets the navigation bar to black, matching the status bar.
This commit is contained in:
1 parent
d1707dc1b7
commit
d25f6940ee
2 files changed
+26
No files matched your search
@@ -2,6 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<style name="AppTheme" parent="@android:style/Theme.Material.NoActionBar">
|
<style name="AppTheme" parent="@android:style/Theme.Material.NoActionBar">
|
||||||
<item name="android:colorBackground">#FF101418</item>
|
<item name="android:colorBackground">#FF101418</item>
|
||||||
|
<item name="android:navigationBarColor">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="SessionTheme" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
|
<style name="SessionTheme" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
|
||||||
<item name="android:windowBackground">@android:color/black</item>
|
<item name="android:windowBackground">@android:color/black</item>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.droiddeck.launcher.ui
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.view.ContextThemeWrapper
|
||||||
|
import com.droiddeck.launcher.R
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.robolectric.RobolectricTestRunner
|
||||||
|
import org.robolectric.RuntimeEnvironment
|
||||||
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner::class)
|
||||||
|
@Config(sdk = [34])
|
||||||
|
class AppThemeTest {
|
||||||
|
@Test fun theNavigationBarIsOpaqueAndDarkSoNothingLightShowsThroughIt() {
|
||||||
|
val themed = ContextThemeWrapper(RuntimeEnvironment.getApplication(), R.style.AppTheme)
|
||||||
|
val attrs = themed.obtainStyledAttributes(intArrayOf(android.R.attr.navigationBarColor))
|
||||||
|
val color = attrs.getColor(0, Color.TRANSPARENT)
|
||||||
|
attrs.recycle()
|
||||||
|
assertEquals(0xFF, Color.alpha(color))
|
||||||
|
assertTrue(Color.luminance(color) < 0.1f)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user