Browse Source

make profile shares look better; close #1378

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
1c710f1bd4
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 24
      app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java

24
app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemProfileViewHolder.java

@ -47,13 +47,6 @@ public class DirectItemProfileViewHolder extends DirectItemViewHolder {
binding.preview5, binding.preview5,
binding.preview6 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 @Override
@ -73,14 +66,29 @@ public class DirectItemProfileViewHolder extends DirectItemViewHolder {
previewView.setImageURI((String) null); previewView.setImageURI((String) null);
} }
final List<Media> previewMedias = item.getPreviewMedias(); final List<Media> previewMedias = item.getPreviewMedias();
if (previewMedias.size() <= 0) {
if (previewMedias == null || previewMedias.size() <= 0) {
binding.firstRow.setVisibility(View.GONE); binding.firstRow.setVisibility(View.GONE);
binding.secondRow.setVisibility(View.GONE); binding.secondRow.setVisibility(View.GONE);
return; return;
} }
final Resources resources = itemView.getResources();
if (previewMedias.size() <= 3) { if (previewMedias.size() <= 3) {
binding.firstRow.setVisibility(View.VISIBLE); binding.firstRow.setVisibility(View.VISIBLE);
binding.secondRow.setVisibility(View.GONE); 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++) { for (int i = 0; i < previewMedias.size(); i++) {
final Media previewMedia = previewMedias.get(i); final Media previewMedia = previewMedias.get(i);

Loading…
Cancel
Save