mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fix for #708
This commit is contained in:
parent
691acbf983
commit
397b4fa586
2 changed files with 11 additions and 1 deletions
|
|
@ -6,10 +6,13 @@ import android.support.annotation.Nullable;
|
|||
import android.support.graphics.drawable.VectorDrawableCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class MediaWikiImageView extends SimpleDraweeView {
|
||||
private ThumbnailFetchTask currentThumbnailTask;
|
||||
|
||||
|
|
@ -81,7 +84,13 @@ public class MediaWikiImageView extends SimpleDraweeView {
|
|||
result = media.getLocalUri().toString();
|
||||
} else {
|
||||
// only cache meaningful thumbnails received from network.
|
||||
CommonsApplication.getInstance().getThumbnailUrlCache().put(media.getFilename(), result);
|
||||
try {
|
||||
CommonsApplication.getInstance().getThumbnailUrlCache().put(media.getFilename(), result);
|
||||
} catch (NullPointerException npe) {
|
||||
Timber.e("error when adding pic to cache " + npe);
|
||||
|
||||
Toast.makeText(getContext(), R.string.error_while_cache, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
setImageUrl(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,5 +198,6 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="no_description_found">no description found</string>
|
||||
<string name="nearby_info_menu_commons_article">Commons Article</string>
|
||||
<string name="nearby_info_menu_wikidata_article">Wikidata item</string>
|
||||
<string name="error_while_cache">Error while caching pictures</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue