#1425 - Add support for system dark mode on Android Q

This commit is contained in:
moezbhatti
2019-08-12 01:21:03 +02:00
parent c80985e59c
commit be20f19c82
15 changed files with 266 additions and 138 deletions
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<!-- On Marshmallow, explicitly don't use the light status bar -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<!-- On Oreo, explicitly don't use the light status and navigation bars -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowLightNavigationBar">false</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<style name="AppTheme" parent="AppBaseTheme" />
<style name="AppBaseTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:divider">@color/separatorDark</item>
<item name="android:navigationBarColor">@color/backgroundDark</item>
<item name="android:queryBackground">@color/toolbarSearchBackgroundDark</item>
<item name="android:statusBarColor">@color/statusBarDark</item>
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
<item name="android:textColorTertiary">@color/textTertiaryDark</item>
<item name="android:windowBackground">@color/backgroundDark</item>
<item name="android:windowContentTransitions">true</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
<item name="bubbleColor">@color/bubbleDark</item>
<item name="colorPrimary">@color/toolbarDark</item>
<item name="colorPrimaryDark">@color/statusBarDark</item>
<item name="composeBackground">@color/backgroundDark</item>
<item name="selectableItemBackground">@drawable/ripple_dark</item>
<item name="switchThumbEnabled">@color/switchThumbEnabledDark</item>
<item name="switchThumbDisabled">@color/switchThumbDisabledDark</item>
<item name="switchTrackEnabled">@color/switchTrackEnabledDark</item>
<item name="switchTrackDisabled">@color/switchTrackDisabledDark</item>
<item name="windowActionBar">false</item>
</style>
<style name="AppThemeDialog" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
<item name="android:textColorTertiary">@color/textTertiaryDark</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
<item name="bubbleColor">@color/bubbleDark</item>
<item name="colorPrimary">@color/toolbarDark</item>
<item name="colorPrimaryDark">@color/statusBarDark</item>
<item name="composeBackground">@color/backgroundDark</item>
<item name="selectableItemBackground">@drawable/ripple_dark</item>
<item name="windowActionBar">false</item>
</style>
<style name="PopupTheme" parent="ThemeOverlay.AppCompat">
<item name="android:colorBackground">@color/backgroundDark</item>
<item name="android:textColor">@color/textPrimaryDark</item>
</style>
<!-- Black theme -->
<style name="AppTheme.Black">
<item name="android:navigationBarColor">@color/black</item>
<item name="android:statusBarColor">@color/black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="composeBackground">@color/black</item>
</style>
<style name="AppThemeDialog.Black">
<item name="actionBarPopupTheme">@style/PopupTheme.Black</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="composeBackground">@color/black</item>
</style>
<style name="PopupTheme.Black">
<item name="android:colorBackground">@color/black</item>
<item name="android:textColor">@color/textPrimaryDark</item>
</style>
</resources>
@@ -19,9 +19,9 @@
<resources>
<!-- On Marshmallow, use the light status bar -->
<style name="AppThemeLight" parent="AppBaseThemeLight">
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:statusBarColor">@color/statusBarLight</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
</resources>
@@ -19,11 +19,11 @@
<resources>
<!-- On Oreo, use the light status and navigation bars -->
<style name="AppThemeLight" parent="AppBaseThemeLight">
<style name="AppTheme" parent="AppBaseTheme">
<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>
</resources>
@@ -343,6 +343,7 @@
<string name="notification_message_failed_text">The message to %s failed to send</string>
<string-array name="night_modes">
<item>System</item>
<item>Disabled</item>
<item>Always on</item>
<item>Automatic</item>
+27 -69
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
@@ -20,11 +21,20 @@
<attr name="bubbleColor" format="reference" />
<attr name="composeBackground" format="reference" />
<attr name="switchThumbEnabled" format="color" />
<attr name="switchThumbDisabled" format="color" />
<attr name="switchTrackEnabled" format="color" />
<attr name="switchTrackDisabled" format="color" />
<style name="AppThemeLight" parent="AppBaseThemeLight" />
<style name="AppLaunchTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:navigationBarColor">@color/backgroundDark</item>
<item name="android:statusBarColor">@color/backgroundDark</item>
<item name="android:windowBackground">@color/backgroundDark</item>
</style>
<!-- Light theme -->
<style name="AppBaseThemeLight" parent="Theme.AppCompat.Light.NoActionBar">item>
<style name="AppTheme" parent="AppBaseTheme" />
<style name="AppBaseTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:divider">@color/separatorLight</item>
<item name="android:queryBackground">@color/toolbarSearchBackgroundLight</item>
<item name="android:statusBarColor">@color/black</item>
@@ -33,21 +43,25 @@
<item name="android:textColorTertiary">@color/textTertiary</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:windowContentTransitions">true</item>
<item name="actionBarPopupTheme">@style/PopupThemeLight</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
<item name="bubbleColor">@color/bubbleLight</item>
<item name="colorPrimary">@color/toolbarLight</item>
<item name="colorPrimaryDark">@color/statusBarLight</item>
<item name="composeBackground">@color/backgroundLight</item>
<item name="selectableItemBackground">@drawable/ripple</item>
<item name="switchThumbEnabled">@color/switchThumbEnabledLight</item>
<item name="switchThumbDisabled">@color/switchThumbDisabledLight</item>
<item name="switchTrackEnabled">@color/switchTrackEnabledLight</item>
<item name="switchTrackDisabled">@color/switchTrackDisabledLight</item>
<item name="windowActionBar">false</item>
</style>
<style name="AppThemeLightDialog" parent="Theme.AppCompat.Light.Dialog">
<style name="AppThemeDialog" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:textColorPrimary">@color/textPrimary</item>
<item name="android:textColorSecondary">@color/textSecondary</item>
<item name="android:textColorTertiary">@color/textTertiary</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="actionBarPopupTheme">@style/PopupThemeLight</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
<item name="bubbleColor">@color/bubbleLight</item>
<item name="colorPrimary">@color/toolbarLight</item>
<item name="colorPrimaryDark">@color/statusBarLight</item>
@@ -56,70 +70,14 @@
<item name="windowActionBar">false</item>
</style>
<style name="PopupThemeLight" parent="ThemeOverlay.AppCompat.Light">
<style name="PopupTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="android:colorBackground">@color/white</item>
<item name="android:textColor">@color/textPrimary</item>
</style>
<!-- Dark theme -->
<style name="AppThemeDark" parent="Theme.AppCompat.NoActionBar">
<item name="android:divider">@color/separatorDark</item>
<item name="android:navigationBarColor">@color/backgroundDark</item>
<item name="android:queryBackground">@color/toolbarSearchBackgroundDark</item>
<item name="android:statusBarColor">@color/statusBarDark</item>
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
<item name="android:textColorTertiary">@color/textTertiaryDark</item>
<item name="android:windowBackground">@color/backgroundDark</item>
<item name="android:windowContentTransitions">true</item>
<item name="actionBarPopupTheme">@style/PopupThemeDark</item>
<item name="bubbleColor">@color/bubbleDark</item>
<item name="colorPrimary">@color/toolbarDark</item>
<item name="colorPrimaryDark">@color/statusBarDark</item>
<item name="composeBackground">@color/backgroundDark</item>
<item name="selectableItemBackground">@drawable/ripple_dark</item>
<item name="windowActionBar">false</item>
</style>
<!-- Black mode. No changes needed when not in night theme -->
<style name="AppTheme.Black" />
<style name="AppThemeDialog.Black" />
<style name="PopupTheme.Black" />
<style name="AppThemeDarkDialog" parent="Theme.AppCompat.Dialog">
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
<item name="android:textColorTertiary">@color/textTertiaryDark</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="actionBarPopupTheme">@style/PopupThemeDark</item>
<item name="bubbleColor">@color/bubbleDark</item>
<item name="colorPrimary">@color/toolbarDark</item>
<item name="colorPrimaryDark">@color/statusBarDark</item>
<item name="composeBackground">@color/backgroundDark</item>
<item name="selectableItemBackground">@drawable/ripple_dark</item>
<item name="windowActionBar">false</item>
</style>
<style name="PopupThemeDark" parent="ThemeOverlay.AppCompat">
<item name="android:colorBackground">@color/backgroundDark</item>
<item name="android:textColor">@color/textPrimaryDark</item>
</style>
<!-- Black theme -->
<style name="AppThemeBlack" parent="AppThemeDark">
<item name="android:navigationBarColor">@color/black</item>
<item name="android:statusBarColor">@color/black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="composeBackground">@color/black</item>
</style>
<style name="AppThemeBlackDialog" parent="AppThemeDarkDialog">
<item name="actionBarPopupTheme">@style/PopupThemeBlack</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="composeBackground">@color/black</item>
</style>
<style name="PopupThemeBlack" parent="@style/PopupThemeDark">
<item name="android:colorBackground">@color/black</item>
<item name="android:textColor">@color/textPrimaryDark</item>
</style>
</resources>
</resources>