Skip to content
Snippets Groups Projects
Commit 5fdda23d authored by Taras's avatar Taras
Browse files

Create load with aspect extension

parent bcf65c4c
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,14 @@ package org.futo.circles.extensions ...@@ -3,14 +3,14 @@ package org.futo.circles.extensions
import android.util.Size import android.util.Size
import android.widget.ImageView import android.widget.ImageView
import org.futo.circles.R import org.futo.circles.R
import org.futo.circles.model.GalleryImageListItem import org.futo.circles.model.MediaContentData
fun GalleryImageListItem.loadInto(imageView: ImageView) { fun MediaContentData.loadEncryptedIntoWithAspect(imageView: ImageView, aspectRatio: Float) {
if (imageContent.mediaContentData.fileUrl.startsWith(UriContentScheme)) { if (fileUrl.startsWith(UriContentScheme)) {
imageView.setImageResource(R.drawable.blurred_placeholder) imageView.setImageResource(R.drawable.blurred_placeholder)
} else { } else {
val imageWith = imageView.width val imageWith = imageView.width
val size = Size(imageWith, (imageWith / imageContent.aspectRatio).toInt()) val size = Size(imageWith, (imageWith / aspectRatio).toInt())
imageView.loadEncryptedImage(imageContent.mediaContentData, size) imageView.loadEncryptedImage(this, size)
} }
} }
\ 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