From e07a0d6d138c9d441139b528d2b77591f88bf9a7 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 14 Mar 2016 21:16:28 +0100 Subject: [PATCH] Adjust DirectionDragListener --- .../android/views/dragbutton/DirectionDragListener.java | 4 ++++ app/src/main/res/values/drag_dimens.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/solovyev/android/views/dragbutton/DirectionDragListener.java b/app/src/main/java/org/solovyev/android/views/dragbutton/DirectionDragListener.java index f3709624..4336b123 100644 --- a/app/src/main/java/org/solovyev/android/views/dragbutton/DirectionDragListener.java +++ b/app/src/main/java/org/solovyev/android/views/dragbutton/DirectionDragListener.java @@ -4,6 +4,7 @@ import android.content.Context; import android.graphics.PointF; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.util.Log; import android.view.View; import org.solovyev.android.calculator.R; @@ -30,17 +31,20 @@ public abstract class DirectionDragListener implements DragListener { public boolean onDrag(@NonNull View view, @NonNull DragEvent e) { final long duration = e.motionEvent.getEventTime() - e.motionEvent.getDownTime(); if (duration < 40 || duration > 2500) { + Log.v("DirectionDragListener", "Drag stopped: too fast movement, " + duration + "ms"); return false; } final float distance = distance(e.start, e.end); if (distance < minDistancePxs) { + Log.v("DirectionDragListener", "Drag stopped: too short distance, " + distance + "pxs"); return false; } final double angle = toDegrees(getAngle(e.start, sum(e.start, axis), e.end, right)); final DragDirection direction = getDirection((float) angle, right[0]); if (direction == null) { + Log.v("DirectionDragListener", "Drag stopped: unknown direction"); return false; } diff --git a/app/src/main/res/values/drag_dimens.xml b/app/src/main/res/values/drag_dimens.xml index 3a198216..51079469 100644 --- a/app/src/main/res/values/drag_dimens.xml +++ b/app/src/main/res/values/drag_dimens.xml @@ -1,4 +1,4 @@ - 25dp + 15dp \ No newline at end of file