mirror of
https://github.com/HackPlan/AndroidArcMenu.git
synced 2026-06-20 09:38:56 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d7cef39bb | ||
|
|
9705636886 | ||
|
|
b392c2d6ac | ||
|
|
42e81adf47 |
12
.idea/misc.xml
generated
12
.idea/misc.xml
generated
@@ -27,17 +27,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -12,7 +12,7 @@ or
|
||||
|
||||
[demo.apk](demo_apk)
|
||||
|
||||
#Including in Your Project
|
||||
# Including in Your Project
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
@@ -21,7 +21,7 @@ repositories {
|
||||
```
|
||||
|
||||
```groovy
|
||||
compile 'com.hackplan.androidarcmenu:library:1.0.1'
|
||||
compile 'com.hackplan.androidarcmenu:library:1.1.0'
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
|
||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Mon Dec 28 10:00:20 PST 2015
|
||||
#Tue Feb 13 19:47:29 CST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
|
||||
@@ -13,7 +13,7 @@ ext {
|
||||
siteUrl = '//github.com/HackPlan/AndroidArcMenu'
|
||||
gitUrl = '//github.com/HackPlan/AndroidArcMenu'
|
||||
|
||||
libraryVersion = '1.0.2'
|
||||
libraryVersion = '1.1.0'
|
||||
|
||||
developerId = 'Dacer'
|
||||
developerName = 'Ding Wenhao'
|
||||
|
||||
@@ -83,7 +83,7 @@ class AnimatorUtils {
|
||||
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++) {
|
||||
@@ -96,6 +96,7 @@ class AnimatorUtils {
|
||||
animSet.playTogether(animList);
|
||||
animSet.addListener(listener);
|
||||
animSet.start();
|
||||
return animSet;
|
||||
}
|
||||
|
||||
static void hideMenu(ViewGroup viewGroup, Point touchPoint) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ArcMenuInterceptLayout extends FrameLayout {
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (arcMenuLayout.isShow()) {
|
||||
return true;
|
||||
return arcMenuLayout.onTouchEvent(ev);
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.hackplan.androidarcmenu;
|
||||
|
||||
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 @@ public class ArcMenuLayout extends ViewGroup {
|
||||
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 @@ public class ArcMenuLayout extends ViewGroup {
|
||||
(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;
|
||||
@@ -118,25 +120,6 @@ public class ArcMenuLayout extends ViewGroup {
|
||||
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) {
|
||||
AnimatorUtils.hideMenu(this, touchPoint);
|
||||
show = false;
|
||||
} else {
|
||||
hideOnTouchUp = true;
|
||||
}
|
||||
lastFocusIndex = -1;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (!animFinished) break;
|
||||
tempRect = new Rect();
|
||||
@@ -158,6 +141,25 @@ public class ArcMenuLayout extends ViewGroup {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user