diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemFooter.java b/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemFooter.java
index 19a47db27..b0023ed4e 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemFooter.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemFooter.java
@@ -215,6 +215,10 @@ public class ConversationItemFooter extends ConstraintLayout {
}
}
+ public TextView getDateView() {
+ return dateView;
+ }
+
private void notifyTouchDelegateChanged(@NonNull Rect rect, @NonNull View touchDelegate) {
if (onTouchDelegateChangedListener != null) {
onTouchDelegateChangedListener.onTouchDelegateChanged(rect, touchDelegate);
diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java
index 85a286f44..a987ad04d 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java
@@ -24,6 +24,7 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
+import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Typeface;
@@ -387,40 +388,46 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
}
}
+ int defaultMargin = readDimen(R.dimen.message_bubble_default_footer_bottom_margin);
if (!updatingFooter &&
!isCaptionlessMms(messageRecord) &&
!isViewOnceMessage(messageRecord) &&
isFooterVisible(messageRecord, nextMessageRecord, groupThread) &&
bodyText.getLastLineWidth() > 0)
{
- int footerWidth = footer.getMeasuredWidth();
- int availableWidth = getAvailableMessageBubbleWidth(bodyText);
+ TextView dateView = footer.getDateView();
+ int footerWidth = footer.getMeasuredWidth();
+ int availableWidth = getAvailableMessageBubbleWidth(bodyText);
+ int bottomDiff = (int) (bodyText.getPaint().getFontMetrics().bottom - dateView.getPaint().getFontMetrics().bottom);
+ int topMargin = -1 * (dateView.getMeasuredHeight() + ViewUtil.dpToPx(7) + bottomDiff) + 1;
if (bodyText.isSingleLine()) {
int maxBubbleWidth = hasBigImageLinkPreview(messageRecord) || hasThumbnail(messageRecord) ? readDimen(R.dimen.media_bubble_max_width) : getMaxBubbleWidth();
int bodyMargins = ViewUtil.getLeftMargin(bodyText) + ViewUtil.getRightMargin(bodyText);
int sizeWithMargins = bodyText.getMeasuredWidth() + ViewUtil.dpToPx(6) + footerWidth + bodyMargins;
int minSize = Math.min(maxBubbleWidth, Math.max(bodyText.getMeasuredWidth() + ViewUtil.dpToPx(6) + footerWidth + bodyMargins, bodyBubble.getMeasuredWidth()));
if (hasQuote(messageRecord) && sizeWithMargins < availableWidth) {
- ViewUtil.setTopMargin(footer, readDimen(R.dimen.message_bubble_same_line_footer_bottom_margin));
+ ViewUtil.setTopMargin(footer, topMargin);
needsMeasure = true;
updatingFooter = true;
} else if (sizeWithMargins != bodyText.getMeasuredWidth() && sizeWithMargins <= minSize) {
bodyBubble.getLayoutParams().width = minSize;
- ViewUtil.setTopMargin(footer, readDimen(R.dimen.message_bubble_same_line_footer_bottom_margin));
+ ViewUtil.setTopMargin(footer, topMargin);
needsMeasure = true;
updatingFooter = true;
}
}
if (!updatingFooter && bodyText.getLastLineWidth() + ViewUtil.dpToPx(6) + footerWidth <= bodyText.getMeasuredWidth()) {
- ViewUtil.setTopMargin(footer, readDimen(R.dimen.message_bubble_same_line_footer_bottom_margin));
+ ViewUtil.setTopMargin(footer, topMargin);
updatingFooter = true;
needsMeasure = true;
- } else if (!updatingFooter && ViewUtil.getTopMargin(footer) == readDimen(R.dimen.message_bubble_same_line_footer_bottom_margin)) {
- ViewUtil.setTopMargin(footer, readDimen(R.dimen.message_bubble_default_footer_bottom_margin));
- needsMeasure = true;
}
}
+ if (!updatingFooter && ViewUtil.getTopMargin(footer) != defaultMargin) {
+ ViewUtil.setTopMargin(footer, defaultMargin);
+ needsMeasure = true;
+ }
+
if (hasSharedContact(messageRecord)) {
int contactWidth = sharedContactStub.get().getMeasuredWidth();
int availableWidth = getAvailableMessageBubbleWidth(sharedContactStub.get());
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/MessageRecordUtil.kt b/app/src/main/java/org/thoughtcrime/securesms/util/MessageRecordUtil.kt
index cc4a5b663..f103c70bd 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/util/MessageRecordUtil.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/MessageRecordUtil.kt
@@ -91,18 +91,18 @@ fun MessageRecord.hasBigImageLinkPreview(context: Context): Boolean {
}
fun MessageRecord.isTextOnly(context: Context): Boolean {
- return !(
- !isMms ||
- isViewOnceMessage() ||
- hasLinkPreview() ||
- hasQuote() ||
- hasExtraText() ||
- hasDocument() ||
- hasThumbnail() ||
- hasAudio() ||
- hasLocation() ||
- hasSharedContact() ||
- hasSticker() ||
- isCaptionlessMms(context)
- )
+ return !isMms ||
+ (
+ !isViewOnceMessage() &&
+ !hasLinkPreview() &&
+ !hasQuote() &&
+ !hasExtraText() &&
+ !hasDocument() &&
+ !hasThumbnail() &&
+ !hasAudio() &&
+ !hasLocation() &&
+ !hasSharedContact() &&
+ !hasSticker() &&
+ !isCaptionlessMms(context)
+ )
}
diff --git a/app/src/main/res/layout/conversation_item_footer_incoming.xml b/app/src/main/res/layout/conversation_item_footer_incoming.xml
index 3de1d63e8..63e327a4a 100644
--- a/app/src/main/res/layout/conversation_item_footer_incoming.xml
+++ b/app/src/main/res/layout/conversation_item_footer_incoming.xml
@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ tools:layout_width="wrap_content"
tools:background="@color/green"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
@@ -54,7 +55,7 @@
app:layout_constraintEnd_toStartOf="@id/footer_expiration_timer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- tools:text="3m" />
+ tools:text="13:14pm" />
+ tools:text="Sim Op"
+ tools:visibility="visible" />
+ app:layout_constraintTop_toTopOf="parent"
+ tools:visibility="visible" />