mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Merge pull request #647 from dbrant/rotate1
Fix showing local image if fetching thumbnail fails.
This commit is contained in:
		
						commit
						0a94c9c0ba
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -3,6 +3,7 @@ package fr.free.nrw.commons; | |||
| import android.content.Context; | ||||
| import android.support.annotation.NonNull; | ||||
| import android.support.annotation.Nullable; | ||||
| import android.text.TextUtils; | ||||
| import android.util.AttributeSet; | ||||
| 
 | ||||
| import com.facebook.drawee.view.SimpleDraweeView; | ||||
|  | @ -61,7 +62,12 @@ public class MediaWikiImageView extends SimpleDraweeView { | |||
|             if (isCancelled()) { | ||||
|                 return; | ||||
|             } | ||||
|             CommonsApplication.getInstance().getThumbnailUrlCache().put(media.getFilename(), result); | ||||
|             if (TextUtils.isEmpty(result) && media.getLocalUri() != null) { | ||||
|                 result = media.getLocalUri().toString(); | ||||
|             } else { | ||||
|                 // only cache meaningful thumbnails received from network. | ||||
|                 CommonsApplication.getInstance().getThumbnailUrlCache().put(media.getFilename(), result); | ||||
|             } | ||||
|             setImageUrl(result); | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Josephine Lim
						Josephine Lim