diff --git a/app/build.gradle b/app/build.gradle index ee5ef2f0c..571e93fd2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.5.11' + implementation 'com.simplemobiletools:commons:3.6.0' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 84fd594f8..42c9534bb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -177,6 +177,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } + val file = File(mPath) + if (!file.exists()) { + deleteFromMediaStore(file) + finish() + return + } + if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { if (isShowHiddenFlagNeeded()) { if (!config.isPasswordProtectionOn) { @@ -189,7 +196,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View showSystemUI() - mDirectory = File(mPath).parent + mDirectory = file.parent supportActionBar?.title = mPath.getFilenameFromPath() view_pager.onGlobalLayout {