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:
Kirk committed 2026-11-02 04:51:54 +08:00
1 parent 8cb5c2168e
commit fdea9f0435
2 files changed
+26

No files matched your search

@@ -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)
}
}