package cn.flightfeather.thirdapp.task;
|
|
import android.app.Activity;
|
import android.widget.ImageView;
|
|
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.util.Util;
|
|
import java.io.File;
|
|
import cn.flightfeather.thirdapp.R;
|
|
/**
|
* Created by note_ff_1602 on 2017/10/26.
|
* 设置图片的task
|
*
|
*/
|
|
// FIXME: 2020/11/12 原来的实现方式可能会导致oom,因此修改为使用Glide来实现图片的显示。
|
public class SetImageTask {
|
private File file;
|
private ImageView miv_photo;
|
private Activity activity;
|
|
public SetImageTask(File file, ImageView miv_photo, Activity activity) {
|
this.file = file;
|
this.miv_photo = miv_photo;
|
this.activity = activity;
|
}
|
|
|
public void execute() {
|
if (Util.isOnMainThread() && activity != null && !activity.isDestroyed()) {
|
Glide.with(miv_photo)
|
.load(file)
|
.placeholder(R.drawable.icon_add_photo_waite)
|
.into(miv_photo);
|
}
|
}
|
|
|
}
|