| | |
| | | package cn.flightfeather.thirdapp.task; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.os.Environment; |
| | | import android.util.Log; |
| | | import android.widget.ImageView; |
| | |
| | | |
| | | import cn.flightfeather.thirdapp.CommonApplication; |
| | | import cn.flightfeather.thirdapp.R; |
| | | import cn.flightfeather.thirdapp.bean.Mediafile; |
| | | import cn.flightfeather.thirdapp.bean.entity.Mediafile; |
| | | import okhttp3.ResponseBody; |
| | | import retrofit2.Call; |
| | | import retrofit2.Callback; |
| | |
| | | private Activity activity; |
| | | |
| | | //下载并显示图片 |
| | | public DownloadAndSetImageTask(Mediafile mediafile, ImageView imageView, Context context) { |
| | | public DownloadAndSetImageTask(Mediafile mediafile, ImageView imageView, Activity activity) { |
| | | this.mediafile = mediafile; |
| | | this.imageView = imageView; |
| | | application = (CommonApplication) context.getApplicationContext(); |
| | | this.activity = activity; |
| | | application = (CommonApplication) activity.getApplicationContext(); |
| | | } |
| | | //只下载 |
| | | public DownloadAndSetImageTask(Mediafile mediafile, Context context) { |
| | | public DownloadAndSetImageTask(Mediafile mediafile, Activity activity) { |
| | | this.mediafile = mediafile; |
| | | application = (CommonApplication) context.getApplicationContext(); |
| | | application = (CommonApplication) activity.getApplicationContext(); |
| | | try { |
| | | activity = (Activity) context; |
| | | this.activity = (Activity) activity; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |