1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-15 19:27:31 +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,13 +133,17 @@ public abstract class DirectItemViewHolder extends RecyclerView.ViewHolder imple
setGroupUserDetails(item, messageDirection); setGroupUserDetails(item, messageDirection);
setBackground(messageDirection); setBackground(messageDirection);
setMessageInfo(item, messageDirection); setMessageInfo(item, messageDirection);
if (itemType == DirectItemType.REEL_SHARE) { switch (itemType) {
containerLayoutParams.setMarginStart(0); case REEL_SHARE:
containerLayoutParams.setMarginEnd(0); case STORY_SHARE: // i think they could have texts?
} // containerLayoutParams.setMarginStart(0);
if (itemType == DirectItemType.TEXT || itemType == DirectItemType.LINK || itemType == DirectItemType.UNKNOWN) { // containerLayoutParams.setMarginEnd(0);
case TEXT:
case LINK:
case UNKNOWN:
binding.messageInfo.setPadding(0, 0, dmRadius, dmRadiusSmall); binding.messageInfo.setPadding(0, 0, dmRadius, dmRadiusSmall);
} else { break;
default:
if (showMessageInfo()) { if (showMessageInfo()) {
binding.messageInfo.setPadding(0, 0, messageInfoPaddingSmall, dmRadiusSmall); binding.messageInfo.setPadding(0, 0, messageInfoPaddingSmall, dmRadiusSmall);
} }

View File

@ -9,6 +9,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import awais.instagrabber.R; import awais.instagrabber.R;
@ -74,7 +75,6 @@ public class ChatMessageLayout extends FrameLayout {
if (firstChild == null) return; if (firstChild == null) return;
final int firstChildId = firstChild.getId(); final int firstChildId = firstChild.getId();
if (firstChildId == R.id.reel_share_container) return;
int availableWidth = widthSize - getPaddingLeft() - getPaddingRight(); int availableWidth = widthSize - getPaddingLeft() - getPaddingRight();
// int availableHeight = heightSize - getPaddingTop() - getPaddingBottom(); // int availableHeight = heightSize - getPaddingTop() - getPaddingBottom();
@ -100,13 +100,24 @@ public class ChatMessageLayout extends FrameLayout {
} else { } else {
int viewPartMainLineCount = 1; int viewPartMainLineCount = 1;
float viewPartMainLastLineWidth = 0; float viewPartMainLastLineWidth = 0;
final TextView textMessage;
if (firstChild instanceof TextView) { 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 viewPartMainLastLineWidth = viewPartMainLineCount > 0
? ((TextView) firstChild).getLayout().getLineWidth(viewPartMainLineCount - 1) ? textMessage.getLayout().getLineWidth(viewPartMainLineCount - 1)
: 0; : 0;
// also include start left padding // also include start left padding
viewPartMainLastLineWidth += firstChild.getPaddingLeft(); viewPartMainLastLineWidth += textMessage.getPaddingLeft();
} }
final float lastLineWithInfoWidth = viewPartMainLastLineWidth + viewPartInfoWidth; final float lastLineWithInfoWidth = viewPartMainLastLineWidth + viewPartInfoWidth;

View File

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