Commit 45395773 by zhengnw@sobot.com

widget 1.1.6 支持picasso 加载本地图片

parent 0bc403d0
...@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) { ...@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext { ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名 PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'picture_x' //项目名 PUBLISH_ARTIFACT_ID = 'picture_x' //项目名
PUBLISH_VERSION = '1.1.5' //版本号 PUBLISH_VERSION = '1.1.6' //版本号
} }
......
...@@ -10,6 +10,8 @@ import com.squareup.picasso.Callback; ...@@ -10,6 +10,8 @@ import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator; import com.squareup.picasso.RequestCreator;
import java.io.File;
/** /**
* 图片加载器 Picasso * 图片加载器 Picasso
*/ */
...@@ -21,7 +23,18 @@ public class SobotPicassoImageLoader extends SobotImageLoader { ...@@ -21,7 +23,18 @@ public class SobotPicassoImageLoader extends SobotImageLoader {
if (TextUtils.isEmpty(path)) { if (TextUtils.isEmpty(path)) {
pathStr = "error"; pathStr = "error";
} }
RequestCreator creator = Picasso.with(context).load(pathStr); RequestCreator creator ;
if (pathStr.startsWith("http")) {
creator = Picasso.with(context).load(pathStr);
} else {
//本地文件
File file = new File(pathStr);
if (file != null) {
creator = Picasso.with(context).load(file);
}else{
creator = Picasso.with(context).load(pathStr);
}
}
if (loadingResId != 0) { if (loadingResId != 0) {
creator.placeholder(loadingResId); creator.placeholder(loadingResId);
} }
......
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