android: Fix cast for abstract settings

This commit is contained in:
Charles Lombardo 2023-04-20 17:42:27 -04:00 committed by bunnei
parent 7531641ecc
commit b6f57da70a
4 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,7 @@ class DateTimeSetting(
val value: String
get() = if (setting != null) {
val setting = setting as StringSetting
val setting = setting as AbstractStringSetting
setting.string
} else {
defaultValue!!

View file

@ -19,7 +19,7 @@ class SingleChoiceSetting(
val selectedValue: Int
get() = if (setting != null) {
val setting = setting as IntSetting
val setting = setting as AbstractIntSetting
setting.int
} else {
defaultValue!!

View file

@ -27,8 +27,8 @@ class SliderSetting(
get() {
val setting = setting ?: return defaultValue!!
return when (setting) {
is IntSetting -> setting.int
is FloatSetting -> setting.float.roundToInt()
is AbstractIntSetting -> setting.int
is AbstractFloatSetting -> setting.float.roundToInt()
else -> {
Log.error("[SliderSetting] Error casting setting type.")
-1

View file

@ -27,7 +27,7 @@ class StringSingleChoiceSetting(
val selectedValue: String
get() = if (setting != null) {
val setting = setting as StringSetting
val setting = setting as AbstractStringSetting
setting.string
} else {
defaultValue!!