mirror of https://github.com/M66B/FairEmail.git
Cleanup
This commit is contained in:
parent
1b948277f9
commit
45ee805c8e
|
@ -51,7 +51,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
@ -1006,39 +1005,18 @@ public class FragmentMessages extends FragmentBase {
|
||||||
|
|
||||||
private SwipeListener swipeListener = new SwipeListener(getContext(), new SwipeListener.ISwipeListener() {
|
private SwipeListener swipeListener = new SwipeListener(getContext(), new SwipeListener.ISwipeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onSwipeRight(MotionEvent me) {
|
public boolean onSwipeRight() {
|
||||||
if (inWebView(me))
|
|
||||||
return false;
|
|
||||||
if (previous != null)
|
if (previous != null)
|
||||||
navigate(previous, true);
|
navigate(previous, true);
|
||||||
return (previous != null);
|
return (previous != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSwipeLeft(MotionEvent me) {
|
public boolean onSwipeLeft() {
|
||||||
if (inWebView(me))
|
|
||||||
return false;
|
|
||||||
if (next != null)
|
if (next != null)
|
||||||
navigate(next, false);
|
navigate(next, false);
|
||||||
return (next != null);
|
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) {
|
private void onActionMove(String folderType) {
|
||||||
|
|
|
@ -27,9 +27,9 @@ public class SwipeListener implements View.OnTouchListener {
|
||||||
if (Math.abs(dx) > MOVE_THRESHOLD && Math.abs(vx) > SPEED_THRESHOLD)
|
if (Math.abs(dx) > MOVE_THRESHOLD && Math.abs(vx) > SPEED_THRESHOLD)
|
||||||
try {
|
try {
|
||||||
if (dx > 0)
|
if (dx > 0)
|
||||||
consumed = listener.onSwipeRight(me1);
|
consumed = listener.onSwipeRight();
|
||||||
else
|
else
|
||||||
consumed = listener.onSwipeLeft(me1);
|
consumed = listener.onSwipeLeft();
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ public class SwipeListener implements View.OnTouchListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ISwipeListener {
|
interface ISwipeListener {
|
||||||
boolean onSwipeRight(MotionEvent me);
|
boolean onSwipeRight();
|
||||||
|
|
||||||
boolean onSwipeLeft(MotionEvent me);
|
boolean onSwipeLeft();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue