do not allow syncing checklist files with the note itself

This commit is contained in:
tibbi
2018-12-09 20:08:44 +01:00
parent ec5977cf9f
commit 21e2a282b8
2 changed files with 30 additions and 3 deletions

View File

@ -349,9 +349,20 @@ class MainActivity : SimpleActivity() {
private fun openFile() {
FilePickerDialog(this, canAddShowHiddenButton = true) {
openFile(it, true) {
OpenFileDialog(this, it.path) {
addNewNote(it)
}
Thread {
val fileText = it.readText().trim()
val checklistItems = fileText.parseChecklistItems()
if (checklistItems != null) {
val note = Note(null, it.absolutePath.getFilenameFromPath(), fileText, TYPE_CHECKLIST)
addNewNote(note)
} else {
runOnUiThread {
OpenFileDialog(this, it.path) {
addNewNote(it)
}
}
}
}.start()
}
}
}