Improve one 'when'
This commit is contained in:
parent
0bc2a8b6d4
commit
a5ae2eaa63
@ -27,14 +27,14 @@ enum class StackWidgetType(val value: Int) {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getWidgetTypeFromValue(value: Int): StackWidgetType? {
|
fun getWidgetTypeFromValue(value: Int): StackWidgetType? {
|
||||||
return when {
|
return when (value) {
|
||||||
CHECKMARK.value == value -> CHECKMARK
|
CHECKMARK.value -> CHECKMARK
|
||||||
FREQUENCY.value == value -> FREQUENCY
|
FREQUENCY.value -> FREQUENCY
|
||||||
SCORE.value == value -> SCORE
|
SCORE.value -> SCORE
|
||||||
HISTORY.value == value -> HISTORY
|
HISTORY.value -> HISTORY
|
||||||
STREAKS.value == value -> STREAKS
|
STREAKS.value -> STREAKS
|
||||||
TARGET.value == value -> TARGET
|
TARGET.value -> TARGET
|
||||||
else -> throw IllegalStateException()
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user