Commit 9b84aab8 by zhengnw@sobot.com

widget 1.1.7 Fresco 加载本地图片

parent 45395773
...@@ -11,7 +11,7 @@ android { ...@@ -11,7 +11,7 @@ android {
//这里就是打jar包 //这里就是打jar包
task makeJar(type: Copy) { task makeJar(type: Copy) {
//删除旧的jar包 //删除旧的jar包
delete 'build/libs/sobot_common_1.5.0.jar' delete 'build/libs/sobot_common_1.5.1.jar'
//原地址 //原地址
from('build/intermediates/packaged-classes/release/') from('build/intermediates/packaged-classes/release/')
//导出jar包的地址 //导出jar包的地址
...@@ -19,7 +19,7 @@ android { ...@@ -19,7 +19,7 @@ android {
//包含的jar包 //包含的jar包
include('classes.jar') include('classes.jar')
//重命名jar包为mysdk //重命名jar包为mysdk
rename ('classes.jar', 'sobot_common_1.5.0.jar') rename ('classes.jar', 'sobot_common_1.5.1.jar')
} }
makeJar.dependsOn(build) makeJar.dependsOn(build)
} }
...@@ -34,7 +34,7 @@ dependencies { ...@@ -34,7 +34,7 @@ dependencies {
api 'com.sobot.library:utils:1.1.3' api 'com.sobot.library:utils:1.1.3'
api 'com.sobot.library:picture_x:1.1.5' api 'com.sobot.library:picture_x:1.1.7'
api 'com.sobot.library:net:1.2.2' api 'com.sobot.library:net:1.2.2'
api 'com.sobot.library:gson:1.1.1' api 'com.sobot.library:gson:1.1.1'
} }
......
...@@ -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 = 'sobotcommon_x' //项目名 PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION = '1.5.0' //版本号 PUBLISH_VERSION = '1.5.1' //版本号
} }
......
...@@ -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.6' //版本号 PUBLISH_VERSION = '1.1.7' //版本号
} }
......
...@@ -21,6 +21,8 @@ import com.facebook.imagepipeline.request.ImageRequest; ...@@ -21,6 +21,8 @@ import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder; import com.facebook.imagepipeline.request.ImageRequestBuilder;
import com.sobot.chat.imageloader.SobotImageLoader; import com.sobot.chat.imageloader.SobotImageLoader;
import java.io.File;
public class SobotFrescoImageLoader extends SobotImageLoader { public class SobotFrescoImageLoader extends SobotImageLoader {
@Override @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) { public void displayImage(Context context, final ImageView imageView, final String path, @DrawableRes int loadingResId, @DrawableRes int failResId, int width, int height, final SobotDisplayImageListener listener) {
...@@ -30,7 +32,17 @@ public class SobotFrescoImageLoader extends SobotImageLoader { ...@@ -30,7 +32,17 @@ public class SobotFrescoImageLoader extends SobotImageLoader {
if (imageView == null) { if (imageView == null) {
return; return;
} }
ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path)); ImageRequestBuilder builder;
if (path.startsWith("http")) {
builder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path));
} else {
File file = new File(path);
if (file != null) {
builder = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(file));
}else{
builder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path));
}
}
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
builder.setResizeOptions(new ResizeOptions(width, height)); builder.setResizeOptions(new ResizeOptions(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