1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 01:36:55 +00:00

Fixed flickering on vertical overscroll

This commit is contained in:
M66B 2020-09-18 12:02:05 +02:00
parent a515bfa81d
commit 56e91abde1
2 changed files with 8 additions and 4 deletions

View file

@ -1929,7 +1929,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public void onOverScrolled(int scrollX, int scrollY, int dx, int dy, boolean clampedX, boolean clampedY) {
if (clampedY && ((WebViewEx) wvBody).isZoomed())
if (clampedY && ((WebViewEx) wvBody).isZoomedY())
properties.scrollBy(0, dy);
}
@ -2796,7 +2796,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else {
//view.getParent().requestDisallowInterceptTouchEvent(false);
//return (view.getId() == R.id.wvBody && ev.getAction() == MotionEvent.ACTION_MOVE);
boolean intercept = (view.getId() == R.id.wvBody && ((WebViewEx) wvBody).isZoomed());
boolean intercept = (view.getId() == R.id.wvBody && ((WebViewEx) wvBody).isZoomedY());
view.getParent().requestDisallowInterceptTouchEvent(intercept);
return false;
}

View file

@ -191,7 +191,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
clampedY = true;
}
Log.i("MMM clamped=" + clampedY + " new=" + newScrollY + " dy=" + deltaY + " mode=" + overScrollMode);
Log.i("onOverScrolled clamped=" + clampedY + " new=" + newScrollY + " dy=" + deltaY);
intf.onOverScrolled(scrollX, scrollY, deltaX, deltaY, clampedX, clampedY);
return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
@ -235,7 +235,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
return super.onGenericMotionEvent(event);
}
public boolean isZoomed() {
public boolean isZoomedX() {
int xtend = computeHorizontalScrollExtent();
if (xtend != 0) {
float xscale = computeHorizontalScrollRange() / (float) xtend;
@ -243,6 +243,10 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
return true;
}
return false;
}
public boolean isZoomedY() {
int ytend = computeVerticalScrollExtent();
if (ytend != 0) {
float yscale = computeVerticalScrollRange() / (float) ytend;