mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-04-12 01:11:14 +02:00
use an improved way of file thumbnail caching
This commit is contained in:
parent
c9ee4f8f60
commit
d68aee2b5f
app/src/main/kotlin/com/simplemobiletools/filemanager/pro
@ -95,7 +95,7 @@ class DecompressItemsAdapter(activity: SimpleActivity, var listItems: MutableLis
|
|||||||
} else {
|
} else {
|
||||||
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
|
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.signature(listItem.mPath.getFileSignature())
|
.signature(listItem.getKey())
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.error(drawable)
|
.error(drawable)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
|
@ -736,7 +736,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
|||||||
|
|
||||||
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
|
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.signature(listItem.mPath.getFileSignature())
|
.signature(listItem.getKey())
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.error(drawable)
|
.error(drawable)
|
||||||
.transform(CenterCrop(), RoundedCorners(10))
|
.transform(CenterCrop(), RoundedCorners(10))
|
||||||
|
@ -231,7 +231,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val lastModifieds = if (isRPlus()) context!!.getFolderLastModifieds(path) else HashMap()
|
val lastModifieds = context!!.getFolderLastModifieds(path)
|
||||||
val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
|
val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
package com.simplemobiletools.filemanager.pro.models
|
package com.simplemobiletools.filemanager.pro.models
|
||||||
|
|
||||||
|
import com.bumptech.glide.signature.ObjectKey
|
||||||
import com.simplemobiletools.commons.models.FileDirItem
|
import com.simplemobiletools.commons.models.FileDirItem
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
data class ListItem(val mPath: String, val mName: String = "", var mIsDirectory: Boolean = false, var mChildren: Int = 0, var mSize: Long = 0L, var mModified: Long = 0L,
|
data class ListItem(val mPath: String, val mName: String = "", var mIsDirectory: Boolean = false, var mChildren: Int = 0, var mSize: Long = 0L, var mModified: Long = 0L,
|
||||||
var isSectionTitle: Boolean) : FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified)
|
var isSectionTitle: Boolean) : FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified) {
|
||||||
|
fun getSignature(): String {
|
||||||
|
val lastModified = if (modified > 1) {
|
||||||
|
modified
|
||||||
|
} else {
|
||||||
|
File(path).lastModified()
|
||||||
|
}
|
||||||
|
|
||||||
|
return "$path-$lastModified-$size"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getKey() = ObjectKey(getSignature())
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user