diff --git a/presentation/src/main/java/common/base/QkThemedActivity.kt b/presentation/src/main/java/common/base/QkThemedActivity.kt index 5090875a..bee97317 100644 --- a/presentation/src/main/java/common/base/QkThemedActivity.kt +++ b/presentation/src/main/java/common/base/QkThemedActivity.kt @@ -73,7 +73,7 @@ abstract class QkThemedActivity> : QkActivity() { .autoDisposable(scope()) .subscribe { color -> window.statusBarColor = color } - colors.background + colors.navigationBar .autoDisposable(scope()) .subscribe { color -> window.navigationBarColor = color } } diff --git a/presentation/src/main/java/common/util/Colors.kt b/presentation/src/main/java/common/util/Colors.kt index 9895d5b3..3f6537a0 100644 --- a/presentation/src/main/java/common/util/Colors.kt +++ b/presentation/src/main/java/common/util/Colors.kt @@ -92,10 +92,25 @@ class Colors @Inject constructor(private val context: Context, private val prefs } }) + /** + * Returns the flags to be used for the system bars. This is used for tinting the icons + * according to the colour of the system bars (light or dark) + * + * If night mode, or no dark icons supported, use light icons + * + * If night mode and only dark status icons supported, use dark status icons + * + * If night mode and all dark icons supported, use all dark icons + */ @SuppressLint("InlinedApi") val systemBarIcons: Observable = prefs.night.asObservable() - .map { night -> night || Build.VERSION.SDK_INT < Build.VERSION_CODES.M } - .map { lightIcons -> if (lightIcons) 0 else View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR} + .map { night -> + when { + night || Build.VERSION.SDK_INT < Build.VERSION_CODES.M -> 0 + Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + else -> View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + } + } .distinctUntilChanged() val statusBar: Observable = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), @@ -103,12 +118,25 @@ class Colors @Inject constructor(private val context: Context, private val prefs when { night && black -> R.color.black night && !black -> R.color.statusBarDark + Build.VERSION.SDK_INT < Build.VERSION_CODES.M -> R.color.black else -> R.color.statusBarLight } }) .map { res -> getColor(res) } .distinctUntilChanged() + val navigationBar: Observable = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), + { night, black -> + when { + night && black -> R.color.black + night && !black -> R.color.backgroundDark + Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> R.color.black + else -> R.color.white + } + }) + .map { res -> getColor(res) } + .distinctUntilChanged() + val toolbarColor: Observable = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), { night, black -> when { diff --git a/presentation/src/main/res/values-v23/themes.xml b/presentation/src/main/res/values-v23/themes.xml new file mode 100644 index 00000000..28d6f614 --- /dev/null +++ b/presentation/src/main/res/values-v23/themes.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values-v27/themes.xml b/presentation/src/main/res/values-v27/themes.xml new file mode 100644 index 00000000..8c9d7fba --- /dev/null +++ b/presentation/src/main/res/values-v27/themes.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values/styles.xml b/presentation/src/main/res/values/styles.xml index 2f95041e..44479d84 100644 --- a/presentation/src/main/res/values/styles.xml +++ b/presentation/src/main/res/values/styles.xml @@ -18,51 +18,6 @@ --> - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file