lets initialize the viewpager at third party intents too

This commit is contained in:
tibbi 2018-11-18 17:49:28 +01:00
parent ad4c1dbd99
commit 45f2b19775
2 changed files with 7 additions and 9 deletions

View File

@ -52,7 +52,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.3.16'
implementation 'com.simplemobiletools:commons:5.4.0'
implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.multidex:multidex:2.0.0'

View File

@ -91,13 +91,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
refreshCalDAVCalendars(false)
}
checkAppOnSDCard()
checkIsViewIntent()
checkIsViewIntent {
if (!checkIsOpenIntent()) {
updateViewPager()
}
}
checkAppOnSDCard()
}
override fun onResume() {
@ -288,7 +288,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
return false
}
private fun checkIsViewIntent(callback: (() -> Unit)? = null) {
private fun checkIsViewIntent() {
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
val uri = intent.data
if (uri.authority == "com.android.calendar") {
@ -302,7 +302,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
putExtra(EVENT_ID, id)
startActivity(this)
}
return@Thread
} else {
toast(R.string.unknown_error_occurred)
}
@ -319,7 +318,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
tryImportEventsFromFile(uri)
}
}
callback?.invoke()
}
private fun showViewDialog() {