mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-23 20:10:07 +01:00
Merge pull request #509 from Aga-C/fix-create-note-on-resume
Fixed unnecessary note creating on app resume
This commit is contained in:
commit
f0520e02dc
@ -338,20 +338,25 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
if (action == Intent.ACTION_VIEW) {
|
if (action == Intent.ACTION_VIEW) {
|
||||||
val realPath = intent.getStringExtra(REAL_FILE_PATH)
|
val realPath = intent.getStringExtra(REAL_FILE_PATH)
|
||||||
if (realPath != null && hasPermission(PERMISSION_READ_STORAGE)) {
|
val isFromHistory = intent.flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0
|
||||||
val file = File(realPath)
|
if (!isFromHistory) {
|
||||||
handleUri(Uri.fromFile(file))
|
if (realPath != null && hasPermission(PERMISSION_READ_STORAGE)) {
|
||||||
} else if (intent.getBooleanExtra(NEW_TEXT_NOTE, false)) {
|
val file = File(realPath)
|
||||||
val newTextNote = Note(null, getCurrentFormattedDateTime(), "", NoteType.TYPE_TEXT.value, "", PROTECTION_NONE, "")
|
handleUri(Uri.fromFile(file))
|
||||||
addNewNote(newTextNote)
|
} else if (intent.getBooleanExtra(NEW_TEXT_NOTE, false)) {
|
||||||
} else if (intent.getBooleanExtra(NEW_CHECKLIST, false)) {
|
val newTextNote = Note(null, getCurrentFormattedDateTime(), "", NoteType.TYPE_TEXT.value, "", PROTECTION_NONE, "")
|
||||||
val newChecklist = Note(null, getCurrentFormattedDateTime(), "", NoteType.TYPE_CHECKLIST.value, "", PROTECTION_NONE, "")
|
addNewNote(newTextNote)
|
||||||
addNewNote(newChecklist)
|
} else if (intent.getBooleanExtra(NEW_CHECKLIST, false)) {
|
||||||
} else {
|
val newChecklist = Note(null, getCurrentFormattedDateTime(), "", NoteType.TYPE_CHECKLIST.value, "", PROTECTION_NONE, "")
|
||||||
handleUri(data!!)
|
addNewNote(newChecklist)
|
||||||
|
} else {
|
||||||
|
handleUri(data!!)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
intent.removeCategory(Intent.CATEGORY_DEFAULT)
|
intent.removeCategory(Intent.CATEGORY_DEFAULT)
|
||||||
intent.action = null
|
intent.action = null
|
||||||
|
intent.removeExtra(NEW_CHECKLIST)
|
||||||
|
intent.removeExtra(NEW_TEXT_NOTE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user