Skip to content

Commit d68aee2

Browse files
committed
use an improved way of file thumbnail caching
1 parent c9ee4f8 commit d68aee2

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/DecompressItemsAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class DecompressItemsAdapter(activity: SimpleActivity, var listItems: MutableLis
9595
} else {
9696
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
9797
val options = RequestOptions()
98-
.signature(listItem.mPath.getFileSignature())
98+
.signature(listItem.getKey())
9999
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
100100
.error(drawable)
101101
.centerCrop()

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
736736

737737
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
738738
val options = RequestOptions()
739-
.signature(listItem.mPath.getFileSignature())
739+
.signature(listItem.getKey())
740740
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
741741
.error(drawable)
742742
.transform(CenterCrop(), RoundedCorners(10))

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
231231
return
232232
}
233233

234-
val lastModifieds = if (isRPlus()) context!!.getFolderLastModifieds(path) else HashMap()
234+
val lastModifieds = context!!.getFolderLastModifieds(path)
235235
val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
236236
if (files != null) {
237237
for (file in files) {
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
package com.simplemobiletools.filemanager.pro.models
22

3+
import com.bumptech.glide.signature.ObjectKey
34
import com.simplemobiletools.commons.models.FileDirItem
5+
import java.io.File
46

57
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,
6-
var isSectionTitle: Boolean) : FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified)
8+
var isSectionTitle: Boolean) : FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified) {
9+
fun getSignature(): String {
10+
val lastModified = if (modified > 1) {
11+
modified
12+
} else {
13+
File(path).lastModified()
14+
}
15+
16+
return "$path-$lastModified-$size"
17+
}
18+
19+
fun getKey() = ObjectKey(getSignature())
20+
}

0 commit comments

Comments
 (0)