Swipe right reimplemented
This commit is contained in:
parent
ee6cf7f054
commit
8cae14ca1f
3 changed files with 4 additions and 12 deletions
|
@ -20,9 +20,6 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.widgets.InterceptorFrameLayout;
|
||||
import net.osmand.plus.widgets.tools.SwipeDismissTouchListener;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
*/
|
||||
public abstract class DashBaseFragment extends Fragment {
|
||||
protected DashboardOnMap dashboard;
|
||||
|
||||
|
@ -72,9 +69,7 @@ public abstract class DashBaseFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onDismiss(View view, Object token, boolean isSwipeRight) {
|
||||
if (isSwipeRight) {
|
||||
getDismissCallback().onDismiss();
|
||||
}
|
||||
getDismissCallback().onDismiss();
|
||||
}
|
||||
});
|
||||
frameLayout.setOnTouchListener(listener);
|
||||
|
|
|
@ -11,9 +11,6 @@ import android.widget.FrameLayout;
|
|||
|
||||
import net.osmand.plus.widgets.tools.SwipeDismissTouchListener;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 8/5/15.
|
||||
*/
|
||||
public class InterceptorFrameLayout extends FrameLayout {
|
||||
private int mTouchSlop;
|
||||
private boolean mIsScrolling;
|
||||
|
@ -67,7 +64,7 @@ public class InterceptorFrameLayout extends FrameLayout {
|
|||
}
|
||||
|
||||
final int xDiff = calculateDistanceX(ev);
|
||||
if (xDiff > mTouchSlop) {
|
||||
if (Math.abs(xDiff) > mTouchSlop) {
|
||||
mIsScrolling = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public class SwipeDismissTouchListener implements View.OnTouchListener {
|
|||
dismiss = (velocityX < 0) == (deltaX < 0);
|
||||
dismissRight = mVelocityTracker.getXVelocity() > 0;
|
||||
}
|
||||
if (dismiss && dismissRight) {
|
||||
if (dismiss) {
|
||||
// dismiss
|
||||
final boolean finalDismissRight = dismissRight;
|
||||
ViewCompat.animate(mView)
|
||||
|
@ -210,7 +210,7 @@ public class SwipeDismissTouchListener implements View.OnTouchListener {
|
|||
mVelocityTracker.addMovement(motionEvent);
|
||||
float deltaX = motionEvent.getRawX() - mDownX;
|
||||
float deltaY = motionEvent.getRawY() - mDownY;
|
||||
if (deltaX > mSlop && Math.abs(deltaY) < deltaX / 2) {
|
||||
if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) {
|
||||
mSwiping = true;
|
||||
mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop);
|
||||
mView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||
|
|
Loading…
Reference in a new issue