Skip to content

Set navigation bar color according to theme on API > 27

Lorem Ipsum requested to merge not-chicken/kdeconnect-android:fixnavbar into master

Summary

Currently the app doesn't set the navigation bar color itself, the base theme used- Theme.MaterialComponents.DayNight uses whatever color system has by default. https://github.com/material-components/material-components-android/issues/547#issuecomment-534565025

So I changed the color by setting android:navigationBarColor to colorSurface. which will be black dark grey(#121212) in dark theme, and white in light theme. Although this attribute is available since API 21, it needs android:windowLightNavigationBar to set dark icons when navigation bar's background is white, which is only available in API 27+. Otherwise we'd get:

image

Both of these need android:windowDrawsSystemBarBackgrounds to be true in order to work.

Test Plan

Tested on Pixel 3a Android R emulator and 2 Android Q devices, checking each- System default, light and dark theme.

Before

Previous behavior was different depending on the device. Emulator and device running stock android had dark nav bar while the Samsung device running One UI had white nav bar in all themes.

On Stock Android(Android One)

image

On One UI

image

After:

On Stock Android(Android One)

image

On One UI

image

Should Fix https://phabricator.kde.org/T11852

Edited by Lorem Ipsum

Merge request reports

Loading