|
| 1 | +//package com.blankj.subutil.util; |
| 2 | +// |
| 3 | +//import android.content.Context; |
| 4 | +//import android.graphics.drawable.PictureDrawable; |
| 5 | +//import android.widget.ImageView; |
| 6 | +// |
| 7 | +//import com.blankj.subutil.R; |
| 8 | +//import com.blankj.subutil.util.image.GlideApp; |
| 9 | +//import com.bumptech.glide.Glide; |
| 10 | +//import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| 11 | +//import com.bumptech.glide.request.RequestOptions; |
| 12 | +// |
| 13 | +///** |
| 14 | +// * <pre> |
| 15 | +// * author: Blankj |
| 16 | +// * blog : http://blankj.com |
| 17 | +// * time : 2018/05/16 |
| 18 | +// * desc : |
| 19 | +// * </pre> |
| 20 | +// */ |
| 21 | +//public final class GlideUtils { |
| 22 | +// |
| 23 | +// |
| 24 | +// |
| 25 | +// public static void setCircleImage(Context context, String url, ImageView view) { |
| 26 | +// RequestOptions requestOptions = new RequestOptions() |
| 27 | +// .placeholder(R.drawable.def_img_round_holder) |
| 28 | +// .error(R.drawable.def_img_round_error) |
| 29 | +// .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) |
| 30 | +// .circleCrop().dontAnimate(); |
| 31 | +// Glide.with(context).load(url).apply(requestOptions).into(view); |
| 32 | +// } |
| 33 | +// |
| 34 | +// public static void setImage(Context context, String url, ImageView view) { |
| 35 | +// if (url.endsWith(".svg") || url.endsWith(".SVG")) { |
| 36 | +// setSvgImage(context, url, view); |
| 37 | +// return; |
| 38 | +// } |
| 39 | +// |
| 40 | +// RequestOptions requestOptions = new RequestOptions().placeholder(R.drawable.def_img) |
| 41 | +// .error(R.drawable.def_img).diskCacheStrategy(DiskCacheStrategy.AUTOMATIC).dontAnimate(); |
| 42 | +// Glide.with(context).load(url).apply(requestOptions).into(view); |
| 43 | +// } |
| 44 | +// |
| 45 | +// private static void setSvgImage(Context context, String url, ImageView view) { |
| 46 | +// GlideApp.with(context) |
| 47 | +// .as(PictureDrawable.class) |
| 48 | +// .error(R.drawable.def_img).load(url).into(view); |
| 49 | +// } |
| 50 | +//} |
0 commit comments