Newer
Older
DownApp / app / src / main / java / me / bell / downapp / util / ImageUtils.java
Bello on 10 Apr 2018 1 KB init
package me.bell.downapp.util;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

/**
 * @Info 图片处理方法类
 * @Auth Bello
 * @Time 17-7-25 下午12:01
 * @Ver
 */
public class ImageUtils {


    /**
     * 显示普通图像
     *
     * @param mContext
     * @param imageView
     * @param url
     */
    public static void displayImg(Context mContext, ImageView imageView, Object url){
        if (null == url)
            return;

        Glide.with(mContext)
                .load( url)
                .crossFade()
                .into(imageView);
    }

    /**
     * 显示本地图像
     *
     * @param mContext
     * @param imageView
     * @param url
     */
    public static void displayLocalImg(Context mContext, ImageView imageView, Object url){
        if (null == url)
            return;
        Glide.with(mContext)
                .load(url)
                .crossFade()
                .into(imageView);
    }






    /**
     * 清除缓存
     */
    public static void cleanCacheImages(final Context mContext) {

        new Thread(new Runnable() {
            @Override
            public void run() {
                Glide.get(mContext).clearDiskCache();
            }
        }).start();

    }


}