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