mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Organise dm view holders bind logic and fix some views
This commit is contained in:
parent
bc107b3627
commit
8937918064
@ -128,11 +128,11 @@ public final class DirectItemsAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||
switch (directItemType) {
|
||||
case TEXT: {
|
||||
final LayoutDmTextBinding binding = LayoutDmTextBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
return new DirectItemTextViewHolder(baseBinding, binding, currentUser, thread, null, null);
|
||||
return new DirectItemTextViewHolder(baseBinding, binding, currentUser, thread, null);
|
||||
}
|
||||
case LIKE: {
|
||||
final LayoutDmLikeBinding binding = LayoutDmLikeBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
return new DirectItemLikeViewHolder(baseBinding, binding, currentUser, thread, null, null);
|
||||
return new DirectItemLikeViewHolder(baseBinding, binding, currentUser, thread, null);
|
||||
}
|
||||
case LINK: {
|
||||
final LayoutDmLinkBinding binding = LayoutDmLinkBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
@ -156,12 +156,12 @@ public final class DirectItemsAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||
}
|
||||
case VOICE_MEDIA: {
|
||||
final LayoutDmVoiceMediaBinding binding = LayoutDmVoiceMediaBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
return new DirectItemVoiceMediaViewHolder(baseBinding, binding, currentUser, thread, null, null);
|
||||
return new DirectItemVoiceMediaViewHolder(baseBinding, binding, currentUser, thread, null);
|
||||
}
|
||||
case LOCATION:
|
||||
case PROFILE: {
|
||||
final LayoutDmProfileBinding binding = LayoutDmProfileBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
return new DirectItemProfileViewHolder(baseBinding, binding, currentUser, thread, null, null);
|
||||
return new DirectItemProfileViewHolder(baseBinding, binding, currentUser, thread, null);
|
||||
}
|
||||
case MEDIA: {
|
||||
final LayoutDmMediaBinding binding = LayoutDmMediaBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
@ -183,7 +183,7 @@ public final class DirectItemsAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||
}
|
||||
case RAVEN_MEDIA: {
|
||||
final LayoutDmRavenMediaBinding binding = LayoutDmRavenMediaBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
return new DirectItemRavenMediaViewHolder(baseBinding, binding, currentUser, thread, null, null);
|
||||
return new DirectItemRavenMediaViewHolder(baseBinding, binding, currentUser, thread, null);
|
||||
}
|
||||
default: {
|
||||
final LayoutDmTextBinding binding = LayoutDmTextBinding.inflate(layoutInflater, baseBinding.message, false);
|
||||
|
@ -69,4 +69,14 @@ public class DirectItemActionLogViewHolder extends DirectItemViewHolder {
|
||||
}
|
||||
binding.tvMessage.setText(sb);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean allowMessageDirectionGravity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showMessageInfo() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ public class DirectItemAnimatedMediaViewHolder extends DirectItemViewHolder {
|
||||
|
||||
@Override
|
||||
public void bindItem(final DirectItem item, final MessageDirection messageDirection) {
|
||||
removeBg();
|
||||
final DirectItemAnimatedMedia animatedMediaModel = item.getAnimatedMedia();
|
||||
final AnimatedMediaImages images = animatedMediaModel.getImages();
|
||||
if (images == null) return;
|
||||
|
@ -6,7 +6,6 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmLikeBinding;
|
||||
import awais.instagrabber.interfaces.MentionClickListener;
|
||||
import awais.instagrabber.repositories.responses.User;
|
||||
import awais.instagrabber.repositories.responses.directmessages.DirectItem;
|
||||
import awais.instagrabber.repositories.responses.directmessages.DirectThread;
|
||||
@ -17,14 +16,11 @@ public class DirectItemLikeViewHolder extends DirectItemViewHolder {
|
||||
@NonNull final LayoutDmLikeBinding binding,
|
||||
final User currentUser,
|
||||
final DirectThread thread,
|
||||
final View.OnClickListener onClickListener,
|
||||
final MentionClickListener mentionClickListener) {
|
||||
final View.OnClickListener onClickListener) {
|
||||
super(baseBinding, currentUser, thread, onClickListener);
|
||||
setItemView(binding.getRoot());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindItem(final DirectItem directItemModel, final MessageDirection messageDirection) {
|
||||
removeBg();
|
||||
}
|
||||
public void bindItem(final DirectItem directItemModel, final MessageDirection messageDirection) {}
|
||||
}
|
||||
|
@ -65,4 +65,9 @@ public class DirectItemLinkViewHolder extends DirectItemViewHolder {
|
||||
}
|
||||
binding.text.setText(link.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showBackground() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.util.Pair;
|
||||
|
||||
import com.facebook.drawee.drawable.ScalingUtils;
|
||||
@ -56,18 +57,7 @@ public class DirectItemMediaShareViewHolder extends DirectItemViewHolder {
|
||||
binding.topBg.setBackgroundResource(messageDirection == MessageDirection.INCOMING
|
||||
? R.drawable.bg_media_share_top_incoming
|
||||
: R.drawable.bg_media_share_top_outgoing);
|
||||
Media media = null;
|
||||
if (item.getItemType() == DirectItemType.MEDIA_SHARE) {
|
||||
media = item.getMediaShare();
|
||||
} else if (item.getItemType() == DirectItemType.CLIP) {
|
||||
final DirectItemClip clip = item.getClip();
|
||||
if (clip == null) return;
|
||||
media = clip.getClip();
|
||||
} else if (item.getItemType() == DirectItemType.FELIX_SHARE) {
|
||||
final DirectItemFelixShare felixShare = item.getFelixShare();
|
||||
if (felixShare == null) return;
|
||||
media = felixShare.getVideo();
|
||||
}
|
||||
Media media = getMedia(item);
|
||||
if (media == null) return;
|
||||
final User user = media.getUser();
|
||||
if (user != null) {
|
||||
@ -121,4 +111,21 @@ public class DirectItemMediaShareViewHolder extends DirectItemViewHolder {
|
||||
? R.drawable.ic_video_24
|
||||
: R.drawable.ic_checkbox_multiple_blank_stroke);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Media getMedia(@NonNull final DirectItem item) {
|
||||
Media media = null;
|
||||
if (item.getItemType() == DirectItemType.MEDIA_SHARE) {
|
||||
media = item.getMediaShare();
|
||||
} else if (item.getItemType() == DirectItemType.CLIP) {
|
||||
final DirectItemClip clip = item.getClip();
|
||||
if (clip == null) return null;
|
||||
media = clip.getClip();
|
||||
} else if (item.getItemType() == DirectItemType.FELIX_SHARE) {
|
||||
final DirectItemFelixShare felixShare = item.getFelixShare();
|
||||
if (felixShare == null) return null;
|
||||
media = felixShare.getVideo();
|
||||
}
|
||||
return media;
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,9 @@ public class DirectItemPlaceholderViewHolder extends DirectItemViewHolder {
|
||||
final String text = String.format("%s: %s", directItemModel.getPlaceholder().getTitle(), directItemModel.getPlaceholder().getMessage());
|
||||
binding.tvMessage.setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showBackground() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import java.util.List;
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmProfileBinding;
|
||||
import awais.instagrabber.interfaces.MentionClickListener;
|
||||
import awais.instagrabber.models.enums.DirectItemType;
|
||||
import awais.instagrabber.repositories.responses.ImageVersions2;
|
||||
import awais.instagrabber.repositories.responses.Location;
|
||||
@ -35,7 +34,6 @@ public class DirectItemProfileViewHolder extends DirectItemViewHolder {
|
||||
@NonNull final LayoutDmProfileBinding binding,
|
||||
final User currentUser,
|
||||
final DirectThread thread,
|
||||
final MentionClickListener mentionClickListener,
|
||||
final View.OnClickListener onClickListener) {
|
||||
super(baseBinding, currentUser, thread, onClickListener);
|
||||
this.binding = binding;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package awais.instagrabber.adapters.viewholder.directmessages;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@ -13,7 +12,6 @@ import com.facebook.drawee.generic.RoundingParams;
|
||||
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmRavenMediaBinding;
|
||||
import awais.instagrabber.interfaces.MentionClickListener;
|
||||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
import awais.instagrabber.models.enums.RavenMediaViewMode;
|
||||
import awais.instagrabber.repositories.responses.ImageVersions2;
|
||||
@ -34,18 +32,15 @@ public class DirectItemRavenMediaViewHolder extends DirectItemViewHolder {
|
||||
@NonNull final LayoutDmRavenMediaBinding binding,
|
||||
final User currentUser,
|
||||
final DirectThread thread,
|
||||
final MentionClickListener mentionClickListener,
|
||||
final View.OnClickListener onClickListener) {
|
||||
super(baseBinding, currentUser, thread, onClickListener);
|
||||
this.binding = binding;
|
||||
final Resources resources = itemView.getResources();
|
||||
maxWidth = windowWidth - margin - dmRadiusSmall;
|
||||
setItemView(binding.getRoot());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindItem(final DirectItem directItemModel, final MessageDirection messageDirection) {
|
||||
removeBg();
|
||||
final DirectItemVisualMedia visualMedia = directItemModel.getVisualMedia();
|
||||
final Media media = visualMedia.getMedia();
|
||||
if (media == null) return;
|
||||
|
@ -40,7 +40,6 @@ public class DirectItemReelShareViewHolder extends DirectItemViewHolder {
|
||||
|
||||
@Override
|
||||
public void bindItem(final DirectItem item, final MessageDirection messageDirection) {
|
||||
removeBg();
|
||||
final DirectItemReelShare reelShare = item.getReelShare();
|
||||
final String type = reelShare.getType();
|
||||
if (type == null) return;
|
||||
|
@ -6,7 +6,6 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmTextBinding;
|
||||
import awais.instagrabber.interfaces.MentionClickListener;
|
||||
import awais.instagrabber.repositories.responses.User;
|
||||
import awais.instagrabber.repositories.responses.directmessages.DirectItem;
|
||||
import awais.instagrabber.repositories.responses.directmessages.DirectThread;
|
||||
@ -19,8 +18,7 @@ public class DirectItemTextViewHolder extends DirectItemViewHolder {
|
||||
@NonNull final LayoutDmTextBinding binding,
|
||||
final User currentUser,
|
||||
final DirectThread thread,
|
||||
final View.OnClickListener onClickListener,
|
||||
final MentionClickListener mentionClickListener) {
|
||||
final View.OnClickListener onClickListener) {
|
||||
super(baseBinding, currentUser, thread, onClickListener);
|
||||
this.binding = binding;
|
||||
setItemView(binding.getRoot());
|
||||
@ -31,5 +29,29 @@ public class DirectItemTextViewHolder extends DirectItemViewHolder {
|
||||
final String text = directItemModel.getText();
|
||||
if (text == null) return;
|
||||
binding.tvMessage.setText(text);
|
||||
// setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showBackground() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// private void setupListeners() {
|
||||
// binding.tvMessage.addOnHashtagListener(autoLinkItem -> {
|
||||
// final String hashtag = autoLinkItem.getOriginalText().trim();
|
||||
// });
|
||||
// binding.tvMessage.addOnMentionClickListener(autoLinkItem -> {
|
||||
// final String mention = autoLinkItem.getOriginalText().trim();
|
||||
// });
|
||||
// binding.tvMessage.addOnEmailClickListener(autoLinkItem -> {
|
||||
// final String email = autoLinkItem.getOriginalText().trim();
|
||||
// });
|
||||
// binding.tvMessage.addOnURLClickListener(autoLinkItem -> {
|
||||
// final String url = autoLinkItem.getOriginalText().trim();
|
||||
// });
|
||||
// binding.tvMessage.setOnLongClickListener(v -> {
|
||||
// return true;
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
@ -62,4 +62,14 @@ public class DirectItemVideoCallEventViewHolder extends DirectItemViewHolder {
|
||||
binding.tvMessage.setMaxLines(1);
|
||||
binding.tvMessage.setText(sb);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean allowMessageDirectionGravity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showMessageInfo() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -77,16 +77,41 @@ public abstract class DirectItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public void bind(final DirectItem item) {
|
||||
final MessageDirection messageDirection = isSelf(item) ? MessageDirection.OUTGOING : MessageDirection.INCOMING;
|
||||
itemView.post(() -> bindBase(item, messageDirection));
|
||||
itemView.post(() -> bindItem(item, messageDirection));
|
||||
}
|
||||
|
||||
private void bindBase(final DirectItem item, final MessageDirection messageDirection) {
|
||||
final FrameLayout.LayoutParams containerLayoutParams = (FrameLayout.LayoutParams) binding.container.getLayoutParams();
|
||||
final DirectItemType itemType = item.getItemType();
|
||||
binding.messageInfo.setVisibility(View.VISIBLE);
|
||||
binding.deliveryStatus.setVisibility(messageDirection == MessageDirection.OUTGOING ? View.VISIBLE : View.GONE);
|
||||
if (itemType != DirectItemType.ACTION_LOG && itemType != DirectItemType.VIDEO_CALL_EVENT) {
|
||||
containerLayoutParams.setMarginStart(messageDirection == MessageDirection.OUTGOING ? margin : 0);
|
||||
containerLayoutParams.setMarginEnd(messageDirection == MessageDirection.INCOMING ? margin : 0);
|
||||
containerLayoutParams.gravity = messageDirection == MessageDirection.INCOMING ? Gravity.START : Gravity.END;
|
||||
setMessageDirectionGravity(messageDirection, containerLayoutParams);
|
||||
setGroupUserDetails(item, messageDirection);
|
||||
setBackground(messageDirection);
|
||||
setMessageInfo(item, messageDirection);
|
||||
if (itemType == DirectItemType.REEL_SHARE) {
|
||||
containerLayoutParams.setMarginStart(0);
|
||||
containerLayoutParams.setMarginEnd(0);
|
||||
}
|
||||
if (itemType == DirectItemType.TEXT || itemType == DirectItemType.LINK) {
|
||||
binding.messageInfo.setPadding(0, 0, dmRadius, dmRadiusSmall);
|
||||
} else {
|
||||
binding.messageInfo.setPadding(0, 0, messageInfoPaddingSmall, dmRadiusSmall);
|
||||
}
|
||||
setupReply(item, messageDirection);
|
||||
setReactions(item, thread.getUsers());
|
||||
}
|
||||
|
||||
private void setBackground(final MessageDirection messageDirection) {
|
||||
if (showBackground()) {
|
||||
binding.background.setBackgroundResource(messageDirection == MessageDirection.INCOMING ? R.drawable.bg_speech_bubble_incoming
|
||||
: R.drawable.bg_speech_bubble_outgoing);
|
||||
return;
|
||||
}
|
||||
binding.background.setBackgroundResource(0);
|
||||
}
|
||||
|
||||
private void setGroupUserDetails(final DirectItem item, final MessageDirection messageDirection) {
|
||||
if (showUserDetailsInGroup()) {
|
||||
binding.ivProfilePic.setVisibility(messageDirection == MessageDirection.INCOMING && thread.isGroup() ? View.VISIBLE : View.GONE);
|
||||
binding.tvUsername.setVisibility(messageDirection == MessageDirection.INCOMING && thread.isGroup() ? View.VISIBLE : View.GONE);
|
||||
if (messageDirection == MessageDirection.INCOMING && thread.isGroup()) {
|
||||
@ -99,45 +124,46 @@ public abstract class DirectItemViewHolder extends RecyclerView.ViewHolder {
|
||||
layoutParams.matchConstraintMaxWidth = groupMessageWidth;
|
||||
binding.chatMessageLayout.setLayoutParams(layoutParams);
|
||||
}
|
||||
} else {
|
||||
binding.ivProfilePic.setVisibility(View.GONE);
|
||||
binding.tvUsername.setVisibility(View.GONE);
|
||||
containerLayoutParams.gravity = Gravity.CENTER;
|
||||
binding.messageInfo.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
if (itemType == DirectItemType.REEL_SHARE) {
|
||||
containerLayoutParams.setMarginStart(0);
|
||||
containerLayoutParams.setMarginEnd(0);
|
||||
binding.ivProfilePic.setVisibility(View.GONE);
|
||||
binding.tvUsername.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void setMessageDirectionGravity(final MessageDirection messageDirection,
|
||||
final FrameLayout.LayoutParams containerLayoutParams) {
|
||||
if (allowMessageDirectionGravity()) {
|
||||
containerLayoutParams.setMarginStart(messageDirection == MessageDirection.OUTGOING ? margin : 0);
|
||||
containerLayoutParams.setMarginEnd(messageDirection == MessageDirection.INCOMING ? margin : 0);
|
||||
containerLayoutParams.gravity = messageDirection == MessageDirection.INCOMING ? Gravity.START : Gravity.END;
|
||||
return;
|
||||
}
|
||||
if (itemType == DirectItemType.TEXT || itemType == DirectItemType.LINK) {
|
||||
binding.messageInfo.setPadding(0,
|
||||
0,
|
||||
dmRadius,
|
||||
dmRadiusSmall);
|
||||
} else {
|
||||
binding.messageInfo.setPadding(0,
|
||||
0,
|
||||
messageInfoPaddingSmall,
|
||||
dmRadiusSmall);
|
||||
}
|
||||
if (itemType == DirectItemType.MEDIA || itemType == DirectItemType.MEDIA_SHARE || itemType == DirectItemType.CLIP || itemType == DirectItemType.STORY_SHARE
|
||||
|| itemType == DirectItemType.LOCATION || itemType == DirectItemType.FELIX_SHARE) {
|
||||
// no background for media items
|
||||
binding.background.setBackgroundResource(0);
|
||||
}
|
||||
binding.messageTime.setText(DateFormat.getTimeFormat(itemView.getContext()).format(item.getDate()));
|
||||
if (messageDirection == MessageDirection.OUTGOING) {
|
||||
if (item.isPending()) {
|
||||
binding.deliveryStatus.setImageResource(R.drawable.ic_check_24);
|
||||
} else {
|
||||
final boolean read = ResponseBodyUtils.isRead(item, thread.getLastSeenAt(), userIds, null);
|
||||
binding.deliveryStatus.setImageResource(R.drawable.ic_check_all_24);
|
||||
ImageViewCompat.setImageTintList(
|
||||
binding.deliveryStatus,
|
||||
ColorStateList.valueOf(itemView.getResources().getColor(read ? R.color.blue_500 : R.color.grey_500))
|
||||
);
|
||||
containerLayoutParams.gravity = Gravity.CENTER;
|
||||
}
|
||||
|
||||
private void setMessageInfo(final DirectItem item, final MessageDirection messageDirection) {
|
||||
if (showMessageInfo()) {
|
||||
binding.messageInfo.setVisibility(View.VISIBLE);
|
||||
binding.deliveryStatus.setVisibility(messageDirection == MessageDirection.OUTGOING ? View.VISIBLE : View.GONE);
|
||||
binding.messageTime.setText(DateFormat.getTimeFormat(itemView.getContext()).format(item.getDate()));
|
||||
if (messageDirection == MessageDirection.OUTGOING) {
|
||||
if (item.isPending()) {
|
||||
binding.deliveryStatus.setImageResource(R.drawable.ic_check_24);
|
||||
} else {
|
||||
final boolean read = ResponseBodyUtils.isRead(item, thread.getLastSeenAt(), userIds, null);
|
||||
binding.deliveryStatus.setImageResource(R.drawable.ic_check_all_24);
|
||||
ImageViewCompat.setImageTintList(
|
||||
binding.deliveryStatus,
|
||||
ColorStateList.valueOf(itemView.getResources().getColor(read ? R.color.blue_500 : R.color.grey_500))
|
||||
);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
binding.messageInfo.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void setupReply(final DirectItem item, final MessageDirection messageDirection) {
|
||||
if (item.getRepliedToMessage() != null) {
|
||||
setReply(item, messageDirection, thread.getUsers());
|
||||
} else {
|
||||
@ -145,8 +171,6 @@ public abstract class DirectItemViewHolder extends RecyclerView.ViewHolder {
|
||||
binding.replyContainer.setVisibility(View.GONE);
|
||||
binding.replyInfo.setVisibility(View.GONE);
|
||||
}
|
||||
setReactions(item, thread.getUsers());
|
||||
bindItem(item, messageDirection);
|
||||
}
|
||||
|
||||
private void setReply(final DirectItem item,
|
||||
@ -324,8 +348,20 @@ public abstract class DirectItemViewHolder extends RecyclerView.ViewHolder {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void removeBg() {
|
||||
binding.background.setBackground(null);
|
||||
protected boolean allowMessageDirectionGravity() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean showUserDetailsInGroup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean showBackground() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean showMessageInfo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void cleanup() {}
|
||||
|
@ -19,7 +19,6 @@ import java.util.List;
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmVoiceMediaBinding;
|
||||
import awais.instagrabber.interfaces.MentionClickListener;
|
||||
import awais.instagrabber.repositories.responses.Audio;
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
import awais.instagrabber.repositories.responses.User;
|
||||
@ -27,7 +26,6 @@ import awais.instagrabber.repositories.responses.directmessages.DirectItem;
|
||||
import awais.instagrabber.repositories.responses.directmessages.DirectItemVoiceMedia;
|
||||
import awais.instagrabber.repositories.responses.directmessages.DirectThread;
|
||||
import awais.instagrabber.utils.TextUtils;
|
||||
import awais.instagrabber.utils.Utils;
|
||||
|
||||
import static com.google.android.exoplayer2.C.TIME_UNSET;
|
||||
|
||||
@ -45,18 +43,16 @@ public class DirectItemVoiceMediaViewHolder extends DirectItemViewHolder {
|
||||
@NonNull final LayoutDmVoiceMediaBinding binding,
|
||||
final User currentUser,
|
||||
final DirectThread thread,
|
||||
final MentionClickListener mentionClickListener,
|
||||
final View.OnClickListener onClickListener) {
|
||||
super(baseBinding, currentUser, thread, onClickListener);
|
||||
this.binding = binding;
|
||||
this.dataSourceFactory = new DefaultDataSourceFactory(binding.getRoot().getContext(), "instagram");
|
||||
setItemView(binding.getRoot());
|
||||
binding.waveformSeekBar.getLayoutParams().width = windowWidth - margin - Utils.convertDpToPx(56);
|
||||
binding.voiceMedia.getLayoutParams().width = mediaImageMaxWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindItem(final DirectItem directItemModel, final MessageDirection messageDirection) {
|
||||
removeBg();
|
||||
final DirectItemVoiceMedia voiceMedia = directItemModel.getVoiceMedia();
|
||||
if (voiceMedia == null) return;
|
||||
final Media media = voiceMedia.getMedia();
|
||||
|
@ -92,7 +92,8 @@ public class ChatMessageLayout extends FrameLayout {
|
||||
if (firstChildId == R.id.media_container) {
|
||||
widthSize += viewPartMainWidth;
|
||||
heightSize += viewPartMainHeight;
|
||||
} else if (firstChildId == R.id.raven_media_container || firstChildId == R.id.profile_container || firstChildId == R.id.voice_media || firstChildId == R.id.story_container) {
|
||||
} else if (firstChildId == R.id.raven_media_container || firstChildId == R.id.profile_container || firstChildId == R.id.voice_media
|
||||
|| firstChildId == R.id.story_container || firstChildId == R.id.media_share_container) {
|
||||
widthSize += viewPartMainWidth;
|
||||
heightSize += viewPartMainHeight + viewPartInfoHeight;
|
||||
} else {
|
||||
|
@ -545,14 +545,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
new ProfileFetcher(username.trim().substring(1), profileModel -> {
|
||||
if (getContext() == null) return;
|
||||
this.profileModel = profileModel;
|
||||
// final String userIdFromCookie = CookieUtils.getUserIdFromCookie(cookie);
|
||||
// final boolean isSelf = isLoggedIn
|
||||
// && profileModel != null
|
||||
// && userIdFromCookie != null
|
||||
// && userIdFromCookie.equals(profileModel.getId());
|
||||
// if (favMenuItem != null) {
|
||||
// favMenuItem.setVisible(isSelf);
|
||||
// }
|
||||
setProfileDetails();
|
||||
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/voice_media"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<FrameLayout
|
||||
@ -62,7 +62,7 @@
|
||||
|
||||
<awais.instagrabber.customviews.masoudss_waveform.WaveformSeekBar
|
||||
android:id="@+id/waveformSeekBar"
|
||||
android:layout_width="200dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
|
Loading…
Reference in New Issue
Block a user