Skip to content

Commit

Permalink
Rename maxSize to maxPxSize
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jul 30, 2024
1 parent fa27331 commit 4c5e127
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class AvatarRenderer @Inject constructor(
glideRequests: GlideRequests,
matrixItem: MatrixItem,
target: Target<Drawable>,
maxSize: Int = 0
maxPxSize: Int = 0
) {
val placeholder = getPlaceholderDrawable(matrixItem)
glideRequests.loadResolvedUrl(matrixItem.avatarUrl)
Expand All @@ -174,7 +174,7 @@ class AvatarRenderer @Inject constructor(
}
else -> {
// TCHAP Fix avatar sizing
it.apply(RequestOptions.circleCropTransform().override(maxSize, maxSize))
it.apply(RequestOptions.circleCropTransform().override(maxPxSize, maxPxSize))
}
}
}
Expand Down Expand Up @@ -266,10 +266,10 @@ class AvatarRenderer @Inject constructor(
}

@AnyThread
fun getCachedDrawable(glideRequests: GlideRequests, matrixItem: MatrixItem, maxSize: Int = 0): Drawable {
fun getCachedDrawable(glideRequests: GlideRequests, matrixItem: MatrixItem, maxPxSize: Int = 0): Drawable {
return glideRequests.loadResolvedUrl(matrixItem.avatarUrl)
.onlyRetrieveFromCache(true)
.apply(RequestOptions.circleCropTransform().override(maxSize, maxSize)) // TCHAP Fix avatar sizing
.apply(RequestOptions.circleCropTransform().override(maxPxSize, maxPxSize)) // TCHAP Fix avatar sizing
.submit()
.get()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class PillImageSpan(
override val matrixItem: MatrixItem
) : ReplacementSpan(), MatrixItemSpan {

private val maxSize = context.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.pill_avatar_size)
private val maxPxSize = context.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.pill_avatar_size)
private val pillDrawable = createChipDrawable()
private val target = PillImageSpanTarget(this)
private var tv: WeakReference<TextView>? = null

@UiThread
fun bind(textView: TextView) {
tv = WeakReference(textView)
avatarRenderer.render(glideRequests, matrixItem, target, maxSize) // TCHAP Fix avatar sizing
avatarRenderer.render(glideRequests, matrixItem, target, maxPxSize) // TCHAP Fix avatar sizing
}

// ReplacementSpan *****************************************************************************
Expand Down Expand Up @@ -145,7 +145,7 @@ class PillImageSpan(
}
else -> {
try {
avatarRenderer.getCachedDrawable(glideRequests, matrixItem, maxSize) // TCHAP Fix avatar sizing
avatarRenderer.getCachedDrawable(glideRequests, matrixItem, maxPxSize) // TCHAP Fix avatar sizing
} catch (exception: Exception) {
avatarRenderer.getPlaceholderDrawable(matrixItem)
}
Expand Down

0 comments on commit 4c5e127

Please sign in to comment.