mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-15 07:52:02 +02:00
handle checklists at Open Text intent
This commit is contained in:
parent
b6f8bea868
commit
cf12439771
@ -403,12 +403,19 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun openPath(path: String) {
|
private fun openPath(path: String) {
|
||||||
openFile(path, false) {
|
openFile(path, false) {
|
||||||
var title = path.getFilenameFromPath()
|
val title = path.getFilenameFromPath()
|
||||||
if (mNotes.any { it.title.equals(title, true) }) {
|
val fileText = it.readText().trim()
|
||||||
title += " (file)"
|
val checklistItems = fileText.parseChecklistItems()
|
||||||
|
val note = if (checklistItems != null) {
|
||||||
|
Note(null, title.substringBeforeLast('.'), fileText, TYPE_CHECKLIST)
|
||||||
|
} else {
|
||||||
|
Note(null, title, "", TYPE_TEXT, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mNotes.any { it.title.equals(note.title, true) }) {
|
||||||
|
note.title += " (file)"
|
||||||
}
|
}
|
||||||
|
|
||||||
val note = Note(null, title, "", TYPE_TEXT, path)
|
|
||||||
addNewNote(note)
|
addNewNote(note)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user