fix a glitch at creating notes synced to files

This commit is contained in:
tibbi 2021-03-21 10:50:44 +01:00
parent 4564c6a561
commit 8897c39f6d
2 changed files with 8 additions and 7 deletions

View File

@ -482,9 +482,10 @@ class MainActivity : SimpleActivity() {
}
}
private fun displayNewNoteDialog(value: String = "", title: String? = null) {
private fun displayNewNoteDialog(value: String = "", title: String? = null, path: String = "") {
NewNoteDialog(this, title) {
it.value = value
it.path = path
addNewNote(it)
}
}
@ -540,7 +541,7 @@ class MainActivity : SimpleActivity() {
} else {
runOnUiThread {
OpenFileDialog(this, it.path) {
displayNewNoteDialog(it.value, title = it.title)
displayNewNoteDialog(it.value, title = it.title, it.path)
}
}
}

View File

@ -9,11 +9,11 @@ import java.io.FileNotFoundException
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
data class Note(
@PrimaryKey(autoGenerate = true) var id: Long?,
@ColumnInfo(name = "title") var title: String,
@ColumnInfo(name = "value") var value: String,
@ColumnInfo(name = "type") var type: Int,
@ColumnInfo(name = "path") var path: String = "") {
@PrimaryKey(autoGenerate = true) var id: Long?,
@ColumnInfo(name = "title") var title: String,
@ColumnInfo(name = "value") var value: String,
@ColumnInfo(name = "type") var type: Int,
@ColumnInfo(name = "path") var path: String = "") {
fun getNoteStoredValue(): String? {
return if (path.isNotEmpty()) {