diff --git a/app/build.gradle b/app/build.gradle index c5edcbb4f..810c0c42f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.19.5' + compile 'com.simplemobiletools:commons:2.19.9' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect: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 a91695969..fbd122166 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -51,6 +51,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private var mShowAll = false private var mRotationDegrees = 0f private var mLastHandledOrientation = 0 + private var mPrevHashcode = 0 companion object { var screenWidth = 0 @@ -94,14 +95,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View config.temporarilyShowHidden = true } - mMedia = ArrayList() showSystemUI() mDirectory = File(mPath).parent title = mPath.getFilenameFromPath() - if (mMedia.isNotEmpty()) + if (mMedia.isNotEmpty()) { gotMedia(mMedia) + } reloadViewPager() scanPath(mPath) {} @@ -433,10 +434,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun gotMedia(media: ArrayList) { - if (isDirEmpty(media) || mMedia.hashCode() == media.hashCode()) { + if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) { return } + mPrevHashcode = media.hashCode() mMedia = media if (mPos == -1) { mPos = getProperPosition()