Glimpse: Specify the memory key for images loaded via Coil
If the Uri matches but sizes don't Coil will re-fetch the image from disk, that's not optimal. Change-Id: I2336b851f2b11819845f4bd5815d1ec60b7fccd4
This commit is contained in:
parent
c45a4cb57b
commit
a528b7302b
|
@ -71,6 +71,7 @@ class AlbumThumbnailAdapter(
|
|||
)
|
||||
|
||||
thumbnailImageView.load(album.thumbnail.externalContentUri) {
|
||||
memoryCacheKey("thumbnail_${album.thumbnail.id}")
|
||||
size(ThumbnailLayoutManager.MAX_THUMBNAIL_SIZE.px)
|
||||
placeholder(R.drawable.thumbnail_placeholder)
|
||||
}
|
||||
|
|
|
@ -93,7 +93,9 @@ class MediaViewerAdapter(
|
|||
fun bind(media: Media, position: Int) {
|
||||
this.media = media
|
||||
this.position = position
|
||||
imageView.load(media.externalContentUri)
|
||||
imageView.load(media.externalContentUri) {
|
||||
memoryCacheKey("full_${media.id}")
|
||||
}
|
||||
}
|
||||
|
||||
fun onViewAttachedToWindow() {
|
||||
|
|
|
@ -150,6 +150,7 @@ class ThumbnailAdapter(
|
|||
this.position = position
|
||||
|
||||
thumbnailImageView.load(media.externalContentUri) {
|
||||
memoryCacheKey("thumbnail_${media.id}")
|
||||
size(ThumbnailLayoutManager.MAX_THUMBNAIL_SIZE.px)
|
||||
placeholder(R.drawable.thumbnail_placeholder)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue