Fix async-drawable tests
This commit is contained in:
parent
d630039196
commit
4fec46fb4d
@ -32,10 +32,11 @@ final Markwon markwon = Markwon.builder(context)
|
|||||||
@Override
|
@Override
|
||||||
public void configureBuilder(@NonNull Builder builder) {
|
public void configureBuilder(@NonNull Builder builder) {
|
||||||
builder
|
builder
|
||||||
.background(backgroundDrawable)
|
|
||||||
.align(JLatexMathDrawable.ALIGN_CENTER)
|
.align(JLatexMathDrawable.ALIGN_CENTER)
|
||||||
.fitCanvas(true)
|
.fitCanvas(true)
|
||||||
.padding(paddingPx)
|
.padding(paddingPx)
|
||||||
|
// @since 4.0.0 - change to provider
|
||||||
|
.backgroundProvider(() -> new MyDrawable()))
|
||||||
// @since 4.0.0 - optional, by default cached-thread-pool will be used
|
// @since 4.0.0 - optional, by default cached-thread-pool will be used
|
||||||
.executorService(Executors.newCachedThreadPool());
|
.executorService(Executors.newCachedThreadPool());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.noties.markwon.image;
|
package io.noties.markwon.image;
|
||||||
|
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -144,9 +145,13 @@ class AsyncDrawableLoaderImpl extends AsyncDrawableLoader {
|
|||||||
final Drawable out = drawable;
|
final Drawable out = drawable;
|
||||||
|
|
||||||
// @since 4.0.0-SNAPSHOT apply intrinsic bounds (but only if they are empty)
|
// @since 4.0.0-SNAPSHOT apply intrinsic bounds (but only if they are empty)
|
||||||
if (out != null
|
if (out != null) {
|
||||||
&& out.getBounds().isEmpty()) {
|
final Rect bounds = out.getBounds();
|
||||||
DrawableUtils.applyIntrinsicBounds(out);
|
//noinspection ConstantConditions
|
||||||
|
if (bounds == null
|
||||||
|
|| bounds.isEmpty()) {
|
||||||
|
DrawableUtils.applyIntrinsicBounds(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.postAtTime(new Runnable() {
|
handler.postAtTime(new Runnable() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user