Use an enum to represent the selected items

This commit is contained in:
davide
2022-08-15 20:42:14 +02:00
parent bb5c521387
commit 29619e1b2b
2 changed files with 18 additions and 27 deletions

View File

@ -1,7 +1,11 @@
package bou.amine.apps.readerforselfossv2.utils
enum class ItemType(val type: String) {
UNREAD("unread"),
ALL("all"),
STARRED("starred")
enum class ItemType(val position: Int, val type: String) {
UNREAD(1, "unread"),
ALL(2, "all"),
STARRED(3, "starred");
companion object {
fun fromInt(value: Int) = values().first { it.position == value }
}
}