From 45f2b19775f0e385f536fcae10ed6cdcbc4de4f0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Nov 2018 17:49:28 +0100 Subject: [PATCH] lets initialize the viewpager at third party intents too --- app/build.gradle | 2 +- .../calendar/pro/activities/MainActivity.kt | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 805f326d3..982e34f17 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index dabc53c90..de46190d2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -91,13 +91,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { refreshCalDAVCalendars(false) } - checkAppOnSDCard() + checkIsViewIntent() - checkIsViewIntent { - if (!checkIsOpenIntent()) { - updateViewPager() - } + 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() {