fix #69, weird behaviour at renaming note

This commit is contained in:
tibbi
2017-03-06 22:07:24 +01:00
parent a05056c9f9
commit 79285a197c
3 changed files with 14 additions and 5 deletions

View File

@ -125,10 +125,19 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe
return note
}
fun updateNote(note: Note) {
val values = fillContentValues(note)
fun updateNoteValue(note: Note) {
val values = ContentValues().apply { put(COL_VALUE, note.value) }
updateNote(note.id, values)
}
fun updateNoteTitle(note: Note) {
val values = ContentValues().apply { put(COL_TITLE, note.title) }
updateNote(note.id, values)
}
fun updateNote(id: Int, values: ContentValues) {
val selection = "$COL_ID = ?"
val selectionArgs = arrayOf(note.id.toString())
val selectionArgs = arrayOf(id.toString())
mDb.update(TABLE_NAME, values, selection, selectionArgs)
}
}