attempt to fix accent setter
This commit is contained in:
parent
0e7f1ce906
commit
dd09310511
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue