1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 06:37:30 +00:00
This commit is contained in:
Austin Huang 2021-06-17 23:39:13 -04:00
parent 5ab794941e
commit d4a20510ec
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
3 changed files with 35 additions and 19 deletions

View File

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

View File

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

View File

@ -72,12 +72,13 @@
<awais.instagrabber.customviews.RamboTextViewV2
android:id="@+id/message"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:paddingStart="@dimen/dm_message_card_radius"
android:paddingTop="@dimen/dm_message_card_radius_small"
android:paddingEnd="@dimen/dm_message_card_radius"
android:paddingBottom="@dimen/dm_message_card_radius_small"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"