mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-13 23:12:02 +02:00
fix #241, check all third party intents at onNewIntent too
This commit is contained in:
parent
13dd6164bd
commit
b314acf30c
@ -60,27 +60,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
pager_title_strip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
|
pager_title_strip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
|
||||||
pager_title_strip.layoutParams.height = (pager_title_strip.height + resources.getDimension(R.dimen.activity_margin) * 2).toInt()
|
pager_title_strip.layoutParams.height = (pager_title_strip.height + resources.getDimension(R.dimen.activity_margin) * 2).toInt()
|
||||||
checkWhatsNewDialog()
|
checkWhatsNewDialog()
|
||||||
|
checkIntents(intent)
|
||||||
intent.apply {
|
|
||||||
if (action == Intent.ACTION_SEND && type == MIME_TEXT_PLAIN) {
|
|
||||||
getStringExtra(Intent.EXTRA_TEXT)?.let {
|
|
||||||
handleTextIntent(it)
|
|
||||||
intent.removeExtra(Intent.EXTRA_TEXT)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action == Intent.ACTION_VIEW) {
|
|
||||||
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.action = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
storeStateVariables()
|
storeStateVariables()
|
||||||
if (config.showNotePicker && savedInstanceState == null) {
|
if (config.showNotePicker && savedInstanceState == null) {
|
||||||
@ -207,6 +187,30 @@ class MainActivity : SimpleActivity() {
|
|||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
val wantedNoteId = intent.getLongExtra(OPEN_NOTE_ID, -1L)
|
val wantedNoteId = intent.getLongExtra(OPEN_NOTE_ID, -1L)
|
||||||
view_pager.currentItem = getWantedNoteIndex(wantedNoteId)
|
view_pager.currentItem = getWantedNoteIndex(wantedNoteId)
|
||||||
|
checkIntents(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkIntents(intent: Intent) {
|
||||||
|
intent.apply {
|
||||||
|
if (action == Intent.ACTION_SEND && type == MIME_TEXT_PLAIN) {
|
||||||
|
getStringExtra(Intent.EXTRA_TEXT)?.let {
|
||||||
|
handleTextIntent(it)
|
||||||
|
intent.removeExtra(Intent.EXTRA_TEXT)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action == Intent.ACTION_VIEW) {
|
||||||
|
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.action = null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user