Commit c9ee982d by 郑娜伟

picture 支持fresco

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