Skip to content

Commit

Permalink
TouchMode.ALL optimization
Browse files Browse the repository at this point in the history
intercept touch events for both TouchMode vales.
In the case of my app, BifacialView is inside a ViewPager. Everything is
ok with TouchMode.DELIMITER, but touch gestures were confusing using
TouchMode.ALL (BifacialView sets new position, but parent viewPager
starts swiping too!). This fixes my bug :)
  • Loading branch information
mudar committed Sep 11, 2017
1 parent 4a40f7a commit bc6a236
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,18 @@ public boolean onTouchEvent(MotionEvent event) {

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (touchMode == TouchMode.DELIMITER) {
if (x > delimiterPosition + delimiterPadding || x < delimiterPosition - delimiterPadding) {
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

0 comments on commit bc6a236

Please sign in to comment.