Skip to content

Commit

Permalink
升级第三方依赖,添加svg图片支持
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwfqin committed Oct 29, 2019
1 parent cc552d1 commit 615de3e
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 64 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
// 支持AndroidX

// quicklib(Base)
implementation 'com.sdwfqin.quicklib:quicklib:3.0.2'
implementation 'com.sdwfqin.quicklib:quicklib:3.0.3'
// 如果使用butterknife请添加【可选】
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'

// 支付模块
implementation 'com.sdwfqin.quicklib:paylib:3.1.0'

// Android 图片加载库(Glide封装)
implementation 'com.sdwfqin.quick:imageloader:3.0.2'
implementation 'com.sdwfqin.quick:imageloader:3.0.3'

// Android 自定义View组件
implementation 'com.sdwfqin.quick:widget:3.0.2'
implementation 'com.sdwfqin.quick:widget:3.0.3'

==================== AndroidX 分界线 ====================

Expand Down
2 changes: 0 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ dependencies {
// implementation 'com.tencent.tinker:tinker-android-lib:1.9.9'

implementation imageDependencies["matisse"]
implementation imageDependencies["androidsvg"]

implementation project(':imageloader')
implementation project(':quicklib')
implementation project(':paylib')
implementation project(':widget')

annotationProcessor compilerDependencies["glide-compiler"]
annotationProcessor compilerDependencies["butterknife-compiler"]
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/sdwfqin/quickseed/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public void right() {
break;
case 2:
List<String> strings = new ArrayList<>();
strings.add("http://sdwfqin1-1252249614.cos.ap-beijing-1.myqcloud.com/blog/MicroText%20(1).png");
strings.add("http://sdwfqin1-1252249614.cos.ap-beijing-1.myqcloud.com/blog/MicroText%20(4).png");
strings.add("https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike116%2C5%2C5%2C116%2C38/sign=80a0e826da160924c828aa49b56e5e9f/f636afc379310a5585445184bd4543a982261059.jpg");
strings.add("https://gss3.bdstatic.com/-Po3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike116%2C5%2C5%2C116%2C38/sign=b214b363d754564ef168ec6bd2b7f7e7/7e3e6709c93d70cfc087257df2dcd100baa12b45.jpg");
ImagePreviewActivity.launch(mContext, strings);
break;
case 3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import android.widget.ImageView;

import com.bumptech.glide.RequestBuilder;
import com.sdwfqin.imageloader.GlideApp;
import com.sdwfqin.imageloader.svg.SvgSoftwareLayerSetter;
import com.sdwfqin.quicklib.base.BaseActivity;
import com.sdwfqin.quickseed.R;
import com.sdwfqin.quickseed.utils.svg.GlideApp;
import com.sdwfqin.quickseed.utils.svg.SvgSoftwareLayerSetter;

import butterknife.BindView;

Expand Down
30 changes: 0 additions & 30 deletions app/src/main/java/com/sdwfqin/quickseed/utils/svg/SvgModule.java

This file was deleted.

16 changes: 8 additions & 8 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {

vlayout = "1.2.26"
vlayout = "1.2.31"

android = [
compileSdkVersion: 28,
Expand All @@ -21,7 +21,7 @@ ext {

eventDependencies = [
// rxjava
"rxjava" : "io.reactivex.rxjava2:rxjava:2.2.12",
"rxjava" : "io.reactivex.rxjava2:rxjava:2.2.13",
"rxandroid": "io.reactivex.rxjava2:rxandroid:2.1.1",
// eventbus
"eventbus" : "org.greenrobot:eventbus:3.1.1",
Expand All @@ -35,8 +35,8 @@ ext {
]

okhttpDependencies = [
"okhttp" : "com.squareup.okhttp3:okhttp:4.2.0",
"logging-interceptor": "com.squareup.okhttp3:logging-interceptor:4.2.0",
"okhttp" : "com.squareup.okhttp3:okhttp:4.2.2",
"logging-interceptor": "com.squareup.okhttp3:logging-interceptor:4.2.2",
]

viewDependencies = [
Expand All @@ -45,9 +45,9 @@ ext {
// smartrefresh
"smartrefresh": "com.scwang.smartrefresh:SmartRefreshLayout:1.1.0",
// pickerview
"pickerview" : "com.contrarywind:Android-PickerView:4.1.8",
"pickerview" : "com.contrarywind:Android-PickerView:4.1.9",
// butterknife
"butterknife" : "com.jakewharton:butterknife:10.1.0",
"butterknife" : "com.jakewharton:butterknife:10.2.0",
]

imageDependencies = [
Expand All @@ -56,7 +56,7 @@ ext {
// photoView 图片放大
"photoview" : "com.github.chrisbanes:PhotoView:2.3.0",
// matisse
"matisse" : "com.zhihu.android:matisse:0.5.3-beta2",
"matisse" : "com.zhihu.android:matisse:0.5.3-beta3",
"androidsvg" : "com.caverock:androidsvg-aar:1.4",
]

Expand All @@ -77,7 +77,7 @@ ext {
"qmui" : "com.qmuiteam:qmui:1.4.0",
"arch" : "com.qmuiteam:arch:0.6.0",
// 微信
"wechat-sdk-mta" : "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.3.1",
"wechat-sdk-mta" : "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.4.0",
// bugly
"crashreport_upgrade": "com.tencent.bugly:crashreport_upgrade:1.4.1",
]
Expand Down
5 changes: 3 additions & 2 deletions imageloader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

// gradlew imageloader:clean imageloader:build imageloader:bintrayUpload

version = "3.0.2"
version = "3.0.3"

android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
Expand All @@ -11,7 +11,7 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode 15
versionCode 16
versionName version
}

Expand All @@ -34,6 +34,7 @@ dependencies {
api imageDependencies["glide"]
annotationProcessor compilerDependencies["glide-compiler"]
api imageDependencies["glide-integration"]
api imageDependencies["androidsvg"]
}

apply from: "deployBintray.gradle"
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
*/
public class ImageLoader {

protected static final String ANDROID_RESOURCE = "android.resource://";
protected static final String FILE = "file://";
protected static final String SEPARATOR = "/";
protected static final String HTTP = "http";
private static final String HTTP = "http";

private WeakReference<ImageView> imageViewWeakReference;
private Builder builder;
Expand All @@ -50,9 +47,6 @@ public GlideRequests loadBaseImage() {
* 创建GlideRequest<Drawable>
*/
public GlideRequest<Drawable> loadDrawableImage() {
if (builder.image instanceof String && ((String) builder.image).toLowerCase().startsWith(HTTP)) {
url = (String) builder.image;
}
GlideRequest<Drawable> glideRequest = loadBaseImage().load(builder.image);
if (builder.placeholder != 0) {
glideRequest = glideRequest.placeholder(builder.placeholder);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.sdwfqin.imageloader;

import android.content.Context;
import android.graphics.drawable.PictureDrawable;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
Expand All @@ -9,7 +11,10 @@
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import com.caverock.androidsvg.SVG;
import com.sdwfqin.imageloader.progress.ProgressManager;
import com.sdwfqin.imageloader.svg.SvgDecoder;
import com.sdwfqin.imageloader.svg.SvgDrawableTranscoder;

import java.io.InputStream;

Expand All @@ -29,5 +34,14 @@ public class ImageLoaderGlideModule extends AppGlideModule {
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
super.registerComponents(context, glide, registry);
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(ProgressManager.getOkHttpClient()));

registry.register(SVG.class, PictureDrawable.class, new SvgDrawableTranscoder())
.append(InputStream.class, SVG.class, new SvgDecoder());
}

// Disable manifest parsing to avoid adding similar modules twice.
@Override
public boolean isManifestParsingEnabled() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sdwfqin.quickseed.utils.svg;
package com.sdwfqin.imageloader.svg;

import androidx.annotation.NonNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sdwfqin.quickseed.utils.svg;
package com.sdwfqin.imageloader.svg;

import android.graphics.Picture;
import android.graphics.drawable.PictureDrawable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sdwfqin.quickseed.utils.svg;
package com.sdwfqin.imageloader.svg;

import android.graphics.drawable.PictureDrawable;
import android.widget.ImageView;
Expand Down
4 changes: 2 additions & 2 deletions quicklib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

// ./gradlew quicklib:clean quicklib:build quicklib:bintrayUpload

version = "3.0.2"
version = "3.0.3"

android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
Expand All @@ -11,7 +11,7 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode 82
versionCode 83
versionName version
}

Expand Down
4 changes: 2 additions & 2 deletions widget/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ apply plugin: 'com.android.library'

// gradlew widget:clean widget:build widget:bintrayUpload

version = "3.0.2"
version = "3.0.3"

android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode 15
versionCode 16
versionName version
}

Expand Down

0 comments on commit 615de3e

Please sign in to comment.