├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── LICENSE
├── README.md
├── RotateMenu.iml
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── yy
│ │ └── rotatemenu
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── example
│ │ └── yy
│ │ └── rotatemenu
│ │ ├── CircleRunActivity.java
│ │ ├── RotateAnimations.java
│ │ └── view
│ │ ├── CoverRingImageView.java
│ │ └── RingOperationLayout.java
│ └── res
│ ├── layout
│ ├── custom_circle_run_activity.xml
│ └── custom_ring_operation_layout.xml
│ ├── mipmap-hdpi
│ ├── ic_custom_ring_menu_channel1.png
│ ├── ic_custom_ring_menu_channel4.png
│ ├── ic_custom_ring_menu_channel7.png
│ ├── ic_custom_ring_menu_home.png
│ ├── ic_custom_ring_menu_inside_ring.png
│ ├── ic_custom_ring_menu_menu.png
│ ├── ic_custom_ring_menu_middle_ring.png
│ ├── ic_custom_ring_menu_myyouku.png
│ ├── ic_custom_ring_menu_outside_ring.png
│ ├── ic_custom_ring_menu_search.png
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | RotateMenu
--------------------------------------------------------------------------------
/.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 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.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 | Android API 19 Platform
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 BOSSYAO
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RotateMenu
2 | a simple rotatable menu android custom widget. 简单地旋转菜单控件
3 | #ScreenShot
4 |
5 |
6 | #Usage
7 | 有兴趣的话看看就好,这东西感觉抽出来也没太大意义,纯粹当初练手用的 :)
8 |
9 | # Last
10 | 其实这个是优酷以前的那个环形菜单,那个时候自己剖析完之后决定重新做个另一种版本的玩一下,也就是现在这样。这也算是搞Android以来的第一个控件,虽然没什么太大用处,但很有纪念意义,让我想起当时2013年的自己,那会儿熬夜去弄这个东西的冲劲儿。最近翻以前的资料看到它,索性也上传上来吧。
11 |
--------------------------------------------------------------------------------
/RotateMenu.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
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 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "21.1.2"
6 |
7 | defaultConfig {
8 | applicationId "com.example.yy.rotatemenu"
9 | minSdkVersion 19
10 | targetSdkVersion 21
11 | versionCode 1
12 | versionName "1.0"
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 | compile 'com.android.support:appcompat-v7:21.0.3'
25 | }
26 |
--------------------------------------------------------------------------------
/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 /Users/BossYao/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/androidTest/java/com/example/yy/rotatemenu/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.yy.rotatemenu;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/yy/rotatemenu/CircleRunActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.yy.rotatemenu;
2 |
3 |
4 |
5 | import android.os.Bundle;
6 | import android.app.Activity;
7 |
8 | public class CircleRunActivity extends Activity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.custom_circle_run_activity);
14 | }
15 | //
16 | // @Override
17 | // public boolean onCreateOptionsMenu(Menu menu) {
18 | // // Inflate the menu; this adds items to the action bar if it is present.
19 | // getMenuInflater().inflate(R.menu.main, menu);
20 | // return true;
21 | // }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/yy/rotatemenu/RotateAnimations.java:
--------------------------------------------------------------------------------
1 | package com.example.yy.rotatemenu;
2 |
3 | import android.view.View;
4 | import android.view.ViewGroup;
5 | import android.view.animation.Animation;
6 | import android.view.animation.RotateAnimation;
7 |
8 | /**
9 | * 类描述 旋转过渡效果类
10 | *
11 | * @author yaoy
12 | * @since 1.0 2013-9-26 下午3:52:41
13 | * @version 1.0 2013-9-26 下午3:52:41
14 | */
15 | public class RotateAnimations {
16 |
17 | /**
18 | * 方法描述 封装旋转效果实现的方法
19 | *
20 | * @param viewGroup
21 | * :需要旋转的viewGroup duration:旋转持续时间 startOffSet:旋转延迟时间
22 | * @return
23 | * @throws
24 | * @since 1.0
25 | * @author yaoy
26 | * @date 2013-9-26
27 | */
28 | public static void startAnimation(ViewGroup viewGroup, int duration, int startOffSet) {
29 | for (int i = 0; i < viewGroup.getChildCount(); i++) {
30 | viewGroup.getChildAt(i).setVisibility(View.VISIBLE);// 设置显示
31 | viewGroup.getChildAt(i).setFocusable(true);// 获得焦点
32 | viewGroup.getChildAt(i).setClickable(true);// 可以点击
33 | }
34 |
35 | Animation animation;
36 |
37 | /**
38 | * 旋转动画
39 | * RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue)
40 | * fromDegrees 开始旋转角度
41 | * toDegrees 旋转到的角度
42 | * pivotXType X轴 参照物
43 | * pivotXValue x轴 旋转的参考点
44 | * pivotYType Y轴 参照物
45 | * pivotYValue Y轴 旋转的参考点
46 | */
47 | animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
48 | animation.setFillAfter(true);// 停留在动画结束位置
49 | animation.setDuration(duration);
50 | animation.setStartOffset(startOffSet);
51 | viewGroup.startAnimation(animation);
52 |
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/yy/rotatemenu/view/CoverRingImageView.java:
--------------------------------------------------------------------------------
1 | package com.example.yy.rotatemenu.view;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.Paint.Style;
9 | import android.graphics.RectF;
10 | import android.util.AttributeSet;
11 | import android.widget.ImageView;
12 |
13 | @SuppressLint("DrawAllocation")
14 | /**
15 | *
16 | * 类描述 选装菜单遮盖绘图类
17 | *
18 | * @author yaoy
19 | * @since 1.0 2013-9-26 下午2:18:02
20 | * @version 1.0 2013-9-26 下午2:18:02
21 | */
22 | public class CoverRingImageView extends ImageView {
23 |
24 | private final Paint paint;
25 |
26 | private Canvas mCanvas = null;
27 |
28 | // 绘制圆环的内圆宽,包括外环和里环
29 | private int mOutsideInnerCircleWidth;
30 |
31 | private int mInsideInnerCircleWidth;
32 |
33 | // 绘制圆环的圆环宽,包括外环和里环(圆环宽*2+1 == 真正圆环宽)
34 | private int mOutsideRingWidth;
35 |
36 | private int mInsideRingWidth;
37 |
38 | // 外、内环的消除绘制终点角度
39 | private int mRemoveOutsideCircleDynamicAngle = 0;
40 |
41 | private int mRemoveInsideCircleDynamicAngle = 0;
42 |
43 | // 外、内环的填充绘制终点角度
44 | private int mDrawOutsideCircleDynamicAngle = 0;
45 |
46 | private int mDrawInsideCircleDynamicAngle = 0;
47 |
48 | // 外、内环的填充是否完成
49 | private Boolean mDrawOutsideCircleIsDone = null;
50 |
51 | private Boolean mDrawInsideCircleIsDone = null;
52 |
53 | // 外、内环的消除是否完成
54 | private Boolean mRemoveOutsideCircleIsDone = null;
55 |
56 | private Boolean mRemoveInsideCircleIsDone = null;
57 |
58 | // 外、内菜单的出现是否完成
59 | private Boolean mShowOutsideCircleBoolean = false;
60 |
61 | private Boolean mShowInsideCircleBoolean = false;
62 |
63 | // 外、内菜单的隐藏是否完成
64 | private Boolean mHideOutsideCircleBoolean = false;
65 |
66 | private Boolean mHideInsideCircleBoolean = false;
67 |
68 | // 外、内菜单的出现是否正在进行
69 | private Boolean mShowOutsideCircleIsRunning = false;
70 |
71 | private Boolean mShowInsideCircleIsRunning = false;
72 |
73 | // 外、内菜单的隐藏是否正在进行
74 | private Boolean mHideOutsideCircleIsRunning = false;
75 |
76 | private Boolean mHideInsideCircleIsRunning = false;
77 |
78 | // 外、内环的颜色
79 | private static final int CIRCLE_COLOR = Color.WHITE;
80 |
81 | // 外、内环的内圆宽适应值
82 | private static final int OUTSIDE_INNER_CIRCLE_WIDTH_FITER = 3;
83 |
84 | private static final int INSIDE_INNER_CIRCLE_WIDTH_FITER = 3;
85 |
86 | // 外、内环的圆环宽适应值
87 | private static final int OUTSIDE_RING_WIDTH_FITER = 6;
88 |
89 | private static final int INTSIDE_RING_WIDTH_FITER = 4;
90 |
91 | /**
92 | * 方法描述 构造方法,初始化一些变量,用于使自定义空间类能再xml运用
93 | *
94 | * @param context
95 | * :上下文 AttributeSet:属性集
96 | * @return 无
97 | * @throws
98 | * @since 1.0
99 | * @author yaoy
100 | * @date 2013-9-26
101 | */
102 | public CoverRingImageView(Context context, AttributeSet attrs) {
103 | super(context, attrs);
104 |
105 | // TODO Auto-generated constructor stub
106 | this.paint = new Paint();
107 |
108 | // 消除锯齿
109 | this.paint.setAntiAlias(true);
110 |
111 | // 绘制空心圆或 空心矩形
112 | this.paint.setStyle(Style.STROKE);
113 |
114 | mRemoveOutsideCircleDynamicAngle = 0;
115 | mDrawOutsideCircleDynamicAngle = 0;
116 |
117 | // 绘制判断的条件,用于决定一开始先画的逻辑
118 | mDrawOutsideCircleIsDone = true;
119 | mRemoveOutsideCircleIsDone = false;
120 | mRemoveInsideCircleIsDone = false;
121 | mDrawInsideCircleIsDone = true;
122 | }
123 |
124 | @Override
125 | protected void onDraw(Canvas canvas) {
126 | // 内圆宽设置(所要覆盖菜单圆宽的一半减去适应值)
127 | mOutsideInnerCircleWidth = RingOperationLayout.mLevel2Width / 2 - OUTSIDE_INNER_CIRCLE_WIDTH_FITER;
128 | mInsideInnerCircleWidth = RingOperationLayout.mLevel1Width / 2 - INSIDE_INNER_CIRCLE_WIDTH_FITER;
129 |
130 | // 圆环宽设置(外圆减内圆的差的一半+适应值)
131 | mOutsideRingWidth = (RingOperationLayout.mLevel3Width - RingOperationLayout.mLevel2Width) / 2 + OUTSIDE_RING_WIDTH_FITER;
132 | mInsideRingWidth = (RingOperationLayout.mLevel2Width - RingOperationLayout.mLevel1Width) / 2 + INTSIDE_RING_WIDTH_FITER;
133 |
134 | mCanvas = canvas;
135 | super.onDraw(mCanvas);
136 |
137 | // 控件宽的一半
138 | int imageViewWidth = getWidth() / 2;
139 |
140 | // 填充参照坐标的矩形,即内切圆,据此计算出坐标点, 参数为左 上 右 下四点
141 | RectF outsideCircleRect = new RectF(imageViewWidth - (mOutsideInnerCircleWidth + 1 + mOutsideRingWidth / 2), imageViewWidth - (mOutsideInnerCircleWidth + 1 + mOutsideRingWidth / 2), imageViewWidth + (mOutsideInnerCircleWidth + 1 + mOutsideRingWidth / 2), imageViewWidth + (mOutsideInnerCircleWidth + 1 + mOutsideRingWidth / 2));
142 |
143 | RectF insideCircleRect = new RectF(imageViewWidth - (mInsideInnerCircleWidth + 1 + mOutsideRingWidth / 2), imageViewWidth - (mInsideInnerCircleWidth + 1 + mInsideRingWidth / 2), imageViewWidth + (mInsideInnerCircleWidth + 1 + mInsideRingWidth / 2), imageViewWidth + (mInsideInnerCircleWidth + 1 + mInsideRingWidth / 2));
144 |
145 | // 绘制逻辑
146 | if (mRemoveInsideCircleIsDone == true) {
147 | removeInsideCircle(canvas, insideCircleRect);
148 | }
149 | if (mDrawInsideCircleIsDone == true) {
150 | drawInsideCircle(canvas, insideCircleRect);
151 | }
152 | if (mRemoveOutsideCircleIsDone == true) {
153 | removeOutsideCircle(canvas, outsideCircleRect);
154 | }
155 | if (mDrawOutsideCircleIsDone == true) {
156 | drawOutsideCircle(canvas, outsideCircleRect);
157 | }
158 |
159 | // 用于重复刷新onDraw
160 | invalidate();
161 | }
162 |
163 | /**
164 | * 方法描述 给其他类调用的接口函数,用于显示里菜单
165 | *
166 | * @param 无
167 | * @return 无
168 | * @throws
169 | * @since 1.0
170 | * @author yaoy
171 | * @date 2013-9-26
172 | */
173 | public void showInsideCircle() {
174 | if (mRemoveInsideCircleIsDone == false && mShowInsideCircleIsRunning == false && mHideInsideCircleIsRunning == false) {
175 | mShowInsideCircleBoolean = true;
176 | mShowInsideCircleIsRunning = true;
177 | }
178 | }
179 |
180 | /**
181 | * 方法描述 给其他类调用的接口函数,用于隐藏里菜单
182 | *
183 | * @param 无
184 | * @return 无
185 | * @throws
186 | * @since 1.0
187 | * @author yaoy
188 | * @date 2013-9-26
189 | */
190 | public void hideInsideCircle() {
191 | if (mDrawInsideCircleIsDone == false && mShowInsideCircleIsRunning == false && mHideInsideCircleIsRunning == false) {
192 | mHideInsideCircleBoolean = true;
193 | mHideInsideCircleIsRunning = true;
194 | }
195 | }
196 |
197 | /**
198 | * 方法描述 给其他类调用的接口函数,用于显示外菜单
199 | *
200 | * @param 无
201 | * @return 无
202 | * @throws
203 | * @since 1.0
204 | * @author yaoy
205 | * @date 2013-9-26
206 | */
207 | public void showOutsideCircle() {
208 | if (mRemoveOutsideCircleIsDone == false && mShowOutsideCircleIsRunning == false && mHideOutsideCircleIsRunning == false) {
209 | mShowOutsideCircleBoolean = true;
210 | mShowOutsideCircleIsRunning = true;
211 | }
212 | }
213 |
214 | /**
215 | * 方法描述 给其他类调用的接口函数,用于隐藏外菜单
216 | *
217 | * @param 无
218 | * @return 无
219 | * @throws
220 | * @since 1.0
221 | * @author yaoy
222 | * @date 2013-9-26
223 | */
224 | public void hideOutsideCircle() {
225 | if (mDrawOutsideCircleIsDone == false && mShowOutsideCircleIsRunning == false && mHideOutsideCircleIsRunning == false) {
226 | mHideOutsideCircleBoolean = true;
227 | mHideOutsideCircleIsRunning = true;
228 | }
229 | }
230 |
231 | /**
232 | * 方法描述 里环绘制具体实现函数
233 | *
234 | * @param canvas
235 | * :画布 rect:参照矩形
236 | * @return
237 | * @throws
238 | * @since 1.0
239 | * @author yaoy
240 | * @date 2013-9-26
241 | */
242 | private void drawInsideCircle(Canvas canvas, RectF rect) {
243 | // TODO Auto-generated method stub
244 | // 画完以后变更逻辑
245 | if (mDrawInsideCircleDynamicAngle == 360) {
246 | mDrawInsideCircleIsDone = false;
247 | mRemoveInsideCircleIsDone = true;
248 | mShowInsideCircleBoolean = false;
249 | mRemoveInsideCircleDynamicAngle = 0;
250 | mShowInsideCircleIsRunning = false;
251 | mHideInsideCircleIsRunning = false;
252 | RingOperationLayout.mLevel2ISRuning = false;
253 | }
254 | this.paint.setColor(CIRCLE_COLOR);
255 | // 设置圆环的挖取大小
256 | this.paint.setStrokeWidth(mInsideRingWidth);
257 | // 绘制圆环
258 | canvas.drawArc(rect, 360, mDrawInsideCircleDynamicAngle - 360, false, paint);
259 |
260 | if (mShowInsideCircleBoolean == true) {
261 | // 设置圆环的画图速度
262 | mDrawInsideCircleDynamicAngle += 4;
263 | }
264 |
265 | }
266 |
267 | /**
268 | * 方法描述 里环消除具体实现函数
269 | *
270 | * @param canvas
271 | * :画布 rect:参照矩形
272 | * @return
273 | * @throws
274 | * @since 1.0
275 | * @author yaoy
276 | * @date 2013-9-26
277 | */
278 | private void removeInsideCircle(Canvas canvas, RectF rect) {
279 | // TODO Auto-generated method stub
280 | // 画完以后变更逻辑
281 | if (mRemoveInsideCircleDynamicAngle == 360) {
282 | mDrawInsideCircleIsDone = true;
283 | mRemoveInsideCircleIsDone = false;
284 | mHideInsideCircleBoolean = false;
285 | mDrawInsideCircleDynamicAngle = 0;
286 | mHideInsideCircleIsRunning = false;
287 | mShowInsideCircleIsRunning = false;
288 | RingOperationLayout.mLevel2ISRuning = false;
289 |
290 | }
291 | this.paint.setColor(CIRCLE_COLOR);
292 | // 设置圆环的挖取大小
293 | this.paint.setStrokeWidth(mInsideRingWidth);
294 | // 绘制圆环
295 | canvas.drawArc(rect, -180, mRemoveInsideCircleDynamicAngle, false, paint);
296 |
297 | if (mHideInsideCircleBoolean == true) {
298 | // 设置圆环的画图速度
299 | mRemoveInsideCircleDynamicAngle += 4;
300 | }
301 |
302 | }
303 |
304 | /**
305 | * 方法描述 外环绘制具体实现函数
306 | *
307 | * @param canvas
308 | * :画布 rect:参照矩形
309 | * @return
310 | * @throws
311 | * @since 1.0
312 | * @author yaoy
313 | * @date 2013-9-26
314 | */
315 | private void drawOutsideCircle(Canvas canvas, RectF rect) {
316 | // TODO Auto-generated method stub
317 | // 画完以后变更逻辑
318 | if (mDrawOutsideCircleDynamicAngle == 360) {
319 | mDrawOutsideCircleIsDone = false;
320 | mRemoveOutsideCircleIsDone = true;
321 | mShowOutsideCircleBoolean = false;
322 | mRemoveOutsideCircleDynamicAngle = 0;
323 | mShowOutsideCircleIsRunning = false;
324 | mHideOutsideCircleIsRunning = false;
325 | RingOperationLayout.mLevel3ISRuning = false;
326 |
327 | }
328 | this.paint.setColor(CIRCLE_COLOR);
329 | // 设置圆环的挖取大小
330 | this.paint.setStrokeWidth(mOutsideRingWidth);
331 | // 绘制圆环
332 | canvas.drawArc(rect, 360, mDrawOutsideCircleDynamicAngle - 360, false, paint);
333 |
334 | if (mShowOutsideCircleBoolean == true) {
335 | // 设置圆环的画图速度
336 | mDrawOutsideCircleDynamicAngle += 2;
337 | }
338 |
339 | }
340 |
341 | /**
342 | * 方法描述 外环消除具体实现函数
343 | *
344 | * @param canvas
345 | * :画布 rect:参照矩形
346 | * @return
347 | * @throws
348 | * @since 1.0
349 | * @author yaoy
350 | * @date 2013-9-26
351 | */
352 | private void removeOutsideCircle(Canvas canvas, RectF rect) {
353 | // TODO Auto-generated method stub
354 | // 画完以后变更逻辑
355 | if (mRemoveOutsideCircleDynamicAngle == 360) {
356 | mDrawOutsideCircleIsDone = true;
357 | mRemoveOutsideCircleIsDone = false;
358 | mHideOutsideCircleBoolean = false;
359 | mDrawOutsideCircleDynamicAngle = 0;
360 | mHideOutsideCircleIsRunning = false;
361 | mShowOutsideCircleIsRunning = false;
362 | RingOperationLayout.mLevel3ISRuning = false;
363 |
364 | }
365 | this.paint.setColor(CIRCLE_COLOR);
366 | // 设置圆环的挖取大小
367 | this.paint.setStrokeWidth(mOutsideRingWidth);
368 | // 绘制圆环
369 | canvas.drawArc(rect, -180, mRemoveOutsideCircleDynamicAngle, false, paint);
370 |
371 | if (mHideOutsideCircleBoolean == true) {
372 | // 设置圆环的画图速度
373 | mRemoveOutsideCircleDynamicAngle += 2;
374 | }
375 |
376 | }
377 |
378 | /**
379 | * 方法描述 根据手机的分辨率从 dp 的单位 转成为 px(像素)
380 | *
381 | * @param context
382 | * :上下文
383 | * rect:需要转换的dip值
384 | * @return
385 | * @throws
386 | * @since 1.0
387 | * @author yaoy
388 | * @date 2013-9-26
389 | */
390 | public static int dip2px(Context context, float dpValue) {
391 | // 获取设备比率值
392 | final float scale = context.getResources().getDisplayMetrics().density;
393 | return (int) (dpValue * scale + 0.5f);
394 | }
395 |
396 | /**
397 | * 方法描述 根据手机的分辨率从 px(像素) 的单位 转成为 dp
398 | *
399 | * @param context
400 | * :上下文 rect:需要转换的px值
401 | * @return
402 | * @throws
403 | * @since 1.0
404 | * @author yaoy
405 | * @date 2013-9-26
406 | */
407 | public static int px2dip(Context context, float pxValue) {
408 | // 获取设备比率值
409 | final float scale = context.getResources().getDisplayMetrics().density;
410 | return (int) (pxValue / scale + 0.5f);
411 | }
412 |
413 | }
414 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/yy/rotatemenu/view/RingOperationLayout.java:
--------------------------------------------------------------------------------
1 | package com.example.yy.rotatemenu.view;
2 |
3 | import java.util.Timer;
4 | import java.util.TimerTask;
5 |
6 |
7 |
8 |
9 | import android.content.Context;
10 | import android.os.Handler;
11 | import android.os.Message;
12 | import android.util.AttributeSet;
13 | import android.view.LayoutInflater;
14 | import android.view.View;
15 | import android.widget.ImageButton;
16 | import android.widget.LinearLayout;
17 | import android.widget.RelativeLayout;
18 |
19 | import com.example.yy.rotatemenu.R;
20 | import com.example.yy.rotatemenu.RotateAnimations;
21 |
22 | /**
23 | *
24 | * 类描述 圆环逻辑实现类
25 | *
26 | * @author yaoy
27 | * @since 1.0 2013-9-26 下午3:51:44
28 | * @version 1.0 2013-9-26 下午3:51:44
29 | */
30 | public class RingOperationLayout extends LinearLayout {
31 |
32 | // 可点击的总菜单按钮
33 | private ImageButton mHomeButton;
34 |
35 | // 可点击的次菜单按钮
36 | private ImageButton mMenuButton;
37 |
38 | // 一级菜单
39 | private RelativeLayout mLevel1;
40 |
41 | // 二级菜单
42 | private RelativeLayout mLevel2;
43 |
44 | // 三级菜单
45 | private RelativeLayout mLevel3;
46 |
47 | // 判断二、三级菜单状态
48 | private boolean mIsLevel2Show = false;
49 |
50 | private boolean mIsLevel3Show = false;
51 |
52 | public static boolean mLevel2ISRuning = false;
53 |
54 | public static boolean mLevel3ISRuning = false;
55 |
56 | private View mConvertView;
57 |
58 | private LayoutInflater mLayoutInflater = null;
59 |
60 | private CoverRingImageView mDrawImageView;
61 |
62 | private Timer mTimer;
63 |
64 | // 菜单的宽
65 | public static int mLevel1Width;
66 |
67 | public static int mLevel2Width;
68 |
69 | public static int mLevel3Width;
70 |
71 | //是否得到了菜单的宽
72 | private Boolean mHasGotWidth = false;
73 |
74 | private static final int WANT_TO_GET_MUNU_WIDTH_MESSAGE = 1;
75 |
76 | public RingOperationLayout(Context context, AttributeSet attrs) {
77 | super(context);
78 | //初始化
79 | initialize(context);
80 |
81 | mMenuButton.setOnClickListener(new OnClickListener() {
82 |
83 | @Override
84 | public void onClick(View v) {
85 |
86 | if (mLevel3ISRuning == false) {
87 | mLevel3ISRuning = true;
88 |
89 | if (mIsLevel3Show) {
90 | // mMenuButton.setClickable(false);
91 | // 隐藏3级导航菜单
92 | mDrawImageView.hideOutsideCircle();
93 | RotateAnimations.startAnimation(mLevel3, 3500, 0);
94 | } else {
95 | // 显示3级导航菜单
96 | // showCircleLevelOne();
97 | mDrawImageView.showOutsideCircle();
98 | RotateAnimations.startAnimation(mLevel3, 3500, 0);
99 | }
100 |
101 | mIsLevel3Show = !mIsLevel3Show;
102 | }
103 | }
104 | });
105 |
106 | mHomeButton.setOnClickListener(new OnClickListener() {
107 |
108 | @Override
109 | public void onClick(View v) {
110 |
111 | if (mLevel3ISRuning == false && mLevel2ISRuning == false) {
112 | mLevel2ISRuning = true;
113 |
114 | if (!mIsLevel2Show) {
115 | // 显示2级导航菜单
116 | mDrawImageView.showInsideCircle();
117 | RotateAnimations.startAnimation(mLevel2, 2000, 0);
118 | } else {
119 | if (mIsLevel3Show) {
120 | // 隐藏3级导航菜单
121 | mDrawImageView.hideOutsideCircle();
122 | RotateAnimations.startAnimation(mLevel3, 3500, 0);
123 | // 隐藏2级导航菜单
124 | mDrawImageView.hideInsideCircle();
125 | RotateAnimations.startAnimation(mLevel2, 2000, 500);
126 | mIsLevel3Show = !mIsLevel3Show;
127 | } else {
128 | // 隐藏2级导航菜单
129 | mDrawImageView.hideInsideCircle();
130 | RotateAnimations.startAnimation(mLevel2, 2000, 0);
131 | }
132 | }
133 | mIsLevel2Show = !mIsLevel2Show;
134 | }
135 | }
136 | });
137 |
138 | addView(mConvertView);
139 |
140 | final Handler myHandler = new Handler() {
141 |
142 | @Override
143 | public void handleMessage(Message msg) {
144 | if (msg.what == WANT_TO_GET_MUNU_WIDTH_MESSAGE) {
145 | if (mLevel3.getWidth() != 0 && mLevel2.getWidth() != 0 && mLevel1.getWidth() != 0) {
146 | mLevel1Width = mLevel1.getWidth();
147 | mLevel2Width = mLevel2.getWidth();
148 | mLevel3Width = mLevel3.getWidth();
149 | System.out.println(mLevel3Width + "");
150 | // 取消定时器
151 | mTimer.cancel();
152 | mHasGotWidth = true;
153 | }
154 | }
155 | }
156 | };
157 |
158 | if (mHasGotWidth == false) {
159 | mTimer = new Timer();
160 | //在未得到菜单宽时,不断线程请求获取
161 | TimerTask task = new TimerTask() {
162 | public void run() {
163 | Message message = new Message();
164 | message.what = WANT_TO_GET_MUNU_WIDTH_MESSAGE;
165 | myHandler.sendMessage(message);
166 | }
167 | };
168 | // 延迟每次延迟10 毫秒 隔1秒执行一次
169 | mTimer.schedule(task, 10, 1000);
170 | }
171 | }
172 |
173 | /**
174 | *
175 | * 方法描述 初始化控件
176 | *
177 | * @param
178 | * @return
179 | * @throws
180 | * @since 1.0
181 | * @author yaoy
182 | * @date 2013-9-26
183 | */
184 | private void initialize(Context context) {
185 | // TODO Auto-generated method stub
186 | mLayoutInflater = LayoutInflater.from(context);
187 | mConvertView = mLayoutInflater.inflate(R.layout.custom_ring_operation_layout, null);
188 | mDrawImageView = (CoverRingImageView) mConvertView.findViewById(R.id.drawImageView);
189 |
190 | mHomeButton = (ImageButton) mConvertView.findViewById(R.id.home);
191 | mMenuButton = (ImageButton) mConvertView.findViewById(R.id.menu);
192 |
193 | mLevel1 = (RelativeLayout) mConvertView.findViewById(R.id.level1);
194 | mLevel2 = (RelativeLayout) mConvertView.findViewById(R.id.level2);
195 | mLevel3 = (RelativeLayout) mConvertView.findViewById(R.id.level3);
196 |
197 | }
198 |
199 | }
200 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_circle_run_activity.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_ring_operation_layout.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
13 |
14 |
21 |
22 |
23 |
30 |
31 |
39 |
40 |
46 |
47 |
55 |
56 |
57 |
64 |
65 |
73 |
74 |
81 |
82 |
88 |
89 |
97 |
98 |
99 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_channel1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_channel1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_channel4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_channel4.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_channel7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_channel7.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_home.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_inside_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_inside_ring.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_menu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_middle_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_middle_ring.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_myyouku.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_myyouku.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_outside_ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_outside_ring.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_custom_ring_menu_search.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RotateMenu
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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:1.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bossyao168/RotateMenu/5b867fc32e9cd719467ecfccef610dc0f8ec8457/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
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.2.1-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 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------