|
@ -16,6 +16,8 @@ import com.bumptech.glide.load.engine.GlideException; |
|
|
import com.bumptech.glide.request.RequestListener; |
|
|
import com.bumptech.glide.request.RequestListener; |
|
|
import com.bumptech.glide.request.target.Target; |
|
|
import com.bumptech.glide.request.target.Target; |
|
|
|
|
|
|
|
|
|
|
|
import java.net.HttpURLConnection; |
|
|
|
|
|
import java.net.URL; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
import awais.instagrabber.R; |
|
|
import awais.instagrabber.R; |
|
@ -78,6 +80,10 @@ public final class PostsAdapter extends RecyclerView.Adapter<PostViewHolder> { |
|
|
@Override |
|
|
@Override |
|
|
public boolean onLoadFailed(@Nullable final GlideException e, final Object model, final Target<Drawable> target, final boolean isFirstResource) { |
|
|
public boolean onLoadFailed(@Nullable final GlideException e, final Object model, final Target<Drawable> target, final boolean isFirstResource) { |
|
|
holder.progressView.setVisibility(View.GONE); |
|
|
holder.progressView.setVisibility(View.GONE); |
|
|
|
|
|
final HttpURLConnection conn = (HttpURLConnection) new URL(postModel.getDisplayUrl()).openConnection(); |
|
|
|
|
|
conn.setUseCaches(false); |
|
|
|
|
|
conn.connect(); |
|
|
|
|
|
if (conn.getResponseCode() != HttpURLConnection.HTTP_GONE) |
|
|
glideRequestManager.load(postModel.getDisplayUrl()).into(holder.postImage); |
|
|
glideRequestManager.load(postModel.getDisplayUrl()).into(holder.postImage); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|