attempt to fix accent setter

This commit is contained in:
X1nto 2020-05-25 22:50:23 +04:00
parent 0e7f1ce906
commit dd09310511
1 changed files with 2 additions and 5 deletions

View File

@ -7,7 +7,6 @@ import android.content.res.Configuration
import android.content.res.Resources
import android.os.Build
import android.os.Bundle
import android.util.AndroidException
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import androidx.preference.PreferenceManager
@ -72,18 +71,16 @@ open class ThemedActivity : AppCompatActivity() {
}
private fun setDarkAccent(accentColor: String) {
val themeVal: Int = ("R.style.DarkTheme_$accentColor").toInt()
try {
setTheme(themeVal)
setTheme("R.style.DarkTheme_$accentColor".toInt())
} catch (e: Resources.NotFoundException) {
setTheme(R.style.DarkTheme_Blue)
}
}
private fun setLightAccent(accentColor: String) {
val themeVal: Int = ("R.style.LightTheme_$accentColor").toInt()
try {
setTheme(themeVal)
setTheme("R.style.DarkTheme_$accentColor".toInt())
} catch (e: Resources.NotFoundException) {
setTheme(R.style.LightTheme_Blue)
}