question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async drawable doesn't show up if it's the only thing in the text view

See original GitHub issue
  • Markwon version: 4.2.1-SNAPSHOT + GlidePlugin

Async drawable doesn’t show up if it’s the only thing in the text view.

In the source code of the ReplacementSpan there’s this suspicious javadoc

   /**
     * Returns the width of the span. Extending classes can set the height of the span by updating
     * attributes of {@link android.graphics.Paint.FontMetricsInt}. If the span covers the whole
     * text, and the height is not set,
     * {@link #draw(Canvas, CharSequence, int, int, float, int, int, int, Paint)} will not be
     * called for the span.
     */
     public abstract int getSize(...)

And AsyncDrawable.initWithKnownDimensions(...) is only called if AsyncDrawableSpan.draw(...) of the parent span was called.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
notiescommented, Mar 8, 2020

I can reproduce it, the fix is going to be in the next 4.3.0 version (and upcoming snapshot). The problem is that Glide is setting placeholder as a regular result. AsyncDrawable receives the result, but as there are no canvas dimensions are available - there are no bounds available, thus span returns 0 for the size. Please note that this is the case when there is exactly one image span in the markdown. If there is at least one other character/span, result would be as OK

1reaction
LaurentTreguiercommented, Feb 5, 2020

This is on API 29, on the emulator

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Image from async task never shows - Stack Overflow
Image from async task never shows ... I then tried to execute it in my code like this: ImageView im1 = (ImageView) findViewById(R.id.image); ......
Read more >
TextView - Android Developers
Returns the extended top padding of the view, including both the top Drawable if any and any extra space to keep more than...
Read more >
AsyncTask Tutorial With Example Android Studio [Step By Step]
This class will executes everything in doInBackground() method inside of other thread which doesn't have access to the GUI where all the views...
Read more >
Kotlin and Android From Scratch Flashcards | Quizlet
Android studio kotlin beginner study guide Learn with flashcards, games, and more — for free.
Read more >
Async Text Loading in Android with PrecomputedText
The TextView is one of the most common Views used across all the Android apps. It has very simple API to show the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found