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