mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-13 23:12: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) {
|
||||
openFile(path, false) {
|
||||
var title = path.getFilenameFromPath()
|
||||
if (mNotes.any { it.title.equals(title, true) }) {
|
||||
title += " (file)"
|
||||
val title = path.getFilenameFromPath()
|
||||
val fileText = it.readText().trim()
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user