Remove dependency on Glide, Picasso, SVG, and multidex. (#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.
This commit is contained in:
Dmitry Brant 2018-08-30 07:40:17 -04:00 committed by neslihanturan
parent a059a3c2ef
commit 2884bd934a
12 changed files with 50 additions and 211 deletions

View file

@ -1,6 +1,5 @@
package fr.free.nrw.commons.notification;
import android.graphics.drawable.PictureDrawable;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
@ -9,23 +8,17 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.borjabravo.readmoretextview.ReadMoreTextView;
import com.bumptech.glide.RequestBuilder;
import com.pedrogomez.renderers.Renderer;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.glide.SvgSoftwareLayerSetter;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
/**
* Created by root on 19.12.2017.
*/
public class NotificationRenderer extends Renderer<Notification> {
private RequestBuilder<PictureDrawable> requestBuilder;
@BindView(R.id.title) ReadMoreTextView title;
@BindView(R.id.time) TextView time;
@BindView(R.id.icon) ImageView icon;
@ -48,11 +41,6 @@ public class NotificationRenderer extends Renderer<Notification> {
protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) {
View inflatedView = layoutInflater.inflate(R.layout.item_notification, viewGroup, false);
ButterKnife.bind(this, inflatedView);
requestBuilder = GlideApp.with(inflatedView.getContext())
.as(PictureDrawable.class)
.error(R.drawable.round_icon_unknown)
.transition(withCrossFade())
.listener(new SvgSoftwareLayerSetter());
return inflatedView;
}
@ -61,7 +49,6 @@ public class NotificationRenderer extends Renderer<Notification> {
Notification notification = getContent();
setTitle(notification.notificationText);
time.setText(notification.date);
requestBuilder.load(notification.iconUrl).into(icon);
}
/**

View file

@ -1,35 +0,0 @@
package fr.free.nrw.commons.notification;
import android.content.Context;
import android.graphics.drawable.PictureDrawable;
import android.support.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
import com.caverock.androidsvg.SVG;
import java.io.InputStream;
import fr.free.nrw.commons.glide.SvgDecoder;
import fr.free.nrw.commons.glide.SvgDrawableTranscoder;
/**
* Module for the SVG sample app.
*/
@GlideModule
public class SvgModule extends AppGlideModule {
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide,
@NonNull Registry registry) {
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;
}
}