mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-29 17:11:12 +01:00
Prevent swipe right/left in WebView
This commit is contained in:
@@ -51,6 +51,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.SeekBar;
|
||||
@@ -993,18 +994,39 @@ public class FragmentMessages extends FragmentBase {
|
||||
|
||||
private SwipeListener swipeListener = new SwipeListener(getContext(), new SwipeListener.ISwipeListener() {
|
||||
@Override
|
||||
public boolean onSwipeRight() {
|
||||
public boolean onSwipeRight(MotionEvent me) {
|
||||
if (inWebView(me))
|
||||
return false;
|
||||
if (previous != null)
|
||||
navigate(previous, true);
|
||||
return (previous != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSwipeLeft() {
|
||||
public boolean onSwipeLeft(MotionEvent me) {
|
||||
if (inWebView(me))
|
||||
return false;
|
||||
if (next != null)
|
||||
navigate(next, false);
|
||||
return (next != null);
|
||||
}
|
||||
|
||||
private boolean inWebView(MotionEvent me) {
|
||||
View parent = rvMessage.findChildViewUnder(me.getX(), me.getY());
|
||||
if (parent == null)
|
||||
return false;
|
||||
|
||||
View child = parent.findViewById(R.id.vwBody);
|
||||
if (!(child instanceof WebView))
|
||||
return false;
|
||||
|
||||
int[] location = new int[2];
|
||||
child.getLocationOnScreen(location);
|
||||
int x = location[0];
|
||||
int y = location[1];
|
||||
return (me.getRawX() >= x && me.getRawX() <= x + view.getWidth() &&
|
||||
me.getRawY() >= y && me.getRawY() <= y + view.getHeight());
|
||||
}
|
||||
});
|
||||
|
||||
private void onActionMove(String folderType) {
|
||||
|
||||
Reference in New Issue
Block a user