package com.shunzhi.parent.util; import android.content.Context; import android.text.TextUtils; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.shunzhi.parent.AppConfig; import com.shunzhi.parent.R; /** * Created by ToaHanDong on 2018/3/21. */ public class GlideUtils { public static void showImg(Context context, ImageView imageView,String url){ if (!TextUtils.isEmpty(url)){ if (url.startsWith("http")) Glide.with(context).load(url).placeholder(R.color.xueqing_blue) .into(imageView); else Glide.with(context).load(AppConfig.BASE_URL_FILE+url).placeholder(R.color.xueqing_blue) .into(imageView); }else { Glide.with(context).load(url).placeholder(R.color.xueqing_blue).centerCrop().into(imageView); } } public static void showImgWithDefaule(Context context,ImageView imageView,String url,int defaultImg){ if (!TextUtils.isEmpty(url)){ if (url.startsWith("http")) Glide.with(context).load(url).placeholder(defaultImg) .into(imageView); else Glide.with(context).load(AppConfig.BASE_URL_FILE+url).placeholder(defaultImg) .into(imageView); }else { Glide.with(context).load(url).placeholder(defaultImg).centerCrop().into(imageView); } } }