Skip to content
Snippets Groups Projects
Commit 78dcc71d authored by Taras's avatar Taras
Browse files

Fix loading thumbnails with size

parent 8a971e12
No related branches found
No related tags found
No related merge requests found
...@@ -83,13 +83,19 @@ fun ImageView.loadMatrixImage( ...@@ -83,13 +83,19 @@ fun ImageView.loadMatrixImage(
session: Session? = null, session: Session? = null,
applyBlur: Boolean = false applyBlur: Boolean = false
) { ) {
val currentSession = session ?: MatrixSessionProvider.currentSession post {
val size = if (loadOriginalSize) null else preferredSize ?: Size(width, height) val currentSession = session ?: MatrixSessionProvider.currentSession
val resolvedUrl = currentSession?.resolveUrl(url, size) val size = if (loadOriginalSize) null
Glide.with(this) else preferredSize ?: Size(
.load(resolvedUrl) measuredWidth,
.fitCenter() measuredHeight
.error(placeholder) ).takeIf { measuredWidth > 0 && measuredHeight > 0 }
.apply { if (applyBlur) transform(BlurTransformation(30)) } val resolvedUrl = currentSession?.resolveUrl(url, size)
.into(this) Glide.with(this)
.load(resolvedUrl)
.fitCenter()
.error(placeholder)
.apply { if (applyBlur) transform(BlurTransformation(30)) }
.into(this)
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment