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,9 +308,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateDirs(newDirs: ArrayList<Directory>) {
|
fun updateDirs(newDirs: ArrayList<Directory>) {
|
||||||
dirs = newDirs
|
if (newDirs.hashCode() != currentDirectoriesHash) {
|
||||||
notifyDataSetChanged()
|
currentDirectoriesHash = newDirs.hashCode()
|
||||||
finishActMode()
|
dirs = newDirs
|
||||||
|
notifyDataSetChanged()
|
||||||
|
finishActMode()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateAnimateGifs(animateGifs: Boolean) {
|
fun updateAnimateGifs(animateGifs: Boolean) {
|
||||||
|
|
|
@ -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,10 +247,13 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateMedia(newMedia: ArrayList<Medium>) {
|
fun updateMedia(newMedia: ArrayList<Medium>) {
|
||||||
media = newMedia
|
if (newMedia.hashCode() != currentMediaHash) {
|
||||||
enableInstantLoad()
|
currentMediaHash = newMedia.hashCode()
|
||||||
notifyDataSetChanged()
|
media = newMedia
|
||||||
finishActMode()
|
enableInstantLoad()
|
||||||
|
notifyDataSetChanged()
|
||||||
|
finishActMode()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateDisplayFilenames(displayFilenames: Boolean) {
|
fun updateDisplayFilenames(displayFilenames: Boolean) {
|
||||||
|
|
Loading…
Reference in a new issue