Skip to content

Commit

Permalink
fixed "click on a menu button will not trigger it" bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dacer committed Feb 13, 2018
1 parent b392c2d commit 9705636
Showing 1 changed file with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,6 @@ public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
hideOnTouchUp = true;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (!show) break;
if (lastFocusIndex != -1) {
show = false;
AnimatorUtils.openMenu(this, lastFocusIndex, animListener);
if (onClickMenuListener != null) {
View clickedView = getChildAt(lastFocusIndex);
onClickMenuListener.onClickArcMenu(arcMenu, viewForListener, (int) clickedView.getTag());
}
} else if (hideOnTouchUp) {
if (showAnimSet != null && showAnimSet.isRunning()) showAnimSet.cancel();
AnimatorUtils.hideMenu(this, touchPoint);
show = false;
} else {
hideOnTouchUp = true;
}
lastFocusIndex = -1;
break;
case MotionEvent.ACTION_MOVE:
if (!animFinished) break;
tempRect = new Rect();
Expand All @@ -161,6 +141,25 @@ public boolean onTouchEvent(MotionEvent event) {
lastFocusIndex = -1;
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (!show) break;
if (lastFocusIndex != -1) {
show = false;
AnimatorUtils.openMenu(this, lastFocusIndex, animListener);
if (onClickMenuListener != null) {
View clickedView = getChildAt(lastFocusIndex);
onClickMenuListener.onClickArcMenu(arcMenu, viewForListener, (int) clickedView.getTag());
}
} else if (hideOnTouchUp) {
if (showAnimSet != null && showAnimSet.isRunning()) showAnimSet.cancel();
AnimatorUtils.hideMenu(this, touchPoint);
show = false;
} else {
hideOnTouchUp = true;
}
lastFocusIndex = -1;
break;
}

return show;
Expand Down

0 comments on commit 9705636

Please sign in to comment.