├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── example-app.png ├── google-services.json ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ahmadrosid │ │ └── drawroutemaps │ │ └── ExampleInstrumentedTest.java │ ├── debug │ └── res │ │ └── values │ │ └── google_maps_api.xml │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── ahmadrosid │ │ │ └── drawroutemaps │ │ │ └── MapsActivity.java │ └── res │ │ ├── drawable │ │ ├── marker_a.png │ │ └── marker_b.png │ │ ├── layout │ │ └── activity_maps.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── release │ └── res │ │ └── values │ │ └── google_maps_api.xml │ └── test │ └── java │ └── com │ └── ahmadrosid │ └── drawroutemaps │ └── ExampleUnitTest.java ├── build.gradle ├── drawroutemap ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ahmadrosid │ │ └── lib │ │ └── drawroutemap │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── ahmadrosid │ │ │ └── lib │ │ │ └── drawroutemap │ │ │ ├── DataRouteParser.java │ │ │ ├── DrawMarker.java │ │ │ ├── DrawRoute.java │ │ │ ├── DrawRouteMaps.java │ │ │ ├── FetchUrl.java │ │ │ └── RouteDrawerTask.java │ └── res │ │ └── values │ │ ├── colors.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── ahmadrosid │ └── lib │ └── drawroutemap │ └── ExampleUnitTest.java ├── example-app.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.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 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DrawRouteMaps 2 | If you want to add route maps feature in your apps you can use DrawRouteMaps to make you work more easier. This is lib will help you to draw route maps between two point LatLng. 3 | 4 | ![alt tag](https://github.com/ar-android/DrawRouteMaps/raw/master/example-app.png) 5 | 6 | # Usage 7 | Make sure your app have allready enable Google Map API and Google Direction API. Then you can use this library and follow this task to integrate DrawRouteMaps into your project. 8 | 9 | Add support jitpact repository in root build.gradle at the end of repositories: 10 | ```gradle 11 | allprojects { 12 | repositories { 13 | maven { url "https://jitpack.io" } 14 | } 15 | } 16 | ``` 17 | Add dependencies : 18 | ```gradle 19 | dependencies { 20 | compile 'com.github.ar-android:DrawRouteMaps:1.0.0' 21 | } 22 | ``` 23 | 24 | In Your GoogleMap Ready 25 | ----- 26 | ```java 27 | @Override 28 | public void onMapReady(GoogleMap googleMap) { 29 | mMap = googleMap; 30 | LatLng origin = new LatLng(-7.788969, 110.338382); 31 | LatLng destination = new LatLng(-7.781200, 110.349709); 32 | DrawRouteMaps.getInstance(this) 33 | .draw(origin, destination, mMap); 34 | DrawMarker.getInstance(this).draw(mMap, origin, R.drawable.marker_a, "Origin Location"); 35 | DrawMarker.getInstance(this).draw(mMap, destination, R.drawable.marker_b, "Destination Location"); 36 | 37 | LatLngBounds bounds = new LatLngBounds.Builder() 38 | .include(origin) 39 | .include(destination).build(); 40 | Point displaySize = new Point(); 41 | getWindowManager().getDefaultDisplay().getSize(displaySize); 42 | mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, displaySize.x, 250, 30)); 43 | } 44 | ``` 45 | If you want to change color of line route just add this in your resource 46 | ```xml 47 | #FF4081 48 | ``` 49 | 50 | # License 51 | 52 | Copyright 2017 Ahmad Rosid 53 | 54 | Licensed under the Apache License, Version 2.0 (the "License"); 55 | you may not use this file except in compliance with the License. 56 | You may obtain a copy of the License at 57 | 58 | http://www.apache.org/licenses/LICENSE-2.0 59 | 60 | Unless required by applicable law or agreed to in writing, software 61 | distributed under the License is distributed on an "AS IS" BASIS, 62 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 63 | See the License for the specific language governing permissions and 64 | limitations under the License. 65 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.ahmadrosid.drawroutemaps" 7 | minSdkVersion 14 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | implementation fileTree(include: ['*.jar'], dir: 'libs') 22 | implementation "com.android.support:appcompat-v7:$support_version" 23 | implementation "com.android.support:support-v4:$support_version" 24 | implementation "com.android.support:animated-vector-drawable:$support_version" 25 | implementation "com.android.support:support-media-compat:$support_version" 26 | implementation "com.google.android.gms:play-services-maps:$play_service_version" 27 | implementation project(':drawroutemap') 28 | } 29 | 30 | apply plugin: 'com.google.gms.google-services' -------------------------------------------------------------------------------- /app/example-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/example-app.png -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "305668264758", 4 | "firebase_url": "https://drawroutemaps-149418.firebaseio.com", 5 | "project_id": "drawroutemaps-149418", 6 | "storage_bucket": "drawroutemaps-149418.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:305668264758:android:3bad4ee622a8f607", 12 | "android_client_info": { 13 | "package_name": "com.ahmadrosid.drawroutemaps" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "305668264758-8uenjb17fl3c03c7htosbgup49r9l98b.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.ahmadrosid.drawroutemaps", 22 | "certificate_hash": "4A842D89BECA5CB3444A15214CB18EEC86142AC9" 23 | } 24 | }, 25 | { 26 | "client_id": "305668264758-u4riail7o7qek0045qa73djc286ih69d.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyD8meg6icPk1u6x4uszx2Wn6ZS3ZmcaQP8" 33 | } 34 | ], 35 | "services": { 36 | "analytics_service": { 37 | "status": 1 38 | }, 39 | "appinvite_service": { 40 | "status": 2, 41 | "other_platform_oauth_client": [ 42 | { 43 | "client_id": "305668264758-u4riail7o7qek0045qa73djc286ih69d.apps.googleusercontent.com", 44 | "client_type": 3 45 | } 46 | ] 47 | }, 48 | "ads_service": { 49 | "status": 2 50 | } 51 | } 52 | } 53 | ], 54 | "configuration_version": "1" 55 | } -------------------------------------------------------------------------------- /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/tarGz/Library/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/androidTest/java/com/ahmadrosid/drawroutemaps/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.drawroutemaps; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.ahmadrosid.drawroutemaps", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/debug/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | AIzaSyC4E53k6embk76ivZwoZp8h37H35cI5gdU 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/ahmadrosid/drawroutemaps/MapsActivity.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.drawroutemaps; 2 | 3 | import android.graphics.Point; 4 | import android.os.Bundle; 5 | import android.support.v4.app.FragmentActivity; 6 | 7 | import com.ahmadrosid.lib.drawroutemap.DrawMarker; 8 | import com.ahmadrosid.lib.drawroutemap.DrawRouteMaps; 9 | import com.google.android.gms.maps.CameraUpdateFactory; 10 | import com.google.android.gms.maps.GoogleMap; 11 | import com.google.android.gms.maps.OnMapReadyCallback; 12 | import com.google.android.gms.maps.SupportMapFragment; 13 | import com.google.android.gms.maps.model.LatLng; 14 | import com.google.android.gms.maps.model.LatLngBounds; 15 | 16 | public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { 17 | 18 | private GoogleMap mMap; 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_maps); 24 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 25 | .findFragmentById(R.id.map); 26 | mapFragment.getMapAsync(this); 27 | } 28 | 29 | @Override 30 | public void onMapReady(GoogleMap googleMap) { 31 | mMap = googleMap; 32 | LatLng origin = new LatLng(-7.788969, 110.338382); 33 | LatLng destination = new LatLng(-7.781200, 110.349709); 34 | DrawRouteMaps.getInstance(this) 35 | .draw(origin, destination, mMap); 36 | DrawMarker.getInstance(this).draw(mMap, origin, R.drawable.marker_a, "Origin Location"); 37 | DrawMarker.getInstance(this).draw(mMap, destination, R.drawable.marker_b, "Destination Location"); 38 | 39 | LatLngBounds bounds = new LatLngBounds.Builder() 40 | .include(origin) 41 | .include(destination).build(); 42 | Point displaySize = new Point(); 43 | getWindowManager().getDefaultDisplay().getSize(displaySize); 44 | mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, displaySize.x, 250, 30)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/marker_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/drawable/marker_a.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/marker_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/drawable/marker_b.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_maps.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | @color/colorAccent 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DrawRouteMaps 3 | Map 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/release/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | YOUR_KEY_HERE 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/test/java/com/ahmadrosid/drawroutemaps/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.drawroutemaps; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.support_version = '27.0.2' 3 | ext.play_service_version = '11.8.0' 4 | repositories { 5 | jcenter() 6 | maven { 7 | url 'https://maven.google.com/' 8 | } 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.0.1' 12 | classpath 'com.google.gms:google-services:3.1.1' 13 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | jcenter() 20 | google() 21 | maven { 22 | url 'https://maven.google.com/' 23 | } 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /drawroutemap/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /drawroutemap/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | android { 5 | compileSdkVersion 27 6 | defaultConfig { 7 | minSdkVersion 14 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | implementation "com.android.support:appcompat-v7:$support_version" 22 | implementation "com.android.support:support-v4:$support_version" 23 | implementation "com.android.support:animated-vector-drawable:$support_version" 24 | implementation "com.android.support:support-media-compat:$support_version" 25 | implementation "com.google.android.gms:play-services-maps:$play_service_version" 26 | } 27 | -------------------------------------------------------------------------------- /drawroutemap/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/tarGz/Library/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 | -------------------------------------------------------------------------------- /drawroutemap/src/androidTest/java/com/ahmadrosid/lib/drawroutemap/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.ahmadrosid.lib.drawroutemap.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /drawroutemap/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /drawroutemap/src/main/java/com/ahmadrosid/lib/drawroutemap/DataRouteParser.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import com.google.android.gms.maps.model.LatLng; 4 | 5 | import org.json.JSONArray; 6 | import org.json.JSONException; 7 | import org.json.JSONObject; 8 | 9 | import java.util.ArrayList; 10 | import java.util.HashMap; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by ocittwo on 11/14/16. 15 | * 16 | * @Author Ahmad Rosid 17 | * @Email ocittwo@gmail.com 18 | * @Github https://github.com/ar-android 19 | * @Web http://ahmadrosid.com 20 | */ 21 | public class DataRouteParser { 22 | 23 | /** 24 | * Receives a JSONObject and returns a list of lists containing latitude and longitude 25 | */ 26 | public List>> parse(JSONObject jObject) { 27 | 28 | List>> routes = new ArrayList<>(); 29 | JSONArray jRoutes; 30 | JSONArray jLegs; 31 | JSONArray jSteps; 32 | 33 | try { 34 | 35 | jRoutes = jObject.getJSONArray("routes"); 36 | 37 | /** Traversing all routes */ 38 | for (int i = 0; i < jRoutes.length(); i++) { 39 | jLegs = ((JSONObject) jRoutes.get(i)).getJSONArray("legs"); 40 | List path = new ArrayList<>(); 41 | 42 | /** Traversing all legs */ 43 | for (int j = 0; j < jLegs.length(); j++) { 44 | jSteps = ((JSONObject) jLegs.get(j)).getJSONArray("steps"); 45 | 46 | /** Traversing all steps */ 47 | for (int k = 0; k < jSteps.length(); k++) { 48 | String polyline = ""; 49 | polyline = (String) ((JSONObject) ((JSONObject) jSteps.get(k)).get("polyline")).get("points"); 50 | List list = decodePoly(polyline); 51 | 52 | /** Traversing all points */ 53 | for (int l = 0; l < list.size(); l++) { 54 | HashMap hm = new HashMap<>(); 55 | hm.put("lat", Double.toString((list.get(l)).latitude)); 56 | hm.put("lng", Double.toString((list.get(l)).longitude)); 57 | path.add(hm); 58 | } 59 | } 60 | routes.add(path); 61 | } 62 | } 63 | 64 | } catch (JSONException e) { 65 | e.printStackTrace(); 66 | } catch (Exception e) { 67 | e.printStackTrace(); 68 | } 69 | return routes; 70 | } 71 | 72 | /** 73 | * Method to decode polyline points 74 | * Courtesy : http://jeffreysambells.com/2010/05/27/decoding-polylines-from-google-maps-direction-api-with-java 75 | */ 76 | private List decodePoly(String encoded) { 77 | 78 | List poly = new ArrayList<>(); 79 | int index = 0, len = encoded.length(); 80 | int lat = 0, lng = 0; 81 | 82 | while (index < len) { 83 | int b, shift = 0, result = 0; 84 | do { 85 | b = encoded.charAt(index++) - 63; 86 | result |= (b & 0x1f) << shift; 87 | shift += 5; 88 | } while (b >= 0x20); 89 | int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); 90 | lat += dlat; 91 | 92 | shift = 0; 93 | result = 0; 94 | do { 95 | b = encoded.charAt(index++) - 63; 96 | result |= (b & 0x1f) << shift; 97 | shift += 5; 98 | } while (b >= 0x20); 99 | int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); 100 | lng += dlng; 101 | 102 | LatLng p = new LatLng((((double) lat / 1E5)), 103 | (((double) lng / 1E5))); 104 | poly.add(p); 105 | } 106 | 107 | return poly; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /drawroutemap/src/main/java/com/ahmadrosid/lib/drawroutemap/DrawMarker.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.drawable.Drawable; 7 | import android.support.v4.content.ContextCompat; 8 | 9 | import com.google.android.gms.maps.GoogleMap; 10 | import com.google.android.gms.maps.model.BitmapDescriptor; 11 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 12 | import com.google.android.gms.maps.model.LatLng; 13 | import com.google.android.gms.maps.model.MarkerOptions; 14 | 15 | /** 16 | * Created by ocittwo on 11/14/16. 17 | * 18 | * @Author Ahmad Rosid 19 | * @Email ocittwo@gmail.com 20 | * @Github https://github.com/ar-android 21 | * @Web http://ahmadrosid.com 22 | */ 23 | public class DrawMarker { 24 | 25 | public static DrawMarker INSTANCE; 26 | 27 | public static DrawMarker getInstance(Context context) { 28 | INSTANCE = new DrawMarker(context); 29 | return INSTANCE; 30 | } 31 | 32 | private Context context; 33 | 34 | DrawMarker(Context context) { 35 | this.context = context; 36 | } 37 | 38 | public void draw(GoogleMap googleMap, LatLng location, int resDrawable, String title) { 39 | Drawable circleDrawable = ContextCompat.getDrawable(context, resDrawable); 40 | BitmapDescriptor markerIcon = getMarkerIconFromDrawable(circleDrawable); 41 | 42 | googleMap.addMarker(new MarkerOptions() 43 | .position(location) 44 | .title(title) 45 | .icon(markerIcon) 46 | ); 47 | } 48 | 49 | private BitmapDescriptor getMarkerIconFromDrawable(Drawable drawable) { 50 | Canvas canvas = new Canvas(); 51 | Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); 52 | canvas.setBitmap(bitmap); 53 | drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); 54 | drawable.draw(canvas); 55 | return BitmapDescriptorFactory.fromBitmap(bitmap); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /drawroutemap/src/main/java/com/ahmadrosid/lib/drawroutemap/DrawRoute.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import android.os.AsyncTask; 4 | import android.util.Log; 5 | 6 | import com.google.android.gms.maps.GoogleMap; 7 | 8 | import java.io.BufferedReader; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.io.InputStreamReader; 12 | import java.net.HttpURLConnection; 13 | import java.net.URL; 14 | /** 15 | * Created by ocittwo on 11/14/16. 16 | * 17 | * @Author Ahmad Rosid 18 | * @Email ocittwo@gmail.com 19 | * @Github https://github.com/ar-android 20 | * @Web http://ahmadrosid.com 21 | */ 22 | 23 | public class DrawRoute extends AsyncTask { 24 | 25 | private GoogleMap mMap; 26 | 27 | public DrawRoute(GoogleMap mMap) { 28 | this.mMap = mMap; 29 | } 30 | 31 | @Override 32 | protected String doInBackground(String... url) { 33 | String data = ""; 34 | try { 35 | data = getJsonRoutePoint(url[0]); 36 | Log.d("Background Task data", data); 37 | } catch (Exception e) { 38 | Log.d("Background Task", e.toString()); 39 | } 40 | return data; 41 | } 42 | 43 | @Override 44 | protected void onPostExecute(String result) { 45 | super.onPostExecute(result); 46 | RouteDrawerTask routeDrawerTask = new RouteDrawerTask(mMap); 47 | routeDrawerTask.execute(result); 48 | } 49 | 50 | /** 51 | * A method to download json data from url 52 | */ 53 | private String getJsonRoutePoint(String strUrl) throws IOException { 54 | String data = ""; 55 | InputStream iStream = null; 56 | HttpURLConnection urlConnection = null; 57 | try { 58 | URL url = new URL(strUrl); 59 | 60 | // Creating an http connection to communicate with url 61 | urlConnection = (HttpURLConnection) url.openConnection(); 62 | 63 | // Connecting to url 64 | urlConnection.connect(); 65 | 66 | // Reading data from url 67 | iStream = urlConnection.getInputStream(); 68 | 69 | BufferedReader br = new BufferedReader(new InputStreamReader(iStream)); 70 | 71 | StringBuffer sb = new StringBuffer(); 72 | 73 | String line = ""; 74 | while ((line = br.readLine()) != null) { 75 | sb.append(line); 76 | } 77 | 78 | data = sb.toString(); 79 | Log.d("getJsonRoutePoint", data.toString()); 80 | br.close(); 81 | 82 | } catch (Exception e) { 83 | Log.d("Exception", e.toString()); 84 | } finally { 85 | iStream.close(); 86 | urlConnection.disconnect(); 87 | } 88 | return data; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /drawroutemap/src/main/java/com/ahmadrosid/lib/drawroutemap/DrawRouteMaps.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.android.gms.maps.GoogleMap; 6 | import com.google.android.gms.maps.model.LatLng; 7 | 8 | /** 9 | * Created by ocittwo on 11/14/16. 10 | * 11 | * @Author Ahmad Rosid 12 | * @Email ocittwo@gmail.com 13 | * @Github https://github.com/ar-android 14 | * @Web http://ahmadrosid.com 15 | */ 16 | 17 | public class DrawRouteMaps { 18 | 19 | private static DrawRouteMaps instance; 20 | private Context context; 21 | 22 | public static DrawRouteMaps getInstance(Context context) { 23 | instance = new DrawRouteMaps(); 24 | instance.context = context; 25 | return instance; 26 | } 27 | 28 | public DrawRouteMaps draw(LatLng origin, LatLng destination, GoogleMap googleMap){ 29 | String url_route = FetchUrl.getUrl(origin, destination); 30 | DrawRoute drawRoute = new DrawRoute(googleMap); 31 | drawRoute.execute(url_route); 32 | return instance; 33 | } 34 | 35 | public static Context getContext() { 36 | return instance.context; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /drawroutemap/src/main/java/com/ahmadrosid/lib/drawroutemap/FetchUrl.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import com.google.android.gms.maps.model.LatLng; 4 | 5 | /** 6 | * Created by ocittwo on 11/14/16. 7 | * 8 | * @Author Ahmad Rosid 9 | * @Email ocittwo@gmail.com 10 | * @Github https://github.com/ar-android 11 | * @Web http://ahmadrosid.com 12 | */ 13 | public class FetchUrl { 14 | public static String getUrl(LatLng origin, LatLng dest) { 15 | String str_origin = "origin=" + origin.latitude + "," + origin.longitude; 16 | String str_dest = "destination=" + dest.latitude + "," + dest.longitude; 17 | String sensor = "sensor=false"; 18 | String parameters = str_origin + "&" + str_dest + "&" + sensor; 19 | String output = "json"; 20 | return "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /drawroutemap/src/main/java/com/ahmadrosid/lib/drawroutemap/RouteDrawerTask.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import android.os.AsyncTask; 4 | import android.support.v4.content.ContextCompat; 5 | import android.util.Log; 6 | 7 | import com.google.android.gms.maps.GoogleMap; 8 | import com.google.android.gms.maps.model.LatLng; 9 | import com.google.android.gms.maps.model.PolylineOptions; 10 | 11 | import org.json.JSONObject; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by ocittwo on 11/14/16. 19 | * 20 | * @Author Ahmad Rosid 21 | * @Email ocittwo@gmail.com 22 | * @Github https://github.com/ar-android 23 | * @Web http://ahmadrosid.com 24 | */ 25 | public class RouteDrawerTask extends AsyncTask>>> { 26 | 27 | private PolylineOptions lineOptions; 28 | private GoogleMap mMap; 29 | private int routeColor; 30 | 31 | public RouteDrawerTask(GoogleMap mMap) { 32 | this.mMap = mMap; 33 | } 34 | 35 | @Override 36 | protected List>> doInBackground(String... jsonData) { 37 | JSONObject jObject; 38 | List>> routes = null; 39 | 40 | try { 41 | jObject = new JSONObject(jsonData[0]); 42 | Log.d("RouteDrawerTask", jsonData[0]); 43 | DataRouteParser parser = new DataRouteParser(); 44 | Log.d("RouteDrawerTask", parser.toString()); 45 | 46 | // Starts parsing data 47 | routes = parser.parse(jObject); 48 | Log.d("RouteDrawerTask", "Executing routes"); 49 | Log.d("RouteDrawerTask", routes.toString()); 50 | 51 | } catch (Exception e) { 52 | Log.d("RouteDrawerTask", e.toString()); 53 | e.printStackTrace(); 54 | } 55 | return routes; 56 | } 57 | 58 | @Override 59 | protected void onPostExecute(List>> result) { 60 | if (result != null) 61 | drawPolyLine(result); 62 | } 63 | 64 | private void drawPolyLine(List>> result) { 65 | ArrayList points; 66 | lineOptions = null; 67 | 68 | for (int i = 0; i < result.size(); i++) { 69 | points = new ArrayList<>(); 70 | lineOptions = new PolylineOptions(); 71 | 72 | // Fetching i-th route 73 | List> path = result.get(i); 74 | 75 | // Fetching all the points in i-th route 76 | for (int j = 0; j < path.size(); j++) { 77 | HashMap point = path.get(j); 78 | 79 | double lat = Double.parseDouble(point.get("lat")); 80 | double lng = Double.parseDouble(point.get("lng")); 81 | LatLng position = new LatLng(lat, lng); 82 | 83 | points.add(position); 84 | } 85 | 86 | // Adding all the points in the route to LineOptions 87 | lineOptions.addAll(points); 88 | lineOptions.width(6); 89 | routeColor = ContextCompat.getColor(DrawRouteMaps.getContext(), R.color.colorRouteLine); 90 | if (routeColor == 0) 91 | lineOptions.color(0xFF0A8F08); 92 | else 93 | lineOptions.color(routeColor); 94 | } 95 | 96 | // Drawing polyline in the Google Map for the i-th route 97 | if (lineOptions != null && mMap != null) { 98 | mMap.addPolyline(lineOptions); 99 | } else { 100 | Log.d("onPostExecute", "without Polylines draw"); 101 | } 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /drawroutemap/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #0A8F08 4 | -------------------------------------------------------------------------------- /drawroutemap/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DrawRouteMap 3 | 4 | -------------------------------------------------------------------------------- /drawroutemap/src/test/java/com/ahmadrosid/lib/drawroutemap/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.ahmadrosid.lib.drawroutemap; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /example-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/example-app.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ar-android/DrawRouteMaps/0ff33cca4442e17db791f346984ce8b00c8ad82b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 21 23:23:03 ICT 2018 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-4.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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':drawroutemap' 2 | --------------------------------------------------------------------------------