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
import android.content.SharedPreferences
import android.os.Environment
import android.util.Xml
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.edit
import com.topjohnwu.magisk.data.database.SettingsDao
import com.topjohnwu.magisk.data.database.StringDao
......@@ -45,6 +46,7 @@ object Config : PreferenceModel, DBConfig {
const val CUSTOM_CHANNEL = "custom_channel"
const val LOCALE = "locale"
const val DARK_THEME = "dark_theme"
const val DARK_THEME_EXTENDED = "dark_theme_extended"
const val REPO_ORDER = "repo_order"
const val SHOW_SYSTEM_APP = "show_system"
const val DOWNLOAD_PATH = "download_path"
......@@ -110,7 +112,12 @@ object Config : PreferenceModel, DBConfig {
var updateChannel by preferenceStrInt(Key.UPDATE_CHANNEL, defaultChannel)
var redesign by preference(Key.REDESIGN, false)
@Deprecated("Use extended dark theme")
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 checkUpdate by preference(Key.CHECK_UPDATES, true)
var magiskHide by preference(Key.MAGISKHIDE, true)
......
......@@ -39,10 +39,13 @@ abstract class BaseActivity<ViewModel : BaseViewModel, Binding : ViewDataBinding
private val resultCallbacks by lazy { SparseArrayCompat<RequestCallback>() }
init {
val theme = if (Config.darkTheme) {
AppCompatDelegate.MODE_NIGHT_YES
val theme = if (Config.redesign) {
Config.darkThemeExtended
} else {
AppCompatDelegate.MODE_NIGHT_NO
when {
Config.darkTheme -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_NO
}
}
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