package com.sobot.album;

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

import com.sobot.pictureframe.SobotBitmapUtil;
import com.sobot.utils.SobotStringUtils;

public class SobotMediaLoader implements AlbumLoader {

    @Override
    public void load(ImageView imageView, AlbumFile albumFile) {
        if (albumFile != null) {
            if (albumFile.getUri() != null) {
                load(imageView, albumFile.getUri());
            } else {
                load(imageView, albumFile.getPath());
            }
        }
    }

    @Override
    public void load(ImageView imageView, String url) {
        if (SobotStringUtils.isNoEmpty(url) && imageView != null) {
            SobotBitmapUtil.display(imageView.getContext(), url, imageView);
        }
    }

    public void load(ImageView imageView, Uri uri) {
        if (uri != null && imageView != null) {
            SobotBitmapUtil.display(imageView.getContext(), uri, imageView);
        }
    }

}