Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Commit

Permalink
Merge pull request #26 from pedrovgs/fix-horizontal-drag-problems
Browse files Browse the repository at this point in the history
Fix horizontal drag problems for issue #20
  • Loading branch information
pedrovgs committed Dec 5, 2014
2 parents bde8e55 + ec3d7bc commit 1021337
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class DraggableViewCallback extends ViewDragHelper.Callback {

private static final int MINIMUN_DX_FOR_HORIZONTAL_DRAG = 25;
private static final int MINIMUN_DX_FOR_HORIZONTAL_DRAG = 5;
private static final int MINIMUM_DY_FOR_VERTICAL_DRAG = 15;
private static final float X_MIN_VELOCITY = 1300;
private static final float Y_MIN_VELOCITY = 1300;
Expand Down Expand Up @@ -163,7 +163,7 @@ private void triggerOnReleaseActionsWhileVerticalDrag(float yVel) {
* the x axis velocity.
*/
private void triggerOnReleaseActionsWhileHorizontalDrag(float xVel) {
if (xVel < 0 && xVel <= X_MIN_VELOCITY) {
if (xVel < 0 && xVel <= -X_MIN_VELOCITY) {
draggableView.closeToLeft();
} else if (xVel > 0 && xVel >= X_MIN_VELOCITY) {
draggableView.closeToRight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,21 @@ class ScaleTransformer extends Transformer {
}

/**
* @return true if the left position of the view is to the right of the twenty five percent of
* the parent width.
* @return true if the right position of the view is to the left of sixty percent of the parent
* width.
*/
@Override public boolean isNextToRightBound() {
return (getView().getLeft() - getMarginRight()) > getParentView().getWidth() * 0.25;
@Override public boolean isNextToLeftBound() {
return (getView().getRight() - getMarginRight()) < getParentView().getWidth() * 0.6;
}

/**
* @return true if the left position of the view is to the left of the twenty five percent of
* the parent width.
* @return true if the right position of the view is to the right of the one hundred twenty five
* five percent of the parent view width.
*/
@Override public boolean isNextToLeftBound() {
return (getView().getLeft() - getMarginRight()) < getParentView().getWidth() * 0.25;
@Override

public boolean isNextToRightBound() {
return (getView().getRight() - getMarginRight()) > getParentView().getWidth() * 1.25;
}

/**
Expand Down

0 comments on commit 1021337

Please sign in to comment.