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 { 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.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 mShowAll = false
private var mRotationDegrees = 0f private var mRotationDegrees = 0f
private var mLastHandledOrientation = 0 private var mLastHandledOrientation = 0
private var mPrevHashcode = 0
companion object { companion object {
var screenWidth = 0 var screenWidth = 0
@ -94,14 +95,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
config.temporarilyShowHidden = true config.temporarilyShowHidden = true
} }
mMedia = ArrayList<Medium>()
showSystemUI() showSystemUI()
mDirectory = File(mPath).parent mDirectory = File(mPath).parent
title = mPath.getFilenameFromPath() title = mPath.getFilenameFromPath()
if (mMedia.isNotEmpty()) if (mMedia.isNotEmpty()) {
gotMedia(mMedia) gotMedia(mMedia)
}
reloadViewPager() reloadViewPager()
scanPath(mPath) {} scanPath(mPath) {}
@ -433,10 +434,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun gotMedia(media: ArrayList<Medium>) { private fun gotMedia(media: ArrayList<Medium>) {
if (isDirEmpty(media) || mMedia.hashCode() == media.hashCode()) { if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) {
return return
} }
mPrevHashcode = media.hashCode()
mMedia = media mMedia = media
if (mPos == -1) { if (mPos == -1) {
mPos = getProperPosition() mPos = getProperPosition()