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) .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 // a11y
imageView.contentDescription = data.filename imageView.contentDescription = data.filename
@ -186,7 +189,8 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
return false return false
} }
}) })
.dontTransform() .onlyRetrieveFromCache(true)
.fitCenter()
.into(imageView) .into(imageView)
} }

View File

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