Fix / view attachment crash + freeze when offline

This commit is contained in:
Valere 2020-07-13 09:15:52 +02:00
parent 246f6bb0d0
commit c63128cfbd
2 changed files with 8 additions and 4 deletions

View File

@ -151,7 +151,10 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
.into(imageView)
}
fun renderThumbnailDontTransform(data: Data, imageView: ImageView, callback: ((Boolean) -> Unit)? = null) {
/**
* onlyRetrieveFromCache is true!
*/
fun renderForSharedElementTransition(data: Data, imageView: ImageView, callback: ((Boolean) -> Unit)? = null) {
// a11y
imageView.contentDescription = data.filename
@ -186,7 +189,8 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
return false
}
})
.dontTransform()
.onlyRetrieveFromCache(true)
.fitCenter()
.into(imageView)
}

View File

@ -96,7 +96,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
// will be shown at end of transition
pager2.isInvisible = true
supportPostponeEnterTransition()
imageContentRenderer.renderThumbnailDontTransform(mediaData, imageTransitionView) {
imageContentRenderer.renderForSharedElementTransition(mediaData, imageTransitionView) {
// Proceed with transaction
scheduleStartPostponedTransition(imageTransitionView)
}
@ -104,7 +104,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
// will be shown at end of transition
pager2.isInvisible = true
supportPostponeEnterTransition()
imageContentRenderer.renderThumbnailDontTransform(mediaData.thumbnailMediaData, imageTransitionView) {
imageContentRenderer.renderForSharedElementTransition(mediaData.thumbnailMediaData, imageTransitionView) {
// Proceed with transaction
scheduleStartPostponedTransition(imageTransitionView)
}