Search in sources :

Example 1 with CustomGlideUriLoader

use of com.owncloud.android.utils.glide.CustomGlideUriLoader in project android by nextcloud.

the class DisplayUtils method downloadSVGIcon.

private static void downloadSVGIcon(CurrentAccountProvider currentAccountProvider, ClientFactory clientFactory, Context context, String iconUrl, SimpleTarget imageView, int placeholder, int width, int height) {
    GenericRequestBuilder<Uri, InputStream, SVG, PictureDrawable> requestBuilder = Glide.with(context).using(new CustomGlideUriLoader(currentAccountProvider.getUser(), clientFactory), InputStream.class).from(Uri.class).as(SVG.class).transcode(new SvgDrawableTranscoder(), PictureDrawable.class).sourceEncoder(new StreamEncoder()).cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder(height, width))).decoder(new SvgDecoder(height, width)).placeholder(placeholder).error(placeholder).animate(android.R.anim.fade_in);
    Uri uri = Uri.parse(iconUrl);
    requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE).load(uri).into(imageView);
}
Also used : SVG(com.caverock.androidsvg.SVG) SvgDrawableTranscoder(com.owncloud.android.utils.svg.SvgDrawableTranscoder) InputStream(java.io.InputStream) PictureDrawable(android.graphics.drawable.PictureDrawable) CustomGlideUriLoader(com.owncloud.android.utils.glide.CustomGlideUriLoader) SvgDecoder(com.owncloud.android.utils.svg.SvgDecoder) Uri(android.net.Uri) StreamEncoder(com.bumptech.glide.load.model.StreamEncoder)

Aggregations

PictureDrawable (android.graphics.drawable.PictureDrawable)1 Uri (android.net.Uri)1 StreamEncoder (com.bumptech.glide.load.model.StreamEncoder)1 SVG (com.caverock.androidsvg.SVG)1 CustomGlideUriLoader (com.owncloud.android.utils.glide.CustomGlideUriLoader)1 SvgDecoder (com.owncloud.android.utils.svg.SvgDecoder)1 SvgDrawableTranscoder (com.owncloud.android.utils.svg.SvgDrawableTranscoder)1 InputStream (java.io.InputStream)1