From 94d62a943fbc8e9c1c368419e28a472ce3ae800e Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 27 Sep 2024 16:48:16 +0200 Subject: [PATCH] fix position and animation of typing indicator Without this fix, typing indicator moves up and wont go down Signed-off-by: Marcel Hibbe --- .../com/nextcloud/talk/chat/ChatActivity.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 486df17b4..6679695d3 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -1307,16 +1307,16 @@ class ChatActivity : runOnUiThread { binding.typingIndicator.text = typingString - if (participantNames.size > 0) { - binding.typingIndicatorWrapper.visibility = View.VISIBLE - binding.typingIndicatorWrapper.animate() - .translationYBy(DisplayUtils.convertDpToPixel(-18f, context)) - .setInterpolator(AccelerateDecelerateInterpolator()) - .duration = TYPING_INDICATOR_ANIMATION_DURATION + val typingIndicatorPositionY = if (participantNames.size > 0) { + TYPING_INDICATOR_POSITION_VISIBLE } else { - binding.typingIndicatorWrapper.visibility = View.INVISIBLE - binding.typingIndicatorWrapper.y += DisplayUtils.convertDpToPixel(18f, context) + TYPING_INDICATOR_POSITION_HIDDEN } + + binding.typingIndicatorWrapper.animate() + .translationY(DisplayUtils.convertDpToPixel(typingIndicatorPositionY, context)) + .setInterpolator(AccelerateDecelerateInterpolator()) + .duration = TYPING_INDICATOR_ANIMATION_DURATION } } @@ -3696,6 +3696,8 @@ class ChatActivity : private const val COMMA = ", " private const val TYPING_INDICATOR_ANIMATION_DURATION = 200L private const val TYPING_INDICATOR_MAX_NAME_LENGTH = 14 + private const val TYPING_INDICATOR_POSITION_VISIBLE = -18f + private const val TYPING_INDICATOR_POSITION_HIDDEN = -1f private const val TYPING_DURATION_TO_SEND_NEXT_TYPING_MESSAGE = 10000L private const val TYPING_INTERVAL_TO_SEND_NEXT_TYPING_MESSAGE = 1000L private const val TYPING_STARTED_SIGNALING_MESSAGE_TYPE = "startedTyping"