This commit is contained in:
M66B 2019-04-30 08:03:20 +02:00
parent 1b948277f9
commit 45ee805c8e
2 changed files with 6 additions and 28 deletions

View File

@ -51,7 +51,6 @@ 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.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageButton;
@ -1006,39 +1005,18 @@ public class FragmentMessages extends FragmentBase {
private SwipeListener swipeListener = new SwipeListener(getContext(), new SwipeListener.ISwipeListener() {
@Override
public boolean onSwipeRight(MotionEvent me) {
if (inWebView(me))
return false;
public boolean onSwipeRight() {
if (previous != null)
navigate(previous, true);
return (previous != null);
}
@Override
public boolean onSwipeLeft(MotionEvent me) {
if (inWebView(me))
return false;
public boolean onSwipeLeft() {
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) {

View File

@ -27,9 +27,9 @@ public class SwipeListener implements View.OnTouchListener {
if (Math.abs(dx) > MOVE_THRESHOLD && Math.abs(vx) > SPEED_THRESHOLD)
try {
if (dx > 0)
consumed = listener.onSwipeRight(me1);
consumed = listener.onSwipeRight();
else
consumed = listener.onSwipeLeft(me1);
consumed = listener.onSwipeLeft();
} catch (Throwable ex) {
Log.e(ex);
}
@ -44,8 +44,8 @@ public class SwipeListener implements View.OnTouchListener {
}
interface ISwipeListener {
boolean onSwipeRight(MotionEvent me);
boolean onSwipeRight();
boolean onSwipeLeft(MotionEvent me);
boolean onSwipeLeft();
}
}