Skip to content

Commit 487350b

Browse files
committed
NoteType refactored
1 parent f626389 commit 487350b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers/Constants.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ const val GRAVITY_LEFT = 0
4444
const val GRAVITY_CENTER = 1
4545
const val GRAVITY_RIGHT = 2
4646

47-
// note types
48-
enum class NoteType(val value: Int) { TYPE_TEXT(0), TYPE_CHECKLIST(1) }
49-
5047
// mime types
5148
const val MIME_TEXT_PLAIN = "text/plain"
5249

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.simplemobiletools.notes.pro.models
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
enum class NoteType(val value: Int) {
7+
TYPE_TEXT(0),
8+
TYPE_CHECKLIST(1);
9+
10+
companion object {
11+
fun fromValue(value: Int): NoteType {
12+
return values().find { it.value == value } ?: TYPE_TEXT
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)