Skip to content

Commit

Permalink
modified drawable width
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajith-Shettigar committed Nov 17, 2023
1 parent 6006277 commit 1ad7142
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ class UrlImageParser private constructor(

var drawableWidth = drawable.intrinsicWidth.toFloat()
var drawableHeight = drawable.intrinsicHeight.toFloat()
val maxContentItemPadding =
context.resources.getDimensionPixelSize(R.dimen.maximum_content_item_padding)
if (autoResizeImage) {
// Treat the drawable's dimensions as dp so that the image scales for higher density
// displays.
Expand All @@ -291,8 +293,7 @@ class UrlImageParser private constructor(
drawableHeight *= multipleFactor
drawableWidth *= multipleFactor
}
val maxContentItemPadding =
context.resources.getDimensionPixelSize(R.dimen.maximum_content_item_padding)

val maximumImageSize = maxAvailableWidth - maxContentItemPadding
if (drawableWidth >= maximumImageSize) {
// The multipleFactor value is used to make sure that the aspect ratio of the image
Expand All @@ -311,6 +312,8 @@ class UrlImageParser private constructor(
}
}

drawableWidth-=maxContentItemPadding

val drawableLeft = if (imageCenterAlign && !isRTLMode()) {
calculateInitialMargin(maxAvailableWidth, drawableWidth)
} else {
Expand Down

0 comments on commit 1ad7142

Please sign in to comment.