From b392c2d6ac6039026935843adbe6bef88a1f4730 Mon Sep 17 00:00:00 2001 From: Dacer Date: Tue, 13 Feb 2018 20:33:57 +0800 Subject: [PATCH] fixed #1 --- .../main/java/com/hackplan/androidarcmenu/AnimatorUtils.java | 3 ++- .../com/hackplan/androidarcmenu/ArcMenuInterceptLayout.java | 2 +- .../main/java/com/hackplan/androidarcmenu/ArcMenuLayout.java | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/hackplan/androidarcmenu/AnimatorUtils.java b/library/src/main/java/com/hackplan/androidarcmenu/AnimatorUtils.java index cddc81e..c327499 100755 --- a/library/src/main/java/com/hackplan/androidarcmenu/AnimatorUtils.java +++ b/library/src/main/java/com/hackplan/androidarcmenu/AnimatorUtils.java @@ -83,7 +83,7 @@ static void clearFocusChild(ViewGroup viewGroup, int index) { animSet.start(); } - static void showMenu(ViewGroup viewGroup, Point touchPoint, AnimatorListenerAdapter listener) { + static AnimatorSet showMenu(ViewGroup viewGroup, Point touchPoint, AnimatorListenerAdapter listener) { List animList = new ArrayList<>(); for (int i = 0, len = viewGroup.getChildCount(); i < len; i++) { @@ -96,6 +96,7 @@ static void showMenu(ViewGroup viewGroup, Point touchPoint, AnimatorListenerAdap animSet.playTogether(animList); animSet.addListener(listener); animSet.start(); + return animSet; } static void hideMenu(ViewGroup viewGroup, Point touchPoint) { diff --git a/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuInterceptLayout.java b/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuInterceptLayout.java index 0cd3e2e..0ced77f 100644 --- a/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuInterceptLayout.java +++ b/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuInterceptLayout.java @@ -56,7 +56,7 @@ public void setOnClickBtnListener(OnClickMenuListener onClickMenuListener) { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (arcMenuLayout.isShow()) { - return true; + return arcMenuLayout.onTouchEvent(ev); } return super.onInterceptTouchEvent(ev); } diff --git a/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuLayout.java b/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuLayout.java index bd9d8b5..73b0552 100644 --- a/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuLayout.java +++ b/library/src/main/java/com/hackplan/androidarcmenu/ArcMenuLayout.java @@ -2,6 +2,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; import android.content.Context; import android.graphics.Canvas; import android.graphics.Point; @@ -93,6 +94,7 @@ protected void onAttachedToWindow() { display.getRectSize(mScreenRect); } + private AnimatorSet showAnimSet; @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { if (!show) return; @@ -105,7 +107,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { (int) (menuPoints.get(i).x + child.getMeasuredWidth() / 2), (int) (menuPoints.get(i).y + child.getMeasuredHeight() / 2)); } - AnimatorUtils.showMenu(this, touchPoint, animListener); + showAnimSet = AnimatorUtils.showMenu(this, touchPoint, animListener); } private int lastFocusIndex = -1; @@ -130,6 +132,7 @@ public boolean onTouchEvent(MotionEvent event) { onClickMenuListener.onClickArcMenu(arcMenu, viewForListener, (int) clickedView.getTag()); } } else if (hideOnTouchUp) { + if (showAnimSet != null && showAnimSet.isRunning()) showAnimSet.cancel(); AnimatorUtils.hideMenu(this, touchPoint); show = false; } else {