diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt
index 00c5c08a4d..90cb58cdc9 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt
@@ -9,9 +9,11 @@ import android.graphics.drawable.ColorDrawable
import android.os.Handler
import android.os.Looper
import android.util.AttributeSet
+import android.view.Gravity
import android.view.HapticFeedbackConstants
import android.view.MotionEvent
import android.view.View
+import android.widget.FrameLayout
import android.widget.LinearLayout
import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes
@@ -114,6 +116,7 @@ class VisibleMessageView : LinearLayout {
binding.root.disableClipping()
binding.mainContainer.disableClipping()
binding.messageInnerContainer.disableClipping()
+ binding.messageInnerLayout.disableClipping()
binding.messageContentView.root.disableClipping()
}
// endregion
@@ -342,11 +345,14 @@ class VisibleMessageView : LinearLayout {
private fun updateExpirationTimer(message: MessageRecord) {
val container = binding.messageInnerContainer
- val content = binding.messageContentView.root
- val expiration = binding.expirationTimerView
- container.removeAllViewsInLayout()
- container.addView(if (message.isOutgoing) expiration else content)
- container.addView(if (message.isOutgoing) content else expiration)
+ val layout = binding.messageInnerLayout
+
+ if (message.isOutgoing) binding.messageContentView.root.bringToFront()
+ else binding.expirationTimerView.bringToFront()
+
+ layout.layoutParams = layout.layoutParams.let { it as FrameLayout.LayoutParams }
+ .apply { gravity = if (message.isOutgoing) Gravity.END else Gravity.START }
+
val containerParams = container.layoutParams as ConstraintLayout.LayoutParams
containerParams.horizontalBias = if (message.isOutgoing) 1f else 0f
container.layoutParams = containerParams
diff --git a/app/src/main/res/layout/view_visible_message.xml b/app/src/main/res/layout/view_visible_message.xml
index 11155ccc20..37b65c8fcb 100644
--- a/app/src/main/res/layout/view_visible_message.xml
+++ b/app/src/main/res/layout/view_visible_message.xml
@@ -107,35 +107,40 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" />
-
-
+ android:orientation="horizontal">
-
+
-
+
+
+
+