fix #555, check if file exists at viewpager activity

This commit is contained in:
tibbi 2018-01-07 16:57:04 +01:00
parent 3c06dfd431
commit 4b2d41ec75
2 changed files with 9 additions and 2 deletions

View file

@ -42,7 +42,7 @@ ext {
} }
dependencies { 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.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'

View file

@ -177,6 +177,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
return return
} }
val file = File(mPath)
if (!file.exists()) {
deleteFromMediaStore(file)
finish()
return
}
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
if (isShowHiddenFlagNeeded()) { if (isShowHiddenFlagNeeded()) {
if (!config.isPasswordProtectionOn) { if (!config.isPasswordProtectionOn) {
@ -189,7 +196,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
showSystemUI() showSystemUI()
mDirectory = File(mPath).parent mDirectory = file.parent
supportActionBar?.title = mPath.getFilenameFromPath() supportActionBar?.title = mPath.getFilenameFromPath()
view_pager.onGlobalLayout { view_pager.onGlobalLayout {