From d81f7fb2eadf303e1c604c06a62dce02ed068b2a Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 24 Jun 2022 20:29:56 +0200 Subject: [PATCH] Limit overscoll delta Y --- .../main/java/eu/faircode/email/WebViewEx.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/WebViewEx.java b/app/src/main/java/eu/faircode/email/WebViewEx.java index 5de6328d8f..79833096cb 100644 --- a/app/src/main/java/eu/faircode/email/WebViewEx.java +++ b/app/src/main/java/eu/faircode/email/WebViewEx.java @@ -295,7 +295,20 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC clampedY = true; } - Log.i("onOverScrolled clamped=" + clampedY + " new=" + newScrollY + " dy=" + deltaY); + Log.i("onOverScrolled" + + " clampedY=" + clampedY + + " scrollY=" + scrollY + + " deltaY=" + deltaY + + " RangeY=" + scrollRangeY + + " maxY=" + maxOverScrollY + + " newY=" + (scrollY + deltaY) + "/" + newScrollY + + " dy=" + deltaY + + " top=" + top + + " bottom=" + bottom); + + if (Math.abs(deltaY) > bottom - top) + deltaY = (deltaY > 0 ? 1 : -1) * (bottom - top); + intf.onOverScrolled(scrollX, scrollY, deltaX, deltaY, clampedX, clampedY); return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);