Browse Source

close #843

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

7
app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemRavenMediaViewHolder.java

@ -24,6 +24,7 @@ import awais.instagrabber.repositories.responses.directmessages.DirectItemVisual
import awais.instagrabber.repositories.responses.directmessages.DirectThread; import awais.instagrabber.repositories.responses.directmessages.DirectThread;
import awais.instagrabber.utils.NumberUtils; import awais.instagrabber.utils.NumberUtils;
import awais.instagrabber.utils.ResponseBodyUtils; import awais.instagrabber.utils.ResponseBodyUtils;
import awais.instagrabber.utils.TextUtils;
public class DirectItemRavenMediaViewHolder extends DirectItemViewHolder { public class DirectItemRavenMediaViewHolder extends DirectItemViewHolder {
@ -48,7 +49,7 @@ public class DirectItemRavenMediaViewHolder extends DirectItemViewHolder {
if (media == null) return; if (media == null) return;
setExpiryInfo(visualMedia); setExpiryInfo(visualMedia);
setPreview(visualMedia, messageDirection); setPreview(visualMedia, messageDirection);
final boolean expired = media.getPk() == null;
final boolean expired = TextUtils.isEmpty(media.getId());
if (expired) return; if (expired) return;
itemView.setOnClickListener(v -> openMedia(media)); itemView.setOnClickListener(v -> openMedia(media));
/*final boolean isExpired = visualMedia == null || (mediaModel = visualMedia.getMedia()) == null || /*final boolean isExpired = visualMedia == null || (mediaModel = visualMedia.getMedia()) == null ||
@ -118,7 +119,7 @@ public class DirectItemRavenMediaViewHolder extends DirectItemViewHolder {
final RavenMediaViewMode viewMode = visualMedia.getViewMode(); final RavenMediaViewMode viewMode = visualMedia.getViewMode();
if (viewMode != RavenMediaViewMode.PERMANENT) { if (viewMode != RavenMediaViewMode.PERMANENT) {
final MediaItemType mediaType = media.getMediaType(); final MediaItemType mediaType = media.getMediaType();
final boolean expired = media.getPk() == null;
final boolean expired = TextUtils.isEmpty(media.getId());
final int info; final int info;
switch (mediaType) { switch (mediaType) {
case MEDIA_TYPE_IMAGE: case MEDIA_TYPE_IMAGE:
@ -153,7 +154,7 @@ public class DirectItemRavenMediaViewHolder extends DirectItemViewHolder {
private void setPreview(final DirectItemVisualMedia visualMedia, private void setPreview(final DirectItemVisualMedia visualMedia,
final MessageDirection messageDirection) { final MessageDirection messageDirection) {
final Media media = visualMedia.getMedia(); final Media media = visualMedia.getMedia();
final boolean expired = media.getPk() == null;
final boolean expired = TextUtils.isEmpty(media.getId());
if (expired) { if (expired) {
binding.preview.setVisibility(View.GONE); binding.preview.setVisibility(View.GONE);
binding.typeIcon.setVisibility(View.GONE); binding.typeIcon.setVisibility(View.GONE);

Loading…
Cancel
Save