mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +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)
|
directories_horizontal_fastscroller.beVisibleIf(directories_grid.isVisible() && allowHorizontalScroll)
|
||||||
|
|
||||||
checkLastMediaChanged()
|
checkLastMediaChanged()
|
||||||
if (dirs.hashCode() == mDirs.hashCode()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
mDirs = dirs
|
mDirs = dirs
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
|
|
|
@ -59,7 +59,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private var mStoredScrollHorizontally = true
|
private var mStoredScrollHorizontally = true
|
||||||
private var mStoredShowInfoBubble = true
|
private var mStoredShowInfoBubble = true
|
||||||
private var mStoredTextColor = 0
|
private var mStoredTextColor = 0
|
||||||
private var mLastDrawnHashCode = 0
|
|
||||||
private var mLatestMediaId = 0L
|
private var mLatestMediaId = 0L
|
||||||
private var mLastMediaHandler = Handler()
|
private var mLastMediaHandler = Handler()
|
||||||
private var mCurrAsyncTask: GetMediaAsynctask? = null
|
private var mCurrAsyncTask: GetMediaAsynctask? = null
|
||||||
|
@ -603,11 +602,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
|
|
||||||
checkLastMediaChanged()
|
checkLastMediaChanged()
|
||||||
|
|
||||||
if (media.hashCode() == mMedia.hashCode() && media.hashCode() == mLastDrawnHashCode) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
mLastDrawnHashCode = media.hashCode()
|
|
||||||
mMedia = media
|
mMedia = media
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
setupAdapter()
|
setupAdapter()
|
||||||
|
|
|
@ -38,6 +38,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
||||||
private var showMediaCount = config.showMediaCount
|
private var showMediaCount = config.showMediaCount
|
||||||
private var animateGifs = config.animateGifs
|
private var animateGifs = config.animateGifs
|
||||||
private var cropThumbnails = config.cropThumbnails
|
private var cropThumbnails = config.cropThumbnails
|
||||||
|
private var currentDirectoriesHash = dirs.hashCode()
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_directories
|
override fun getActionMenuId() = R.menu.cab_directories
|
||||||
|
|
||||||
|
@ -307,10 +308,13 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateDirs(newDirs: ArrayList<Directory>) {
|
fun updateDirs(newDirs: ArrayList<Directory>) {
|
||||||
|
if (newDirs.hashCode() != currentDirectoriesHash) {
|
||||||
|
currentDirectoriesHash = newDirs.hashCode()
|
||||||
dirs = newDirs
|
dirs = newDirs
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun updateAnimateGifs(animateGifs: Boolean) {
|
fun updateAnimateGifs(animateGifs: Boolean) {
|
||||||
this.animateGifs = animateGifs
|
this.animateGifs = animateGifs
|
||||||
|
|
|
@ -38,6 +38,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
private var visibleItemPaths = ArrayList<String>()
|
private var visibleItemPaths = ArrayList<String>()
|
||||||
private var loadImageInstantly = false
|
private var loadImageInstantly = false
|
||||||
private var delayHandler = Handler(Looper.getMainLooper())
|
private var delayHandler = Handler(Looper.getMainLooper())
|
||||||
|
private var currentMediaHash = media.hashCode()
|
||||||
|
|
||||||
private var scrollHorizontally = config.scrollHorizontally
|
private var scrollHorizontally = config.scrollHorizontally
|
||||||
private var animateGifs = config.animateGifs
|
private var animateGifs = config.animateGifs
|
||||||
|
@ -246,11 +247,14 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateMedia(newMedia: ArrayList<Medium>) {
|
fun updateMedia(newMedia: ArrayList<Medium>) {
|
||||||
|
if (newMedia.hashCode() != currentMediaHash) {
|
||||||
|
currentMediaHash = newMedia.hashCode()
|
||||||
media = newMedia
|
media = newMedia
|
||||||
enableInstantLoad()
|
enableInstantLoad()
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun updateDisplayFilenames(displayFilenames: Boolean) {
|
fun updateDisplayFilenames(displayFilenames: Boolean) {
|
||||||
this.displayFilenames = displayFilenames
|
this.displayFilenames = displayFilenames
|
||||||
|
|
Loading…
Reference in a new issue