speed up fullscreen media showing a bit by providing files last modified too

This commit is contained in:
tibbi 2021-01-14 18:29:51 +01:00
parent c783ae4b5d
commit 60e0a68c1c
2 changed files with 3 additions and 3 deletions

View file

@ -598,7 +598,7 @@ fun Activity.fileRotatedSuccessfully(path: String, lastModified: Long) {
updateLastModified(path, lastModified) updateLastModified(path, lastModified)
} }
Picasso.get().invalidate(path.getFileKey()) Picasso.get().invalidate(path.getFileKey(lastModified))
// we cannot refresh a specific image in Glide Cache, so just clear it all // we cannot refresh a specific image in Glide Cache, so just clear it all
val glide = Glide.get(applicationContext) val glide = Glide.get(applicationContext)
glide.clearDiskCache() glide.clearDiskCache()

View file

@ -410,7 +410,7 @@ class PhotoFragment : ViewPagerFragment() {
private fun loadWithGlide(path: String, addZoomableView: Boolean) { private fun loadWithGlide(path: String, addZoomableView: Boolean) {
val priority = if (mIsFragmentVisible) Priority.IMMEDIATE else Priority.NORMAL val priority = if (mIsFragmentVisible) Priority.IMMEDIATE else Priority.NORMAL
val options = RequestOptions() val options = RequestOptions()
.signature(getFilePathToShow().getFileSignature()) .signature(getFilePathToShow().getFileSignature(mMedium.modified))
.format(DecodeFormat.PREFER_ARGB_8888) .format(DecodeFormat.PREFER_ARGB_8888)
.priority(priority) .priority(priority)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
@ -450,7 +450,7 @@ class PhotoFragment : ViewPagerFragment() {
val picasso = Picasso.get() val picasso = Picasso.get()
.load(pathToLoad) .load(pathToLoad)
.centerInside() .centerInside()
.stableKey(mMedium.path.getFileKey()) .stableKey(mMedium.path.getFileKey(mMedium.modified))
.resize(mScreenWidth, mScreenHeight) .resize(mScreenWidth, mScreenHeight)
if (mCurrentRotationDegrees != 0) { if (mCurrentRotationDegrees != 0) {