mirror of
https://github.com/KokaKiwi/BarInsta
synced 2026-04-03 09:31:34 +00:00
close #1339
This commit is contained in:
parent
5ab794941e
commit
d4a20510ec
3 changed files with 35 additions and 19 deletions
|
|
@ -133,16 +133,20 @@ public abstract class DirectItemViewHolder extends RecyclerView.ViewHolder imple
|
|||
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 || itemType == DirectItemType.UNKNOWN) {
|
||||
binding.messageInfo.setPadding(0, 0, dmRadius, dmRadiusSmall);
|
||||
} else {
|
||||
if (showMessageInfo()) {
|
||||
binding.messageInfo.setPadding(0, 0, messageInfoPaddingSmall, dmRadiusSmall);
|
||||
}
|
||||
switch (itemType) {
|
||||
case REEL_SHARE:
|
||||
case STORY_SHARE: // i think they could have texts?
|
||||
// containerLayoutParams.setMarginStart(0);
|
||||
// containerLayoutParams.setMarginEnd(0);
|
||||
case TEXT:
|
||||
case LINK:
|
||||
case UNKNOWN:
|
||||
binding.messageInfo.setPadding(0, 0, dmRadius, dmRadiusSmall);
|
||||
break;
|
||||
default:
|
||||
if (showMessageInfo()) {
|
||||
binding.messageInfo.setPadding(0, 0, messageInfoPaddingSmall, dmRadiusSmall);
|
||||
}
|
||||
}
|
||||
setupReply(item, messageDirection);
|
||||
setReactions(item, position);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
|
||||
|
|
@ -74,7 +75,6 @@ public class ChatMessageLayout extends FrameLayout {
|
|||
if (firstChild == null) return;
|
||||
|
||||
final int firstChildId = firstChild.getId();
|
||||
if (firstChildId == R.id.reel_share_container) return;
|
||||
|
||||
int availableWidth = widthSize - getPaddingLeft() - getPaddingRight();
|
||||
// int availableHeight = heightSize - getPaddingTop() - getPaddingBottom();
|
||||
|
|
@ -100,13 +100,24 @@ public class ChatMessageLayout extends FrameLayout {
|
|||
} else {
|
||||
int viewPartMainLineCount = 1;
|
||||
float viewPartMainLastLineWidth = 0;
|
||||
final TextView textMessage;
|
||||
if (firstChild instanceof TextView) {
|
||||
viewPartMainLineCount = ((TextView) firstChild).getLineCount();
|
||||
textMessage = (TextView) firstChild;
|
||||
}
|
||||
else if (firstChildId == R.id.reel_share_container) {
|
||||
textMessage = (TextView) ((ConstraintLayout) firstChild).getChildAt(5);
|
||||
}
|
||||
else if (firstChildId == R.id.story_container) {
|
||||
textMessage = (TextView) ((ConstraintLayout) firstChild).getChildAt(2);
|
||||
}
|
||||
else textMessage = null;
|
||||
if (textMessage != null) {
|
||||
viewPartMainLineCount = textMessage.getLineCount();
|
||||
viewPartMainLastLineWidth = viewPartMainLineCount > 0
|
||||
? ((TextView) firstChild).getLayout().getLineWidth(viewPartMainLineCount - 1)
|
||||
? textMessage.getLayout().getLineWidth(viewPartMainLineCount - 1)
|
||||
: 0;
|
||||
// also include start left padding
|
||||
viewPartMainLastLineWidth += firstChild.getPaddingLeft();
|
||||
viewPartMainLastLineWidth += textMessage.getPaddingLeft();
|
||||
}
|
||||
|
||||
final float lastLineWithInfoWidth = viewPartMainLastLineWidth + viewPartInfoWidth;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue