|
|
@ -6,6 +6,7 @@ import androidx.annotation.NonNull; |
|
|
|
|
|
|
|
import awais.instagrabber.databinding.LayoutDmBaseBinding; |
|
|
|
import awais.instagrabber.databinding.LayoutDmRavenMediaBinding; |
|
|
|
import awais.instagrabber.interfaces.MentionClickListener; |
|
|
|
import awais.instagrabber.models.direct_messages.DirectItemModel; |
|
|
|
import awais.instagrabber.models.enums.MediaItemType; |
|
|
|
import awais.instagrabber.utils.Utils; |
|
|
@ -16,30 +17,31 @@ public class DirectMessageReelShareViewHolder extends DirectMessageItemViewHolde |
|
|
|
|
|
|
|
public DirectMessageReelShareViewHolder(@NonNull final LayoutDmBaseBinding baseBinding, |
|
|
|
@NonNull final LayoutDmRavenMediaBinding binding, |
|
|
|
final View.OnClickListener onClickListener) { |
|
|
|
final View.OnClickListener onClickListener, |
|
|
|
final MentionClickListener mentionClickListener) { |
|
|
|
super(baseBinding, onClickListener); |
|
|
|
this.binding = binding; |
|
|
|
binding.tvMessage.setVisibility(View.GONE); |
|
|
|
binding.tvMessage.setMentionClickListener(mentionClickListener); |
|
|
|
setItemView(binding.getRoot()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void bindItem(final DirectItemModel directItemModel) { |
|
|
|
final DirectItemModel.DirectItemReelShareModel reelShare = directItemModel.getReelShare(); |
|
|
|
final String text = reelShare.getText(); |
|
|
|
if (!Utils.isEmpty(text)) { |
|
|
|
CharSequence text = reelShare.getText(); |
|
|
|
if (Utils.isEmpty(text)) { |
|
|
|
binding.tvMessage.setVisibility(View.GONE); |
|
|
|
} else { |
|
|
|
if (Utils.hasMentions(text)) text = Utils.getMentionText(text); // for mentions |
|
|
|
binding.tvMessage.setText(text); |
|
|
|
binding.tvMessage.setVisibility(View.VISIBLE); |
|
|
|
} |
|
|
|
final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia(); |
|
|
|
final MediaItemType mediaType = reelShareMedia.getMediaType(); |
|
|
|
|
|
|
|
if (mediaType == null) |
|
|
|
if (mediaType == null) { |
|
|
|
binding.mediaExpiredIcon.setVisibility(View.VISIBLE); |
|
|
|
else { |
|
|
|
} else { |
|
|
|
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO || |
|
|
|
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE); |
|
|
|
|
|
|
|
getGlideRequestManager().load(reelShareMedia.getThumbUrl()).into(binding.ivMediaPreview); |
|
|
|
} |
|
|
|
} |
|
|
|