| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.ImageView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | import cn.flightfeather.thirdapp.R; |
| | | import cn.flightfeather.thirdapp.bean.Mediafile; |
| | | import cn.flightfeather.thirdapp.task.DownloadAndSetImageTask; |
| | | import cn.flightfeather.thirdapp.task.SetImageTask; |
| | | |
| | | /** |
| | | * Created by note_ff_1602 on 2018/1/30. |
| | |
| | | @Override |
| | | public void onBindViewHolder(PhotoListHolder holder, int position) { |
| | | Mediafile mediafile = mediafileList.get(position); |
| | | |
| | | if (mediafile.getGuid() == null) { |
| | | Glide.with(context) |
| | | .load(R.drawable.icon_add_photo) |
| | | .into(holder.iv_photo); |
| | | } else { |
| | | // String url = CommonApplication.getInstance().ROOT_URL_RELEASE_IMAGE + mediafile.getExtension1() + mediafile.getGuid() + ".jpg"; |
| | | // Glide.with(context).asDrawable().load(url).override(100,100).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.iv_photo); |
| | | |
| | | File file = new File(Environment.getExternalStorageDirectory(),mediafile.getPath()+mediafile.getDescription()); |
| | | if (file.exists()){ |
| | | SetImageTask task = new SetImageTask(file,holder.iv_photo); |
| | | task.execute(); |
| | | }else { |
| | | DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediafile,holder.iv_photo,context); |
| | | task.execute(); |
| | | Log.e("photolist",position+" no image found"); |
| | | File file = new File(Environment.getExternalStorageDirectory(), mediafile.getPath() + mediafile.getDescription()); |
| | | if (file.exists()) { |
| | | // SetImageTask task = new SetImageTask(file,holder.iv_photo); |
| | | // task.execute(); |
| | | // String url = CommonApplication.getInstance().ROOT_URL_RELEASE_IMAGE + mediafile.getExtension1() + mediafile.getGuid() + ".jpg"; |
| | | Glide.with(context) |
| | | .load(file) |
| | | .placeholder(R.drawable.icon_add_photo_waite) |
| | | .override(100, 100) |
| | | .into(holder.iv_photo); |
| | | } else { |
| | | DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediafile, holder.iv_photo, context); |
| | | task.execute(); |
| | | Log.e("photolist", position + " no image found"); |
| | | } |
| | | } |
| | | } |
| | | |