mirror of
				https://github.com/SimpleMobileTools/Simple-Notes.git
				synced 2025-06-05 17:00:23 +02:00 
			
		
		
		
	properly import text files containing checklist items as checklists
This commit is contained in:
		| @@ -611,14 +611,23 @@ class MainActivity : SimpleActivity() { | |||||||
|     private fun addNoteFromUri(uri: Uri, filename: String? = null) { |     private fun addNoteFromUri(uri: Uri, filename: String? = null) { | ||||||
|         val noteTitle = if (filename?.isEmpty() == false) { |         val noteTitle = if (filename?.isEmpty() == false) { | ||||||
|             filename |             filename | ||||||
|  |         } else if (uri.toString().startsWith("content://")) { | ||||||
|  |             getFilenameFromContentUri(uri) ?: getNewNoteTitle() | ||||||
|         } else { |         } else { | ||||||
|             getNewNoteTitle() |             getNewNoteTitle() | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         val inputStream = contentResolver.openInputStream(uri) |         val inputStream = contentResolver.openInputStream(uri) | ||||||
|         val content = inputStream?.bufferedReader().use { it!!.readText() } |         val content = inputStream?.bufferedReader().use { it!!.readText() } | ||||||
|         val note = Note(null, noteTitle, content, NoteType.TYPE_TEXT.value, "") |         val checklistItems = content.parseChecklistItems() | ||||||
|         addNewNote(note) |  | ||||||
|  |         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) { |     private fun openPath(path: String) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user