mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-12 06:30:06 +01:00
get the notes earlier at the importing process
This commit is contained in:
parent
a66ac61f98
commit
13dd6164bd
@ -245,7 +245,10 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
if (it) {
|
if (it) {
|
||||||
importFileWithSync(uri)
|
NotesHelper(this).getNotes {
|
||||||
|
mNotes = it
|
||||||
|
importUri(uri)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,7 +390,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun importFileWithSync(uri: Uri) {
|
private fun importUri(uri: Uri) {
|
||||||
when (uri.scheme) {
|
when (uri.scheme) {
|
||||||
"file" -> openPath(uri.path)
|
"file" -> openPath(uri.path)
|
||||||
"content" -> {
|
"content" -> {
|
||||||
@ -412,14 +415,11 @@ class MainActivity : SimpleActivity() {
|
|||||||
Note(null, title, "", TYPE_TEXT, path)
|
Note(null, title, "", TYPE_TEXT, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
NotesHelper(this).getNotes {
|
if (mNotes.any { it.title.equals(note.title, true) }) {
|
||||||
mNotes = it
|
note.title += " (file)"
|
||||||
if (mNotes.any { it.title.equals(note.title, true) }) {
|
|
||||||
note.title += " (file)"
|
|
||||||
}
|
|
||||||
|
|
||||||
addNewNote(note)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addNewNote(note)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user