Commit 7c037268 by zhengnw@sobot.com

pic 加载图片 path 不能为空 null

parent 9666a013
......@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'picture' //项目名
//PUBLISH_ARTIFACT_ID = 'picture_x' //项目名
PUBLISH_VERSION = '1.1.4' //版本号
PUBLISH_VERSION = '1.1.5' //版本号
}
......
......@@ -6,6 +6,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.ImageView;
import com.facebook.common.executors.UiThreadImmediateExecutorService;
......@@ -23,6 +24,12 @@ import com.sobot.chat.imageloader.SobotImageLoader;
public class SobotFrescoImageLoader extends SobotImageLoader {
@Override
public void displayImage(Context context, final ImageView imageView, final String path, @DrawableRes int loadingResId, @DrawableRes int failResId, int width, int height, final SobotDisplayImageListener listener) {
if (TextUtils.isEmpty(path) || "null".equals(path)) {
return;
}
if (imageView == null) {
return;
}
ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path));
if (width > 0 && height > 0) {
builder.setResizeOptions(new ResizeOptions(width, height));
......
......@@ -3,6 +3,7 @@ package com.sobot.pictureframe;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.annotation.DrawableRes;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.BitmapRequestBuilder;
......@@ -18,6 +19,12 @@ public class SobotGlideImageLoader extends SobotImageLoader {
@Override
public void displayImage(Context context, final ImageView imageView, final String path, @DrawableRes int loadingResId, @DrawableRes int failResId, int width, int height, final SobotDisplayImageListener listener) {
if (TextUtils.isEmpty(path) || "null".equals(path)) {
return;
}
if (imageView == null) {
return;
}
BitmapRequestBuilder<String, Bitmap> builder = Glide.with(context).load(path).asBitmap().placeholder(loadingResId).error(failResId);
if (width != 0 || height != 0) {
builder.override(width, height);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment