mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
move thumbnail hashcode checking directly in adapters
This commit is contained in:
parent
f19d6ada1f
commit
41d0b0bef9
4 changed files with 15 additions and 17 deletions
|
@ -548,10 +548,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
directories_horizontal_fastscroller.beVisibleIf(directories_grid.isVisible() && allowHorizontalScroll)
|
||||
|
||||
checkLastMediaChanged()
|
||||
if (dirs.hashCode() == mDirs.hashCode()) {
|
||||
return
|
||||
}
|
||||
|
||||
mDirs = dirs
|
||||
|
||||
runOnUiThread {
|
||||
|
|
|
@ -59,7 +59,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
private var mStoredScrollHorizontally = true
|
||||
private var mStoredShowInfoBubble = true
|
||||
private var mStoredTextColor = 0
|
||||
private var mLastDrawnHashCode = 0
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mCurrAsyncTask: GetMediaAsynctask? = null
|
||||
|
@ -603,11 +602,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
|
||||
checkLastMediaChanged()
|
||||
|
||||
if (media.hashCode() == mMedia.hashCode() && media.hashCode() == mLastDrawnHashCode) {
|
||||
return
|
||||
}
|
||||
|
||||
mLastDrawnHashCode = media.hashCode()
|
||||
mMedia = media
|
||||
runOnUiThread {
|
||||
setupAdapter()
|
||||
|
|
|
@ -38,6 +38,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
|||
private var showMediaCount = config.showMediaCount
|
||||
private var animateGifs = config.animateGifs
|
||||
private var cropThumbnails = config.cropThumbnails
|
||||
private var currentDirectoriesHash = dirs.hashCode()
|
||||
|
||||
override fun getActionMenuId() = R.menu.cab_directories
|
||||
|
||||
|
@ -307,10 +308,13 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
|||
}
|
||||
|
||||
fun updateDirs(newDirs: ArrayList<Directory>) {
|
||||
if (newDirs.hashCode() != currentDirectoriesHash) {
|
||||
currentDirectoriesHash = newDirs.hashCode()
|
||||
dirs = newDirs
|
||||
notifyDataSetChanged()
|
||||
finishActMode()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAnimateGifs(animateGifs: Boolean) {
|
||||
this.animateGifs = animateGifs
|
||||
|
|
|
@ -38,6 +38,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
|||
private var visibleItemPaths = ArrayList<String>()
|
||||
private var loadImageInstantly = false
|
||||
private var delayHandler = Handler(Looper.getMainLooper())
|
||||
private var currentMediaHash = media.hashCode()
|
||||
|
||||
private var scrollHorizontally = config.scrollHorizontally
|
||||
private var animateGifs = config.animateGifs
|
||||
|
@ -246,11 +247,14 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
|||
}
|
||||
|
||||
fun updateMedia(newMedia: ArrayList<Medium>) {
|
||||
if (newMedia.hashCode() != currentMediaHash) {
|
||||
currentMediaHash = newMedia.hashCode()
|
||||
media = newMedia
|
||||
enableInstantLoad()
|
||||
notifyDataSetChanged()
|
||||
finishActMode()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateDisplayFilenames(displayFilenames: Boolean) {
|
||||
this.displayFilenames = displayFilenames
|
||||
|
|
Loading…
Reference in a new issue