diff --git a/build.gradle b/build.gradle index 195c104..d8b8a36 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,8 @@ buildscript { apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/gradle7_5/remote3.gradle?q=2' apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/gradle7_5/z_config/pack.gradle?q=3' //apply from : 'https://raw.githubusercontent.com/hss01248/BaseAppAnalytics/master/remote.gradle' - apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/dev/deps/depsLastestChecker.gradle' - //apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/dev/deps/uploadAllTask.gradle' + apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/gradle7_5/deps/depsLastestChecker.gradle' + apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/gradle7_5/deps/uploadAllByMavenPublish.gradle?a=3' apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/gradle7_5/z_config/git_branch_info.gradle' //apply from: 'pack.gradle' @@ -14,7 +14,7 @@ buildscript { // 快照版需要在版本号后面加-SNAPSHOT //groupId='com.xxx.yyy.mylib' groupId='com.github.hss01248.ImageLoader' - versionCode = '3.3.3.01' + versionCode = '3.7.2.00' isPublisToLocal=true } diff --git a/glidev4/build.gradle b/glidev4/build.gradle index 5acd378..60471c7 100644 --- a/glidev4/build.gradle +++ b/glidev4/build.gradle @@ -1,3 +1,4 @@ + apply plugin: 'com.android.library' android { @@ -9,7 +10,7 @@ android { targetSdkVersion 28 versionCode 1 versionName "1.0" - + consumerProguardFiles "consumer-rules.pro" //testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/glidev4/consumer-rules.pro b/glidev4/consumer-rules.pro new file mode 100644 index 0000000..684040b --- /dev/null +++ b/glidev4/consumer-rules.pro @@ -0,0 +1,3 @@ +-keep class com.shizhefei.view.largeimage.factory.** { *; } +-keep class com.bumptech.glide.** { *; } +-keep class pl.droidsonroids.gif.InputSource.** { *; } \ No newline at end of file diff --git a/glidev4/src/main/java/com/hss01248/glidev4/config/GlideModelConfig.java b/glidev4/src/main/java/com/hss01248/glidev4/config/GlideModelConfig.java index 6767619..75b3e8a 100644 --- a/glidev4/src/main/java/com/hss01248/glidev4/config/GlideModelConfig.java +++ b/glidev4/src/main/java/com/hss01248/glidev4/config/GlideModelConfig.java @@ -1,6 +1,7 @@ package com.hss01248.glidev4.config; import android.content.Context; +import android.graphics.Bitmap; import android.util.Log; import androidx.annotation.NonNull; @@ -9,11 +10,14 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.Registry; import com.bumptech.glide.annotation.GlideModule; +import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader; +import com.bumptech.glide.load.model.GlideUrl; import com.bumptech.glide.module.LibraryGlideModule; import com.hss01248.glide.aop.net.ModifyResponseBodyInterceptor; import com.hss01248.image.config.GlobalConfig; import java.io.InputStream; +import java.nio.ByteBuffer; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; @@ -26,6 +30,8 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; +import jp.co.link_u.library.glideavif.AvifDecoderFromByteBuffer; +import me.jessyan.progressmanager.ProgressManager; import okhttp3.OkHttpClient; /** @@ -44,19 +50,20 @@ public void registerComponents(@NonNull Context context, @NonNull Glide glide, LogUtils.w("in lib: registerComponents"); OkHttpClient.Builder builder = new OkHttpClient.Builder(); //.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); - if(GlobalConfig.debug){ + //if(GlobalConfig.debug){ setIgnoreAll(builder); - } + // } builder .addNetworkInterceptor(new ModifyResponseBodyInterceptor()) - .connectTimeout(30, TimeUnit.SECONDS) - .readTimeout(30, TimeUnit.SECONDS) - .writeTimeout(30, TimeUnit.SECONDS); - // registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(ProgressManager.getInstance() - // .with(builder).build())); + .connectTimeout(10, TimeUnit.SECONDS) + .readTimeout(10, TimeUnit.SECONDS) + .writeTimeout(10, TimeUnit.SECONDS); + registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(ProgressManager.getInstance() + .with(builder).build())); + registry.prepend(ByteBuffer.class, Bitmap.class,new AvifDecoderFromByteBuffer()); //todo 不如直接用aop切,简单粗暴: com.bumptech.glide.load.model.FileLoader.buildLoadData, 将第一个参数File model替换掉 -/* registry.prepend(ByteBuffer.class, Bitmap.class,new AvifDecoderFromByteBuffer()); +/* registry.replace(File.class, InputStream.class, new MyStreamFactory());