komikku/app/src/main/java/exh/md/utils/FollowStatus.kt

22 lines
540 B
Kotlin
Raw Normal View History

package exh.md.utils
import java.util.Locale
enum class FollowStatus(val int: Int) {
UNFOLLOWED(0),
READING(1),
COMPLETED(2),
ON_HOLD(3),
PLAN_TO_READ(4),
DROPPED(5),
2022-09-12 01:43:45 +02:00
RE_READING(6),
;
2021-07-06 00:31:30 +02:00
fun toDex(): String = this.name.lowercase(Locale.US)
companion object {
2021-06-02 03:09:03 +02:00
fun fromDex(value: String?): FollowStatus = values().firstOrNull { it.name.lowercase(Locale.US) == value } ?: UNFOLLOWED
fun fromInt(value: Int): FollowStatus = values().firstOrNull { it.int == value } ?: UNFOLLOWED
}
}