diff --git a/app/build.gradle b/app/build.gradle index 298232902..8e7286938 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.34.25' + implementation 'com.github.SimpleMobileTools:Simple-Commons:b3a9e4114f' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index b01727673..d069e8b98 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -5,6 +5,7 @@ import android.animation.ValueAnimator import android.annotation.SuppressLint import android.annotation.TargetApi import android.app.Activity +import android.content.ActivityNotFoundException import android.content.Intent import android.content.pm.ActivityInfo import android.content.pm.ShortcutInfo @@ -1236,16 +1237,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View putExtra(SHOW_PREV_ITEM, view_pager.currentItem != 0) putExtra(SHOW_NEXT_ITEM, view_pager.currentItem != mMediaFiles.size - 1) - if (resolveActivity(packageManager) != null) { - try { - startActivityForResult(this, REQUEST_VIEW_VIDEO) - } catch (e: NullPointerException) { - showErrorToast(e) - } - } else { + try { + startActivityForResult(this, REQUEST_VIEW_VIDEO) + } catch (e: ActivityNotFoundException) { if (!tryGenericMimeType(this, mimeType, newUri)) { toast(R.string.no_app_found) } + } catch (e: Exception) { + showErrorToast(e) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index d2a9bfa48..d7a1ee3d4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -74,11 +74,7 @@ fun Activity.openEditor(path: String, forceChooser: Boolean = false) { fun Activity.launchCamera() { val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA) - if (intent.resolveActivity(packageManager) != null) { - startActivity(intent) - } else { - toast(R.string.no_app_found) - } + launchActivityIntent(intent) } fun SimpleActivity.launchAbout() {