Update AsyncDrawableSpan.java

Don't extend drawable beyond screen.
This commit is contained in:
Rohit 2023-10-15 18:47:28 +05:30 committed by GitHub
parent 2ea148c30a
commit 071d72d649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,10 +101,8 @@ public class AsyncDrawableSpan extends ReplacementSpan {
@NonNull Paint paint) {
// @since 4.4.0 use SpanUtils instead of `canvas.getWidth`
drawable.initWithKnownDimensions(
SpanUtils.width(canvas, text),
paint.getTextSize()
);
final int width = (int) (SpanUtils.width(canvas, text) - x);
getDrawable().initWithKnownDimensions(width, paint.getTextSize());
final AsyncDrawable drawable = this.drawable;