@@ -17,6 +17,7 @@ import com.simplemobiletools.commons.extensions.*
1717import com.simplemobiletools.commons.helpers.LICENSE_RTL
1818import com.simplemobiletools.commons.helpers.PERMISSION_READ_STORAGE
1919import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
20+ import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
2021import com.simplemobiletools.commons.models.FAQItem
2122import com.simplemobiletools.commons.models.FileDirItem
2223import com.simplemobiletools.commons.models.RadioItem
@@ -72,7 +73,13 @@ class MainActivity : SimpleActivity() {
7273 }
7374
7475 if (action == Intent .ACTION_VIEW ) {
75- handleUri(data)
76+ val realPath = intent.getStringExtra(REAL_FILE_PATH )
77+ if (realPath != null ) {
78+ val file = File (realPath)
79+ handleUri(Uri .fromFile(file))
80+ } else {
81+ handleUri(data)
82+ }
7683 intent.removeCategory(Intent .CATEGORY_DEFAULT )
7784 intent.action = null
7885 }
@@ -291,9 +298,16 @@ class MainActivity : SimpleActivity() {
291298
292299 private fun updateSelectedNote (id : Long ) {
293300 config.currentNoteId = id
294- val index = getNoteIndexWithId(id)
295- view_pager.currentItem = index
296- mCurrentNote = mNotes[index]
301+ if (mNotes.isEmpty()) {
302+ NotesHelper (this ).getNotes {
303+ mNotes = it
304+ updateSelectedNote(id)
305+ }
306+ } else {
307+ val index = getNoteIndexWithId(id)
308+ view_pager.currentItem = index
309+ mCurrentNote = mNotes[index]
310+ }
297311 }
298312
299313 private fun displayNewNoteDialog (value : String = "") {
0 commit comments