├── .gitignore ├── ImageGestures.iml ├── README.md ├── app ├── app.iml ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bornander │ │ ├── gestures │ │ ├── GesturesActivity.java │ │ ├── SandboxView.java │ │ └── TouchManager.java │ │ └── math │ │ └── Vector2D.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-ldpi │ └── ic_launcher.png │ ├── drawable-mdpi │ ├── advert.png │ └── ic_launcher.png │ ├── layout │ └── main.xml │ └── values │ └── strings.xml ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── import-summary.txt └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /app/build 3 | /.gradle 4 | /.idea 5 | local.properties 6 | -------------------------------------------------------------------------------- /ImageGestures.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImageGesture 2 | Zoom, Rotate and Drag on ImageView 3 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 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 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.bornander.gestures" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | } 12 | 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/bornander/gestures/GesturesActivity.java: -------------------------------------------------------------------------------- 1 | package com.bornander.gestures; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | 9 | public class GesturesActivity extends Activity { 10 | 11 | @Override 12 | public void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | 15 | Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.advert); 16 | View view = new SandboxView(this, bitmap); 17 | 18 | setContentView(view); 19 | } 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/bornander/gestures/SandboxView.java: -------------------------------------------------------------------------------- 1 | package com.bornander.gestures; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Matrix; 7 | import android.graphics.Paint; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.View.OnTouchListener; 11 | 12 | import com.bornander.math.Vector2D; 13 | 14 | public class SandboxView extends View implements OnTouchListener { 15 | 16 | private final Bitmap bitmap; 17 | private final int width; 18 | private final int height; 19 | private Matrix transform = new Matrix(); 20 | 21 | private Vector2D position = new Vector2D(); 22 | private float scale = 1; 23 | private float angle = 0; 24 | 25 | private TouchManager touchManager = new TouchManager(2); 26 | private boolean isInitialized = false; 27 | 28 | // Debug helpers to draw lines between the two touch points 29 | private Vector2D vca = null; 30 | private Vector2D vcb = null; 31 | private Vector2D vpa = null; 32 | private Vector2D vpb = null; 33 | 34 | public SandboxView(Context context, Bitmap bitmap) { 35 | super(context); 36 | 37 | this.bitmap = bitmap; 38 | this.width = bitmap.getWidth(); 39 | this.height = bitmap.getHeight(); 40 | 41 | setOnTouchListener(this); 42 | } 43 | 44 | 45 | private static float getDegreesFromRadians(float angle) { 46 | return (float)(angle * 180.0 / Math.PI); 47 | } 48 | 49 | @Override 50 | protected void onDraw(Canvas canvas) { 51 | super.onDraw(canvas); 52 | 53 | if (!isInitialized) { 54 | int w = getWidth(); 55 | int h = getHeight(); 56 | position.set(w / 2, h / 2); 57 | isInitialized = true; 58 | } 59 | 60 | Paint paint = new Paint(); 61 | 62 | transform.reset(); 63 | transform.postTranslate(-width / 2.0f, -height / 2.0f); 64 | transform.postRotate(getDegreesFromRadians(angle)); 65 | transform.postScale(scale, scale); 66 | transform.postTranslate(position.getX(), position.getY()); 67 | 68 | canvas.drawBitmap(bitmap, transform, paint); 69 | 70 | try { 71 | /*paint.setColor(0xFF007F00); 72 | canvas.drawCircle(vca.getX(), vca.getY(), 64, paint); 73 | paint.setColor(0xFF7F0000); 74 | canvas.drawCircle(vcb.getX(), vcb.getY(), 64, paint); 75 | 76 | paint.setColor(0xFFFF0000); 77 | canvas.drawLine(vpa.getX(), vpa.getY(), vpb.getX(), vpb.getY(), paint); 78 | paint.setColor(0xFF00FF00); 79 | canvas.drawLine(vca.getX(), vca.getY(), vcb.getX(), vcb.getY(), paint);*/ 80 | } 81 | catch(NullPointerException e) { 82 | // Just being lazy here... 83 | } 84 | } 85 | 86 | 87 | @Override 88 | public boolean onTouch(View v, MotionEvent event) { 89 | vca = null; 90 | vcb = null; 91 | vpa = null; 92 | vpb = null; 93 | 94 | try { 95 | touchManager.update(event); 96 | 97 | if (touchManager.getPressCount() == 1) { 98 | vca = touchManager.getPoint(0); 99 | vpa = touchManager.getPreviousPoint(0); 100 | position.add(touchManager.moveDelta(0)); 101 | } 102 | else { 103 | if (touchManager.getPressCount() == 2) { 104 | vca = touchManager.getPoint(0); 105 | vpa = touchManager.getPreviousPoint(0); 106 | vcb = touchManager.getPoint(1); 107 | vpb = touchManager.getPreviousPoint(1); 108 | 109 | Vector2D current = touchManager.getVector(0, 1); 110 | Vector2D previous = touchManager.getPreviousVector(0, 1); 111 | float currentDistance = current.getLength(); 112 | float previousDistance = previous.getLength(); 113 | 114 | if (previousDistance != 0) { 115 | scale *= currentDistance / previousDistance; 116 | } 117 | 118 | angle -= Vector2D.getSignedAngleBetween(current, previous); 119 | } 120 | } 121 | 122 | invalidate(); 123 | } 124 | catch(Throwable t) { 125 | // So lazy... 126 | } 127 | return true; 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /app/src/main/java/com/bornander/gestures/TouchManager.java: -------------------------------------------------------------------------------- 1 | package com.bornander.gestures; 2 | 3 | import android.view.MotionEvent; 4 | 5 | import com.bornander.math.Vector2D; 6 | 7 | public class TouchManager { 8 | 9 | private final int maxNumberOfTouchPoints; 10 | 11 | private final Vector2D[] points; 12 | private final Vector2D[] previousPoints; 13 | 14 | public TouchManager(final int maxNumberOfTouchPoints) { 15 | this.maxNumberOfTouchPoints = maxNumberOfTouchPoints; 16 | 17 | points = new Vector2D[maxNumberOfTouchPoints]; 18 | previousPoints = new Vector2D[maxNumberOfTouchPoints]; 19 | } 20 | 21 | public boolean isPressed(int index) { 22 | return points[index] != null; 23 | } 24 | 25 | public int getPressCount() { 26 | int count = 0; 27 | for(Vector2D point : points) { 28 | if (point != null) 29 | ++count; 30 | } 31 | return count; 32 | } 33 | 34 | public Vector2D moveDelta(int index) { 35 | 36 | if (isPressed(index)) { 37 | Vector2D previous = previousPoints[index] != null ? previousPoints[index] : points[index]; 38 | return Vector2D.subtract(points[index], previous); 39 | } 40 | else { 41 | return new Vector2D(); 42 | } 43 | } 44 | 45 | private static Vector2D getVector(Vector2D a, Vector2D b) { 46 | if (a == null || b == null) 47 | throw new RuntimeException("can't do this on nulls"); 48 | 49 | return Vector2D.subtract(b, a); 50 | } 51 | 52 | public Vector2D getPoint(int index) { 53 | return points[index] != null ? points[index] : new Vector2D(); 54 | } 55 | 56 | public Vector2D getPreviousPoint(int index) { 57 | return previousPoints[index] != null ? previousPoints[index] : new Vector2D(); 58 | } 59 | 60 | public Vector2D getVector(int indexA, int indexB) { 61 | return getVector(points[indexA], points[indexB]); 62 | } 63 | 64 | public Vector2D getPreviousVector(int indexA, int indexB) { 65 | if (previousPoints[indexA] == null || previousPoints[indexB] == null) 66 | return getVector(points[indexA], points[indexB]); 67 | else 68 | return getVector(previousPoints[indexA], previousPoints[indexB]); 69 | } 70 | 71 | public void update(MotionEvent event) { 72 | int actionCode = event.getAction() & MotionEvent.ACTION_MASK; 73 | 74 | if (actionCode == MotionEvent.ACTION_POINTER_UP || actionCode == MotionEvent.ACTION_UP) { 75 | int index = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT; 76 | previousPoints[index] = points[index] = null; 77 | } 78 | else { 79 | for(int i = 0; i < maxNumberOfTouchPoints; ++i) { 80 | if (i < event.getPointerCount()) { 81 | int index = event.getPointerId(i); 82 | 83 | Vector2D newPoint = new Vector2D(event.getX(i), event.getY(i)); 84 | 85 | if (points[index] == null) 86 | points[index] = newPoint; 87 | else { 88 | if (previousPoints[index] != null) { 89 | previousPoints[index].set(points[index]); 90 | } 91 | else { 92 | previousPoints[index] = new Vector2D(newPoint); 93 | 94 | } 95 | 96 | if (Vector2D.subtract(points[index], newPoint).getLength() < 64) 97 | points[index].set(newPoint); 98 | } 99 | } 100 | else { 101 | previousPoints[i] = points[i] = null; 102 | } 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /app/src/main/java/com/bornander/math/Vector2D.java: -------------------------------------------------------------------------------- 1 | package com.bornander.math; 2 | 3 | public class Vector2D { 4 | 5 | private float x; 6 | private float y; 7 | 8 | public Vector2D() { 9 | } 10 | 11 | public Vector2D(Vector2D v) { 12 | this.x = v.x; 13 | this.y = v.y; 14 | } 15 | 16 | public Vector2D(float x, float y) { 17 | this.x = x; 18 | this.y = y; 19 | } 20 | 21 | public float getX() { 22 | return x; 23 | } 24 | 25 | public float getY() { 26 | return y; 27 | } 28 | 29 | public float getLength() { 30 | return (float)Math.sqrt(x * x + y * y); 31 | } 32 | 33 | public Vector2D set(Vector2D other) { 34 | x = other.getX(); 35 | y = other.getY(); 36 | return this; 37 | } 38 | 39 | public Vector2D set(float x, float y) { 40 | this.x = x; 41 | this.y = y; 42 | return this; 43 | } 44 | 45 | public Vector2D add(Vector2D value) { 46 | this.x += value.getX(); 47 | this.y += value.getY(); 48 | return this; 49 | } 50 | 51 | public static Vector2D subtract(Vector2D lhs, Vector2D rhs) { 52 | return new Vector2D(lhs.x - rhs.x, lhs.y - rhs.y); 53 | } 54 | 55 | public static float getDistance(Vector2D lhs, Vector2D rhs) { 56 | Vector2D delta = Vector2D.subtract(lhs, rhs); 57 | return delta.getLength(); 58 | } 59 | 60 | public static float getSignedAngleBetween(Vector2D a, Vector2D b) { 61 | Vector2D na = getNormalized(a); 62 | Vector2D nb = getNormalized(b); 63 | 64 | return (float)(Math.atan2(nb.y, nb.x) - Math.atan2(na.y, na.x)); 65 | } 66 | 67 | public static Vector2D getNormalized(Vector2D v) { 68 | float l = v.getLength(); 69 | if (l == 0) 70 | return new Vector2D(); 71 | else 72 | return new Vector2D(v.x / l, v.y / l); 73 | 74 | } 75 | 76 | @Override 77 | public String toString() { 78 | return String.format("(%.4f, %.4f)", x, y); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techierishi/ImageGesture/a870f4e11a2a3c4f13cc494824994bf6de9fef8a/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techierishi/ImageGesture/a870f4e11a2a3c4f13cc494824994bf6de9fef8a/app/src/main/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/advert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techierishi/ImageGesture/a870f4e11a2a3c4f13cc494824994bf6de9fef8a/app/src/main/res/drawable-mdpi/advert.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techierishi/ImageGesture/a870f4e11a2a3c4f13cc494824994bf6de9fef8a/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Gestures 6 | 7 | 8 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:1.3.0' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techierishi/ImageGesture/a870f4e11a2a3c4f13cc494824994bf6de9fef8a/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 | -------------------------------------------------------------------------------- /import-summary.txt: -------------------------------------------------------------------------------- 1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY 2 | ====================================== 3 | 4 | Ignored Files: 5 | -------------- 6 | The following files were *not* copied into the new Gradle project; you 7 | should evaluate whether these are still needed in your project and if 8 | so manually move them: 9 | 10 | * proguard.cfg 11 | 12 | Moved Files: 13 | ------------ 14 | Android Gradle projects use a different directory structure than ADT 15 | Eclipse projects. Here's how the projects were restructured: 16 | 17 | * AndroidManifest.xml => app\src\main\AndroidManifest.xml 18 | * assets\ => app\src\main\assets 19 | * res\ => app\src\main\res\ 20 | * src\ => app\src\main\java\ 21 | 22 | Next Steps: 23 | ----------- 24 | You can now build the project. The Gradle project needs network 25 | connectivity to download dependencies. 26 | 27 | Bugs: 28 | ----- 29 | If for some reason your project does not build, and you determine that 30 | it is due to a bug or limitation of the Eclipse to Gradle importer, 31 | please file a bug at http://b.android.com with category 32 | Component-Tools. 33 | 34 | (This import summary is for your information only, and can be deleted 35 | after import once you are satisfied with the results.) 36 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------