Commit cf5feab0 by gao.chao

picasso升级

parent 6ae24f86
...@@ -42,7 +42,7 @@ dependencies { ...@@ -42,7 +42,7 @@ dependencies {
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'//下拉刷新,加载更多 api 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'//下拉刷新,加载更多
api 'com.youth.banner:banner:1.4.10' //图片轮播控件 api 'com.youth.banner:banner:1.4.10' //图片轮播控件
api 'com.squareup.okhttp3:okhttp:4.3.1' api 'com.squareup.okhttp3:okhttp:4.3.1'
api 'com.squareup.picasso:picasso:2.5.2'//图片加载 api 'com.squareup.picasso:picasso:2.71828'//图片加载
api 'com.tencent.bugly:crashreport_upgrade:1.3.4' api 'com.tencent.bugly:crashreport_upgrade:1.3.4'
api 'com.tencent.bugly:nativecrashreport:3.6.0.1' api 'com.tencent.bugly:nativecrashreport:3.6.0.1'
api 'com.orhanobut:logger:2.2.0' api 'com.orhanobut:logger:2.2.0'
......
...@@ -3,6 +3,7 @@ package com.mayi.fastdevelop.base; ...@@ -3,6 +3,7 @@ package com.mayi.fastdevelop.base;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
...@@ -31,9 +32,12 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout; ...@@ -31,9 +32,12 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.constant.SpinnerStyle; import com.scwang.smartrefresh.layout.constant.SpinnerStyle;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter; import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader; import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import com.squareup.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;
import com.tencent.bugly.crashreport.CrashReport; import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.mmkv.MMKV; import com.tencent.mmkv.MMKV;
import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -54,6 +58,12 @@ public abstract class BaseApplication extends MultiDexApplication { ...@@ -54,6 +58,12 @@ public abstract class BaseApplication extends MultiDexApplication {
initSmartRefreshLayout(); initSmartRefreshLayout();
MMKV.initialize(this); MMKV.initialize(this);
HttpProxy.getInstance().init(new OKHttpModel()); HttpProxy.getInstance().init(new OKHttpModel());
File externalFilesDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
Picasso picasso = new Picasso.Builder(this)
.downloader(new OkHttp3Downloader(externalFilesDir))//设置disk缓存
.defaultBitmapConfig(Bitmap.Config.RGB_565) // 设置全局的图片样式
.build();
Picasso.setSingletonInstance(picasso);
} }
private void initSmartRefreshLayout() { private void initSmartRefreshLayout() {
......
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