├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── attrs.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── home_publish_yyap_ic.png
│ │ │ │ ├── add_publish_fragment_bg.png
│ │ │ │ ├── home_publish_erwei_ic.png
│ │ │ │ ├── home_publish_tuiguang_ic.png
│ │ │ │ └── home_publish_edite_advanter_ic.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── view_rotate_menu_item.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── view_rotate_menu.xml
│ │ ├── java
│ │ │ └── cn
│ │ │ │ └── asheng
│ │ │ │ └── rotateMenu
│ │ │ │ ├── view
│ │ │ │ ├── OnCenterAddClickAdd.java
│ │ │ │ ├── OnRotateItemClickListner.java
│ │ │ │ ├── SimpleAnimatorListener.java
│ │ │ │ ├── RotateMenuItem.java
│ │ │ │ └── RotateMenuView.java
│ │ │ │ ├── utils
│ │ │ │ ├── ViewUtils.java
│ │ │ │ └── ScrollUtils.java
│ │ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── asheng
│ │ │ └── rotateMenu
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── cn
│ │ └── asheng
│ │ └── rotateMenu
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── images
└── image.gif
├── .idea
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/images/image.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/images/image.gif
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | rotateMenu
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/home_publish_yyap_ic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-hdpi/home_publish_yyap_ic.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/add_publish_fragment_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-hdpi/add_publish_fragment_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/home_publish_erwei_ic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-hdpi/home_publish_erwei_ic.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/home_publish_tuiguang_ic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-hdpi/home_publish_tuiguang_ic.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/home_publish_edite_advanter_ic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/494293346/rotateMenu/HEAD/app/src/main/res/mipmap-hdpi/home_publish_edite_advanter_ic.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/view/OnCenterAddClickAdd.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.view;
2 |
3 | /**
4 | * Created by Administrator on 2017/1/4.
5 | */
6 |
7 | public interface OnCenterAddClickAdd {
8 | void onclickAdd();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/view/OnRotateItemClickListner.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.view;
2 |
3 | /**
4 | * Created by Administrator on 2016/12/20.
5 | */
6 |
7 | public interface OnRotateItemClickListner {
8 | void onclickMenu(int i);
9 | }
10 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/utils/ViewUtils.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.utils;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by Administrator on 2016/12/20.
7 | */
8 |
9 | public class ViewUtils {
10 | public static int dip2px(Context context, float dpValue) {
11 | final float scale = context.getResources().getDisplayMetrics().density;
12 | return (int) (dpValue * scale + 0.5f);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/test/java/cn/asheng/rotateMenu/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/view/SimpleAnimatorListener.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.view;
2 |
3 | import android.animation.Animator;
4 |
5 | /**
6 | * Created by laixuejun on 2016/1/5.
7 | */
8 | public class SimpleAnimatorListener implements Animator.AnimatorListener {
9 | @Override
10 | public void onAnimationStart(Animator animation) {
11 |
12 | }
13 |
14 | @Override
15 | public void onAnimationEnd(Animator animation) {
16 |
17 | }
18 |
19 | @Override
20 | public void onAnimationCancel(Animator animation) {
21 |
22 | }
23 |
24 | @Override
25 | public void onAnimationRepeat(Animator animation) {
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\androidsdk\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_rotate_menu_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
14 |
15 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/cn/asheng/rotateMenu/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("cn.asheng.rotateMenu", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "24.0.3"
6 | defaultConfig {
7 | applicationId "cn.asheng.rotateMenu"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.0.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/utils/ScrollUtils.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.utils;
2 |
3 | import android.os.Build;
4 | import android.view.View;
5 | import android.view.ViewTreeObserver;
6 |
7 | /**
8 | * Created by Administrator on 2016/10/21.
9 | */
10 | public class ScrollUtils {
11 | public static View addOnGlobalLayoutListener(final View view, final Runnable runnable) {
12 | ViewTreeObserver vto = view.getViewTreeObserver();
13 | vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
14 | @Override
15 | public void onGlobalLayout() {
16 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
17 | view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
18 | } else {
19 | view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
20 | }
21 | runnable.run();
22 | }
23 | });
24 | return view;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_rotate_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
26 |
27 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rotateMenu
2 | 仿闲鱼首页,“底部加号弹出菜单选项” 界面,动画效果可能跟闲鱼有点不一样
3 | ##简介
4 | ```
5 | 仿闲鱼首页,“底部加号弹出菜单选项” 界面,动画效果可能跟闲鱼有点不一样,详情请看效果图,用模拟器有点卡,真机效果要好一些~~~
6 | 具体效果如下图:
7 | ```
8 | ##效果图展示
9 | 
10 | ##用法
11 | ```
12 | 1、请将所有相关的文件拷贝到自己的项目中,这个就不多解释了。。。
13 |
14 | 2、在xml界面中加入该控件
15 |
26 |
27 | 2、在相关java代码中
28 | 定义子选项
29 | RotateMenuItem rotateMenuItem1 =new RotateMenuItem(mContext);
30 | rotateMenuItem1.setTopImageRes(R.mipmap.home_publish_erwei_ic); 子选项图片
31 | rotateMenuItem1.setBottomTextstr("选项一"); 子选项下方文字描述
32 |
33 | RotateMenuItem rotateMenuItem2 =new RotateMenuItem(mContext);
34 | rotateMenuItem2.setTopImageRes(R.mipmap.home_publish_edite_advanter_ic);
35 | rotateMenuItem2.setBottomTextstr("选项二");
36 |
37 | 为了看起来美观,请放偶数个子选项,奇数个没做处理,会挺难看的 = =
38 |
39 | 将子选项加入集合
40 | List list=new ArrayList<>();
41 | list.add(rotateMenuItem1);
42 | list.add(rotateMenuItem2);
43 |
44 | 将集合放入控件
45 | rotateMenuView.setCreateItems(list);
46 |
47 | 设置相关监听
48 | 子选项被点击
49 | rotateMenuView.setOnRotateItemClickListner(new OnRotateItemClickListner() {
50 | @Override
51 | public void onclickMenu(int i) {
52 | Toast.makeText(mContext,"选项"+(i+1)+"被点击了",Toast.LENGTH_SHORT).show();
53 | }
54 | });
55 | 中间“加号被点击监听” 如果不设置将为默认效果:弹出菜单栏或者隐藏菜单栏
56 | rotateMenuView.setOnCenterAddClickAdd(new OnCenterAddClickAdd() {
57 | @Override
58 | public void onclickAdd() {
59 | Toast.makeText(mContext,"加号被点击了",Toast.LENGTH_SHORT).show();
60 | }
61 | });
62 |
63 | 还有更多用法,请自行下载参考
64 |
65 | 3、如果你需要更换相应控件按钮的大小,请到对应的xml文件自行修改
66 | ```
67 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/MainActivity.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu;
2 |
3 | import android.content.Context;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.widget.Toast;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import cn.asheng.rotateMenu.view.RotateMenuItem;
12 | import cn.asheng.rotateMenu.view.OnCenterAddClickAdd;
13 | import cn.asheng.rotateMenu.view.RotateMenuView;
14 | import cn.asheng.rotateMenu.view.OnRotateItemClickListner;
15 |
16 | public class MainActivity extends AppCompatActivity {
17 | private RotateMenuView rotateMenuView;
18 | private Context mContext;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_main);
24 | mContext = this;
25 | initView();
26 | }
27 |
28 | private void initView() {
29 | rotateMenuView = (RotateMenuView) findViewById(R.id.view_create);
30 |
31 | RotateMenuItem rotateMenuItem1 =new RotateMenuItem(mContext);
32 | rotateMenuItem1.setTopImageRes(R.mipmap.home_publish_erwei_ic);
33 | rotateMenuItem1.setBottomTextstr("选项一");
34 |
35 | RotateMenuItem rotateMenuItem2 =new RotateMenuItem(mContext);
36 | rotateMenuItem2.setTopImageRes(R.mipmap.home_publish_edite_advanter_ic);
37 | rotateMenuItem2.setBottomTextstr("选项二");
38 |
39 | RotateMenuItem rotateMenuItem3 =new RotateMenuItem(mContext);
40 | rotateMenuItem3.setTopImageRes(R.mipmap.home_publish_tuiguang_ic);
41 | rotateMenuItem3.setBottomTextstr("选项三");
42 |
43 | RotateMenuItem rotateMenuItem4 =new RotateMenuItem(mContext);
44 | rotateMenuItem4.setTopImageRes(R.mipmap.home_publish_yyap_ic);
45 | rotateMenuItem4.setBottomTextstr("选项四");
46 |
47 |
48 | List list=new ArrayList<>();
49 | list.add(rotateMenuItem1);
50 | list.add(rotateMenuItem2);
51 | list.add(rotateMenuItem3);
52 | list.add(rotateMenuItem4);
53 |
54 | rotateMenuView.setCreateItems(list);
55 |
56 | rotateMenuView.setOnRotateItemClickListner(new OnRotateItemClickListner() {
57 | @Override
58 | public void onclickMenu(int i) {
59 | Toast.makeText(mContext,"选项"+(i+1)+"被点击了",Toast.LENGTH_SHORT).show();
60 | }
61 | });
62 |
63 | //如果需要监听中间“加号”按钮,请自行重写
64 | // rotateMenuView.setOnCenterAddClickAdd(new OnCenterAddClickAdd() {
65 | // @Override
66 | // public void onclickAdd() {
67 | // Toast.makeText(mContext,"加号被点击了",Toast.LENGTH_SHORT).show();
68 | // }
69 | // });
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/view/RotateMenuItem.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.view;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Color;
6 | import android.graphics.Rect;
7 | import android.util.AttributeSet;
8 | import android.util.TypedValue;
9 | import android.view.LayoutInflater;
10 | import android.widget.ImageView;
11 | import android.widget.RelativeLayout;
12 | import android.widget.TextView;
13 |
14 | import cn.asheng.rotateMenu.R;
15 | import cn.asheng.rotateMenu.utils.ViewUtils;
16 |
17 | /**
18 | * Created by Administrator on 2016/12/5.
19 | */
20 |
21 | public class RotateMenuItem extends RelativeLayout {
22 | private static final int DEFULT_IMG_SRC = R.mipmap.home_publish_erwei_ic;//默认图片
23 | private static final int DEFULT_IMG_WIDTH = 80;//图片默认宽度
24 | private static final int DEFULT_IMG_HEIGH = 80;//图片默认高度
25 | private static final int DEFULT_TEXT_SIZE = 14;//文字大小
26 | private static final int DEFULT_TEXT_COLOR = Color.BLACK;//文字颜色
27 | private static final int DEFULT_TEXT_MARGIN = 16;//图文距离
28 | private static final int DEFULT_ITEM_ROTE = 360;//旋转角度
29 |
30 | private Context mContext;
31 | private ImageView imgTop;
32 | private TextView tvBottom;
33 | private int totate = DEFULT_ITEM_ROTE;
34 |
35 | private Rect itemRct = new Rect();
36 |
37 | public RotateMenuItem(Context context) {
38 | this(context, null, 0);
39 | }
40 |
41 | public RotateMenuItem(Context context, AttributeSet attrs) {
42 | this(context, attrs, 0);
43 | }
44 |
45 | public RotateMenuItem(Context context, AttributeSet attrs, int defStyleAttr) {
46 | super(context, attrs, defStyleAttr);
47 | mContext = context;
48 | initView(attrs);
49 | }
50 |
51 | private void initView(AttributeSet attrs) {
52 | LayoutInflater.from(mContext).inflate(R.layout.view_rotate_menu_item, this, true);
53 | TypedArray typedArray = mContext.obtainStyledAttributes(attrs, R.styleable.RotateMenuItem);
54 | int imgSrc = typedArray.getResourceId(R.styleable.RotateMenuItem_img_src, DEFULT_IMG_SRC);
55 | float imgWidth = typedArray.getDimension(R.styleable.RotateMenuItem_img_width, ViewUtils.dip2px(mContext, DEFULT_IMG_WIDTH));
56 | float imgHeight = typedArray.getDimension(R.styleable.RotateMenuItem_img_height, ViewUtils.dip2px(mContext, DEFULT_IMG_HEIGH));
57 | float bottom_text_size = typedArray.getDimension(R.styleable.RotateMenuItem_bottom_text_size, ViewUtils.dip2px(mContext, DEFULT_TEXT_SIZE));
58 | int textColor = typedArray.getColor(R.styleable.RotateMenuItem_bottom_text_color, DEFULT_TEXT_COLOR);
59 | float textMargin = typedArray.getDimension(R.styleable.RotateMenuItem_bottom_text_margin, ViewUtils.dip2px(mContext, DEFULT_TEXT_MARGIN));
60 | String strText = typedArray.getString(R.styleable.RotateMenuItem_bottom_text);
61 | typedArray.recycle();
62 |
63 | imgTop = (ImageView) findViewById(R.id.imgTop);
64 | tvBottom = (TextView) findViewById(R.id.tvBottom);
65 | imgTop.setImageResource(imgSrc);
66 | LayoutParams mParams = new LayoutParams((int) imgWidth, (int) imgHeight);
67 | imgTop.setLayoutParams(mParams);
68 | tvBottom.setTextSize(TypedValue.COMPLEX_UNIT_PX, bottom_text_size);
69 | tvBottom.setTextColor(textColor);
70 | tvBottom.setPadding(0, (int) textMargin, 0, 0);
71 | tvBottom.setText(strText);
72 | }
73 |
74 | public void setItemRotate(int rotate) {
75 | this.totate = rotate;
76 | }
77 |
78 | public void setTextPadding(int textMargin) {
79 | tvBottom.setPadding(0, textMargin, 0, 0);
80 | }
81 |
82 | public void setBottomTextstr(String strText) {
83 | tvBottom.setText(strText);
84 | }
85 |
86 | public void setBottomTextColor(int textColor) {
87 | tvBottom.setTextColor(textColor);
88 | }
89 |
90 | public void setBottomTextSize(int bottom_text_size) {
91 | tvBottom.setTextSize(TypedValue.COMPLEX_UNIT_PX, bottom_text_size);
92 | }
93 |
94 | public void setImgTopSize(int imgTopWidth, int imgTopHeight) {
95 | LayoutParams mParams = new LayoutParams(imgTopWidth, imgTopHeight);
96 | imgTop.setLayoutParams(mParams);
97 | }
98 |
99 | public void setTopImageRes(int imgSrc) {
100 | imgTop.setImageResource(imgSrc);
101 | }
102 |
103 | public void setTopImgVisibility(int visibility) {
104 | imgTop.setVisibility(visibility);
105 | }
106 |
107 | public void setTopImgAnimate(float value) {
108 | imgTop.setAlpha(value);
109 | imgTop.setRotation(totate * value);
110 | imgTop.setScaleX(0.5f + value * 0.5f);
111 | imgTop.setScaleY(0.5f + value * 0.5f);
112 | }
113 |
114 | public void setTranslationX(int i, float verticalMargin, float value) {
115 | if (i % 2 == 0) {
116 | setTranslationX((-verticalMargin * value) / 2);
117 | } else {
118 | setTranslationX((verticalMargin * value) / 2);
119 | }
120 | }
121 |
122 | public void setTranslationY(int i, float horizontalMargin, float value) {
123 | float paddingTop = 0;
124 | if (i > 1) {
125 | paddingTop = horizontalMargin * value;
126 | }
127 | setPadding(0, (int) paddingTop, 0, 0);
128 | }
129 |
130 | public void clearTopAnimation() {
131 | imgTop.clearAnimation();
132 | }
133 |
134 | public void setBottomTextVisibility(int visibility) {
135 | tvBottom.setVisibility(visibility);
136 | }
137 |
138 | public void setBottomTextAlpha(int alpha) {
139 | tvBottom.setAlpha(alpha);
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/asheng/rotateMenu/view/RotateMenuView.java:
--------------------------------------------------------------------------------
1 | package cn.asheng.rotateMenu.view;
2 |
3 | import android.animation.Animator;
4 | import android.animation.ValueAnimator;
5 | import android.content.Context;
6 | import android.content.res.TypedArray;
7 | import android.graphics.Color;
8 | import android.util.AttributeSet;
9 | import android.view.Gravity;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.widget.ImageView;
13 | import android.widget.RelativeLayout;
14 | import android.widget.TableLayout;
15 | import android.widget.TableRow;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | import cn.asheng.rotateMenu.R;
21 | import cn.asheng.rotateMenu.utils.ViewUtils;
22 |
23 |
24 | /**
25 | * Created by Administrator on 2016/10/25.
26 | */
27 | public class RotateMenuView extends RelativeLayout implements View.OnClickListener {
28 | private static final int DEFULT_HORIZONTAL_MARGIN = 10;//行间距
29 | private static final int DEFULT_VERTICAL_MARGIN = 50;//列间距
30 | private static final int DEFULT_CENTER_ROTATE = 225;//中间按钮旋转角度
31 | private static final int DEFULT_ITEM_ROTATE = 360;//item旋转角度
32 | private static final int DEFULT_BACKGROUD_COLR = Color.WHITE;//背景颜色
33 | private static final int DEFULT_CENTER_ADD_SRC = R.mipmap.add_publish_fragment_bg;//默认加号
34 |
35 | private View backgroudView;
36 | private ImageView mIvCenterAdd;
37 | private boolean isShowMenu = false;
38 | private Context mContext;
39 |
40 | private OnRotateItemClickListner onRotateItemClickListner;
41 | private OnCenterAddClickAdd onCenterAddClickAdd;
42 | private TableLayout viewCreateAll;
43 | private List rotateMenuItemList = new ArrayList<>();
44 | private float horizontalMargin;
45 | private float verticalMargin;
46 | private int centerRotate;
47 | private int itemRotate;
48 | private int backGoundColor;
49 |
50 | public void setOnCenterAddClickAdd(OnCenterAddClickAdd onCenterAddClickAdd) {
51 | this.onCenterAddClickAdd = onCenterAddClickAdd;
52 | }
53 |
54 | public void setOnRotateItemClickListner(OnRotateItemClickListner onRotateItemClickListner) {
55 | this.onRotateItemClickListner = onRotateItemClickListner;
56 | }
57 |
58 | public boolean isShowMenu() {
59 | return isShowMenu;
60 | }
61 |
62 | public void setShowMenu(boolean showMenu) {
63 | isShowMenu = showMenu;
64 | }
65 |
66 | public RotateMenuView(Context context) {
67 | this(context, null, 0);
68 | }
69 |
70 | public RotateMenuView(Context context, AttributeSet attrs) {
71 | this(context, attrs, 0);
72 | }
73 |
74 | public RotateMenuView(Context context, AttributeSet attrs, int defStyleAttr) {
75 | super(context, attrs, defStyleAttr);
76 | mContext = context;
77 | initView(attrs);
78 | }
79 |
80 | private void initView(AttributeSet attrs) {
81 | LayoutInflater.from(mContext).inflate(R.layout.view_rotate_menu, this, true);
82 | TypedArray typedArray = mContext.obtainStyledAttributes(attrs, R.styleable.RotateMenuView);
83 | horizontalMargin = typedArray.getDimension(R.styleable.RotateMenuView_horizontal_margin, ViewUtils.dip2px(mContext, DEFULT_HORIZONTAL_MARGIN));
84 | verticalMargin = typedArray.getDimension(R.styleable.RotateMenuView_vertical_margin, ViewUtils.dip2px(mContext, DEFULT_VERTICAL_MARGIN));
85 | centerRotate = typedArray.getInt(R.styleable.RotateMenuView_center_rotate, DEFULT_CENTER_ROTATE);
86 | itemRotate = typedArray.getInt(R.styleable.RotateMenuView_item_rotate, DEFULT_ITEM_ROTATE);
87 | backGoundColor = typedArray.getColor(R.styleable.RotateMenuView_back_ground_color, DEFULT_BACKGROUD_COLR);
88 | int addSrc = typedArray.getResourceId(R.styleable.RotateMenuView_center_add_src, DEFULT_CENTER_ADD_SRC);
89 | typedArray.recycle();
90 |
91 | viewCreateAll = (TableLayout) findViewById(R.id.viewCreateAll);
92 | backgroudView = findViewById(R.id.backgroud_view);
93 | backgroudView.setOnClickListener(this);
94 | mIvCenterAdd = (ImageView) findViewById(R.id.btnCreateMenu);
95 | mIvCenterAdd.setImageResource(addSrc);
96 | mIvCenterAdd.setOnClickListener(this);
97 | backgroudView.setBackgroundColor(backGoundColor);
98 | }
99 |
100 | public void setCreateItems(List list) {
101 | if (list != null && list.size() > 0) {
102 | rotateMenuItemList = list;
103 | TableRow tablerow = null;
104 | for (int i = 0; i < rotateMenuItemList.size(); i++) {
105 | //能被二整除 或者是第一次到循环中
106 | if (tablerow == null || i % 2 == 0) {
107 | tablerow = new TableRow(mContext);
108 | tablerow.setGravity(Gravity.CENTER);
109 | }
110 | tablerow.addView(rotateMenuItemList.get(i));
111 | //当tablerow child为2,或者i为最后一个时才添加(防止总个数为奇数情况)
112 | if (i == rotateMenuItemList.size() - 1 || tablerow.getChildCount() == 2) {
113 | viewCreateAll.addView(tablerow);
114 | }
115 | //设置监听
116 | rotateMenuItemList.get(i).setOnClickListener(this);
117 | rotateMenuItemList.get(i).setTag(i);
118 | //设置旋转角度
119 | rotateMenuItemList.get(i).setItemRotate(itemRotate);
120 | }
121 | }
122 | }
123 |
124 | @Override
125 | public void onClick(View view) {
126 | switch (view.getId()) {
127 | case R.id.backgroud_view:
128 | hideCreateMenu();
129 | break;
130 | case R.id.btnCreateMenu:
131 | if (onCenterAddClickAdd != null) {
132 | onCenterAddClickAdd.onclickAdd();
133 | return;
134 | }
135 | if (isShowMenu) {
136 | hideCreateMenu();
137 | } else {
138 | showCreateMenu();
139 | }
140 | break;
141 | default:
142 | int i = (int) view.getTag();
143 | if (onRotateItemClickListner != null) {
144 | onRotateItemClickListner.onclickMenu(i);
145 | }
146 | hideCreateMenuNoAnimation();
147 | break;
148 | }
149 | }
150 |
151 | public void showCreateMenu() {
152 | isShowMenu = true;
153 | viewCreateAll.setVisibility(VISIBLE);
154 | backgroudView.setVisibility(VISIBLE);
155 | ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
156 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
157 | @Override
158 | public void onAnimationUpdate(ValueAnimator animation) {
159 | float value = (float) animation.getAnimatedValue();
160 | mIvCenterAdd.setRotation((centerRotate) * value);
161 | for (int i = 0; i < rotateMenuItemList.size(); i++) {
162 | rotateMenuItemList.get(i).setTopImgVisibility(VISIBLE);
163 | rotateMenuItemList.get(i).setTopImgAnimate(value);
164 | rotateMenuItemList.get(i).setTranslationX(i, verticalMargin, value);
165 | rotateMenuItemList.get(i).setTranslationY(i, horizontalMargin, value);
166 | }
167 | }
168 | });
169 | animator.addListener(new SimpleAnimatorListener() {
170 | @Override
171 | public void onAnimationEnd(Animator animation) {
172 | mIvCenterAdd.clearAnimation();
173 | for (RotateMenuItem rotateMenuItem : rotateMenuItemList) {
174 | rotateMenuItem.clearTopAnimation();
175 | rotateMenuItem.setBottomTextVisibility(View.VISIBLE);
176 | rotateMenuItem.setBottomTextAlpha(1);
177 | rotateMenuItem.clearAnimation();
178 | }
179 |
180 | }
181 | });
182 | animator.start();
183 | }
184 |
185 | public void hideCreateMenu() {
186 | isShowMenu = false;
187 | for (RotateMenuItem rotateMenuItem : rotateMenuItemList) {
188 | rotateMenuItem.setBottomTextAlpha(0);
189 | }
190 | ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
191 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
192 | @Override
193 | public void onAnimationUpdate(ValueAnimator animation) {
194 | float value = (float) animation.getAnimatedValue();
195 | mIvCenterAdd.setRotation((centerRotate) * value);
196 | for (int i = 0; i < rotateMenuItemList.size(); i++) {
197 | rotateMenuItemList.get(i).setTopImgAnimate(value);
198 | rotateMenuItemList.get(i).setTranslationX(i, verticalMargin, value);
199 | rotateMenuItemList.get(i).setTranslationY(i, horizontalMargin, value);
200 | }
201 | }
202 | });
203 | animator.addListener(new SimpleAnimatorListener() {
204 | @Override
205 | public void onAnimationEnd(Animator animation) {
206 | mIvCenterAdd.clearAnimation();
207 | viewCreateAll.setVisibility(GONE);
208 | backgroudView.setVisibility(GONE);
209 | for (RotateMenuItem rotateMenuItem : rotateMenuItemList) {
210 | rotateMenuItem.clearTopAnimation();
211 | rotateMenuItem.setTopImgVisibility(View.GONE);
212 | rotateMenuItem.setBottomTextVisibility(View.INVISIBLE);
213 | rotateMenuItem.clearAnimation();
214 | }
215 |
216 | }
217 | });
218 | animator.start();
219 | }
220 |
221 | private void hideCreateMenuNoAnimation() {
222 | isShowMenu = false;
223 | viewCreateAll.setVisibility(GONE);
224 | backgroudView.setVisibility(GONE);
225 |
226 | for (RotateMenuItem rotateMenuItem : rotateMenuItemList) {
227 | rotateMenuItem.setTopImgVisibility(View.GONE);
228 | rotateMenuItem.setBottomTextVisibility(View.INVISIBLE);
229 | }
230 | mIvCenterAdd.setRotation(VISIBLE);
231 | }
232 | }
233 |
--------------------------------------------------------------------------------