Skip to content

Commit 2884bd9

Browse files
dbrantneslihanturan
authored andcommitted
Remove dependency on Glide, Picasso, SVG, and multidex. (commons-app#1859)
* Eliminate the use of Picasso. This gets rid of the single use of the Picasso library (which was causing the whole library to be imported and shipped) and replaces it with Glide. TODO: replace this and the other instance(s) of Glide usage with Fresco, or vice versa. * Remove dependency on Glide. This removes the dependency on Glide, as well as the SVG rendering library, whose only purpose was to display a single SVG image in the Notification activity. Unfortunately Android doesn't support SVG natively, but Echo notifications have icons that are SVG formatted. Rather than import a bunch of heavy libraries to support this single case of SVG rendering, we can simply create a few local drawables that correspond to the different types of notifications, and use them instead. * Remove multidex! Multidex is a killer of performance and should be avoided at all costs. * Remove further unused bits. * Remove final vestige of multidex.
1 parent a059a3c commit 2884bd9

12 files changed

+50
-211
lines changed

README.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ We try to have an extensive documentation at [our wiki here at Github][5]:
3939
* [Fresco][27]
4040
* [Stetho][28]
4141
* [Dagger][29]
42-
* [AndroidSVG][30]
43-
* [Java-HTTP-Fluent][31]
44-
* [CircleProgressBar][32]
45-
* [Glide][33]
46-
* [Leak Canary][34]
42+
* [Java-HTTP-Fluent][30]
43+
* [CircleProgressBar][31]
44+
* [Leak Canary][32]
4745

4846
## License ##
4947

@@ -80,8 +78,6 @@ This software is open source, licensed under the [Apache License 2.0][4].
8078
[27]: https://github.com/facebook/fresco
8179
[28]: https://github.com/facebook/stetho
8280
[29]: https://github.com/google/dagger
83-
[30]: https://github.com/BigBadaboom/androidsvg
84-
[31]: https://github.com/yuvipanda/java-http-fluent/blob/master/src/main/java/in/yuvi/http/fluent/Http.java
85-
[32]: https://github.com/dinuscxj/CircleProgressBar
86-
[33]: https://github.com/bumptech/glide
87-
[34]: https://github.com/square/leakcanary
81+
[30]: https://github.com/yuvipanda/java-http-fluent/blob/master/src/main/java/in/yuvi/http/fluent/Http.java
82+
[31]: https://github.com/dinuscxj/CircleProgressBar
83+
[32]: https://github.com/square/leakcanary

app/build.gradle

+1-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ apply from: 'quality.gradle'
77
apply plugin: 'com.getkeepsafe.dexcount'
88

99
dependencies {
10-
implementation 'com.squareup.picasso:picasso:2.71828'
1110
implementation 'com.prof.rssparser:rssparser:1.1'
1211
implementation 'com.github.nicolas-raoul:Quadtree:ac16ea8035bf07'
1312
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
@@ -40,7 +39,6 @@ dependencies {
4039
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
4140
// Because RxAndroid releases are few and far between, it is recommended you also
4241
// explicitly depend on RxJava's latest version for bug fixes and new features.
43-
implementation 'com.android.support:multidex:1.0.3'
4442
implementation 'io.reactivex.rxjava2:rxjava:2.1.2'
4543
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
4644
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0'
@@ -53,7 +51,6 @@ dependencies {
5351
implementation "com.google.dagger:dagger-android-support:$DAGGER_VERSION"
5452
kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION"
5553
kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
56-
testImplementation 'org.robolectric:multidex:3.4.2'
5754
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
5855
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
5956
testImplementation 'junit:junit:4.12'
@@ -62,10 +59,6 @@ dependencies {
6259
testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
6360
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
6461

65-
implementation 'com.caverock:androidsvg:1.2.1'
66-
implementation 'com.github.bumptech.glide:glide:4.7.1'
67-
kapt 'com.github.bumptech.glide:compiler:4.7.1'
68-
6962
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
7063
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
7164
androidTestImplementation "com.android.support:support-annotations:$SUPPORT_LIB_VERSION"
@@ -95,8 +88,6 @@ android {
9588
targetSdkVersion project.targetSdkVersion
9689
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
9790
vectorDrawables.useSupportLibrary = true
98-
99-
multiDexEnabled true
10091
}
10192

10293
testOptions {
@@ -117,7 +108,7 @@ android {
117108
buildTypes {
118109
release {
119110
minifyEnabled false // See https://stackoverflow.com/questions/40232404/google-play-apk-and-android-studio-apk-usb-debug-behaving-differently - proguard.cfg modification alone insufficient.
120-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-glide.txt'
111+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
121112
}
122113
debug {
123114
testCoverageEnabled true

app/proguard-glide.txt

-9
This file was deleted.

app/src/main/java/fr/free/nrw/commons/CommonsApplication.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package fr.free.nrw.commons;
22

3+
import android.app.Application;
34
import android.app.NotificationChannel;
45
import android.app.NotificationManager;
56
import android.content.Context;
67
import android.content.SharedPreferences;
78
import android.database.sqlite.SQLiteDatabase;
89
import android.os.Build;
910
import android.support.annotation.RequiresApi;
10-
import android.support.multidex.MultiDexApplication;
1111

1212
import com.facebook.drawee.backends.pipeline.Fresco;
1313
import com.facebook.imagepipeline.core.ImagePipelineConfig;
@@ -45,7 +45,7 @@
4545
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
4646
resDialogOkToast = R.string.crash_dialog_ok_toast
4747
)
48-
public class CommonsApplication extends MultiDexApplication {
48+
public class CommonsApplication extends Application {
4949

5050
@Inject SessionManager sessionManager;
5151
@Inject DBOpenHelper dbOpenHelper;

app/src/main/java/fr/free/nrw/commons/glide/SvgDecoder.java

-36
This file was deleted.

app/src/main/java/fr/free/nrw/commons/glide/SvgDrawableTranscoder.java

-28
This file was deleted.

app/src/main/java/fr/free/nrw/commons/glide/SvgSoftwareLayerSetter.java

-51
This file was deleted.

app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java

-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package fr.free.nrw.commons.notification;
22

3-
import android.graphics.drawable.PictureDrawable;
43
import android.text.Html;
54
import android.view.LayoutInflater;
65
import android.view.View;
@@ -9,23 +8,17 @@
98
import android.widget.TextView;
109

1110
import com.borjabravo.readmoretextview.ReadMoreTextView;
12-
import com.bumptech.glide.RequestBuilder;
1311
import com.pedrogomez.renderers.Renderer;
1412

1513
import butterknife.BindView;
1614
import butterknife.ButterKnife;
1715
import fr.free.nrw.commons.R;
18-
import fr.free.nrw.commons.glide.SvgSoftwareLayerSetter;
19-
20-
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
2116

2217
/**
2318
* Created by root on 19.12.2017.
2419
*/
2520

2621
public class NotificationRenderer extends Renderer<Notification> {
27-
private RequestBuilder<PictureDrawable> requestBuilder;
28-
2922
@BindView(R.id.title) ReadMoreTextView title;
3023
@BindView(R.id.time) TextView time;
3124
@BindView(R.id.icon) ImageView icon;
@@ -48,11 +41,6 @@ protected void hookListeners(View rootView) {
4841
protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) {
4942
View inflatedView = layoutInflater.inflate(R.layout.item_notification, viewGroup, false);
5043
ButterKnife.bind(this, inflatedView);
51-
requestBuilder = GlideApp.with(inflatedView.getContext())
52-
.as(PictureDrawable.class)
53-
.error(R.drawable.round_icon_unknown)
54-
.transition(withCrossFade())
55-
.listener(new SvgSoftwareLayerSetter());
5644
return inflatedView;
5745
}
5846

@@ -61,7 +49,6 @@ public void render() {
6149
Notification notification = getContent();
6250
setTitle(notification.notificationText);
6351
time.setText(notification.date);
64-
requestBuilder.load(notification.iconUrl).into(icon);
6552
}
6653

6754
/**

app/src/main/java/fr/free/nrw/commons/notification/SvgModule.java

-35
This file was deleted.

0 commit comments

Comments
 (0)