Update displayTheme prference only if changed
This commit is contained in:
@ -33,6 +33,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
private var oldCAFile = false
|
||||
private var oldLogLevel = ""
|
||||
private var callVolume = BaresipService.callVolume
|
||||
private var oldDisplayTheme = -1
|
||||
private var save = false
|
||||
private var restart = false
|
||||
private var menu: Menu? = null
|
||||
@ -43,6 +44,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivityConfigBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
@ -100,7 +102,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
darkTheme = binding.DarkTheme
|
||||
val oldDisplayTheme = Preferences(applicationContext).displayTheme
|
||||
oldDisplayTheme = Preferences(applicationContext).displayTheme
|
||||
darkTheme.isChecked = oldDisplayTheme == AppCompatDelegate.MODE_NIGHT_YES
|
||||
|
||||
debug = binding.Debug
|
||||
@ -246,7 +248,8 @@ class ConfigActivity : AppCompatActivity() {
|
||||
AppCompatDelegate.MODE_NIGHT_YES
|
||||
else
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
Preferences(applicationContext).displayTheme = newDisplayTheme
|
||||
if (oldDisplayTheme != newDisplayTheme)
|
||||
Preferences(applicationContext).displayTheme = newDisplayTheme
|
||||
|
||||
var logLevelString = "2"
|
||||
if (debug.isChecked) logLevelString = "0"
|
||||
@ -259,7 +262,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
|
||||
BaresipService.sipTrace = sipTrace.isChecked
|
||||
Api.uag_enable_sip_trace(sipTrace.isChecked)
|
||||
|
||||
|
||||
if (reset.isChecked) {
|
||||
Config.reset(this)
|
||||
save = false
|
||||
|
||||
Reference in New Issue
Block a user