From 1ad7142a3fa760ffea634d7c13caf97013292198 Mon Sep 17 00:00:00 2001 From: Vishwajith-Shettigar Date: Fri, 17 Nov 2023 16:15:54 +0530 Subject: [PATCH] modified drawable width --- .../org/oppia/android/util/parser/image/UrlImageParser.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/parser/image/UrlImageParser.kt b/utility/src/main/java/org/oppia/android/util/parser/image/UrlImageParser.kt index b18934a1897..b3e95ae5e02 100644 --- a/utility/src/main/java/org/oppia/android/util/parser/image/UrlImageParser.kt +++ b/utility/src/main/java/org/oppia/android/util/parser/image/UrlImageParser.kt @@ -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. @@ -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 @@ -311,6 +312,8 @@ class UrlImageParser private constructor( } } + drawableWidth-=maxContentItemPadding + val drawableLeft = if (imageCenterAlign && !isRTLMode()) { calculateInitialMargin(maxAvailableWidth, drawableWidth) } else {