From 9e62e1eab42d12058306d60c1c283beed2f0ade8 Mon Sep 17 00:00:00 2001 From: Al Lansley Date: Wed, 27 Mar 2024 07:21:21 +1100 Subject: [PATCH] SES-789 - Scroll to bottom of long new message(s) (#1426) * WIP * Working - push before cleanup * Fixes #1316 * Cleanup * PR review adjustments * Fixed scrolling when receiving an image based message while keyboard is up * Prevent auto-scroll to last seen item pos in conversation view if <= 3 * Put back <=3 check to scroll * Forced scrolling to bottom of long messages (both sent and received) when already at the bottom of the RecyclerView * Fixes #1364 --------- Co-authored-by: = <=> Co-authored-by: AL-Session <160798022+AL-Session@users.noreply.github.com> --- .../securesms/conversation/v2/ConversationActivityV2.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 964e3c91ef..5e6dd45c21 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -2162,7 +2162,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe override fun onChanged() { super.onChanged() if (recyclerView.isScrolledToWithin30dpOfBottom) { - recyclerView.scrollToPosition(adapter.itemCount-1) + // Note: The adapter itemCount is zero based - so calling this with the itemCount in + // a non-zero based manner scrolls us to the bottom of the last message (including + // to the bottom of long messages as required by Jira SES-789 / GitHub 1364). + recyclerView.scrollToPosition(adapter.itemCount) } } }