mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-07 20:21:05 +02:00
fix some glitches related to opening third party intents
This commit is contained in:
parent
05ee03f351
commit
22f9db423b
@ -17,6 +17,7 @@ import com.simplemobiletools.commons.extensions.*
|
|||||||
import com.simplemobiletools.commons.helpers.LICENSE_RTL
|
import com.simplemobiletools.commons.helpers.LICENSE_RTL
|
||||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_STORAGE
|
import com.simplemobiletools.commons.helpers.PERMISSION_READ_STORAGE
|
||||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||||
|
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
|
||||||
import com.simplemobiletools.commons.models.FAQItem
|
import com.simplemobiletools.commons.models.FAQItem
|
||||||
import com.simplemobiletools.commons.models.FileDirItem
|
import com.simplemobiletools.commons.models.FileDirItem
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
@ -72,7 +73,13 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action == Intent.ACTION_VIEW) {
|
if (action == Intent.ACTION_VIEW) {
|
||||||
handleUri(data)
|
val realPath = intent.getStringExtra(REAL_FILE_PATH)
|
||||||
|
if (realPath != null) {
|
||||||
|
val file = File(realPath)
|
||||||
|
handleUri(Uri.fromFile(file))
|
||||||
|
} else {
|
||||||
|
handleUri(data)
|
||||||
|
}
|
||||||
intent.removeCategory(Intent.CATEGORY_DEFAULT)
|
intent.removeCategory(Intent.CATEGORY_DEFAULT)
|
||||||
intent.action = null
|
intent.action = null
|
||||||
}
|
}
|
||||||
@ -291,9 +298,16 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun updateSelectedNote(id: Long) {
|
private fun updateSelectedNote(id: Long) {
|
||||||
config.currentNoteId = id
|
config.currentNoteId = id
|
||||||
val index = getNoteIndexWithId(id)
|
if (mNotes.isEmpty()) {
|
||||||
view_pager.currentItem = index
|
NotesHelper(this).getNotes {
|
||||||
mCurrentNote = mNotes[index]
|
mNotes = it
|
||||||
|
updateSelectedNote(id)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val index = getNoteIndexWithId(id)
|
||||||
|
view_pager.currentItem = index
|
||||||
|
mCurrentNote = mNotes[index]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayNewNoteDialog(value: String = "") {
|
private fun displayNewNoteDialog(value: String = "") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user