Theme should automatically change on phone settings change.

This commit is contained in:
aminecmi
2022-11-07 22:06:35 +01:00
parent e36189e2e7
commit 04dec50808
4 changed files with 35 additions and 2 deletions

View File

@ -35,6 +35,7 @@ class AppSettingsService {
private var _fontSize: Int? = null
private var _staticBar: Boolean? = null
private var _font: String = ""
private var _theme: Int? = null
init {
@ -318,6 +319,17 @@ class AppSettingsService {
return _font
}
private fun refreshCurrentTheme() {
_theme = settings.getString(CURRENT_THEME, "-1").toInt()
}
fun getCurrentTheme(): Int {
if (_theme == null) {
refreshCurrentTheme()
}
return _theme ?: -1
}
fun refreshApiSettings() {
refreshPassword()
refreshUsername()
@ -346,6 +358,7 @@ class AppSettingsService {
refreshFontSize()
refreshFont()
refreshStaticBarEnabled()
refreshCurrentTheme()
}
fun refreshLoginInformation(
@ -444,5 +457,7 @@ class AppSettingsService {
const val INFINITE_LOADING = "infinite_loading"
const val ITEMS_CACHING = "items_caching"
const val CURRENT_THEME = "currentMode"
}
}