From fe82d159633f0056e50db8b59da6df90082322bc Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 23 Oct 2020 20:37:35 +0800 Subject: Rename PostGalleryTypeViewHolder to PostWithPreviewTypeViewHolder. --- .../Adapter/PostRecyclerViewAdapter.java | 136 ++++++++++----------- 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 0d0e784a..164b283e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -360,7 +360,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter imageRequestBuilder = mGlide.load(preview.getPreviewUrl()).listener(new RequestListener() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { - ((PostGalleryTypeViewHolder) holder).progressBar.setVisibility(View.GONE); - ((PostGalleryTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE); - ((PostGalleryTypeViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> { - ((PostGalleryTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE); - ((PostGalleryTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE); + ((PostWithPreviewTypeViewHolder) holder).progressBar.setVisibility(View.GONE); + ((PostWithPreviewTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE); + ((PostWithPreviewTypeViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> { + ((PostWithPreviewTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE); + ((PostWithPreviewTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE); loadImage(holder, post, preview); }); return false; @@ -979,20 +979,20 @@ public class PostRecyclerViewAdapter extends PagedListAdapter target, DataSource dataSource, boolean isFirstResource) { - ((PostGalleryTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE); - ((PostGalleryTypeViewHolder) holder).progressBar.setVisibility(View.GONE); + ((PostWithPreviewTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE); + ((PostWithPreviewTypeViewHolder) holder).progressBar.setVisibility(View.GONE); return false; } }); if ((post.isNSFW() && mNeedBlurNSFW && !(post.getPostType() == Post.GIF_TYPE && mAutoplayNsfwVideos)) || post.isSpoiler() && mNeedBlurSpoiler) { imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) - .into(((PostGalleryTypeViewHolder) holder).imageView); + .into(((PostWithPreviewTypeViewHolder) holder).imageView); } else { if (mImageViewWidth > preview.getPreviewWidth()) { - imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostGalleryTypeViewHolder) holder).imageView); + imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostWithPreviewTypeViewHolder) holder).imageView); } else { - imageRequestBuilder.into(((PostGalleryTypeViewHolder) holder).imageView); + imageRequestBuilder.into(((PostWithPreviewTypeViewHolder) holder).imageView); } } } else if (holder instanceof PostCompactBaseViewHolder) { @@ -1182,14 +1182,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter