Continue adding Card Layout 2.

This commit is contained in:
Alex Ning 2021-02-22 15:53:09 +08:00
parent 8d53a5e273
commit 6c67fda7cf

View File

@ -865,6 +865,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
} else { } else {
Post.Preview preview = getSuitablePreview(post.getPreviews()); Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) { if (preview != null) {
((PostCard2WithPreviewViewHolder) holder).imageView.setVisibility(View.VISIBLE);
if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) {
int height = (int) (400 * mScale); int height = (int) (400 * mScale);
((PostCard2WithPreviewViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((PostCard2WithPreviewViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
@ -1783,6 +1784,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostTextTypeViewHolder) holder).contentTextView.setVisibility(View.GONE); ((PostTextTypeViewHolder) holder).contentTextView.setVisibility(View.GONE);
} else if (holder instanceof PostCard2WithPreviewViewHolder) { } else if (holder instanceof PostCard2WithPreviewViewHolder) {
mGlide.clear(((PostCard2WithPreviewViewHolder) holder).imageView); mGlide.clear(((PostCard2WithPreviewViewHolder) holder).imageView);
((PostCard2WithPreviewViewHolder) holder).imageView.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE); ((PostCard2WithPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setVisibility(View.GONE); ((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).progressBar.setVisibility(View.GONE); ((PostCard2WithPreviewViewHolder) holder).progressBar.setVisibility(View.GONE);