properly reuse thumbnails media list at fullscreen view

This commit is contained in:
tibbi 2017-06-06 22:30:55 +02:00
parent 6dc1323252
commit 53261310a2
2 changed files with 6 additions and 4 deletions

View File

@ -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'

View File

@ -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<Medium>()
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<Medium>) {
if (isDirEmpty(media) || mMedia.hashCode() == media.hashCode()) {
if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) {
return
}
mPrevHashcode = media.hashCode()
mMedia = media
if (mPos == -1) {
mPos = getProperPosition()