Skip to content

Commit

Permalink
Fix image dimensions
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Jan 12, 2024
1 parent 1ace448 commit ac47af3
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class GalleryRowHolder(
val placeholder = ContextCompat.getDrawable(context, R.drawable.file_image)

val thumbnail = ImageView(context).apply {
LinearLayout.LayoutParams(defaultThumbnailSize.toInt(), defaultThumbnailSize.toInt())
setImageDrawable(placeholder)
}

Expand Down Expand Up @@ -148,7 +147,7 @@ class GalleryRowHolder(
}

private fun getSize(file: OCFile, shrinkRatio: Float): Pair<Int, Int> {
val imageDimension = file.imageDimension ?: ImageDimension(defaultThumbnailSize, defaultThumbnailSize)
val imageDimension = file.imageDimension ?: defaultImageDimension
val height = (imageDimension.height * shrinkRatio).toInt()
val width = (imageDimension.width * shrinkRatio).toInt()
return Pair(width, height)
Expand All @@ -158,7 +157,7 @@ class GalleryRowHolder(
val linearLayout = binding.rowLayout[index] as LinearLayout
val thumbnail = (linearLayout[0] as ImageView).apply {
adjustViewBounds = true
scaleType = ImageView.ScaleType.FIT_CENTER
scaleType = ImageView.ScaleType.FIT_XY
}

val (width, height) = size
Expand All @@ -170,9 +169,7 @@ class GalleryRowHolder(
.using(CustomGlideStreamLoader(user, clientFactory))
.load(imageUrl)
.asBitmap()
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.override(width, height)
.placeholder(placeholder)
.dontAnimate()
.into(thumbnail)
Expand Down

0 comments on commit ac47af3

Please sign in to comment.