Skip to content

Commit

Permalink
fix position and animation of typing indicator
Browse files Browse the repository at this point in the history
Without this fix, typing indicator moves up and wont go down

Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi committed Oct 9, 2024
1 parent d5f0a36 commit 75d0bc0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1292,16 +1292,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
}
}

Expand Down Expand Up @@ -3677,6 +3677,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"
Expand Down

0 comments on commit 75d0bc0

Please sign in to comment.