Skip to content

Commit

Permalink
fixed #1
Browse files Browse the repository at this point in the history
  • Loading branch information
dacer committed Feb 13, 2018
1 parent 42e81ad commit b392c2d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Animator> animList = new ArrayList<>();

for (int i = 0, len = viewGroup.getChildCount(); i < len; i++) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 {
Expand Down

1 comment on commit b392c2d

@Iamivan1996
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! that's what i need. Thanks a million.

Please sign in to comment.