├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── markdown-exported-files.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README-EN.md
├── README-ZH.md
├── README.md
├── annularmenu
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── dingmouren
│ │ └── annularmenu
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── dingmouren
│ │ │ └── annularmenu
│ │ │ ├── AnnularMenu.java
│ │ │ └── ShadowImageView.java
│ └── res
│ │ └── values
│ │ ├── attr.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── dingmouren
│ └── annularmenu
│ └── ExampleUnitTest.java
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── dingmouren
│ │ └── annularmenuview
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── dingmouren
│ │ │ └── annularmenuview
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── item_layout.xml
│ │ ├── left_bottom_menu.xml
│ │ ├── left_top_menu.xml
│ │ ├── right_bottom_menu.xml
│ │ └── right_top_menu.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── item1.png
│ │ ├── item2.png
│ │ ├── item3.png
│ │ ├── item4.png
│ │ ├── item5.png
│ │ └── menu.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── p1.jpg
│ │ ├── p2.jpg
│ │ ├── p3.jpg
│ │ ├── p4.jpg
│ │ └── p5.jpg
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── dingmouren
│ └── annularmenuview
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshot
├── demo1.gif
├── demo2.gif
├── demo3.gif
└── title.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | <<<<<<< HEAD
2 | # Compiled class file
3 | *.class
4 |
5 | # Log file
6 | *.log
7 |
8 | # BlueJ files
9 | *.ctxt
10 |
11 | # Mobile Tools for Java (J2ME)
12 | .mtj.tmp/
13 |
14 | # Package Files #
15 | *.jar
16 | *.war
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 | =======
25 | *.iml
26 | .gradle
27 | /local.properties
28 | /.idea/workspace.xml
29 | /.idea/libraries
30 | .DS_Store
31 | /build
32 | /captures
33 | .externalNativeBuild
34 | >>>>>>> commit
35 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/markdown-exported-files.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.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 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README-EN.md:
--------------------------------------------------------------------------------
1 |
2 | 
3 | # AnnularMenu is based on Material Design design of the ring menu control. For specific use, please read down.
4 | 
5 | 
6 | 
7 | ## Usage
8 | In the module build.gradle
9 | ```
10 | com.dingmouren.annularmenu:annularmenu:1.0.2
11 | ```
12 |
13 | ## Example Usage
14 | #### 1.Layout XML
15 | ```
16 |
25 |
26 |
35 |
44 | ...
45 |
46 | ```
47 |
48 | #### 2.Java code
49 | ```
50 | menu1.setOnMenuItemClickListener(new AnnularMenu.OnMenuItemClickListener() {
51 | @Override
52 | public void onClick(View view, int position) {
53 |
54 | }
55 | });
56 | ```
57 |
58 | ## Attribute
59 | AnnularMenu | Description
60 | -------|---
61 | position|The menu's location, values are: left_top, left_bottom, right_top, right_bottom, and the default is right_bottom
62 | radius|The radius of the menu, when the number of item items in the menu increases, you need to set the radius to adjust the item spacing
63 | toggleDuration|Open / close the menu duration of the animation, the default is 500 milliseconds
64 |
65 | ShadowImageView | Description
66 | -------|---
67 | shadowOffsetX|The shadow of the offset in the direction of X
68 | shadowOffsetY|The offset of the shadow in the Y direction
69 | shadowRadius|Shadow radius
70 | src|picture
71 |
72 | ## AnnularMenu’Method
73 | AnnularMenu | Description
74 | -------|---
75 | public boolean isOpen()| Determines whether the menu is open or closed at the moment
76 | public void toggle()|Switch menu
77 | public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener)|Listen for the click of the menu item item
78 | public void setMenuButtonClickable(boolean clickable)|Change the menu button clickable state
79 | #### Welcome to make suggestions
80 |
81 | ## License
82 | ```
83 | Copyright (C) 2017
84 |
85 | Licensed under the Apache License, Version 2.0 (the "License");
86 | you may not use this file except in compliance with the License.
87 | You may obtain a copy of the License at
88 |
89 | http://www.apache.org/licenses/LICENSE-2.0
90 |
91 | Unless required by applicable law or agreed to in writing, software
92 | distributed under the License is distributed on an "AS IS" BASIS,
93 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94 | See the License for the specific language governing permissions and
95 | limitations under the License
96 | ```
--------------------------------------------------------------------------------
/README-ZH.md:
--------------------------------------------------------------------------------
1 |
2 | 
3 | # AnnularMenu是基于Material Design设计的环形菜单控件。具体使用请往下阅读。
4 | 
5 | 
6 | 
7 | ## 引入方式
8 | 在module的build.gradle中
9 | ```
10 | com.dingmouren.annularmenu:annularmenu:1.0.2
11 | ```
12 |
13 | ## 怎么使用
14 | 1.布局文件
15 | ```
16 |
25 |
26 |
35 |
44 | ...
45 |
46 | ```
47 |
48 | 2.代码中的菜单item项点击的监听
49 | ```
50 | menu1.setOnMenuItemClickListener(new AnnularMenu.OnMenuItemClickListener() {
51 | @Override
52 | public void onClick(View view, int position) {
53 |
54 | }
55 | });
56 | ```
57 |
58 | ## 属性
59 | AnnularMenu | 描述
60 | -------|---
61 | position|菜单的位置,取值有:left_top left_bottom right_top right_bottom,默认是right_bottom
62 | radius|菜单的半径,在菜单的item项数目增多的时候需要设置radius调整item的间距
63 | toggleDuration|菜单打开/关闭动画的持续时间,默认是500毫秒
64 |
65 | ShadowImageView | 描述
66 | -------|---
67 | shadowOffsetX|阴影在x方向上的偏移量
68 | shadowOffsetY|阴影在y方向上的偏移量
69 | shadowRadius|阴影半径
70 | src|指定图片
71 |
72 | ## AnnularMenu公开的方法
73 | AnnularMenu | 描述
74 | -------|---
75 | public boolean isOpen()| 判断菜单当前是打开还是关闭状态
76 | public void toggle()|根据菜单当前状态切换打开或者关闭菜单
77 | public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener)|菜单item项的点击监听
78 | public void setMenuButtonClickable(boolean clickable)|设置菜单按钮是否可点击
79 |
80 | 欢迎大家提建议
81 |
82 | ## License
83 | ```
84 | Copyright (C) 2017
85 |
86 | Licensed under the Apache License, Version 2.0 (the "License");
87 | you may not use this file except in compliance with the License.
88 | You may obtain a copy of the License at
89 |
90 | http://www.apache.org/licenses/LICENSE-2.0
91 |
92 | Unless required by applicable law or agreed to in writing, software
93 | distributed under the License is distributed on an "AS IS" BASIS,
94 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95 | See the License for the specific language governing permissions and
96 | limitations under the License
97 | ```
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | 
3 | # AnnularMenu is based on Material Design design of the ring menu control. For specific use, please read down.
4 | 
5 | 
6 | 
7 |
8 | [English README](https://github.com/DingMouRen/AnnularMenuView/blob/master/README-EN.md)
9 | [中文文档](https://github.com/DingMouRen/AnnularMenuView/blob/master/README-ZH.md)
10 | ## Usage
11 | In the module build.gradle
12 | ```
13 | com.dingmouren.annularmenu:annularmenu:1.0.2
14 | ```
15 |
16 | ## Example Usage
17 | #### 1.Layout XML
18 | ```
19 |
28 |
29 |
38 |
47 | ...
48 |
49 | ```
50 |
51 | #### 2.Java code
52 | ```
53 | menu1.setOnMenuItemClickListener(new AnnularMenu.OnMenuItemClickListener() {
54 | @Override
55 | public void onClick(View view, int position) {
56 |
57 | }
58 | });
59 | ```
60 |
61 | ## Attribute
62 | AnnularMenu | Description
63 | -------|---
64 | position|The menu's location, values are: left_top, left_bottom, right_top, right_bottom, and the default is right_bottom
65 | radius|The radius of the menu, when the number of item items in the menu increases, you need to set the radius to adjust the item spacing
66 | toggleDuration|Open / close the menu duration of the animation, the default is 500 milliseconds
67 |
68 | ShadowImageView | Description
69 | -------|---
70 | shadowOffsetX|The shadow of the offset in the direction of X
71 | shadowOffsetY|The offset of the shadow in the Y direction
72 | shadowRadius|Shadow radius
73 | src|picture
74 |
75 | ## AnnularMenu’Method
76 | AnnularMenu | Description
77 | -------|---
78 | public boolean isOpen()| Determines whether the menu is open or closed at the moment
79 | public void toggle()|Switch menu
80 | public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener)|Listen for the click of the menu item item
81 | public void setMenuButtonClickable(boolean clickable)|Change the menu button clickable state
82 | #### Welcome to make suggestions
83 |
84 | ## License
85 | ```
86 | Copyright (C) 2017
87 |
88 | Licensed under the Apache License, Version 2.0 (the "License");
89 | you may not use this file except in compliance with the License.
90 | You may obtain a copy of the License at
91 |
92 | http://www.apache.org/licenses/LICENSE-2.0
93 |
94 | Unless required by applicable law or agreed to in writing, software
95 | distributed under the License is distributed on an "AS IS" BASIS,
96 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
97 | See the License for the specific language governing permissions and
98 | limitations under the License
99 | ```
--------------------------------------------------------------------------------
/annularmenu/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/annularmenu/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 | apply plugin: 'com.jfrog.bintray'
4 |
5 | android {
6 | compileSdkVersion 25
7 | buildToolsVersion "25.0.1"
8 |
9 | defaultConfig {
10 | minSdkVersion 15
11 | targetSdkVersion 25
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 |
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile 'com.android.support:appcompat-v7:25.0.1'
28 | compile 'de.hdodenhof:circleimageview:2.1.0'
29 | }
30 | def siteUrl = 'https://github.com/DingMouRen/AnnularMenuView' // #CONFIG# // project homepage
31 | def gitUrl = 'https://github.com/DingMouRen/AnnularMenuView.git' // #CONFIG# // project git
32 | group = "com.dingmouren.annularmenu"
33 | version = "1.0.2"
34 |
35 | install {
36 | repositories.mavenInstaller {
37 | // This generates POM.xml with proper parameters
38 | pom {
39 | project {
40 | packaging 'aar'
41 | name 'AnnularMenu For Android' // #CONFIG# // project title
42 | url siteUrl
43 | // Set your license
44 | licenses {
45 | license {
46 | name 'The Apache Software License, Version 2.0'
47 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
48 | }
49 | }
50 | developers {
51 | developer {
52 | id 'dingmouren' // #CONFIG# // your user id (you can write your nickname)
53 | name 'dingmouren' // #CONFIG# // your user name
54 | email 'naildingmouren@gmail.com' // #CONFIG# // your email
55 | }
56 | }
57 | scm {
58 | connection gitUrl
59 | developerConnection gitUrl
60 | url siteUrl
61 | }
62 | }
63 | }
64 | }
65 | }
66 |
67 | task sourcesJar(type: Jar) {
68 | from android.sourceSets.main.java.srcDirs
69 | classifier = 'sources'
70 | }
71 |
72 | task javadoc(type: Javadoc) {
73 | options.encoding = "UTF-8"
74 | source = android.sourceSets.main.java.srcDirs
75 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
76 | }
77 |
78 | task javadocJar(type: Jar, dependsOn: javadoc) {
79 | classifier = 'javadoc'
80 | from javadoc.destinationDir
81 | }
82 | javadoc {
83 | options {
84 | encoding "UTF-8"
85 | charSet 'UTF-8'
86 | author true
87 | version true
88 | links "http://docs.oracle.com/javase/7/docs/api"
89 | title 'A AnnularMenu For Android' // 文档标题
90 | }
91 | }
92 | artifacts {
93 | archives javadocJar
94 | archives sourcesJar
95 | }
96 | // 生成jar包
97 | task releaseJar(type: Copy) {
98 | from( 'build/intermediates/bundles/release')
99 | into( '../jar')
100 | include('classes.jar')
101 | rename('classes.jar', 'okgo-' + version + '.jar')
102 | }
103 |
104 | Properties properties = new Properties()
105 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
106 | bintray {
107 | user = properties.getProperty("bintray.user")
108 | key = properties.getProperty("bintray.apikey")
109 | configurations = ['archives']
110 | pkg {
111 | repo = "maven"
112 | name = "annularmenu" // #CONFIG# project name in jcenter
113 | userOrg = "dingmouren"
114 | websiteUrl = siteUrl
115 | vcsUrl = gitUrl
116 | licenses = ["Apache-2.0"]
117 | publish = true
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/annularmenu/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 D:\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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/annularmenu/src/androidTest/java/com/dingmouren/annularmenu/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenu;
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("com.dingmouren.annularmenu", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/annularmenu/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/annularmenu/src/main/java/com/dingmouren/annularmenu/AnnularMenu.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenu;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.util.AttributeSet;
6 | import android.util.TypedValue;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.view.animation.AlphaAnimation;
10 | import android.view.animation.Animation;
11 | import android.view.animation.AnimationSet;
12 | import android.view.animation.RotateAnimation;
13 | import android.view.animation.ScaleAnimation;
14 | import android.view.animation.TranslateAnimation;
15 |
16 |
17 | /**
18 | * Created by dingmouren on 2017/6/11.
19 | * email:naildingmouren@gmail.com
20 | */
21 |
22 | public class AnnularMenu extends ViewGroup implements View.OnClickListener {
23 | private static final String TAG = "AnnulardMenu";
24 | private static final int POSITION_LEFT_TOP = 0;
25 | private static final int POSITION_LEFT_BOTTOM = 1;
26 | private static final int POSITION_RIGHT_TOP = 2;
27 | private static final int POSITION_RIGHT_BOTTOM = 3;
28 | private static final int DEFAULT_TOGGLE_DURATION = 500;
29 | private int mToggleDuration = DEFAULT_TOGGLE_DURATION;
30 | private Position mPosition = Position.RIGHT_BOTTOM;//菜单位置
31 | private int mRadius;//菜单的 尺寸
32 | private Status mCurrentStatus = Status.CLOSE;//菜单默认的状态是关闭
33 | private View mCButton;//菜单的主按钮
34 | private OnMenuItemClickListener mOnMenuItemClickListener;
35 |
36 | /**
37 | * 菜单的打开 关闭的状态
38 | */
39 | public enum Status {
40 | OPEN, CLOSE
41 | }
42 |
43 | /**
44 | * 菜单的位置
45 | */
46 | public enum Position {
47 | LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM
48 | }
49 |
50 | public AnnularMenu(Context context) {
51 | this(context, null);
52 | }
53 |
54 | public AnnularMenu(Context context, AttributeSet attrs) {
55 | this(context, attrs, -1);
56 | }
57 |
58 | public AnnularMenu(Context context, AttributeSet attrs, int defStyleAttr) {
59 | super(context, attrs, defStyleAttr);
60 | mRadius = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());//菜单尺寸的默认值
61 | //获取自定义属性
62 | TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AnnularMenu, defStyleAttr, 0);
63 | int position = a.getInt(R.styleable.AnnularMenu_position, POSITION_RIGHT_BOTTOM);
64 | switch (position) {
65 | case POSITION_LEFT_TOP:
66 | mPosition = Position.LEFT_TOP;
67 | break;
68 | case POSITION_LEFT_BOTTOM:
69 | mPosition = Position.LEFT_BOTTOM;
70 | break;
71 | case POSITION_RIGHT_TOP:
72 | mPosition = Position.RIGHT_TOP;
73 | break;
74 | case POSITION_RIGHT_BOTTOM:
75 | mPosition = Position.RIGHT_BOTTOM;
76 | break;
77 | }
78 | mRadius = (int) a.getDimension(R.styleable.AnnularMenu_radius, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics()));
79 | mToggleDuration = a.getInt(R.styleable.AnnularMenu_toggleDuration, DEFAULT_TOGGLE_DURATION);
80 | a.recycle();//释放资源
81 | }
82 |
83 | @Override
84 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
85 | int count = getChildCount();
86 | //测量child
87 | for (int i = 0; i < count; i++) {
88 | measureChild(getChildAt(i), widthMeasureSpec, heightMeasureSpec);
89 | }
90 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
91 | }
92 |
93 | @Override //父元素确定子元素位置的方法
94 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
95 | if (changed) {
96 | layoutCButton(); //定位主菜单
97 | //定位item
98 | int count = getChildCount();
99 | for (int i = 0; i < count - 1; i++) {
100 | View child = getChildAt(i + 1);
101 | child.setVisibility(GONE);
102 | int childLeft = (int) (mRadius * Math.sin(Math.PI / 2 / (count - 2) * i));
103 | int childTop = (int) (mRadius * Math.cos(Math.PI / 2 / (count - 2) * i));
104 | int childWidth = child.getMeasuredWidth();
105 | int childHeight = child.getMeasuredHeight();
106 | //左下 右下时
107 | if (mPosition == Position.LEFT_BOTTOM || mPosition == Position.RIGHT_BOTTOM) {
108 | childTop = getMeasuredHeight() - childHeight - childTop;
109 | }
110 | //右下 右上时
111 | if (mPosition == Position.RIGHT_BOTTOM || mPosition == Position.RIGHT_TOP) {
112 | childLeft = getMeasuredWidth() - childWidth - childLeft;
113 | }
114 | child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
115 |
116 | }
117 | }
118 | }
119 |
120 | /**
121 | * 定位主菜单
122 | */
123 | private void layoutCButton() {
124 | mCButton = getChildAt(0);
125 | mCButton.setOnClickListener(this);
126 |
127 | int left = 0;
128 | int top = 0;
129 | int width = mCButton.getMeasuredWidth();
130 | int height = mCButton.getMeasuredHeight();
131 | switch (mPosition) {
132 | case LEFT_TOP:
133 | left = 0;
134 | top = 0;
135 | break;
136 | case LEFT_BOTTOM:
137 | left = 0;
138 | top = getMeasuredHeight() - height;
139 | break;
140 | case RIGHT_TOP:
141 | left = getMeasuredWidth() - width;
142 | top = 0;
143 | break;
144 | case RIGHT_BOTTOM:
145 | left = getMeasuredWidth() - width;
146 | top = getMeasuredHeight() - height;
147 | break;
148 | }
149 | mCButton.layout(left, top, left + width, top + height);
150 | }
151 |
152 | @Override
153 | public void onClick(View v) {
154 | rotateCButton(v, 0f, 360f, 300);
155 | toggleMenu(mToggleDuration);//切换菜单打开关闭状态
156 | }
157 |
158 | private void toggleMenu(int duration) {
159 | //为item添加平移动画 和旋转动画
160 | int count = getChildCount();
161 | for (int i = 0; i < count - 1; i++) {
162 | final View child = getChildAt(i + 1);
163 | child.setVisibility(VISIBLE);
164 | // 动画结束坐标: ( 0,0) 动画开始坐标:
165 | int childLeft = (int) (mRadius * Math.sin(Math.PI / 2 / (count - 2) * i));
166 | int childTop = (int) (mRadius * Math.cos(Math.PI / 2 / (count - 2) * i));
167 | int xflag = 1;
168 | int yflag = 1;
169 | if (mPosition == Position.LEFT_TOP || mPosition == Position.LEFT_BOTTOM) {
170 | xflag = -1;
171 | }
172 | if (mPosition == Position.LEFT_TOP || mPosition == Position.RIGHT_TOP) {
173 | yflag = -1;
174 | }
175 |
176 | AnimationSet animationSet = new AnimationSet(true);
177 | Animation tranAnim = null;
178 | AlphaAnimation alphaAnimation = null;
179 | //to open
180 | if (mCurrentStatus == Status.CLOSE) {
181 | alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
182 | tranAnim = new TranslateAnimation(xflag * (childLeft - child.getMeasuredWidth() / 2), 0, yflag * (childTop - child.getMeasuredWidth() / 2), 0);
183 | child.setClickable(true);
184 | child.setFocusable(true);
185 | } else { //to close
186 | alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
187 | tranAnim = new TranslateAnimation(0, xflag * (childLeft - child.getMeasuredWidth() / 2), 0, yflag * (childTop - child.getMeasuredWidth() / 2));
188 | child.setClickable(false);
189 | child.setFocusable(false);
190 | }
191 | tranAnim.setFillAfter(true);
192 | tranAnim.setDuration(duration);
193 | tranAnim.setStartOffset((i * 150) / count);
194 | tranAnim.setAnimationListener(new Animation.AnimationListener() {
195 | @Override
196 | public void onAnimationStart(Animation animation) {
197 | }
198 |
199 | @Override
200 | public void onAnimationEnd(Animation animation) {
201 | if (mCurrentStatus == Status.CLOSE) {
202 | child.setVisibility(GONE);
203 | }
204 | }
205 |
206 | @Override
207 | public void onAnimationRepeat(Animation animation) {
208 | }
209 | });
210 | //旋转动画
211 | RotateAnimation rotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
212 | rotateAnimation.setDuration(duration);
213 | rotateAnimation.setFillAfter(true);
214 | //渐变动画
215 | alphaAnimation.setDuration(duration);
216 | alphaAnimation.setFillAfter(true);
217 | animationSet.addAnimation(rotateAnimation);
218 | animationSet.addAnimation(tranAnim);
219 | animationSet.addAnimation(alphaAnimation);
220 | child.startAnimation(animationSet);
221 | final int childPosition = i + 1;
222 | child.setOnClickListener(new OnClickListener() {
223 | @Override
224 | public void onClick(View v) {
225 | if (mOnMenuItemClickListener != null) {
226 | mOnMenuItemClickListener.onClick(child, childPosition);
227 | }
228 | itemAnimation(childPosition - 1);
229 | changeStatus();
230 | }
231 | });
232 | }
233 | //切换菜单的状态
234 | changeStatus();
235 | }
236 |
237 | /**
238 | * item 点击效果
239 | */
240 | private void itemAnimation(int position) {
241 | for (int i = 0; i < getChildCount() - 1; i++) {
242 | View child = getChildAt(i + 1);
243 | if (i == position) {
244 | child.startAnimation(scaleBigAnimation(300));
245 | } else {
246 | child.startAnimation(scaleSmallAnimation(300));
247 | }
248 | child.setClickable(false);
249 | child.setFocusable(false);
250 | }
251 | }
252 |
253 | public boolean isOpen() {
254 | return mCurrentStatus == Status.OPEN;
255 | }
256 |
257 | public void toggle() {
258 | toggleMenu(mToggleDuration);
259 | }
260 |
261 | public void setMenuButtonClickable(boolean clickable){
262 | View menuView = getChildAt(0);
263 | menuView.setClickable(clickable);
264 | }
265 |
266 |
267 |
268 |
269 | /*
270 | * item变小的动画
271 | * @return
272 | */
273 | private Animation scaleSmallAnimation(int duration) {
274 | AnimationSet animationSet = new AnimationSet(true);
275 | ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5F);
276 | AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
277 | animationSet.addAnimation(scaleAnimation);
278 | animationSet.addAnimation(alphaAnimation);
279 | animationSet.setDuration(duration);
280 | animationSet.setFillAfter(true);
281 | return animationSet;
282 | }
283 |
284 | /**
285 | * item变大的动画
286 | *
287 | * @return
288 | */
289 | private Animation scaleBigAnimation(int duration) {
290 | AnimationSet animationSet = new AnimationSet(true);
291 | ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 2.5f, 1.0f, 2.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5F);
292 | AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
293 | animationSet.addAnimation(scaleAnimation);
294 | animationSet.addAnimation(alphaAnimation);
295 | animationSet.setDuration(duration);
296 | animationSet.setFillAfter(true);
297 | return animationSet;
298 | }
299 |
300 | /**
301 | * 切换菜单状态
302 | */
303 | private void changeStatus() {
304 | mCurrentStatus = (mCurrentStatus == Status.CLOSE ? Status.OPEN : Status.CLOSE);
305 | }
306 |
307 | /**
308 | * 主按钮旋转动画
309 | */
310 | private void rotateCButton(View v, float start, float end, int duration) {
311 | RotateAnimation animation = new RotateAnimation(start, end, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
312 | animation.setDuration(duration);
313 | animation.setFillAfter(true);
314 | v.startAnimation(animation);
315 | }
316 |
317 | public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
318 | mOnMenuItemClickListener = onMenuItemClickListener;
319 | }
320 |
321 |
322 | /**
323 | * 子菜单点击回调接口
324 | */
325 | public interface OnMenuItemClickListener {
326 | void onClick(View view, int position);
327 | }
328 | }
329 |
--------------------------------------------------------------------------------
/annularmenu/src/main/java/com/dingmouren/annularmenu/ShadowImageView.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenu;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Bitmap;
6 | import android.graphics.Canvas;
7 | import android.graphics.Color;
8 | import android.graphics.Paint;
9 | import android.graphics.RectF;
10 | import android.graphics.drawable.BitmapDrawable;
11 | import android.os.Build;
12 | import android.support.annotation.AttrRes;
13 | import android.support.annotation.NonNull;
14 | import android.support.annotation.Nullable;
15 | import android.util.AttributeSet;
16 | import android.widget.FrameLayout;
17 | import android.widget.ImageView;
18 |
19 | import de.hdodenhof.circleimageview.CircleImageView;
20 |
21 | /**
22 | * Created by dingmouren on 2017/6/12.
23 | */
24 |
25 | public class ShadowImageView extends FrameLayout {
26 | private static final String TAG = "ShadowImageView";
27 | private static final String DEFAULT_SHADOW_COLOR = "#88FFFFFF";//默认的阴影颜色
28 | private float mShadowOffsetX;//阴影在x方向的偏移量
29 | private float mShadowOffsetY;//阴影在y方向的偏移量
30 | private float mShadowRadius;//阴影的圆角半径
31 | private ImageView mImageView;//图片
32 | private int mImgId;
33 |
34 | public ShadowImageView(@NonNull Context context) {
35 | this(context, null);
36 | }
37 |
38 | public ShadowImageView(@NonNull Context context, @Nullable AttributeSet attrs) {
39 | this(context, attrs, 0);
40 | }
41 |
42 | public ShadowImageView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
43 | super(context, attrs, defStyleAttr);
44 | setBackgroundColor(getResources().getColor(android.R.color.transparent));
45 | //获取自定义属性值
46 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShadowImageView);
47 | if (attrs == null) return;
48 | try {
49 | mShadowOffsetX = a.getDimension(R.styleable.ShadowImageView_shadowOffsetX, 0.0f);
50 | mShadowOffsetY = a.getDimension(R.styleable.ShadowImageView_shadowOffsetY, 0.0f);
51 | mShadowRadius = a.getDimension(R.styleable.ShadowImageView_shadowRadius, 0.0f);
52 | mImgId = a.getResourceId(R.styleable.ShadowImageView_src, -1);
53 | } catch (Exception e) {
54 | e.printStackTrace();
55 | } finally {
56 | a.recycle();
57 | }
58 | mImageView = new CircleImageView(context);
59 | mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
60 | mImageView.setImageResource(mImgId);
61 | addView(mImageView);
62 |
63 | int xPadding = (int) (mShadowRadius + Math.abs(mShadowOffsetX));
64 | int yPadding = (int) (mShadowRadius + Math.abs(mShadowOffsetY));
65 | setPadding(xPadding, yPadding, xPadding, yPadding);
66 | }
67 |
68 | @Override
69 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
70 | super.onSizeChanged(w, h, oldw, oldh);
71 | if (w > 0 && h > 0) {
72 | setBackgroundCompat(w, h);
73 | }
74 | }
75 |
76 | @Override
77 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
78 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
79 | measureChild(getChildAt(0), widthMeasureSpec, heightMeasureSpec);
80 | }
81 |
82 | @Override
83 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
84 | super.onLayout(changed, left, top, right, bottom);
85 | setBackgroundCompat(right - left, bottom - top);
86 | }
87 |
88 | @Override
89 | protected void onDraw(Canvas canvas) {
90 |
91 | }
92 |
93 | private void setBackgroundCompat(int w, int h) {
94 | Bitmap bitmap = createShadowBitmap(w, h, mShadowRadius, mShadowOffsetX, mShadowOffsetY, Color.TRANSPARENT);
95 | BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap);
96 | if (Build.VERSION.SDK_INT <= 16) {
97 | setBackgroundDrawable(drawable);
98 | } else {
99 | setBackground(drawable);
100 | }
101 | }
102 |
103 | private Bitmap createShadowBitmap(int shadowWidth, int shadowHeight, float shadowRadius, float shadowOffsetX, float shadowOffsetY, int fillColor) {
104 | Bitmap bitmap = Bitmap.createBitmap(shadowWidth, shadowHeight, Bitmap.Config.ALPHA_8);
105 | Canvas canvas = new Canvas(bitmap);
106 | RectF shadowRect = new RectF(shadowRadius, shadowRadius, shadowWidth - shadowRadius, shadowHeight - shadowRadius);
107 | if (shadowOffsetX > 0) {
108 | shadowRect.left += shadowOffsetX;
109 | shadowRect.right -= shadowOffsetX;
110 | } else if (shadowOffsetX < 0) {
111 | shadowRect.left += Math.abs(shadowOffsetX);
112 | shadowRect.right -= Math.abs(shadowOffsetX);
113 | }
114 |
115 | if (shadowOffsetY > 0) {
116 | shadowRect.top += shadowOffsetY;
117 | shadowRect.bottom -= shadowOffsetY;
118 | } else if (shadowOffsetY < 0) {
119 | shadowRect.top += Math.abs(shadowOffsetY);
120 | shadowRect.bottom -= Math.abs(shadowOffsetY);
121 | }
122 |
123 | Paint shadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
124 | shadowPaint.setColor(Color.parseColor(DEFAULT_SHADOW_COLOR));
125 | shadowPaint.setStyle(Paint.Style.FILL);
126 | shadowPaint.setShadowLayer(shadowRadius, shadowOffsetX, shadowOffsetY, Color.parseColor(DEFAULT_SHADOW_COLOR));
127 | int radius = Math.max(mImageView.getMeasuredWidth(), mImageView.getMeasuredHeight());
128 | canvas.drawRoundRect(shadowRect, radius, radius, shadowPaint);
129 |
130 | return bitmap;
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/annularmenu/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/annularmenu/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/annularmenu/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AnnularMenu
3 |
4 |
--------------------------------------------------------------------------------
/annularmenu/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/annularmenu/src/test/java/com/dingmouren/annularmenu/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenu;
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 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.1"
6 | defaultConfig {
7 | applicationId "com.dingmouren.annularmenuview"
8 | minSdkVersion 15
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(include: ['*.jar'], dir: 'libs')
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 | compile project(':annularmenu')
30 | compile 'com.android.support:recyclerview-v7:25.0.1'
31 | compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
32 | }
33 |
--------------------------------------------------------------------------------
/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 D:\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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/dingmouren/annularmenuview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenuview;
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("com.dingmouren.annularmenuview", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dingmouren/annularmenuview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenuview;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.util.Log;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ImageView;
12 | import android.widget.Toast;
13 |
14 | import com.bumptech.glide.Glide;
15 | import com.dingmouren.annularmenu.AnnularMenu;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | public class MainActivity extends AppCompatActivity {
21 | private AnnularMenu menu1,menu2,menu3,menu4;
22 | private RecyclerView recyclerView;
23 | private List mList = new ArrayList<>();
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_main);
28 | menu1 = (AnnularMenu) findViewById(R.id.menu1);
29 | menu2 = (AnnularMenu) findViewById(R.id.menu2);
30 | menu3 = (AnnularMenu) findViewById(R.id.menu3);
31 | menu4 = (AnnularMenu) findViewById(R.id.menu4);
32 | // menu1.setVisibility(View.INVISIBLE);
33 | menu2.setVisibility(View.INVISIBLE);
34 | menu3.setVisibility(View.INVISIBLE);
35 | menu4.setVisibility(View.INVISIBLE);
36 | menu1.setOnMenuItemClickListener(new AnnularMenu.OnMenuItemClickListener() {
37 | @Override
38 | public void onClick(View view, int position) {
39 | Toast.makeText(MainActivity.this,position+"条目被点击",Toast.LENGTH_SHORT).show();
40 | }
41 | });
42 | initList();
43 | recyclerView = (RecyclerView) findViewById(R.id.recycler);
44 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
45 | recyclerView.setHasFixedSize(true);
46 | recyclerView.setAdapter(new MyAdapter());
47 | recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
48 | @Override
49 | public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
50 | if (newState == RecyclerView.SCROLL_STATE_IDLE){
51 | menu1.setMenuButtonClickable(true);
52 | }else {
53 | menu1.setMenuButtonClickable(false);
54 | }
55 | super.onScrollStateChanged(recyclerView, newState);
56 |
57 | }
58 |
59 | @Override
60 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
61 | super.onScrolled(recyclerView, dx, dy);
62 | if (menu1.isOpen()){
63 | menu1.toggle();
64 | }
65 | if (menu2.isOpen()){
66 | menu2.toggle();
67 | }
68 | if (menu3.isOpen()){
69 | menu3.toggle();
70 | }
71 | if (menu4.isOpen()){
72 | menu4.toggle();
73 | }
74 | }
75 | });
76 | }
77 |
78 | private void initList() {
79 | mList.clear();
80 | mList.add(R.mipmap.p1);
81 | mList.add(R.mipmap.p2);
82 | mList.add(R.mipmap.p3);
83 | mList.add(R.mipmap.p4);
84 | mList.add(R.mipmap.p5);
85 | mList.add(R.mipmap.p1);
86 | mList.add(R.mipmap.p2);
87 | mList.add(R.mipmap.p3);
88 | mList.add(R.mipmap.p4);
89 | mList.add(R.mipmap.p5);
90 | mList.add(R.mipmap.p1);
91 | mList.add(R.mipmap.p2);
92 | mList.add(R.mipmap.p3);
93 | mList.add(R.mipmap.p4);
94 | mList.add(R.mipmap.p5);
95 | }
96 |
97 | private class MyAdapter extends RecyclerView.Adapter{
98 |
99 | @Override
100 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
101 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_layout,parent,false);
102 | return new ViewHolder(view);
103 | }
104 |
105 | @Override
106 | public void onBindViewHolder(ViewHolder holder, int position) {
107 | Glide.with(holder.itemView.getContext()).load(mList.get(position)).into(holder.img);
108 | }
109 |
110 | @Override
111 | public int getItemCount() {
112 | return mList.size();
113 | }
114 |
115 | public class ViewHolder extends RecyclerView.ViewHolder{
116 | ImageView img;
117 | public ViewHolder(View itemView) {
118 | super(itemView);
119 | img = (ImageView) itemView.findViewById(R.id.img);
120 | }
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
18 |
21 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/left_bottom_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
30 |
39 |
48 |
57 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/left_top_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
30 |
39 |
48 |
57 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/right_bottom_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
30 |
39 |
48 |
57 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/right_top_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
30 |
39 |
48 |
57 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/item1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/item1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/item2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/item2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/item3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/item3.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/item4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/item4.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/item5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/item5.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-mdpi/menu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/p1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/p1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/p2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/p2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/p3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/p3.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/p4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/p4.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/p5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xhdpi/p5.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AnnularMenuView
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/dingmouren/annularmenuview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.dingmouren.annularmenuview;
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 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.2'
9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1'
10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 12 17:02:39 CST 2017
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-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/screenshot/demo1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/screenshot/demo1.gif
--------------------------------------------------------------------------------
/screenshot/demo2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/screenshot/demo2.gif
--------------------------------------------------------------------------------
/screenshot/demo3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/screenshot/demo3.gif
--------------------------------------------------------------------------------
/screenshot/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DingMouRen/AnnularMenuView/2557da0748faf6196668acc25a0770e0cfbdbd81/screenshot/title.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':annularmenu'
2 |
--------------------------------------------------------------------------------