From f29d17fefde1707317de526a3ed70a1e0c499217 Mon Sep 17 00:00:00 2001 From: iorgamgabriel Date: Mon, 17 Oct 2022 13:29:20 +0300 Subject: [PATCH] For #1795650 The colors of the icons from the status bar should be in contrast with the status bar background color. --- .../components/support/ktx/android/view/Window.kt | 12 ++++++------ docs/changelog.md | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt b/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt index e2eff49a3fb..b54a34f6e3e 100644 --- a/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt +++ b/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt @@ -15,24 +15,24 @@ import mozilla.components.support.utils.ColorUtils.isDark * Colors the status bar. * If the color is light enough, a light status bar with dark icons will be used. */ -fun Window.setStatusBarTheme(@ColorInt color: Int) { +fun Window.setStatusBarTheme(@ColorInt toolbarColor: Int) { getWindowInsetsController().isAppearanceLightStatusBars = - isDark(color) - statusBarColor = color + !isDark(toolbarColor) + statusBarColor = toolbarColor } /** * Colors the navigation bar. * If the color is light enough, a light navigation bar with dark icons will be used. */ -fun Window.setNavigationBarTheme(@ColorInt color: Int) { +fun Window.setNavigationBarTheme(@ColorInt toolbarColor: Int) { getWindowInsetsController().isAppearanceLightNavigationBars = - isDark(color) + !isDark(toolbarColor) if (SDK_INT >= Build.VERSION_CODES.P) { navigationBarDividerColor = 0 } - navigationBarColor = color + navigationBarColor = toolbarColor } /** diff --git a/docs/changelog.md b/docs/changelog.md index 0abe16f5acd..873cbfd0eaa 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,6 +10,9 @@ permalink: /changelog/ * [Gecko](https://github.com/mozilla-mobile/android-components/blob/main/buildSrc/src/main/java/Gecko.kt) * [Configuration](https://github.com/mozilla-mobile/android-components/blob/main/.config.yml) +* **support-ktx**: + * The colors of the icons from the status bar should be in contrast with the status bar background color [#1795650](https://bugzilla.mozilla.org/show_bug.cgi?id=1795650) + # 107.0.0 * [Commits](https://github.com/mozilla-mobile/android-components/compare/v106.0.0..v107.0.0) * [Milestone](https://github.com/mozilla-mobile/android-components/milestone/154?closed=1)