├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values
│ │ │ └── strings.xml
│ │ └── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── rect_activity_main.xml
│ │ │ └── round_activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── hookedonplay
│ │ └── androidbycode
│ │ └── androidwearqrgenerator
│ │ ├── GenerateQR.java
│ │ └── MainActivity.java
├── proguard-rules.pro
├── build.gradle
└── app.iml
├── settings.gradle
├── .gitignore
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── README.md
├── gradle.properties
├── AndroidWearQRGenerator.iml
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmarrdev/AndroidWearQRGenerator/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmarrdev/AndroidWearQRGenerator/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmarrdev/AndroidWearQRGenerator/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmarrdev/AndroidWearQRGenerator/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmarrdev/AndroidWearQRGenerator/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidWearQRGenerator
2 | Generate and display QR codes on square or round Android Wear devices
3 |
4 | For a full run down on what this project does and how it works, please visit:
5 |
6 | https://androidbycode.wordpress.com/2015/02/09/generating-and-displaying-qr-codes-on-android-wear-devices/
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Android Wear QR Generator
4 | Touch to generate a QR code (round device)
5 | Touch to generate a QR code (square device)
6 | https://androidbycode.wordpress.com/
7 | Unable to generate QR Code
8 | QR Code Image
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/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 /home/brent/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/AndroidWearQRGenerator.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 |
4 | android {
5 | compileSdkVersion 21
6 | buildToolsVersion "21.1.2"
7 |
8 | defaultConfig {
9 | applicationId "com.hookedonplay.androidbycode.androidwearqrgenerator"
10 | minSdkVersion 20
11 | targetSdkVersion 21
12 | versionCode 1
13 | versionName "1.0"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | repositories {
24 | mavenCentral()
25 |
26 | maven {
27 | url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
28 | }
29 | }
30 |
31 | dependencies {
32 | compile fileTree(dir: 'libs', include: ['*.jar'])
33 | compile 'com.google.android.support:wearable:1.1.0'
34 | compile 'com.google.android.gms:play-services-wearable:6.5.87'
35 | // zxing support for API level 15 and up
36 | compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
37 | compile 'com.google.zxing:core:3.0.1'
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rect_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
24 |
25 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/round_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
24 |
25 |
32 |
33 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hookedonplay/androidbycode/androidwearqrgenerator/GenerateQR.java:
--------------------------------------------------------------------------------
1 | package com.hookedonplay.androidbycode.androidwearqrgenerator;
2 |
3 | import java.util.EnumMap;
4 | import java.util.Map;
5 |
6 | import android.graphics.Bitmap;
7 | import android.os.Looper;
8 | import android.support.annotation.NonNull;
9 |
10 | import com.google.zxing.BarcodeFormat;
11 | import com.google.zxing.EncodeHintType;
12 | import com.google.zxing.MultiFormatWriter;
13 | import com.google.zxing.WriterException;
14 | import com.google.zxing.common.BitMatrix;
15 |
16 | /**
17 | * Created by HookedOnPlay on 20150206
18 | *
19 | * QR Code generator using the zxing engine
20 | */
21 | public class GenerateQR {
22 |
23 | /**
24 | * Allow the zxing engine use the default argument for the margin variable
25 | */
26 | static public int MARGIN_AUTOMATIC = -1;
27 |
28 | /**
29 | * Set no margin to be added to the QR code by the zxing engine
30 | */
31 | static public int MARGIN_NONE = 0;
32 |
33 | /**
34 | * Encode a string into a QR Code and return a bitmap image of the QR code
35 | *
36 | * @param contentsToEncode String to be encoded, this will often be a URL, but could be any string
37 | * @param imageWidth number of pixels in width for the resultant image
38 | * @param imageHeight number of pixels in height for the resultant image
39 | * @param marginSize the EncodeHintType.MARGIN parameter into zxing engine
40 | * @param color data color for QR code
41 | * @param colorBack background color for QR code
42 | * @return bitmap containing QR code image
43 | * @throws WriterException zxing engine is unable to create QR code data
44 | * @throws IllegalStateException when executed on the UI thread
45 | */
46 | static public Bitmap generateBitmap(@NonNull String contentsToEncode,
47 | int imageWidth, int imageHeight,
48 | int marginSize, int color, int colorBack)
49 | throws WriterException, IllegalStateException {
50 |
51 | if (Looper.myLooper() == Looper.getMainLooper()) {
52 | throw new IllegalStateException("Should not be invoked from the UI thread");
53 | }
54 |
55 | Map hints = null;
56 | if (marginSize != MARGIN_AUTOMATIC) {
57 | hints = new EnumMap<>(EncodeHintType.class);
58 | // We want to generate with a custom margin size
59 | hints.put(EncodeHintType.MARGIN, marginSize);
60 | }
61 |
62 | MultiFormatWriter writer = new MultiFormatWriter();
63 | BitMatrix result = writer.encode(contentsToEncode, BarcodeFormat.QR_CODE, imageWidth, imageHeight, hints);
64 |
65 | final int width = result.getWidth();
66 | final int height = result.getHeight();
67 | int[] pixels = new int[width * height];
68 | for (int y = 0; y < height; y++) {
69 | int offset = y * width;
70 | for (int x = 0; x < width; x++) {
71 | pixels[offset + x] = result.get(x, y) ? color : colorBack;
72 | }
73 | }
74 |
75 | Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
76 | bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
77 | return bitmap;
78 | }
79 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hookedonplay/androidbycode/androidwearqrgenerator/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.hookedonplay.androidbycode.androidwearqrgenerator;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Color;
6 | import android.os.AsyncTask;
7 | import android.os.Bundle;
8 | import android.support.wearable.view.WatchViewStub;
9 | import android.util.Log;
10 | import android.view.View;
11 | import android.widget.ImageView;
12 | import android.widget.ProgressBar;
13 | import android.widget.TextView;
14 |
15 | import com.google.zxing.WriterException;
16 |
17 | /**
18 | * Created by HookedOnPlay on 20150206
19 | *
20 | * Generate and display QR codes correctly on round and square Android Wear devices
21 | */
22 | public class MainActivity extends Activity {
23 | private static final String TAG = "MainActivity";
24 |
25 | private String mEncodeString;
26 | private TextView mTextDesc;
27 | private ImageView mImageQR;
28 | private ProgressBar mProgress;
29 | private Bitmap mBitmapQR;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_main);
35 | final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
36 | stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
37 | @Override
38 | public void onLayoutInflated(WatchViewStub stub) {
39 | mTextDesc = (TextView) stub.findViewById(R.id.textDesc);
40 | mImageQR = (ImageView) stub.findViewById(R.id.imageQR);
41 | mProgress = (ProgressBar) stub.findViewById(R.id.progressGenerate);
42 | }
43 | });
44 | }
45 |
46 | public void onClickGenerateRound(View view) {
47 | mEncodeString = getString(R.string.string_to_encode);
48 | mTextDesc.setVisibility(View.GONE);
49 | mProgress.setVisibility(View.VISIBLE);
50 | new AsyncGenerateQRCode().execute(GenerateQR.MARGIN_NONE);
51 | }
52 |
53 | public void onClickGenerateSquare(View view) {
54 | mEncodeString = getString(R.string.string_to_encode);
55 | mTextDesc.setVisibility(View.GONE);
56 | mProgress.setVisibility(View.VISIBLE);
57 | new AsyncGenerateQRCode().execute(GenerateQR.MARGIN_AUTOMATIC);
58 | }
59 |
60 | /**
61 | * AsyncTask to generate QR Code image
62 | */
63 | private class AsyncGenerateQRCode extends AsyncTask {
64 |
65 | /**
66 | * Background thread function to generate image
67 | *
68 | * @param params margin to use in creating QR Code
69 | * @return non zero for success
70 | *
71 | * Note that is margin is not in pixels. See the zxing api for details about the margin
72 | * for QR code generation
73 | */
74 | @Override
75 | protected Integer doInBackground(Integer... params) {
76 | if (params.length != 1) {
77 | throw new IllegalArgumentException("Must pass QR Code margin value as argument");
78 | }
79 |
80 | try {
81 | final int colorQR = Color.BLACK;
82 | final int colorBackQR = Color.WHITE;
83 | final int marginSize = params[0];
84 | final int width = 400;
85 | final int height = 400;
86 |
87 | mBitmapQR = GenerateQR.generateBitmap(mEncodeString, width, height,
88 | marginSize, colorQR, colorBackQR);
89 | }
90 | catch (IllegalArgumentException iae) {
91 | Log.e(TAG, "Invalid arguments for encoding QR");
92 | iae.printStackTrace();
93 | return 0;
94 | }
95 | catch (WriterException we) {
96 | Log.e(TAG, "QR Writer unable to generate code");
97 | we.printStackTrace();
98 | return 0;
99 | }
100 | return 1;
101 | }
102 |
103 | @Override
104 | protected void onPostExecute(Integer result) {
105 | mProgress.setVisibility(View.GONE);
106 | if (result != 0) {
107 | mImageQR.setImageBitmap(mBitmapQR);
108 | mImageQR.setVisibility(View.VISIBLE);
109 | }else {
110 | mTextDesc.setText(getString(R.string.encode_error));
111 | mTextDesc.setVisibility(View.VISIBLE);
112 | }
113 | }
114 |
115 | @Override
116 | protected void onPreExecute() {}
117 |
118 | @Override
119 | protected void onProgressUpdate(Void... values) {}
120 | }
121 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------