1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00
This commit is contained in:
Austin Huang 2021-03-22 12:12:03 -04:00
parent 58a69f2da6
commit 81bdced230
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -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);