Browse Source

close #1339

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
d4a20510ec
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 16
      app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemViewHolder.java
  2. 19
      app/src/main/java/awais/instagrabber/customviews/ChatMessageLayout.java
  3. 11
      app/src/main/res/layout/layout_dm_reel_share.xml

16
app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectItemViewHolder.java

@ -133,13 +133,17 @@ 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) {
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);
} else {
break;
default:
if (showMessageInfo()) {
binding.messageInfo.setPadding(0, 0, messageInfoPaddingSmall, dmRadiusSmall);
}

19
app/src/main/java/awais/instagrabber/customviews/ChatMessageLayout.java

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

11
app/src/main/res/layout/layout_dm_reel_share.xml

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

Loading…
Cancel
Save