Loading presentation/src/main/java/common/base/QkThemedActivity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ abstract class QkThemedActivity<VM : QkViewModel<*, *>> : QkActivity<VM>() { .autoDisposable(scope()) .subscribe { color -> window.statusBarColor = color } colors.background colors.navigationBar .autoDisposable(scope()) .subscribe { color -> window.navigationBarColor = color } } Loading presentation/src/main/java/common/util/Colors.kt +30 −2 Original line number Diff line number Diff line Loading @@ -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<Int> = 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<Int> = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), Loading @@ -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<Int> = 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<Int> = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), { night, black -> when { Loading presentation/src/main/res/values-v23/themes.xml 0 → 100644 +10 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <!-- On Marshmallow, use the light status bar --> <style name="AppThemeLight" parent="AppBaseThemeLight"> <item name="android:statusBarColor">@color/statusBarLight</item> <item name="android:windowLightStatusBar">true</item> </style> </resources> No newline at end of file presentation/src/main/res/values-v27/themes.xml 0 → 100644 +12 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <!-- On Oreo, use the light status and navigation bars --> <style name="AppThemeLight" parent="AppBaseThemeLight"> <item name="android:navigationBarColor">@color/white</item> <item name="android:statusBarColor">@color/statusBarLight</item> <item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightStatusBar">true</item> </style> </resources> No newline at end of file presentation/src/main/res/values/styles.xml +0 −45 Original line number Diff line number Diff line Loading @@ -18,51 +18,6 @@ --> <resources> <style name="AppThemeLight" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@color/backgroundLight</item> <item name="android:windowContentTransitions">true</item> <item name="actionBarPopupTheme">@style/PopupThemeLight</item> <item name="colorPrimary">@color/white</item> <item name="colorPrimaryDark">@color/statusBarLight</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeLightDialog" parent="Theme.AppCompat.Light.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="actionBarPopupTheme">@style/PopupThemeLight</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeDark" parent="Theme.AppCompat.NoActionBar"> <item name="android:windowBackground">@color/backgroundDark</item> <item name="android:windowContentTransitions">true</item> <item name="actionBarPopupTheme">@style/PopupThemeDark</item> <item name="colorPrimary">@color/backgroundDark</item> <item name="colorPrimaryDark">@color/statusBarDark</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeDarkDialog" parent="Theme.AppCompat.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="actionBarPopupTheme">@style/PopupThemeDark</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeBlack" parent="Theme.AppCompat.NoActionBar"> <item name="android:windowBackground">@color/black</item> <item name="android:windowContentTransitions">true</item> <item name="actionBarPopupTheme">@style/PopupThemeDark</item> <item name="colorPrimary">@color/black</item> <item name="colorPrimaryDark">@color/black</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeBlackDialog" parent="Theme.AppCompat.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="actionBarPopupTheme">@style/PopupThemeBlack</item> <item name="windowActionBar">false</item> </style> <style name="TextPrimary"> <item name="android:textSize">16sp</item> <item name="textColor">primary</item> Loading Loading
presentation/src/main/java/common/base/QkThemedActivity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ abstract class QkThemedActivity<VM : QkViewModel<*, *>> : QkActivity<VM>() { .autoDisposable(scope()) .subscribe { color -> window.statusBarColor = color } colors.background colors.navigationBar .autoDisposable(scope()) .subscribe { color -> window.navigationBarColor = color } } Loading
presentation/src/main/java/common/util/Colors.kt +30 −2 Original line number Diff line number Diff line Loading @@ -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<Int> = 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<Int> = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), Loading @@ -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<Int> = 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<Int> = Observables.combineLatest(prefs.night.asObservable(), prefs.black.asObservable(), { night, black -> when { Loading
presentation/src/main/res/values-v23/themes.xml 0 → 100644 +10 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <!-- On Marshmallow, use the light status bar --> <style name="AppThemeLight" parent="AppBaseThemeLight"> <item name="android:statusBarColor">@color/statusBarLight</item> <item name="android:windowLightStatusBar">true</item> </style> </resources> No newline at end of file
presentation/src/main/res/values-v27/themes.xml 0 → 100644 +12 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <!-- On Oreo, use the light status and navigation bars --> <style name="AppThemeLight" parent="AppBaseThemeLight"> <item name="android:navigationBarColor">@color/white</item> <item name="android:statusBarColor">@color/statusBarLight</item> <item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightStatusBar">true</item> </style> </resources> No newline at end of file
presentation/src/main/res/values/styles.xml +0 −45 Original line number Diff line number Diff line Loading @@ -18,51 +18,6 @@ --> <resources> <style name="AppThemeLight" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@color/backgroundLight</item> <item name="android:windowContentTransitions">true</item> <item name="actionBarPopupTheme">@style/PopupThemeLight</item> <item name="colorPrimary">@color/white</item> <item name="colorPrimaryDark">@color/statusBarLight</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeLightDialog" parent="Theme.AppCompat.Light.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="actionBarPopupTheme">@style/PopupThemeLight</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeDark" parent="Theme.AppCompat.NoActionBar"> <item name="android:windowBackground">@color/backgroundDark</item> <item name="android:windowContentTransitions">true</item> <item name="actionBarPopupTheme">@style/PopupThemeDark</item> <item name="colorPrimary">@color/backgroundDark</item> <item name="colorPrimaryDark">@color/statusBarDark</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeDarkDialog" parent="Theme.AppCompat.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="actionBarPopupTheme">@style/PopupThemeDark</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeBlack" parent="Theme.AppCompat.NoActionBar"> <item name="android:windowBackground">@color/black</item> <item name="android:windowContentTransitions">true</item> <item name="actionBarPopupTheme">@style/PopupThemeDark</item> <item name="colorPrimary">@color/black</item> <item name="colorPrimaryDark">@color/black</item> <item name="windowActionBar">false</item> </style> <style name="AppThemeBlackDialog" parent="Theme.AppCompat.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="actionBarPopupTheme">@style/PopupThemeBlack</item> <item name="windowActionBar">false</item> </style> <style name="TextPrimary"> <item name="android:textSize">16sp</item> <item name="textColor">primary</item> Loading