mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
reuse the same list of media at thumbnails and fullscreen view
This commit is contained in:
parent
d2713635d5
commit
6248f0db76
2 changed files with 9 additions and 4 deletions
|
@ -46,6 +46,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private var mLoadedInitialPhotos = false
|
private var mLoadedInitialPhotos = false
|
||||||
private var mStoredAnimateGifs = true
|
private var mStoredAnimateGifs = true
|
||||||
private var mStoredCropThumbnails = true
|
private var mStoredCropThumbnails = true
|
||||||
|
private var mLastDrawnHashCode = 0
|
||||||
private var mLastMediaModified = 0
|
private var mLastMediaModified = 0
|
||||||
private var mLastMediaHandler = Handler()
|
private var mLastMediaHandler = Handler()
|
||||||
|
|
||||||
|
@ -393,9 +394,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
media_refresh_layout.isRefreshing = false
|
media_refresh_layout.isRefreshing = false
|
||||||
|
|
||||||
checkLastMediaChanged()
|
checkLastMediaChanged()
|
||||||
if (media.hashCode() == mMedia.hashCode())
|
if (mLastDrawnHashCode == 0)
|
||||||
|
mLastDrawnHashCode = media.hashCode()
|
||||||
|
|
||||||
|
if (media.hashCode() == mMedia.hashCode() && media.hashCode() == mLastDrawnHashCode)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
mLastDrawnHashCode = media.hashCode()
|
||||||
mMedia = media
|
mMedia = media
|
||||||
setupAdapter()
|
setupAdapter()
|
||||||
storeFolder()
|
storeFolder()
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.simplemobiletools.commons.dialogs.PropertiesDialog
|
||||||
import com.simplemobiletools.commons.dialogs.RenameItemDialog
|
import com.simplemobiletools.commons.dialogs.RenameItemDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
|
import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia
|
||||||
import com.simplemobiletools.gallery.adapters.MyPagerAdapter
|
import com.simplemobiletools.gallery.adapters.MyPagerAdapter
|
||||||
import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask
|
import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask
|
||||||
import com.simplemobiletools.gallery.dialogs.SaveAsDialog
|
import com.simplemobiletools.gallery.dialogs.SaveAsDialog
|
||||||
|
@ -42,7 +43,6 @@ import java.util.*
|
||||||
|
|
||||||
class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener {
|
class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener {
|
||||||
lateinit var mOrientationEventListener: OrientationEventListener
|
lateinit var mOrientationEventListener: OrientationEventListener
|
||||||
private var mMedia = ArrayList<Medium>()
|
|
||||||
private var mPath = ""
|
private var mPath = ""
|
||||||
private var mDirectory = ""
|
private var mDirectory = ""
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
mDirectory = File(mPath).parent
|
mDirectory = File(mPath).parent
|
||||||
title = mPath.getFilenameFromPath()
|
title = mPath.getFilenameFromPath()
|
||||||
|
|
||||||
if (MediaActivity.mMedia.isNotEmpty())
|
if (mMedia.isNotEmpty())
|
||||||
gotMedia(MediaActivity.mMedia)
|
gotMedia(mMedia)
|
||||||
|
|
||||||
reloadViewPager()
|
reloadViewPager()
|
||||||
scanPath(mPath) {}
|
scanPath(mPath) {}
|
||||||
|
|
Loading…
Reference in a new issue