Skip to content

Commit b392c2d

Browse files
committed
fixed #1
1 parent 42e81ad commit b392c2d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

library/src/main/java/com/hackplan/androidarcmenu/AnimatorUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void clearFocusChild(ViewGroup viewGroup, int index) {
8383
animSet.start();
8484
}
8585

86-
static void showMenu(ViewGroup viewGroup, Point touchPoint, AnimatorListenerAdapter listener) {
86+
static AnimatorSet showMenu(ViewGroup viewGroup, Point touchPoint, AnimatorListenerAdapter listener) {
8787
List<Animator> animList = new ArrayList<>();
8888

8989
for (int i = 0, len = viewGroup.getChildCount(); i < len; i++) {
@@ -96,6 +96,7 @@ static void showMenu(ViewGroup viewGroup, Point touchPoint, AnimatorListenerAdap
9696
animSet.playTogether(animList);
9797
animSet.addListener(listener);
9898
animSet.start();
99+
return animSet;
99100
}
100101

101102
static void hideMenu(ViewGroup viewGroup, Point touchPoint) {

library/src/main/java/com/hackplan/androidarcmenu/ArcMenuInterceptLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void setOnClickBtnListener(OnClickMenuListener onClickMenuListener) {
5656
@Override
5757
public boolean onInterceptTouchEvent(MotionEvent ev) {
5858
if (arcMenuLayout.isShow()) {
59-
return true;
59+
return arcMenuLayout.onTouchEvent(ev);
6060
}
6161
return super.onInterceptTouchEvent(ev);
6262
}

library/src/main/java/com/hackplan/androidarcmenu/ArcMenuLayout.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.animation.Animator;
44
import android.animation.AnimatorListenerAdapter;
5+
import android.animation.AnimatorSet;
56
import android.content.Context;
67
import android.graphics.Canvas;
78
import android.graphics.Point;
@@ -93,6 +94,7 @@ protected void onAttachedToWindow() {
9394
display.getRectSize(mScreenRect);
9495
}
9596

97+
private AnimatorSet showAnimSet;
9698
@Override
9799
protected void onLayout(boolean changed, int l, int t, int r, int b) {
98100
if (!show) return;
@@ -105,7 +107,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
105107
(int) (menuPoints.get(i).x + child.getMeasuredWidth() / 2),
106108
(int) (menuPoints.get(i).y + child.getMeasuredHeight() / 2));
107109
}
108-
AnimatorUtils.showMenu(this, touchPoint, animListener);
110+
showAnimSet = AnimatorUtils.showMenu(this, touchPoint, animListener);
109111
}
110112

111113
private int lastFocusIndex = -1;
@@ -130,6 +132,7 @@ public boolean onTouchEvent(MotionEvent event) {
130132
onClickMenuListener.onClickArcMenu(arcMenu, viewForListener, (int) clickedView.getTag());
131133
}
132134
} else if (hideOnTouchUp) {
135+
if (showAnimSet != null && showAnimSet.isRunning()) showAnimSet.cancel();
133136
AnimatorUtils.hideMenu(this, touchPoint);
134137
show = false;
135138
} else {

0 commit comments

Comments
 (0)