mirror of
https://github.com/FossifyOrg/Notes.git
synced 2026-09-17 08:22:47 -04:00
properly import text files containing checklist items as checklists
This commit is contained in:
1 parent
d5fd63e331
commit
852ee0ba42
1 file changed
+11
-2
@@ -611,14 +611,23 @@ class MainActivity : SimpleActivity() {
|
||||
private fun addNoteFromUri(uri: Uri, filename: String? = null) {
|
||||
val noteTitle = if (filename?.isEmpty() == false) {
|
||||
filename
|
||||
} else if (uri.toString().startsWith("content://")) {
|
||||
getFilenameFromContentUri(uri) ?: getNewNoteTitle()
|
||||
} else {
|
||||
getNewNoteTitle()
|
||||
}
|
||||
|
||||
val inputStream = contentResolver.openInputStream(uri)
|
||||
val content = inputStream?.bufferedReader().use { it!!.readText() }
|
||||
val note = Note(null, noteTitle, content, NoteType.TYPE_TEXT.value, "")
|
||||
addNewNote(note)
|
||||
val checklistItems = content.parseChecklistItems()
|
||||
|
||||
if (checklistItems != null) {
|
||||
val note = Note(null, noteTitle, content, NoteType.TYPE_CHECKLIST.value)
|
||||
addNewNote(note)
|
||||
} else {
|
||||
val note = Note(null, noteTitle, content, NoteType.TYPE_TEXT.value, "")
|
||||
addNewNote(note)
|
||||
}
|
||||
}
|
||||
|
||||
private fun openPath(path: String) {
|
||||
|
||||
Reference in new issue
Block a user