());
13 |
14 | public static void keyDown(final int key) {
15 | threadPool.execute(new Runnable() {
16 | @Override
17 | public void run() {
18 | sendKeyDownUpSync(key);
19 | }
20 | });
21 | }
22 |
23 | //必须运行在子线程
24 | private static void sendKeyDownUpSync(int key) {
25 | try {
26 | Instrumentation inst = new Instrumentation();
27 | inst.sendKeyDownUpSync(key);
28 | }catch (java.lang.SecurityException e) {
29 | e.printStackTrace();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhang/autotouch/utils/LoopArrayList.java:
--------------------------------------------------------------------------------
1 | package com.zhang.autotouch.utils;
2 |
3 | import java.util.ArrayList;
4 |
5 | /**
6 | * This List is extends from ArrayList
7 | * 继承自ArrayList
8 | *
9 | * When list size() > 0 and The User get(index) the object out of index for List from list,Don't throw IndexOutOfBoundsException
10 | * And restart get Value List from index = 0
11 | * 当数组长度大于0
12 | * 且用户取的索引出现索引越界时,不会抛出异常,会从重新索引0开始继续取
13 | *
14 | * Avoid index transgressions(Avoid IndexOutOfBoundsException)
15 | * 避免索引越界
16 | *
17 | * Pay attention to get index value
18 | * 注意取值逻辑
19 | *
20 | *
21 | * @author Damon Lee CN
22 | * @see ArrayList
23 | * @since 1.2
24 | */
25 | public class LoopArrayList extends ArrayList {
26 | @Override
27 | public E get(int index) {
28 | if (size() != 0 && index >= size()) {
29 | // KEY POINT
30 | return super.get(index % size());
31 | } else {
32 | return super.get(index);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zhang/autotouch/utils/SpUtils.java:
--------------------------------------------------------------------------------
1 | package com.zhang.autotouch.utils;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.text.TextUtils;
6 |
7 | import com.zhang.autotouch.bean.TouchPoint;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * SharedPreferences 工具类
14 | */
15 | public class SpUtils {
16 |
17 | /**
18 | * 保存在手机里面的文件名
19 | */
20 | private static final String FILE_NAME = "share_date";
21 | private static final String KEY_TOUCH_LIST = "touch_list";
22 |
23 | /**
24 | * 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
25 | * @param context
26 | * @param key
27 | * @param object
28 | */
29 | public static void setParam(Context context , String key, Object object){
30 |
31 | String type = object.getClass().getSimpleName();
32 | SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
33 | SharedPreferences.Editor editor = sp.edit();
34 |
35 | if("String".equals(type)){
36 | editor.putString(key, (String)object);
37 | }
38 | else if("Integer".equals(type)){
39 | editor.putInt(key, (Integer)object);
40 | }
41 | else if("Boolean".equals(type)){
42 | editor.putBoolean(key, (Boolean)object);
43 | }
44 | else if("Float".equals(type)){
45 | editor.putFloat(key, (Float)object);
46 | }
47 | else if("Long".equals(type)){
48 | editor.putLong(key, (Long)object);
49 | }
50 | editor.apply();
51 | }
52 |
53 |
54 | /**
55 | * 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
56 | * @param context
57 | * @param key
58 | * @param defaultObject
59 | * @return
60 | */
61 | public static Object getParam(Context context , String key, Object defaultObject){
62 | String type = defaultObject.getClass().getSimpleName();
63 | SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
64 |
65 | if("String".equals(type)){
66 | return sp.getString(key, (String)defaultObject);
67 | }
68 |
69 | else if("Integer".equals(type)){
70 | return sp.getInt(key, (Integer)defaultObject);
71 | }
72 |
73 | else if("Boolean".equals(type)){
74 | return sp.getBoolean(key, (Boolean)defaultObject);
75 | }
76 |
77 | else if("Float".equals(type)){
78 | return sp.getFloat(key, (Float)defaultObject);
79 | }
80 |
81 | else if("Long".equals(type)){
82 | return sp.getLong(key, (Long)defaultObject);
83 | }
84 |
85 | return null;
86 | }
87 |
88 | /**
89 | * 清除所有数据
90 | * @param context
91 | */
92 | public static void clear(Context context) {
93 | SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
94 | Context.MODE_PRIVATE);
95 | SharedPreferences.Editor editor = sp.edit();
96 | editor.clear().apply();
97 | }
98 |
99 | /**
100 | * 清除指定数据
101 | * @param context
102 | */
103 | public static void clearAll(Context context) {
104 | SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
105 | Context.MODE_PRIVATE);
106 | SharedPreferences.Editor editor = sp.edit();
107 | editor.remove("定义的键名");
108 | editor.apply();
109 | }
110 |
111 | public static void addTouchPoint(Context context, TouchPoint touchPoint) {
112 | List touchPoints = getTouchPoints(context);
113 | touchPoints.add(touchPoint);
114 | setTouchPoints(context, touchPoints);
115 | }
116 |
117 | public static void setTouchPoints(Context context, List touchPoints) {
118 | String string = GsonUtils.beanToJson(touchPoints);
119 | setParam(context, KEY_TOUCH_LIST, string);
120 | }
121 |
122 | public static List getTouchPoints(Context context) {
123 | String string = (String) getParam(context, KEY_TOUCH_LIST, "");
124 | if (TextUtils.isEmpty(string)) {
125 | return new ArrayList<>();
126 | }
127 | return GsonUtils.jsonToList(string, TouchPoint.class);
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhang/autotouch/utils/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package com.zhang.autotouch.utils;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.widget.Toast;
6 |
7 | public class ToastUtil {
8 |
9 | @SuppressLint("StaticFieldLeak")
10 | private static Context mContext;
11 |
12 | public static void init(Context context) {
13 | mContext = context.getApplicationContext();
14 | }
15 |
16 | public static void show(String content) {
17 | Toast.makeText(mContext, content, Toast.LENGTH_SHORT).show();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhang/autotouch/utils/WindowUtils.java:
--------------------------------------------------------------------------------
1 | package com.zhang.autotouch.utils;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.ContextWrapper;
7 | import android.content.pm.ActivityInfo;
8 | import android.content.res.Resources;
9 | import android.content.res.TypedArray;
10 | import android.graphics.PixelFormat;
11 | import android.os.Build;
12 | import android.util.Log;
13 | import android.view.View;
14 | import android.view.ViewConfiguration;
15 | import android.view.ViewGroup;
16 | import android.view.Window;
17 | import android.view.WindowManager;
18 |
19 | import java.lang.reflect.Field;
20 | import java.lang.reflect.Method;
21 |
22 | import static android.content.Context.WINDOW_SERVICE;
23 | import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
24 |
25 | /**
26 | * 屏幕工具类
27 | */
28 | public class WindowUtils {
29 |
30 | /**
31 | * 判断是否是透明背景的Activity
32 | * @param context
33 | * @return
34 | */
35 | public static boolean isTranslucentOrFloating(Context context){
36 | boolean isTranslucentOrFloating = false;
37 | try {
38 | int [] styleableRes = (int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null);
39 | final TypedArray ta = context.obtainStyledAttributes(styleableRes);
40 | Method m = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
41 | m.setAccessible(true);
42 | isTranslucentOrFloating = (boolean)m.invoke(null, ta);
43 | m.setAccessible(false);
44 | } catch (Exception e) {
45 | e.printStackTrace();
46 | }
47 | return isTranslucentOrFloating;
48 | }
49 |
50 | /**
51 | * 修复8.0以上透明背景Activity指定方向时候闪退的bug
52 | * @param activity
53 | */
54 | public static void fixOrientation(Activity activity){
55 | try {
56 | Field field = Activity.class.getDeclaredField("mActivityInfo");
57 | field.setAccessible(true);
58 | ActivityInfo o = (ActivityInfo)field.get(activity);
59 | o.screenOrientation = -1;
60 | field.setAccessible(false);
61 | } catch (Exception e) {
62 | e.printStackTrace();
63 | }
64 | }
65 |
66 | /**
67 | * 获取屏幕宽度
68 | */
69 | public static int getScreenWidth(Context context){
70 | return context.getResources().getDisplayMetrics().widthPixels;
71 | }
72 |
73 | /**
74 | * 获取屏幕高度
75 | */
76 | public static int getScreenHeight(Context context){
77 | return context.getResources().getDisplayMetrics().heightPixels;
78 | }
79 |
80 | /**
81 | * 获取虚拟按键高度
82 | * @param context
83 | * @return
84 | */
85 | public static int getNavigationBarHeight(Context context) {
86 | int result = 0;
87 | if (hasNavBar(context)) {
88 | Resources res = context.getResources();
89 | int resourceId = res.getIdentifier("navigation_bar_height", "dimen", "android");
90 | if (resourceId > 0) {
91 | result = res.getDimensionPixelSize(resourceId);
92 | }
93 | }
94 | return result;
95 | }
96 |
97 | /**
98 | * 检查是否存在虚拟按键栏
99 | * @param context
100 | */
101 | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
102 | public static boolean hasNavBar(Context context) {
103 | Resources res = context.getResources();
104 | int resourceId = res.getIdentifier("config_showNavigationBar", "bool", "android");
105 | if (resourceId != 0) {
106 | boolean hasNav = res.getBoolean(resourceId);
107 | // check override flag
108 | String sNavBarOverride = getNavBarOverride();
109 | if ("1".equals(sNavBarOverride)) {
110 | hasNav = false;
111 | } else if ("0".equals(sNavBarOverride)) {
112 | hasNav = true;
113 | }
114 | return hasNav;
115 | } else { // fallback
116 | return !ViewConfiguration.get(context).hasPermanentMenuKey();
117 | }
118 | }
119 |
120 | /**
121 | * 判断虚拟按键栏是否重写
122 | *
123 | * @return
124 | */
125 | private static String getNavBarOverride() {
126 | String sNavBarOverride = null;
127 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
128 | try {
129 | Class c = Class.forName("android.os.SystemProperties");
130 | Method m = c.getDeclaredMethod("get", String.class);
131 | m.setAccessible(true);
132 | sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys");
133 | } catch (Throwable e) {
134 | }
135 | }
136 | return sNavBarOverride;
137 | }
138 |
139 | /**
140 | * 全屏 - 隐藏状态栏和虚拟按键
141 | * @param window
142 | */
143 | public static void setHideVirtualKey(Window window) {
144 | //保持布局状态
145 | int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE|
146 | //布局位于状态栏下方
147 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION|
148 | //全屏
149 | View.SYSTEM_UI_FLAG_FULLSCREEN|
150 | //隐藏导航栏
151 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|
152 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
153 | if (Build.VERSION.SDK_INT >= 19){
154 | uiOptions |= 0x00001000;
155 | }else{
156 | uiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
157 | }
158 | window.getDecorView().setSystemUiVisibility(uiOptions);
159 | }
160 |
161 | /**
162 | * 改变屏幕亮度
163 | */
164 | /** * 设置页面的透明度 * @param bgAlpha 1表示不透明 */
165 | public static void setBackgroundAlpha(Activity activity, float bgAlpha) {
166 | WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
167 | lp.alpha = bgAlpha;
168 | if (bgAlpha == 1) {
169 | //不移除该Flag的话,在有视频的页面上的视频会出现黑屏的bug
170 | activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
171 |
172 | } else {
173 | //此行代码主要是解决在华为手机上半透明效果无效的bug
174 | activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
175 | }
176 | activity.getWindow().setAttributes(lp);
177 | }
178 |
179 | /**
180 | * 获取状态栏高度
181 | */
182 | public static int getStatusBarHeight(Context context) {
183 | int statusBarHeight = 0;
184 | Resources res = context.getResources();
185 | int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
186 | if (resourceId > 0) {
187 | statusBarHeight = res.getDimensionPixelSize(resourceId);
188 | }
189 | return statusBarHeight;
190 | }
191 |
192 | /**
193 | * 将View全屏
194 | * @param context
195 | * @param view
196 | */
197 | public static void enterFullScreen(Context context, View view){
198 | //从原有的View中取出来
199 | ViewGroup parent = (ViewGroup) view.getParent();
200 | if (parent != null) {
201 | parent.removeView(view);
202 | }
203 |
204 | //找到父布局
205 | ViewGroup contentView = scanForActivity(context)
206 | .findViewById(android.R.id.content);
207 |
208 | //添加到父布局中
209 | ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
210 | MATCH_PARENT,MATCH_PARENT);
211 | contentView.addView(view,params);
212 | }
213 |
214 | /**
215 | * 将View退出全屏
216 | */
217 | public static void exitFullScreen(Context context, View view){
218 | //找到父布局
219 | ViewGroup contentView = scanForActivity(context)
220 | .findViewById(android.R.id.content);
221 | contentView.removeView(view);
222 | }
223 |
224 | private static Activity scanForActivity(Context cont) {
225 | if (cont == null) {
226 | Log.d("scanForActivity","cont == null");
227 | return null;
228 | } else if (cont instanceof Activity) {
229 | Log.d("scanForActivity","Activity");
230 | return (Activity) cont;
231 | } else if (cont instanceof ContextWrapper) {
232 | Log.d("scanForActivity","ContextWrapper");
233 | return scanForActivity(((ContextWrapper) cont).getBaseContext());
234 | }
235 | Log.d("scanForActivity","not result");
236 | return null;
237 | }
238 |
239 | public static WindowManager.LayoutParams newWmParams(int width, int height) {
240 | WindowManager.LayoutParams params = new WindowManager.LayoutParams();
241 | params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
242 | | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
243 | | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
244 | | WindowManager.LayoutParams.FLAG_SCALED
245 | | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
246 | | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
247 | if (Build.VERSION.SDK_INT >= 26) {
248 | params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
249 | } else {
250 | params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
251 | }
252 | params.width = width;
253 | params.height = height;
254 | params.format = PixelFormat.TRANSLUCENT;
255 | return params;
256 | }
257 |
258 | public static WindowManager getWindowManager(Context context) {
259 | return (WindowManager) context.getSystemService(WINDOW_SERVICE);
260 | }
261 | }
262 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_bg_touch.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_bt_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_dialog_menu_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
22 |
23 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_add_point.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
25 |
26 |
33 |
34 |
45 |
46 |
57 |
58 |
70 |
71 |
83 |
84 |
91 |
92 |
98 |
99 |
100 |
112 |
113 |
123 |
124 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
27 |
28 |
38 |
39 |
49 |
50 |
60 |
61 |
71 |
72 |
73 |
74 |
79 |
80 |
90 |
91 |
92 |
93 |
99 |
100 |
105 |
106 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_record.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_touch_point.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
33 |
34 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_window.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/window_touch_point.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/damonlear/AutoTouch/8da4460070fa69eaa4bb70fce9b13ba1e5f55b77/app/src/main/res/mipmap/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 | #66000000
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 自动点赞助手
3 | 开启该权限才能正常使用自动触控功能
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/accessibility_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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 | google()
6 | maven { url'http://maven.aliyun.com/nexus/content/groups/public/' }
7 | maven { url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.3'
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | maven { url'http://maven.aliyun.com/nexus/content/groups/public/' }
18 | maven { url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/damonlear/AutoTouch/8da4460070fa69eaa4bb70fce9b13ba1e5f55b77/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Sep 06 15:36:27 CST 2019
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-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
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 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name='AutoTouch'
3 |
--------------------------------------------------------------------------------