Skip to content

Commit

Permalink
Merge pull request #3 from mudar/master
Browse files Browse the repository at this point in the history
Updating swipe behvior
  • Loading branch information
pavel163 authored Sep 12, 2017
2 parents 99a8dde + bc6a236 commit 2a4bce5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public enum TouchMode {

private int delimiterColor;
private int delimiterWidth;
private int delimiterPadding;
private int arrowColor;
private boolean arrowVisible;
private int arrowWidth;
Expand Down Expand Up @@ -97,6 +98,8 @@ private void initAttrs(AttributeSet attrs) {
drawableRight = a.getDrawable(R.styleable.BifacialView_drawableRight);
delimiterColor = a.getColor(R.styleable.BifacialView_delimiterColor, Color.WHITE);
delimiterWidth = a.getDimensionPixelSize(R.styleable.BifacialView_delimiterWidth,3);
delimiterPadding = a.getDimensionPixelSize(R.styleable.BifacialView_delimiterPadding,
20);
arrowColor = a.getColor(R.styleable.BifacialView_arrowColor, Color.WHITE);
arrowVisible = a.getBoolean(R.styleable.BifacialView_arrowVisibility, false);
leftText = a.getString(R.styleable.BifacialView_leftText);
Expand Down Expand Up @@ -165,22 +168,18 @@ public boolean onTouchEvent(MotionEvent event) {

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (touchMode == TouchMode.DELIMITER) {
if (x > delimiterPosition + 20 || x < delimiterPosition - 20) {
return false;
} else {
getParent().requestDisallowInterceptTouchEvent(true);
}
if ((touchMode == TouchMode.DELIMITER) &&
(x > delimiterPosition + delimiterPadding || x < delimiterPosition - delimiterPadding)) {
return false;
}
getParent().requestDisallowInterceptTouchEvent(true);
case MotionEvent.ACTION_MOVE:
isMove = true;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
isMove = false;
if (touchMode == TouchMode.DELIMITER) {
getParent().requestDisallowInterceptTouchEvent(false);
}
getParent().requestDisallowInterceptTouchEvent(false);
break;
}
delimiterPosition = (int) (x / 1);
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<attr name="drawableRight" format="reference" />
<attr name="delimiterColor" format="color" />
<attr name="delimiterWidth" format="dimension" />
<attr name="delimiterPadding" format="dimension" />
<attr name="arrowColor" format="color" />
<attr name="arrowWidth" format="dimension"/>
<attr name="arrowHeight" format="dimension"/>
Expand Down

0 comments on commit 2a4bce5

Please sign in to comment.