package com.mayi.fastdevelop.view;

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

import com.squareup.picasso.Picasso;
import com.youth.banner.loader.ImageLoader;

import java.io.File;

/**
 * 支持加载本地图片，网络图片，文件中图片
 */
public class PicassoImageLoader extends ImageLoader {
    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {
        if (path instanceof String) {
            Picasso.get().load((String) path).into(imageView);
        } else if (path instanceof Integer) {
            Picasso.get().load((Integer) path).into(imageView);
        } else if (path instanceof Uri) {
            Picasso.get().load((Uri) path).into(imageView);
        } else if (path instanceof File) {
            Picasso.get().load((File) path).into(imageView);
        }
    }
}
