Fix preview issue in PostCompactBaseViewHolder in PostRecyclerViewAdapter.

This commit is contained in:
Docile-Alligator 2022-03-05 11:33:07 +08:00
parent 023cef76ad
commit dc9725735b
2 changed files with 4 additions and 6 deletions

View File

@ -1207,10 +1207,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_gallery_24dp); ((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_gallery_24dp);
} }
if (post.getPreviews() != null && !post.getPreviews().isEmpty()) { if (post.getPreviews() != null && !post.getPreviews().isEmpty()) {
if (post.getPostType() != Post.GIF_TYPE && post.getPostType() != Post.VIDEO_TYPE) {
((PostCompactBaseViewHolder) holder).imageView.setVisibility(View.VISIBLE); ((PostCompactBaseViewHolder) holder).imageView.setVisibility(View.VISIBLE);
((PostCompactBaseViewHolder) holder).progressBar.setVisibility(View.VISIBLE); ((PostCompactBaseViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
}
loadImage(holder); loadImage(holder);
} }
} }
@ -1531,7 +1529,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(postCompactThumbnailPreviewUrl) RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(postCompactThumbnailPreviewUrl)
.error(R.drawable.ic_error_outline_black_24dp).listener(((PostCompactBaseViewHolder) holder).requestListener); .error(R.drawable.ic_error_outline_black_24dp).listener(((PostCompactBaseViewHolder) holder).requestListener);
if ((post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || post.isSpoiler() && mNeedBlurSpoiler) { if ((post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (post.isSpoiler() && mNeedBlurSpoiler)) {
imageRequestBuilder imageRequestBuilder
.transform(new BlurTransformation(50, 2)).into(((PostCompactBaseViewHolder) holder).imageView); .transform(new BlurTransformation(50, 2)).into(((PostCompactBaseViewHolder) holder).imageView);
} else { } else {

View File

@ -225,7 +225,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/thumbnail_compact_layout_rounded_edge" android:background="@drawable/thumbnail_compact_layout_rounded_edge"
android:scaleType="center" /> android:scaleType="centerCrop" />
<ImageView <ImageView
android:id="@+id/play_button_image_view_item_post_compact" android:id="@+id/play_button_image_view_item_post_compact"