- wip: app crash when gson can not deserialize note

This commit is contained in:
Pavol Franek
2020-02-29 10:28:54 +01:00
parent 51f1dc67b4
commit 86714229b4
13 changed files with 65 additions and 41 deletions

View File

@ -72,7 +72,7 @@ class Config(context: Context) : BaseConfig(context) {
set(useIncognitoMode) = prefs.edit().putBoolean(USE_INCOGNITO_MODE, useIncognitoMode).apply()
var lastCreatedNoteType: Int
get() = prefs.getInt(LAST_CREATED_NOTE_TYPE, TYPE_TEXT)
get() = prefs.getInt(LAST_CREATED_NOTE_TYPE, NoteType.TYPE_TEXT.value)
set(lastCreatedNoteType) = prefs.edit().putInt(LAST_CREATED_NOTE_TYPE, lastCreatedNoteType).apply()
var moveUndoneChecklistItems: Boolean

View File

@ -37,8 +37,7 @@ const val GRAVITY_CENTER = 1
const val GRAVITY_RIGHT = 2
// note types
const val TYPE_TEXT = 0
const val TYPE_CHECKLIST = 1
enum class NoteType(val value: Int) { TYPE_TEXT(0), TYPE_CHECKLIST(1) }
// mime types
const val MIME_TEXT_PLAIN = "text/plain"

View File

@ -32,7 +32,7 @@ class NotesHelper(val context: Context) {
if (notes.isEmpty()) {
val generalNote = context.resources.getString(R.string.general_note)
val note = Note(null, generalNote, "", TYPE_TEXT)
val note = Note(null, generalNote, "", NoteType.TYPE_TEXT.value)
context.notesDB.insertOrUpdate(note)
notes.add(note)
}