From 1c710f1bd465912fe050d104a29334d23bdcbe38 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 29 Jun 2021 21:47:23 -0400 Subject: [PATCH] make profile shares look better; close #1378 --- .../DirectItemProfileViewHolder.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java index 0360b6b7..26f8bf8c 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java @@ -47,13 +47,6 @@ public class DirectItemProfileViewHolder extends DirectItemViewHolder { binding.preview5, binding.preview6 ); - final Resources resources = itemView.getResources(); - binding.preview4.setHierarchy(new GenericDraweeHierarchyBuilder(resources) - .setRoundingParams(RoundingParams.fromCornersRadii(0, 0, 0, dmRadius)) - .build()); - binding.preview6.setHierarchy(new GenericDraweeHierarchyBuilder(resources) - .setRoundingParams(RoundingParams.fromCornersRadii(0, 0, dmRadius, 0)) - .build()); } @Override @@ -73,14 +66,29 @@ public class DirectItemProfileViewHolder extends DirectItemViewHolder { previewView.setImageURI((String) null); } final List previewMedias = item.getPreviewMedias(); - if (previewMedias.size() <= 0) { + if (previewMedias == null || previewMedias.size() <= 0) { binding.firstRow.setVisibility(View.GONE); binding.secondRow.setVisibility(View.GONE); return; } + final Resources resources = itemView.getResources(); if (previewMedias.size() <= 3) { binding.firstRow.setVisibility(View.VISIBLE); binding.secondRow.setVisibility(View.GONE); + binding.preview1.setHierarchy(new GenericDraweeHierarchyBuilder(resources) + .setRoundingParams(RoundingParams.fromCornersRadii(0, 0, 0, dmRadius)) + .build()); + binding.preview3.setHierarchy(new GenericDraweeHierarchyBuilder(resources) + .setRoundingParams(RoundingParams.fromCornersRadii(0, 0, dmRadius, 0)) + .build()); + } + if (previewMedias.size() > 3) { + binding.preview4.setHierarchy(new GenericDraweeHierarchyBuilder(resources) + .setRoundingParams(RoundingParams.fromCornersRadii(0, 0, 0, dmRadius)) + .build()); + binding.preview6.setHierarchy(new GenericDraweeHierarchyBuilder(resources) + .setRoundingParams(RoundingParams.fromCornersRadii(0, 0, dmRadius, 0)) + .build()); } for (int i = 0; i < previewMedias.size(); i++) { final Media previewMedia = previewMedias.get(i);