Commit 27fb0474 authored by Viktor De Pasquale's avatar Viktor De Pasquale

Added more standard night-mode system

parent 7f0a8774
...@@ -4,6 +4,7 @@ import android.content.Context ...@@ -4,6 +4,7 @@ import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Environment import android.os.Environment
import android.util.Xml import android.util.Xml
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.edit import androidx.core.content.edit
import com.topjohnwu.magisk.data.database.SettingsDao import com.topjohnwu.magisk.data.database.SettingsDao
import com.topjohnwu.magisk.data.database.StringDao import com.topjohnwu.magisk.data.database.StringDao
...@@ -45,6 +46,7 @@ object Config : PreferenceModel, DBConfig { ...@@ -45,6 +46,7 @@ object Config : PreferenceModel, DBConfig {
const val CUSTOM_CHANNEL = "custom_channel" const val CUSTOM_CHANNEL = "custom_channel"
const val LOCALE = "locale" const val LOCALE = "locale"
const val DARK_THEME = "dark_theme" const val DARK_THEME = "dark_theme"
const val DARK_THEME_EXTENDED = "dark_theme_extended"
const val REPO_ORDER = "repo_order" const val REPO_ORDER = "repo_order"
const val SHOW_SYSTEM_APP = "show_system" const val SHOW_SYSTEM_APP = "show_system"
const val DOWNLOAD_PATH = "download_path" const val DOWNLOAD_PATH = "download_path"
...@@ -110,7 +112,12 @@ object Config : PreferenceModel, DBConfig { ...@@ -110,7 +112,12 @@ object Config : PreferenceModel, DBConfig {
var updateChannel by preferenceStrInt(Key.UPDATE_CHANNEL, defaultChannel) var updateChannel by preferenceStrInt(Key.UPDATE_CHANNEL, defaultChannel)
var redesign by preference(Key.REDESIGN, false) var redesign by preference(Key.REDESIGN, false)
@Deprecated("Use extended dark theme")
var darkTheme by preference(Key.DARK_THEME, true) var darkTheme by preference(Key.DARK_THEME, true)
var darkThemeExtended by preference(
Key.DARK_THEME_EXTENDED,
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
)
var suReAuth by preference(Key.SU_REAUTH, false) var suReAuth by preference(Key.SU_REAUTH, false)
var checkUpdate by preference(Key.CHECK_UPDATES, true) var checkUpdate by preference(Key.CHECK_UPDATES, true)
var magiskHide by preference(Key.MAGISKHIDE, true) var magiskHide by preference(Key.MAGISKHIDE, true)
......
...@@ -39,10 +39,13 @@ abstract class BaseActivity<ViewModel : BaseViewModel, Binding : ViewDataBinding ...@@ -39,10 +39,13 @@ abstract class BaseActivity<ViewModel : BaseViewModel, Binding : ViewDataBinding
private val resultCallbacks by lazy { SparseArrayCompat<RequestCallback>() } private val resultCallbacks by lazy { SparseArrayCompat<RequestCallback>() }
init { init {
val theme = if (Config.darkTheme) { val theme = if (Config.redesign) {
AppCompatDelegate.MODE_NIGHT_YES Config.darkThemeExtended
} else { } else {
AppCompatDelegate.MODE_NIGHT_NO when {
Config.darkTheme -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_NO
}
} }
AppCompatDelegate.setDefaultNightMode(theme) AppCompatDelegate.setDefaultNightMode(theme)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment