Commit fceb9d4d by zhengnw@sobot.com

widget 1.1.6 支持picasso 加载本地图片

parent 7750ced8
......@@ -3,7 +3,7 @@ plugins {
}
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 14
......@@ -11,7 +11,7 @@ android {
//这里就是打jar包
task makeJar(type: Copy) {
//删除旧的jar包
delete 'build/libs/sobot_picture_1.1.4.jar'
delete 'build/libs/sobot_picture_1.1.6.jar'
//原地址
from('build/intermediates/packaged-classes/release/')
//导出jar包的地址
......@@ -19,7 +19,7 @@ android {
//包含的jar包
include('classes.jar')
//重命名jar包为mysdk
rename ('classes.jar', 'sobot_picture_1.1.4.jar')
rename ('classes.jar', 'sobot_picture_1.1.6.jar')
}
makeJar.dependsOn(build)
......
......@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'picture' //项目名
//PUBLISH_ARTIFACT_ID = 'picture_x' //项目名
PUBLISH_VERSION = '1.1.5' //版本号
PUBLISH_VERSION = '1.1.6' //版本号
}
......
......@@ -10,6 +10,8 @@ import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import java.io.File;
/**
* 图片加载器 Picasso
*/
......@@ -21,7 +23,18 @@ public class SobotPicassoImageLoader extends SobotImageLoader {
if (TextUtils.isEmpty(path)) {
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) {
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