From 1c5721db82b24ca834def694e99ac9e58b88b805 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 10 Jun 2021 10:54:26 +1000 Subject: [PATCH] Don't move date break header --- .../conversation/v2/messages/VisibleMessageView.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 55cde4ab14..13862ef7d3 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 @@ -179,8 +179,6 @@ class VisibleMessageView : LinearLayout { } fun recycle() { - translationX = 0.0f - swipeToReplyIcon.alpha = 0 profilePictureView.recycle() messageContentView.recycle() } @@ -217,6 +215,7 @@ class VisibleMessageView : LinearLayout { val sign = -1.0f val x = (damping * (sqrt(abs(translationX)) / sqrt(damping))) * sign this.translationX = x + this.dateBreakTextView.translationX = -x // Bit of a hack to keep the date break text view from moving postInvalidate() // Ensure onDraw(canvas:) is called if (abs(x) > VisibleMessageView.swipeToReplyThreshold && abs(previousTranslationX) < VisibleMessageView.swipeToReplyThreshold) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { @@ -238,8 +237,15 @@ class VisibleMessageView : LinearLayout { animate() .translationX(0.0f) .setDuration(150) - .setUpdateListener { postInvalidate() } // Ensure onDraw(canvas:) is called + .setUpdateListener { + postInvalidate() // Ensure onDraw(canvas:) is called + } .start() + // Bit of a hack to keep the date break text view from moving + dateBreakTextView.animate() + .translationX(0.0f) + .setDuration(150) + .start() } private fun onLongPress() {