Commit c9ee982d by 郑娜伟

picture 支持fresco

parent 27207957
...@@ -41,6 +41,7 @@ dependencies { ...@@ -41,6 +41,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0' implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.sobot.chat:sobotsupport-glidev4:2.1' implementation 'com.sobot.chat:sobotsupport-glidev4:2.1'
// implementation 'com.facebook.fresco:fresco:1.13.0'
implementation 'com.squareup.okhttp3:okhttp:4.4.0' implementation 'com.squareup.okhttp3:okhttp:4.4.0'
//添加此行 //添加此行
......
...@@ -3,6 +3,7 @@ package com.sobot.moduletest; ...@@ -3,6 +3,7 @@ package com.sobot.moduletest;
import android.app.Application; import android.app.Application;
import android.support.multidex.MultiDex; import android.support.multidex.MultiDex;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.sobot.common.ui.SobotMarkConfig; import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.common.utils.SobotCommonApi; import com.sobot.common.utils.SobotCommonApi;
...@@ -16,6 +17,7 @@ public class MyApp extends Application { ...@@ -16,6 +17,7 @@ public class MyApp extends Application {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Fresco.initialize(this);
// 主要是添加下面这句代码 // 主要是添加下面这句代码
MultiDex.install(this); MultiDex.install(this);
SobotCommonApi.init(this,"https://sobot.com"); SobotCommonApi.init(this,"https://sobot.com");
......
...@@ -31,7 +31,7 @@ dependencies { ...@@ -31,7 +31,7 @@ dependencies {
compileOnly 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' compileOnly 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compileOnly 'com.github.bumptech.glide:glide:3.8.0' compileOnly 'com.github.bumptech.glide:glide:3.8.0'
compileOnly 'com.squareup.picasso:picasso:2.5.2' compileOnly 'com.squareup.picasso:picasso:2.5.2'
compileOnly 'com.facebook.fresco:fresco:2.6.0' compileOnly 'com.facebook.fresco:fresco:1.13.0'
api 'com.sobot.chat:sobotsupport-glidev4:2.0' api 'com.sobot.chat:sobotsupport-glidev4:2.0'
} }
......
...@@ -13,7 +13,7 @@ ext { ...@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名 PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'picture' //项目名 PUBLISH_ARTIFACT_ID = 'picture' //项目名
//PUBLISH_ARTIFACT_ID = 'picture_x' //项目名 //PUBLISH_ARTIFACT_ID = 'picture_x' //项目名
PUBLISH_VERSION = '1.1' //版本号 PUBLISH_VERSION = '1.1.1' //版本号
} }
......
...@@ -35,7 +35,6 @@ public class SobotFrescoImageLoader extends SobotImageLoader { ...@@ -35,7 +35,6 @@ public class SobotFrescoImageLoader extends SobotImageLoader {
BaseBitmapDataSubscriber subscriber = new BaseBitmapDataSubscriber() { BaseBitmapDataSubscriber subscriber = new BaseBitmapDataSubscriber() {
@Override @Override
public void onNewResultImpl(@Nullable Bitmap bitmap) { public void onNewResultImpl(@Nullable Bitmap bitmap) {
// if (listener != null) {
new AsyncTask<Bitmap, Void, Bitmap>() { new AsyncTask<Bitmap, Void, Bitmap>() {
@Override @Override
protected Bitmap doInBackground(Bitmap... params) { protected Bitmap doInBackground(Bitmap... params) {
...@@ -50,10 +49,8 @@ public class SobotFrescoImageLoader extends SobotImageLoader { ...@@ -50,10 +49,8 @@ public class SobotFrescoImageLoader extends SobotImageLoader {
@Override @Override
protected void onPostExecute(Bitmap bitmap) { protected void onPostExecute(Bitmap bitmap) {
if (bitmap != null) { if (bitmap != null) {
// listener.onLoadComplete(bitmap);
imageView.setImageBitmap(bitmap); imageView.setImageBitmap(bitmap);
} else { } else {
// listener.onLoadFailed(null);
} }
} }
}.execute(bitmap); }.execute(bitmap);
...@@ -62,9 +59,6 @@ public class SobotFrescoImageLoader extends SobotImageLoader { ...@@ -62,9 +59,6 @@ public class SobotFrescoImageLoader extends SobotImageLoader {
@Override @Override
public void onFailureImpl(DataSource dataSource) { public void onFailureImpl(DataSource dataSource) {
// if (listener != null) {
// listener.onLoadFailed(dataSource.getFailureCause());
// }
} }
}; };
...@@ -73,6 +67,11 @@ public class SobotFrescoImageLoader extends SobotImageLoader { ...@@ -73,6 +67,11 @@ public class SobotFrescoImageLoader extends SobotImageLoader {
@Override @Override
public void displayImage(Context context, final ImageView imageView, @DrawableRes int targetResId, @DrawableRes int loadingResId, @DrawableRes int failResId, int width, int height, final SobotDisplayImageListener listener) { public void displayImage(Context context, final ImageView imageView, @DrawableRes int targetResId, @DrawableRes int loadingResId, @DrawableRes int failResId, int width, int height, final SobotDisplayImageListener listener) {
try {
if (imageView != null) {
imageView.setBackgroundResource(targetResId);
}
} catch (Exception e) {
}
} }
} }
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