#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
@@ -22,6 +22,7 @@ import android.app.AlarmManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatDelegate
import com.moez.QKSMS.manager.WidgetManager
import com.moez.QKSMS.receiver.NightModeReceiver
import java.text.SimpleDateFormat
@@ -38,17 +39,33 @@ class NightModeManager @Inject constructor(
) {
fun updateCurrentTheme() {
// If night mode is not on auto, then there's nothing to do here
if (prefs.nightMode.get() != Preferences.NIGHT_MODE_AUTO) {
return
when (prefs.nightMode.get()) {
Preferences.NIGHT_MODE_SYSTEM -> {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
}
Preferences.NIGHT_MODE_OFF -> {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
Preferences.NIGHT_MODE_ON -> {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
}
Preferences.NIGHT_MODE_AUTO -> {
val nightStartTime = getPreviousInstanceOfTime(prefs.nightStart.get())
val nightEndTime = getPreviousInstanceOfTime(prefs.nightEnd.get())
// If the last nightStart was more recent than the last nightEnd, then it's night time
val night = nightStartTime > nightEndTime
prefs.night.set(night)
AppCompatDelegate.setDefaultNightMode(when (night) {
true -> AppCompatDelegate.MODE_NIGHT_YES
false -> AppCompatDelegate.MODE_NIGHT_NO
})
widgetManager.updateTheme()
}
}
val nightStartTime = getPreviousInstanceOfTime(prefs.nightStart.get())
val nightEndTime = getPreviousInstanceOfTime(prefs.nightEnd.get())
// If the last nightStart was more recent than the last nightEnd, then it's night time
prefs.night.set(nightStartTime > nightEndTime)
widgetManager.updateTheme()
}
fun updateNightMode(mode: Int) {
@@ -57,6 +74,12 @@ class NightModeManager @Inject constructor(
// If it's not on auto mode, set the appropriate night mode
if (mode != Preferences.NIGHT_MODE_AUTO) {
prefs.night.set(mode == Preferences.NIGHT_MODE_ON)
AppCompatDelegate.setDefaultNightMode(when (mode) {
Preferences.NIGHT_MODE_OFF -> AppCompatDelegate.MODE_NIGHT_NO
Preferences.NIGHT_MODE_ON -> AppCompatDelegate.MODE_NIGHT_YES
Preferences.NIGHT_MODE_SYSTEM -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
else -> AppCompatDelegate.MODE_NIGHT_NO
})
widgetManager.updateTheme()
}
@@ -29,9 +29,10 @@ import javax.inject.Singleton
class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences) {
companion object {
const val NIGHT_MODE_OFF = 0
const val NIGHT_MODE_ON = 1
const val NIGHT_MODE_AUTO = 2
const val NIGHT_MODE_SYSTEM = 0
const val NIGHT_MODE_OFF = 1
const val NIGHT_MODE_ON = 2
const val NIGHT_MODE_AUTO = 3
const val TEXT_SIZE_SMALL = 0
const val TEXT_SIZE_NORMAL = 1
@@ -66,7 +67,10 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
val canUseSubId = rxPrefs.getBoolean("canUseSubId", true)
// User configurable
val nightMode = rxPrefs.getInteger("nightModeSummary", NIGHT_MODE_OFF)
val nightMode = rxPrefs.getInteger("nightMode", when (Build.VERSION.SDK_INT >= 29) {
true -> NIGHT_MODE_SYSTEM
false -> NIGHT_MODE_OFF
})
val nightStart = rxPrefs.getString("nightStart", "18:00")
val nightEnd = rxPrefs.getString("nightEnd", "6:00")
val black = rxPrefs.getBoolean("black", false)
@@ -90,6 +94,20 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
val logging = rxPrefs.getBoolean("logging", false)
val version = rxPrefs.getInteger("version", 0)
init {
// Migrate from old night mode preference to new one, now that we support android Q night mode
val nightModeSummary = rxPrefs.getInteger("nightModeSummary")
if (nightModeSummary.isSet) {
nightMode.set(when (nightModeSummary.get()) {
0 -> NIGHT_MODE_OFF
1 -> NIGHT_MODE_ON
2 -> NIGHT_MODE_AUTO
else -> NIGHT_MODE_OFF
})
nightModeSummary.delete()
}
}
fun theme(threadId: Long = 0): Preference<Int> {
val default = rxPrefs.getInteger("theme", 0xFF0097A7.toInt())
+3 -3
View File
@@ -41,7 +41,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppThemeDark">
android:theme="@style/AppLaunchTheme">
<activity
android:name=".feature.main.MainActivity"
@@ -96,7 +96,7 @@
<activity android:name=".feature.plus.PlusActivity" />
<activity
android:name=".feature.gallery.GalleryActivity"
android:theme="@style/AppThemeBlack" />
android:theme="@style/AppTheme" />
<activity android:name=".feature.conversationinfo.ConversationInfoActivity" />
<activity android:name=".feature.notificationprefs.NotificationPrefsActivity" />
<activity android:name=".feature.blocked.BlockedActivity" />
@@ -104,7 +104,7 @@
android:name=".feature.qkreply.QkReplyActivity"
android:excludeFromRecents="true"
android:taskAffinity=""
android:theme="@style/AppThemeLightDialog"
android:theme="@style/AppThemeDialog"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".feature.scheduled.ScheduledActivity" />
<activity android:name=".feature.backup.BackupActivity" />
@@ -23,7 +23,6 @@ import android.app.ActivityManager
import android.graphics.BitmapFactory
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.core.view.iterator
import androidx.lifecycle.Lifecycle
import com.moez.QKSMS.R
@@ -33,10 +32,12 @@ import com.moez.QKSMS.util.Preferences
import com.uber.autodispose.android.lifecycle.scope
import com.uber.autodispose.autoDisposable
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.rxkotlin.Observables
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
import kotlinx.android.synthetic.main.toolbar.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
/**
@@ -65,29 +66,17 @@ abstract class QkThemedActivity : QkActivity() {
@SuppressLint("InlinedApi")
override fun onCreate(savedInstanceState: Bundle?) {
val night = prefs.night.get()
val black = prefs.black.get()
setTheme(getActivityThemeRes(night, black))
setTheme(getActivityThemeRes(prefs.black.get()))
super.onCreate(savedInstanceState)
// When certain preferences change, we need to recreate the activity
Observable.merge(
listOf(prefs.night, prefs.black, prefs.textSize, prefs.systemFont).map { it.asObservable().skip(1) })
val triggers = listOf(prefs.nightMode, prefs.night, prefs.black, prefs.textSize, prefs.systemFont)
Observable.merge(triggers.map { it.asObservable().skip(1) })
.debounce(400, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.autoDisposable(scope())
.subscribe { recreate() }
// Set the color for the status bar icons
// 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
window.decorView.systemUiVisibility = 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
}
// Some devices don't let you modify android.R.attr.navigationBarColor
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
window.navigationBarColor = resolveThemeColor(android.R.attr.windowBackground)
@@ -127,10 +116,9 @@ abstract class QkThemedActivity : QkActivity() {
/**
* This can be overridden in case an activity does not want to use the default themes
*/
open fun getActivityThemeRes(night: Boolean, black: Boolean) = when {
night && black -> R.style.AppThemeBlack
night && !black -> R.style.AppThemeDark
else -> R.style.AppThemeLight
open fun getActivityThemeRes(black: Boolean) = when {
black -> R.style.AppTheme_Black
else -> R.style.AppTheme
}
}
@@ -24,7 +24,7 @@ import android.util.AttributeSet
import androidx.appcompat.widget.SwitchCompat
import com.moez.QKSMS.R
import com.moez.QKSMS.common.util.Colors
import com.moez.QKSMS.common.util.extensions.getColorCompat
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
import com.moez.QKSMS.common.util.extensions.withAlpha
import com.moez.QKSMS.injection.appComponent
import com.moez.QKSMS.util.Preferences
@@ -50,26 +50,15 @@ class QkSwitch @JvmOverloads constructor(context: Context, attrs: AttributeSet?
intArrayOf(android.R.attr.state_checked),
intArrayOf())
val themeColor = colors.theme().theme
thumbTintList = ColorStateList(states, intArrayOf(
context.resolveThemeColor(R.attr.switchThumbDisabled),
colors.theme().theme,
context.resolveThemeColor(R.attr.switchThumbEnabled)))
val switchThumbEnabled: Int = prefs.night.get()
.let { night -> if (night) R.color.switchThumbEnabledDark else R.color.switchThumbEnabledLight }
.let { res -> context.getColorCompat(res) }
val switchThumbDisabled: Int = prefs.night.get()
.let { night -> if (night) R.color.switchThumbDisabledDark else R.color.switchThumbDisabledLight }
.let { res -> context.getColorCompat(res) }
val switchTrackEnabled: Int = prefs.night.get()
.let { night -> if (night) R.color.switchTrackEnabledDark else R.color.switchTrackEnabledLight }
.let { res -> context.getColorCompat(res) }
val switchTrackDisabled: Int = prefs.night.get()
.let { night -> if (night) R.color.switchTrackDisabledDark else R.color.switchTrackDisabledLight }
.let { res -> context.getColorCompat(res) }
thumbTintList = ColorStateList(states, intArrayOf(switchThumbDisabled, themeColor, switchThumbEnabled))
trackTintList = ColorStateList(states, intArrayOf(switchTrackDisabled, themeColor.withAlpha(0x4D), switchTrackEnabled))
trackTintList = ColorStateList(states, intArrayOf(
context.resolveThemeColor(R.attr.switchTrackDisabled),
colors.theme().theme.withAlpha(0x4D),
context.resolveThemeColor(R.attr.switchTrackEnabled)))
}
}
}
@@ -123,10 +123,9 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView {
return true
}
override fun getActivityThemeRes(night: Boolean, black: Boolean) = when {
night && black -> R.style.AppThemeBlackDialog
night && !black -> R.style.AppThemeDarkDialog
else -> R.style.AppThemeLightDialog
override fun getActivityThemeRes(black: Boolean) = when {
black -> R.style.AppThemeDialog_Black
else -> R.style.AppThemeDialog
}
}
@@ -21,6 +21,7 @@ package com.moez.QKSMS.feature.settings
import android.animation.ObjectAnimator
import android.app.TimePickerDialog
import android.content.Context
import android.os.Build
import android.text.format.DateFormat
import android.view.View
import androidx.core.view.isVisible
@@ -30,6 +31,7 @@ import com.jakewharton.rxbinding2.view.clicks
import com.jakewharton.rxbinding2.view.longClicks
import com.moez.QKSMS.BuildConfig
import com.moez.QKSMS.R
import com.moez.QKSMS.common.MenuItem
import com.moez.QKSMS.common.QkChangeHandler
import com.moez.QKSMS.common.QkDialog
import com.moez.QKSMS.common.base.QkController
@@ -91,7 +93,12 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
override fun onViewCreated() {
preferences.postDelayed({ preferences?.animateLayoutChanges = true }, 100)
nightModeDialog.adapter.setData(R.array.night_modes)
when (Build.VERSION.SDK_INT >= 29) {
true -> nightModeDialog.adapter.setData(R.array.night_modes)
false -> nightModeDialog.adapter.data = context.resources.getStringArray(R.array.night_modes)
.mapIndexed { index, title -> MenuItem(title, index) }
.drop(1)
}
textSizeDialog.adapter.setData(R.array.text_sizes)
sendDelayDialog.adapter.setData(R.array.delayed_sending_labels)
mmsSizeDialog.adapter.setData(R.array.mms_sizes, R.array.mms_sizes_ids)
@@ -49,7 +49,9 @@ class SettingsPresenter @Inject constructor(
private val nightModeManager: NightModeManager,
private val prefs: Preferences,
private val syncMessages: SyncMessages
) : QkPresenter<SettingsView, SettingsState>(SettingsState()) {
) : QkPresenter<SettingsView, SettingsState>(SettingsState(
nightModeId = prefs.nightMode.get()
)) {
init {
disposables += colors.themeObservable()
@@ -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>