From 579794d7e0558d216751d12893d6ab5fdb25a71c Mon Sep 17 00:00:00 2001 From: sk Date: Sat, 31 Dec 2022 01:52:07 +0100 Subject: [PATCH] peek original post before scrolling --- .../joinmastodon/android/fragments/ComposeFragment.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index f2db62bd9..98579bbaa 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -573,9 +573,10 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr initiallyScrolled = true; scrollView.post(() -> { int bottom = scrollView.getChildAt(0).getBottom(); - int sy = scrollView.getScrollY(); - int sh = scrollView.getHeight(); - scrollView.scrollBy(0, bottom - (sy + sh)); + int delta = bottom - (scrollView.getScrollY() + scrollView.getHeight()); + int space = Math.min(V.dp(150), delta); + scrollView.scrollBy(0, delta - space); + scrollView.postDelayed(() -> scrollView.smoothScrollBy(0, space), 150); }); } }