├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── andrewconcepcion.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── MarkerBuilder.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro ├── src │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── aconcepcion │ │ │ └── markerbuilder │ │ │ └── ApplicationTest.java │ ├── debug │ │ └── res │ │ │ └── values │ │ │ └── google_maps_api.xml │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── aconcepcion │ │ │ │ └── markerbuilder │ │ │ │ └── MapsActivity.java │ │ └── res │ │ │ ├── layout │ │ │ └── activity_maps.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── release │ │ └── res │ │ └── values │ │ └── google_maps_api.xml └── version.properties ├── build.gradle ├── geofencemarkerbuilder ├── .gitignore ├── build.gradle ├── geofencemarkerbuilder.iml ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── aconcepcion │ │ └── geofencemarkerbuilder │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── aconcepcion │ │ └── geofencemarkerbuilder │ │ ├── CircleManagerListener.java │ │ ├── GeofenceCircle.java │ │ ├── MapDataPointWrapper.java │ │ ├── MarkerAreaMeasure.java │ │ ├── MarkerAreaWrapper.java │ │ ├── MarkerAreasConstants.java │ │ ├── MarkerAreasUtils.java │ │ ├── MarkerBuilderManagerV2.java │ │ ├── MarkerMoveResultWithCircle.java │ │ └── MetricsUtils.java │ └── res │ └── values │ └── strings.xml ├── 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 | /.idea/* 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.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/dictionaries/andrewconcepcion.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /MarkerBuilder.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MarkerBuilder 2 | Versatile map area / geofence utility for google maps v2 for android. 3 | Create geofence areas in your map by initializing markerBuilderManager. 4 | Not that difficult isn't it? 5 | 6 | ![Marker Demo](https://cloud.githubusercontent.com/assets/7637791/11803625/9a6946b2-a337-11e5-96d2-36a908f8aa8c.png) 7 | 8 | Usage 9 | ------ 10 | ```java 11 | private void setUpMap() { 12 | markerBuilderManager = new MarkerBuilderManagerV2.Builder(this) 13 | .map(mMap) // required 14 | .build(); 15 | } 16 | ``` 17 | 18 | You can also set other marker options such as: 19 | ```java 20 | markerBuilderManager = new MarkerBuilderManagerV2.Builder(this) 21 | .map(googleMap) 22 | .enabled(isEnabled) 23 | .radius(initRadiusMetersFinal) 24 | .circleId(circleId) 25 | .strokeWidth(strokeWidth) 26 | .strokeColor(strokeColor) 27 | .fillColor(fillColor) 28 | .minRadius(minRadius) 29 | .maxRadius(maxRadius) 30 | .centerIcon(centerIcon) 31 | .centerBitmap(centerBitmap) 32 | .resizerIcon(resizerIcon) 33 | .centerOffsetHorizontal(centerOffsetHorizontal) 34 | .centerOffsetVertical(centerOffsetVertical) 35 | .build(); 36 | ``` 37 | 38 | Configuration 39 | ------ 40 | There is no pre-configuration needed. :) 41 | 42 | Download 43 | ------ 44 | Add the following code to your `build.gradle` file (as described on [JitPack]) 45 | ``` 46 | repositories { 47 | maven { 48 | url "https://jitpack.io" 49 | } 50 | } 51 | dependencies { 52 | compile 'com.github.ac-opensource:MarkerBuilder:v1.0.8' 53 | } 54 | ``` 55 | 56 | License 57 | ------- 58 | 59 | Copyright 2015 A-Ar Andrew Concepcion 60 | 61 | Licensed under the Apache License, Version 2.0 (the "License"); 62 | you may not use this file except in compliance with the License. 63 | You may obtain a copy of the License at 64 | 65 | http://www.apache.org/licenses/LICENSE-2.0 66 | 67 | Unless required by applicable law or agreed to in writing, software 68 | distributed under the License is distributed on an "AS IS" BASIS, 69 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 70 | See the License for the specific language governing permissions and 71 | limitations under the License. 72 | 73 | [JitPack]:https://jitpack.io/#ac-opensource/MarkerBuilder/v1.0.0 74 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 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 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'me.tatarka.retrolambda' 3 | 4 | android { 5 | compileSdkVersion rootProject.compileSdkVersion 6 | buildToolsVersion rootProject.buildToolsVersion 7 | 8 | def Properties versionProps = new Properties() 9 | def versionPropsFile = file('version.properties') 10 | if(versionPropsFile.exists()) 11 | versionProps.load(new FileInputStream(versionPropsFile)) 12 | def code = (versionProps['VERSION_CODE'] ?: "0").toInteger() + 1 13 | versionProps['VERSION_CODE'] = code.toString() 14 | versionProps.store(versionPropsFile.newWriter(), null) 15 | 16 | defaultConfig { 17 | applicationId "com.aconcepcion.markerbuilder" 18 | minSdkVersion rootProject.minSdkVersion 19 | targetSdkVersion rootProject.targetSdkVersion 20 | versionCode code 21 | versionName "1.0." + code 22 | } 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | } 34 | 35 | dependencies { 36 | compile fileTree(dir: 'libs', include: ['*.jar']) 37 | compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" 38 | compile "com.google.android.gms:play-services-maps:$rootProject.playServicesVersion" 39 | compile project(':geofencemarkerbuilder') 40 | } 41 | -------------------------------------------------------------------------------- /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/andrewconcepcion/Utilities/Utilities/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/aconcepcion/markerbuilder/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.markerbuilder; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/debug/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | AIzaSyA0SKYpzdUhe_XMcGyXiKn5RpTLlMFLiL8 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | 21 | 24 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/aconcepcion/markerbuilder/MapsActivity.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.markerbuilder; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.v4.app.FragmentActivity; 6 | 7 | import com.aconcepcion.geofencemarkerbuilder.MarkerBuilderManagerV2; 8 | import com.google.android.gms.maps.GoogleMap; 9 | import com.google.android.gms.maps.GoogleMap.OnMapClickListener; 10 | import com.google.android.gms.maps.SupportMapFragment; 11 | import com.google.android.gms.maps.model.LatLng; 12 | import com.google.android.gms.maps.model.MarkerOptions; 13 | 14 | public class MapsActivity extends FragmentActivity implements OnMapClickListener { 15 | 16 | private GoogleMap mMap; // Might be null if Google Play services APK is not available. 17 | private MarkerBuilderManagerV2 markerBuilderManager; 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_maps); 22 | } 23 | 24 | @Override 25 | protected void onResume() { 26 | super.onResume(); 27 | setUpMapIfNeeded(); 28 | } 29 | 30 | /** 31 | * Sets up the map if it is possible to do so (i.e., the Google Play services APK is correctly 32 | * installed) and the map has not already been instantiated.. This will ensure that we only ever 33 | * call {@link #setUpMap()} once when {@link #mMap} is not null. 34 | *

35 | * If it isn't installed {@link SupportMapFragment} (and 36 | * {@link com.google.android.gms.maps.MapView MapView}) will show a prompt for the user to 37 | * install/update the Google Play services APK on their device. 38 | *

39 | * A user can return to this FragmentActivity after following the prompt and correctly 40 | * installing/updating/enabling the Google Play services. Since the FragmentActivity may not 41 | * have been completely destroyed during this process (it is likely that it would only be 42 | * stopped or paused), {@link #onCreate(Bundle)} may not be called again so we should call this 43 | * method in {@link #onResume()} to guarantee that it will be called. 44 | */ 45 | private void setUpMapIfNeeded() { 46 | // Do a null check to confirm that we have not already instantiated the map. 47 | if (mMap == null) { 48 | // Try to obtain the map from the SupportMapFragment. 49 | ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(googleMap -> { 50 | mMap = googleMap; 51 | if (mMap != null) { 52 | setUpMap(); 53 | } 54 | }); 55 | } 56 | } 57 | 58 | /** 59 | * This is where we can add markers or lines, add listeners or move the camera. In this case, we 60 | * just add a marker near Africa. 61 | *

62 | * This should only be called once and when we are sure that {@link #mMap} is not null. 63 | */ 64 | private void setUpMap() { 65 | mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker")); 66 | mMap.setOnMapClickListener(this); 67 | 68 | markerBuilderManager = new MarkerBuilderManagerV2.Builder(this) 69 | .map(mMap) 70 | .enabled(true) 71 | .radius(200) 72 | .fillColor(Color.BLUE) 73 | .build(); 74 | } 75 | 76 | @Override 77 | public void onMapClick(LatLng latLng) { 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_maps.xml: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ac-opensource/MarkerBuilder/aa5d5417ca1571e73a88bba85b45a187591022f7/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ac-opensource/MarkerBuilder/aa5d5417ca1571e73a88bba85b45a187591022f7/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ac-opensource/MarkerBuilder/aa5d5417ca1571e73a88bba85b45a187591022f7/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ac-opensource/MarkerBuilder/aa5d5417ca1571e73a88bba85b45a187591022f7/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Marker Builder 3 | Sample Map 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/release/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | YOUR_KEY_HERE 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/version.properties: -------------------------------------------------------------------------------- 1 | #Sat Feb 25 08:27:44 PHT 2017 2 | VERSION_CODE=8 3 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | classpath 'me.tatarka:gradle-retrolambda:3.2.5' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | } 20 | } 21 | 22 | 23 | ext { 24 | // SDK and tools 25 | minSdkVersion = 15 26 | targetSdkVersion = 25 27 | compileSdkVersion = 25 28 | buildToolsVersion = '25.0.1' 29 | 30 | // dependency versions 31 | junitVersion = '4.12' 32 | supportLibraryVersion = '25.0.1' 33 | rxJavaVersion = '1.1.0' 34 | rxAndroidVersion = '1.1.0' 35 | playServicesVersion = '10.0.1' 36 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.compileSdkVersion 5 | buildToolsVersion rootProject.buildToolsVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.minSdkVersion 9 | targetSdkVersion rootProject.targetSdkVersion 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | compileOptions { 20 | sourceCompatibility JavaVersion.VERSION_1_8 21 | targetCompatibility JavaVersion.VERSION_1_8 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" 28 | compile "com.google.android.gms:play-services-maps:$rootProject.playServicesVersion" 29 | } 30 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/geofencemarkerbuilder.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 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 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/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/andrewconcepcion/Utilities/Utilities/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 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/androidTest/java/com/aconcepcion/geofencemarkerbuilder/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/CircleManagerListener.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | /** 4 | * Created by andrewconcepcion on 4/28/15. 5 | */ 6 | public interface CircleManagerListener { 7 | 8 | /** 9 | * Called when location was initially loaded 10 | * @param draggableCircle created circle 11 | */ 12 | void onInitCreateCircle(GeofenceCircle draggableCircle); 13 | 14 | /** 15 | * Called when a circle was placed on the map 16 | * @param draggableCircle created circle 17 | */ 18 | void onCircleMarkerClick(GeofenceCircle draggableCircle); 19 | 20 | void onCreateCircle(GeofenceCircle draggableCircle); 21 | 22 | /** 23 | * Called when resizing gesture finishes (user lifts the finger) 24 | * @param draggableCircle resized circle 25 | */ 26 | void onResizeCircleEnd(GeofenceCircle draggableCircle); 27 | 28 | /** 29 | * Called when move gesture finishes (user lifts the finger) 30 | * @param draggableCircle move circle 31 | */ 32 | void onMoveCircleEnd(GeofenceCircle draggableCircle); 33 | 34 | /** 35 | * Called when move gesture starts (user long presses the position marker) 36 | * @param draggableCircle circle about to be moved 37 | */ 38 | void onMoveCircleStart(GeofenceCircle draggableCircle); 39 | 40 | /** 41 | * Called when resize gesture starts (user long presses the resizing marker) 42 | * @param draggableCircle circle about to be resized 43 | */ 44 | void onResizeCircleStart(GeofenceCircle draggableCircle); 45 | 46 | /** 47 | * Called when the circle reaches the min possible radius (meters), if it was initialized with a min radius value 48 | * This happens during resizing gesture 49 | * Reducing size is automatically blocked when reached this value - no extra action required for this 50 | * 51 | * @param draggableCircle circle 52 | */ 53 | void onMinRadius(GeofenceCircle draggableCircle); 54 | 55 | /** 56 | * Called when the circle reaches the max possible radius (meters), if it was initialized with a max radius value 57 | * This happens during resizing gesture 58 | * Increasing size is automatically blocked when reached this value - no extra action required for this 59 | * 60 | * @param draggableCircle circle 61 | */ 62 | 63 | void onMaxRadius(GeofenceCircle draggableCircle); 64 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/GeofenceCircle.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Matrix; 8 | import android.graphics.Paint; 9 | import android.graphics.PorterDuff; 10 | import android.graphics.PorterDuffXfermode; 11 | import android.graphics.Rect; 12 | import android.graphics.RectF; 13 | import android.graphics.drawable.BitmapDrawable; 14 | import android.graphics.drawable.Drawable; 15 | import android.support.v4.content.res.ResourcesCompat; 16 | 17 | import com.google.android.gms.maps.GoogleMap; 18 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 19 | import com.google.android.gms.maps.model.Circle; 20 | import com.google.android.gms.maps.model.CircleOptions; 21 | import com.google.android.gms.maps.model.LatLng; 22 | import com.google.android.gms.maps.model.Marker; 23 | import com.google.android.gms.maps.model.MarkerOptions; 24 | 25 | /** 26 | * Created by andrewconcepcion on 4/20/15. 27 | */ 28 | public class GeofenceCircle { 29 | // private final int size; 30 | 31 | public static final String GEOFENCE_WRAPPER = "geofence"; 32 | public static final String DATA_POINT_WRAPPER = "dataPoint"; 33 | 34 | public long getCircleId() { 35 | return circleId; 36 | } 37 | 38 | public static enum MarkerMoveResult {moved, radiusChange, minRadius, maxRadius, none;}; 39 | public static enum MarkerType {move, resize, none;} 40 | 41 | 42 | private static Bitmap centerBitmapCache; 43 | 44 | private Context context; 45 | private GoogleMap map; 46 | private boolean isEnabled; 47 | private LatLng center; 48 | private double radius; 49 | private long circleId; 50 | private float strokeWidth; 51 | private int strokeColor; 52 | private int fillColor; 53 | private int minRadius; 54 | private int maxRadius; 55 | private int centerIcon; 56 | private Bitmap centerBitmap; 57 | private int resizerIcon; 58 | private float centerOffsetHorizontal; 59 | private float centerOffsetVertical; 60 | 61 | private Marker centerMarker; 62 | private Marker resizerMarker; 63 | private Circle circle; 64 | 65 | 66 | public static class Builder { 67 | 68 | 69 | private static int DEFAULT_FILL_COLOR = 0xff0000ff; 70 | private static int DEFAULT_STROKE_COLOR = 0xff000000; 71 | private static int DEFAULT_STROKE_WIDTH = 1; 72 | 73 | 74 | //required 75 | // private final int size; 76 | 77 | //optional 78 | private Context context; 79 | private GoogleMap map; 80 | private boolean isEnabled; 81 | private LatLng center; 82 | private double radius = new MarkerAreaMeasure(200, MarkerAreaMeasure.Unit.meters).value; 83 | private long circleId; 84 | private int fillColor = Color.HSVToColor(70, new float[] {1, 1, 200}); 85 | private float strokeWidth = 4f; 86 | private int strokeColor = Color.RED; 87 | private int minRadius = -1; 88 | private int maxRadius = -1; 89 | private int centerIcon = android.R.drawable.ic_menu_mylocation; 90 | private int resizerIcon = android.R.drawable.ic_menu_mylocation; 91 | private Bitmap centerBitmap; 92 | private float centerOffsetHorizontal = 0.5f; 93 | private float centerOffsetVertical = 0.5f; 94 | private float resizerOffsetHorizontal = 0.5f; 95 | private float resizerOffsetVertical = 0.5f; 96 | 97 | private Marker centerMarker; 98 | private Marker resizerMarker; 99 | private Circle circle; 100 | 101 | public Builder(Context context) { 102 | this.context = context; 103 | } 104 | 105 | public Builder map(GoogleMap map) { 106 | this.map = map; 107 | return this; 108 | } 109 | 110 | public Builder enabled(boolean isEnabled) { 111 | this.isEnabled = isEnabled; 112 | return this; 113 | } 114 | 115 | public Builder center(LatLng center) { 116 | this.center = center; 117 | return this; 118 | } 119 | 120 | public Builder radius(double radius) { 121 | this.radius = radius; 122 | return this; 123 | } 124 | 125 | public Builder circleId(long circleId) { 126 | this.circleId = circleId; 127 | return this; 128 | } 129 | 130 | public Builder strokeWidth(float strokeWidth) { 131 | this.strokeWidth = strokeWidth; 132 | return this; 133 | } 134 | 135 | public Builder strokeColor(int strokeColor) { 136 | this.strokeColor = strokeColor; 137 | return this; 138 | } 139 | 140 | public Builder fillColor(int fillColor) { 141 | this.fillColor = fillColor; 142 | return this; 143 | } 144 | 145 | public Builder minRadius(int minRadius) { 146 | this.minRadius = minRadius; 147 | return this; 148 | } 149 | 150 | public Builder maxRadius(int maxRadius) { 151 | this.maxRadius = maxRadius; 152 | return this; 153 | } 154 | 155 | public Builder centerIcon(int centerIcon) { 156 | this.centerIcon = centerIcon; 157 | return this; 158 | } 159 | 160 | public Builder centerBitmap(Bitmap centerBitmap) { 161 | this.centerBitmap = centerBitmap; 162 | return this; 163 | } 164 | 165 | public Builder resizerIcon(int resizerIcon) { 166 | this.resizerIcon = resizerIcon; 167 | return this; 168 | } 169 | 170 | public Builder centerOffsetHorizontal(float centerOffsetHorizontal) { 171 | this.centerOffsetHorizontal = centerOffsetHorizontal; 172 | return this; 173 | } 174 | 175 | public Builder centerOffsetVertical(float centerOffsetVertical) { 176 | this.centerOffsetVertical = centerOffsetVertical; 177 | return this; 178 | } 179 | 180 | public Builder resizerOffsetHorizontal(float resizerOffsetHorizontal) { 181 | this.resizerOffsetHorizontal = resizerOffsetHorizontal; 182 | return this; 183 | } 184 | 185 | public Builder resizerOffsetVertical(float resizerOffsetVertical) { 186 | this.resizerOffsetVertical = resizerOffsetVertical; 187 | return this; 188 | } 189 | 190 | public Bitmap overlay(Bitmap bmp1, Bitmap bmp2) { 191 | Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig()); 192 | Canvas canvas = new Canvas(bmOverlay); 193 | canvas.drawBitmap(bmp1, new Matrix(), null); 194 | 195 | int offset = MetricsUtils.convertDIPsToPixels(context, 5); 196 | 197 | canvas.drawBitmap(bmp2, offset, offset, null); 198 | return bmOverlay; 199 | } 200 | 201 | public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) { 202 | Bitmap output = Bitmap.createBitmap(pixels, pixels, Bitmap.Config.ARGB_8888); 203 | Canvas canvas = new Canvas(output); 204 | 205 | final int color = 0xff424242; 206 | final Paint paint = new Paint(); 207 | final Rect rect = new Rect(0, 0, pixels, pixels); 208 | final RectF rectF = new RectF(rect); 209 | final float roundPx = pixels; 210 | 211 | paint.setAntiAlias(true); 212 | canvas.drawARGB(0, 0, 0, 0); 213 | paint.setColor(color); 214 | canvas.drawRoundRect(rectF, roundPx, roundPx, paint); 215 | 216 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); 217 | canvas.drawBitmap(Bitmap.createScaledBitmap(bitmap, pixels, pixels, false), rect, rect, paint); 218 | 219 | return output; 220 | } 221 | 222 | public GeofenceCircle build(){ 223 | 224 | centerMarker = map.addMarker(new MarkerOptions() 225 | .position(center) 226 | .flat(true) 227 | .anchor(centerOffsetHorizontal, centerOffsetVertical) 228 | .draggable(isEnabled)); 229 | 230 | 231 | resizerMarker = map.addMarker(new MarkerOptions() 232 | .position(MarkerAreasUtils.toRadiusLatLng(center, radius)) 233 | .anchor(resizerOffsetHorizontal, resizerOffsetVertical) 234 | .draggable(isEnabled)); 235 | 236 | if (resizerIcon != 0 && resizerIcon != -1) { 237 | 238 | int px = 120; 239 | Bitmap mDotMarkerBitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888); 240 | Canvas canvas = new Canvas(mDotMarkerBitmap); 241 | Drawable shape = ResourcesCompat.getDrawable(context.getResources(), resizerIcon, null); 242 | shape.setBounds(0, 0, mDotMarkerBitmap.getWidth(), mDotMarkerBitmap.getHeight()); 243 | shape.draw(canvas); 244 | 245 | resizerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap)); 246 | } 247 | 248 | 249 | 250 | if (centerIcon != -1) { 251 | BitmapDrawable bitmapDrawable = (BitmapDrawable) context.getResources().getDrawable(centerIcon); 252 | Bitmap bitmap = bitmapDrawable.getBitmap(); 253 | Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, (int)(bitmap.getWidth() / 2), (int)(bitmap.getHeight() / 2), false); 254 | // centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap)); 255 | 256 | int imageSize = (MetricsUtils.convertDIPsToPixels(context, 30f)); 257 | 258 | if (centerBitmap == null) { 259 | if(centerBitmapCache == null) { 260 | centerBitmap = Bitmap.createBitmap(imageSize, imageSize, Bitmap.Config.RGB_565); 261 | Drawable drawable = context.getResources().getDrawable(android.R.drawable.sym_def_app_icon); 262 | Canvas canvas = new Canvas(centerBitmap); 263 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 264 | drawable.draw(canvas); 265 | centerBitmapCache = centerBitmap; 266 | } else { 267 | centerBitmap = centerBitmapCache; 268 | } 269 | 270 | } 271 | 272 | // centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(overlay(scaledBitmap, getRoundedCornerBitmap(centerBitmap, imageSize)))); 273 | } 274 | 275 | circle = map.addCircle(new CircleOptions() 276 | .center(center) 277 | .radius(radius) 278 | .strokeWidth(strokeWidth) 279 | .strokeColor(strokeColor) 280 | .fillColor(fillColor)); 281 | 282 | return new GeofenceCircle(this); 283 | } 284 | } 285 | 286 | private GeofenceCircle(Builder b) { 287 | this.context = b.context; 288 | this.map = b.map; 289 | this.isEnabled = b.isEnabled; 290 | this.center = b.center; 291 | this.radius = b.radius; 292 | this.circleId = b.circleId; 293 | this.strokeWidth = b.strokeWidth; 294 | this.strokeColor = b.strokeColor; 295 | this.fillColor = b.fillColor; 296 | this.minRadius = b.minRadius; 297 | this.maxRadius = b.maxRadius; 298 | this.centerIcon = b.centerIcon; 299 | this.centerBitmap = b.centerBitmap; 300 | this.resizerIcon = b.resizerIcon; 301 | this.centerOffsetHorizontal = b.centerOffsetHorizontal; 302 | this.centerOffsetVertical = b.centerOffsetVertical; 303 | this.centerMarker = b.centerMarker; 304 | this.resizerMarker = b.resizerMarker; 305 | this.circle = b.circle; 306 | 307 | } 308 | 309 | public void setCenter(LatLng center) { 310 | centerMarker.setPosition(center); 311 | onCenterUpdated(center); 312 | } 313 | 314 | public void removeArea() { 315 | if(resizerMarker != null) resizerMarker.remove(); 316 | if(centerMarker != null) centerMarker.remove(); 317 | if(circle != null) circle.remove(); 318 | } 319 | 320 | 321 | /** 322 | * This modifies circle according to marker's type and position 323 | * 324 | * if the marker is position marker (from this circle), the circle will be moved according to marker's position 325 | * if the marker is resizing marker (from this circle), the circle will be resized according to marker's position 326 | * 327 | * If the marker is not in this circle (it's not the position or resizing marker) no action will be done 328 | * 329 | * @param marker 330 | * 331 | * @return flag indicating which action was done. 332 | * When the marker is not in this circle returned action is MarkerMoveResult.none 333 | */ 334 | public MarkerMoveResult onMarkerMoved(Marker marker) { 335 | if (marker.equals(centerMarker)) { 336 | onCenterUpdated(marker.getPosition()); 337 | return MarkerMoveResult.moved; 338 | } 339 | 340 | if (marker.equals(resizerMarker)) { 341 | double newRadius = MarkerAreasUtils.toRadiusMeters(centerMarker.getPosition(), marker.getPosition()); 342 | 343 | if (minRadius != -1 && newRadius < minRadius) { 344 | return MarkerMoveResult.minRadius; 345 | 346 | } else if (maxRadius != -1 && newRadius > maxRadius) { 347 | return MarkerMoveResult.maxRadius; 348 | 349 | } else { 350 | setRadius(newRadius); 351 | 352 | return MarkerMoveResult.radiusChange; 353 | } 354 | 355 | } 356 | return MarkerMoveResult.none; 357 | } 358 | 359 | 360 | 361 | /** 362 | * Called after update position of center marker, to update the circle and the radius marker 363 | * @param center 364 | */ 365 | public void onCenterUpdated(LatLng center) { 366 | if(circle != null) circle.setCenter(center); 367 | if(resizerMarker != null) resizerMarker.setPosition(MarkerAreasUtils.toRadiusLatLng(center, radius)); 368 | } 369 | 370 | /** 371 | * Set the radius of circle 372 | * the map circle will be updated immediately 373 | * 374 | * @param radius 375 | */ 376 | public void setRadius(double radius) { 377 | this.radius = radius; 378 | circle.setRadius(radius); 379 | } 380 | 381 | public LatLng getCenter() { 382 | return center; 383 | } 384 | 385 | public double getRadius() { 386 | return radius; 387 | } 388 | 389 | 390 | 391 | @Override 392 | public String toString() { 393 | return "center: " + getCenter() + " radius: " + getRadius(); 394 | } 395 | 396 | 397 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MapDataPointWrapper.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | /** 4 | * This class manages a map circle, with markers 5 | * 6 | * Currently there's position marker (in the middle) and resizing marker (in border) 7 | * Long pressing these markers allow to change circle position or size. 8 | * 9 | * @author A-Ar Andrew Concepcion 10 | * 11 | */ 12 | 13 | import android.content.Context; 14 | import android.graphics.Bitmap; 15 | import android.graphics.Canvas; 16 | import android.graphics.drawable.BitmapDrawable; 17 | import android.graphics.drawable.Drawable; 18 | 19 | import com.google.android.gms.maps.GoogleMap; 20 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 21 | import com.google.android.gms.maps.model.Circle; 22 | import com.google.android.gms.maps.model.CircleOptions; 23 | import com.google.android.gms.maps.model.LatLng; 24 | import com.google.android.gms.maps.model.Marker; 25 | import com.google.android.gms.maps.model.MarkerOptions; 26 | 27 | /** 28 | * Created by andrewconcepcion on 12/3/14. 29 | */ 30 | 31 | public class MapDataPointWrapper { 32 | 33 | public static enum MarkerMoveResult {moved, radiusChange, minRadius, maxRadius, none}; 34 | public static enum MarkerType {move, resize, none} 35 | 36 | private Marker centerMarker; 37 | private Marker radiusMarker; 38 | private Circle circle; 39 | private double radiusMeters; 40 | private long geofenceCircleId; 41 | private int count; 42 | private boolean isEnabled; 43 | 44 | private int minRadiusMeters = -1; 45 | private int maxRadiusMeters = -1; 46 | 47 | /** 48 | * Primary constructor 49 | * 50 | * @param map 51 | * @param center center of circle in geo coordinates 52 | * @param radiusMeters radius of circle in meters 53 | * @param strokeWidth circle stroke with in pixels 54 | * @param strokeColor circle stroke color 55 | * @param fillColor circle fill color 56 | * @param minRadiusMeters optional - circle min radius in meters (circle will not shrink bellow this, and callback is called when reached) 57 | * @param maxRadiusMeters optional - circle max radius in meters (circle will not expand above this, and callback is called when reached) 58 | * @param centerDrawableId drawable ressource id for positioning marker. If not set a default geomarker is used 59 | * @param radiusDrawableId drawable ressource id for resizing marker. If not set a default geomarker is used 60 | * @param moveDrawableAnchorU horizontal anchor for move drawable 61 | * @param moveDrawableAnchorV vertical anchor for move drawable 62 | * @param resizeDrawableAnchorU horizontal anchor for resize drawable 63 | * @param resizeDrawableAnchorV vertical anchor for resize drawable 64 | */ 65 | public MapDataPointWrapper(Context context, GoogleMap map, boolean isEnabled, LatLng center, int count, int centerDrawableId) { 66 | this.isEnabled = isEnabled; 67 | this.count = count; 68 | 69 | centerMarker = map.addMarker(new MarkerOptions() 70 | .position(center) 71 | .flat(true) 72 | .draggable(isEnabled)); 73 | 74 | if (centerDrawableId != -1) { 75 | BitmapDrawable bitmapDrawable = (BitmapDrawable) context.getResources().getDrawable(centerDrawableId); 76 | Bitmap bitmap = bitmapDrawable.getBitmap(); 77 | Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth()/2, bitmap.getHeight()/2, false); 78 | centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap)); 79 | } 80 | } 81 | 82 | public static Bitmap drawableToBitmap (Drawable drawable) { 83 | Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); 84 | Canvas canvas = new Canvas(bitmap); 85 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 86 | drawable.draw(canvas); 87 | return bitmap; 88 | } 89 | 90 | /** 91 | * @return center of circle in geocoordinates 92 | */ 93 | public LatLng getCenter() { 94 | return centerMarker.getPosition(); 95 | } 96 | 97 | public long getGeofenceCircleId() { return geofenceCircleId; } 98 | 99 | public void removeArea() { 100 | centerMarker.remove(); 101 | } 102 | 103 | @Override 104 | public String toString() { 105 | return "center: " + getCenter(); 106 | } 107 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MarkerAreaMeasure.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | /** 4 | * MapAreaMeasure 5 | * 6 | * @author A-Ar Andrew Concepcion 7 | */ 8 | public class MarkerAreaMeasure { 9 | 10 | public static enum Unit {pixels, meters} 11 | 12 | public double value; 13 | public Unit unit; 14 | 15 | public MarkerAreaMeasure(double value, Unit unit) { 16 | this.value = value; 17 | this.unit = unit; 18 | } 19 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MarkerAreaWrapper.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 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.graphics.PorterDuff; 9 | import android.graphics.PorterDuffXfermode; 10 | import android.graphics.Rect; 11 | import android.graphics.RectF; 12 | import android.graphics.drawable.BitmapDrawable; 13 | import android.graphics.drawable.Drawable; 14 | import android.support.v4.content.res.ResourcesCompat; 15 | 16 | import com.google.android.gms.maps.GoogleMap; 17 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 18 | import com.google.android.gms.maps.model.Circle; 19 | import com.google.android.gms.maps.model.CircleOptions; 20 | import com.google.android.gms.maps.model.LatLng; 21 | import com.google.android.gms.maps.model.Marker; 22 | import com.google.android.gms.maps.model.MarkerOptions; 23 | 24 | import java.util.ArrayList; 25 | 26 | 27 | /** 28 | * This class manages a map circle, with markers 29 | * 30 | * Currently there's position marker (in the middle) and resizing marker (in border) 31 | * Long pressing these markers allow to change circle position or size. 32 | * 33 | * @author A-Ar Andrew Concepcion 34 | * 35 | */ 36 | 37 | public class MarkerAreaWrapper { 38 | 39 | public static final String GEOFENCE_WRAPPER = "geofence"; 40 | public static final String DATA_POINT_WRAPPER = "dataPoint"; 41 | 42 | private Marker centerMarker; 43 | private Marker radiusMarker; 44 | private Circle circle; 45 | 46 | private static Bitmap childBitmap; 47 | 48 | private double radiusMeters; 49 | private long geofenceCircleId; 50 | private boolean isEnabled; 51 | private int fillColor; 52 | 53 | private String mapAreaType; 54 | private int count; 55 | private boolean shouldExpand; 56 | private ArrayList locationData; 57 | 58 | private int minRadiusMeters = -1; 59 | private int maxRadiusMeters = -1; 60 | 61 | private Context context; 62 | 63 | 64 | public int getFillColor() { 65 | return fillColor; 66 | } 67 | 68 | /** 69 | * Primary constructor 70 | * 71 | * @param map 72 | * @param center center of circle in geo coordinates 73 | * @param radiusMeters radius of circle in meters 74 | * @param strokeWidth circle stroke with in pixels 75 | * @param strokeColor circle stroke color 76 | * @param fillColor circle fill color 77 | * @param minRadiusMeters optional - circle min radius in meters (circle will not shrink bellow this, and callback is called when reached) 78 | * @param maxRadiusMeters optional - circle max radius in meters (circle will not expand above this, and callback is called when reached) 79 | * @param centerDrawableId drawable ressource id for positioning marker. If not set a default geomarker is used 80 | * @param radiusDrawableId drawable ressource id for resizing marker. If not set a default geomarker is used 81 | * @param moveDrawableAnchorU horizontal anchor for move drawable 82 | * @param moveDrawableAnchorV vertical anchor for move drawable 83 | * @param resizeDrawableAnchorU horizontal anchor for resize drawable 84 | * @param resizeDrawableAnchorV vertical anchor for resize drawable 85 | */ 86 | public MarkerAreaWrapper(Context context, GoogleMap map, boolean isEnabled, LatLng center, double radiusMeters, long geofenceCircleId, float strokeWidth, int strokeColor, int fillColor, int minRadiusMeters, int maxRadiusMeters, 87 | int centerDrawableId, Bitmap childProfileImage, int radiusDrawableId, float moveDrawableAnchorU, float moveDrawableAnchorV, float resizeDrawableAnchorU, float resizeDrawableAnchorV) { 88 | this.isEnabled = isEnabled; 89 | this.radiusMeters = radiusMeters; 90 | this.minRadiusMeters = minRadiusMeters; 91 | this.maxRadiusMeters = maxRadiusMeters; 92 | this.geofenceCircleId = geofenceCircleId; 93 | this.mapAreaType = GEOFENCE_WRAPPER; 94 | this.fillColor = fillColor; 95 | 96 | this.context = context; 97 | 98 | radiusMarker = map.addMarker(new MarkerOptions() 99 | .position(MarkerAreasUtils.toRadiusLatLng(center, radiusMeters)) 100 | .anchor(resizeDrawableAnchorU, resizeDrawableAnchorV) 101 | .draggable(isEnabled)); 102 | radiusMarker.setVisible(isEnabled); 103 | 104 | centerMarker = map.addMarker(new MarkerOptions() 105 | .position(center) 106 | .flat(true) 107 | .anchor(moveDrawableAnchorU, moveDrawableAnchorV) 108 | .draggable(isEnabled)); 109 | 110 | if (radiusDrawableId != 0 && radiusDrawableId != -1) { 111 | 112 | int px = context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size); 113 | Bitmap mDotMarkerBitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888); 114 | Canvas canvas = new Canvas(mDotMarkerBitmap); 115 | Drawable shape = ResourcesCompat.getDrawable(context.getResources(), radiusDrawableId, null); 116 | shape.setBounds(0, 0, mDotMarkerBitmap.getWidth(), mDotMarkerBitmap.getHeight()); 117 | shape.draw(canvas); 118 | 119 | radiusMarker.setIcon(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap)); 120 | } 121 | 122 | if (centerDrawableId != -1) { 123 | BitmapDrawable bitmapDrawable = (BitmapDrawable) context.getResources().getDrawable(centerDrawableId); 124 | Bitmap bitmap = bitmapDrawable.getBitmap(); 125 | Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, (int)(bitmap.getWidth() / 2), (int)(bitmap.getHeight() / 2), false); 126 | // centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap)); 127 | 128 | int imageSize = (MetricsUtils.convertDIPsToPixels(context, 30f)); 129 | 130 | if (childProfileImage == null) { 131 | if(childBitmap == null) { 132 | childProfileImage = Bitmap.createBitmap(imageSize, imageSize, Bitmap.Config.ARGB_8888); 133 | Drawable drawable = context.getResources().getDrawable(android.R.drawable.sym_contact_card); 134 | Canvas canvas = new Canvas(childProfileImage); 135 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 136 | drawable.draw(canvas); 137 | childBitmap = childProfileImage; 138 | } else { 139 | childProfileImage = childBitmap; 140 | } 141 | 142 | } 143 | 144 | centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(overlay(scaledBitmap, getRoundedCornerBitmap(childProfileImage, imageSize)))); 145 | } 146 | 147 | circle = map.addCircle(new CircleOptions() 148 | .center(center) 149 | .radius(radiusMeters) 150 | .strokeWidth(strokeWidth) 151 | .strokeColor(strokeColor) 152 | .fillColor(fillColor)); 153 | } 154 | 155 | public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) { 156 | Bitmap output = Bitmap.createBitmap(pixels, pixels, Bitmap.Config.ARGB_8888); 157 | Canvas canvas = new Canvas(output); 158 | 159 | final int color = 0xff424242; 160 | final Paint paint = new Paint(); 161 | final Rect rect = new Rect(0, 0, pixels, pixels); 162 | final RectF rectF = new RectF(rect); 163 | final float roundPx = pixels; 164 | 165 | paint.setAntiAlias(true); 166 | canvas.drawARGB(0, 0, 0, 0); 167 | paint.setColor(color); 168 | canvas.drawRoundRect(rectF, roundPx, roundPx, paint); 169 | 170 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); 171 | canvas.drawBitmap(Bitmap.createScaledBitmap(bitmap, pixels, pixels, false), rect, rect, paint); 172 | 173 | return output; 174 | } 175 | 176 | public Bitmap overlay(Bitmap bmp1, Bitmap bmp2) { 177 | Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig()); 178 | Canvas canvas = new Canvas(bmOverlay); 179 | canvas.drawBitmap(bmp1, new Matrix(), null); 180 | 181 | int offset = MetricsUtils.convertDIPsToPixels(context, 5); 182 | 183 | canvas.drawBitmap(bmp2, offset, offset, null); 184 | return bmOverlay; 185 | } 186 | 187 | 188 | public MarkerAreaWrapper(Context context, GoogleMap map, boolean isEnabled, LatLng center, int count, Boolean shouldExpand, ArrayList locationData, int centerDrawableId) { 189 | this.isEnabled = isEnabled; 190 | this.count = count; 191 | this.mapAreaType = DATA_POINT_WRAPPER; 192 | this.shouldExpand = shouldExpand; 193 | this.locationData = locationData; 194 | 195 | centerMarker = map.addMarker(new MarkerOptions() 196 | .position(center) 197 | .flat(true) 198 | .draggable(isEnabled)); 199 | 200 | if (centerDrawableId != -1) { 201 | BitmapDrawable bitmapDrawable = (BitmapDrawable) context.getResources().getDrawable(centerDrawableId); 202 | Bitmap bitmap = bitmapDrawable.getBitmap(); 203 | Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth()/2, bitmap.getHeight()/2, false); 204 | centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap)); 205 | } 206 | } 207 | 208 | public static Bitmap drawableToBitmap (Drawable drawable) { 209 | Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); 210 | Canvas canvas = new Canvas(bitmap); 211 | 212 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 213 | drawable.draw(canvas); 214 | return bitmap; 215 | } 216 | 217 | /** 218 | * @return center of circle in geocoordinates 219 | */ 220 | public LatLng getCenter() { 221 | return centerMarker.getPosition(); 222 | } 223 | 224 | public Marker getCenterMarker() { 225 | return centerMarker; 226 | } 227 | 228 | public long getGeofenceCircleId() { return geofenceCircleId; } 229 | 230 | /** 231 | * @return radius of circle in meters 232 | */ 233 | public double getRadius() { 234 | return radiusMeters; 235 | } 236 | 237 | public String getMapAreaType() { 238 | return mapAreaType; 239 | } 240 | 241 | public void setMapAreaType(String mapAreaType) { 242 | this.mapAreaType = mapAreaType; 243 | } 244 | 245 | public int getCount() { 246 | return count; 247 | } 248 | 249 | public void setCount(int count) { 250 | this.count = count; 251 | } 252 | 253 | public boolean isShouldExpand() { 254 | return shouldExpand; 255 | } 256 | 257 | public void setShouldExpand(boolean shouldExpand) { 258 | this.shouldExpand = shouldExpand; 259 | } 260 | 261 | public ArrayList getLocationData() { 262 | return locationData; 263 | } 264 | 265 | public void setLocationData(ArrayList locationData) { 266 | this.locationData = locationData; 267 | } 268 | 269 | public void setStokeWidth(float strokeWidth) { 270 | circle.setStrokeWidth(strokeWidth); 271 | } 272 | 273 | public void setStokeColor(int strokeColor) { 274 | circle.setStrokeColor(strokeColor); 275 | } 276 | 277 | public void setFillColor(int fillColor) { 278 | circle.setFillColor(fillColor); 279 | } 280 | 281 | public void setCenter(LatLng center) { 282 | centerMarker.setPosition(center); 283 | onCenterUpdated(center); 284 | } 285 | 286 | public void removeArea() { 287 | if(radiusMarker != null) radiusMarker.remove(); 288 | if(centerMarker != null) centerMarker.remove(); 289 | if(circle != null) circle.remove(); 290 | } 291 | 292 | public void removeDataPoint() { 293 | if(centerMarker != null) centerMarker.remove(); 294 | } 295 | 296 | /** 297 | * Called after update position of center marker, to update the circle and the radius marker 298 | * @param center 299 | */ 300 | public void onCenterUpdated(LatLng center) { 301 | if(circle != null) circle.setCenter(center); 302 | if(radiusMarker != null) radiusMarker.setPosition(MarkerAreasUtils.toRadiusLatLng(center, radiusMeters)); 303 | } 304 | 305 | /** 306 | * Set the radius of circle 307 | * the map circle will be updated immediately 308 | * 309 | * @param radiusMeters 310 | */ 311 | public void setRadius(double radiusMeters) { 312 | this.radiusMeters = radiusMeters; 313 | circle.setRadius(radiusMeters); 314 | } 315 | 316 | @Override 317 | public String toString() { 318 | return "center: " + getCenter() + " radius: " + getRadius() + " type: " + getMapAreaType() + " count: " + getCount(); 319 | } 320 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MarkerAreasConstants.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | /** 4 | * Constants 5 | * 6 | * @author A-Ar Andrew Concepcion 7 | */ 8 | public class MarkerAreasConstants { 9 | public static final double RADIUS_OF_EARTH_METERS = 6371009; 10 | } 11 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MarkerAreasUtils.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | import android.location.Location; 4 | 5 | import com.google.android.gms.maps.model.LatLng; 6 | 7 | /** 8 | * Map Geofence Marker Builder Utility 9 | * 10 | * @author A-Ar Andrew Concepcion 11 | */ 12 | public class MarkerAreasUtils { 13 | 14 | public static LatLng toRadiusLatLng(LatLng center, double radius) { 15 | double radiusAngle = Math.toDegrees(radius / MarkerAreasConstants.RADIUS_OF_EARTH_METERS) / Math.cos(Math.toRadians(center.latitude)); 16 | return new LatLng(center.latitude, center.longitude + radiusAngle); 17 | } 18 | 19 | public static double toRadiusMeters(LatLng center, LatLng radius) { 20 | float[] result = new float[1]; 21 | Location.distanceBetween(center.latitude, center.longitude, radius.latitude, radius.longitude, result); 22 | return result[0]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MarkerBuilderManagerV2.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Color; 6 | import android.graphics.Point; 7 | 8 | import com.google.android.gms.maps.GoogleMap; 9 | import com.google.android.gms.maps.model.LatLng; 10 | import com.google.android.gms.maps.model.Marker; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by andrewconcepcion on 4/28/15. 17 | */ 18 | public class MarkerBuilderManagerV2 implements GoogleMap.OnMarkerClickListener, GoogleMap.OnMarkerDragListener, GoogleMap.OnMapLongClickListener, GoogleMap.OnMapClickListener { 19 | 20 | private final Context context; 21 | private final GoogleMap googleMap; 22 | private final boolean isEnabled; 23 | private final double radius; 24 | private final long circleId; 25 | private final float strokeWidth; 26 | private final int strokeColor; 27 | private final int fillColor; 28 | private final int minRadius; 29 | private final int maxRadius; 30 | private final int centerIcon; 31 | private final Bitmap centerBitmap; 32 | private final int resizerIcon; 33 | private final float centerOffsetHorizontal; 34 | private final float centerOffsetVertical; 35 | private final CircleManagerListener circleManagerListener; 36 | 37 | private List areas = new ArrayList<>(1); 38 | private List savedPoints = new ArrayList<>(1); 39 | private List savedDataPoints = new ArrayList<>(1); 40 | 41 | public static class Builder { 42 | private Context context; 43 | private GoogleMap googleMap; 44 | private boolean isEnabled; 45 | private double radius = 0; 46 | private long circleId; 47 | private int fillColor = Color.HSVToColor(70, new float[]{1, 1, 200}); 48 | private float strokeWidth = 4f; 49 | private int strokeColor = Color.RED; 50 | private int minRadius = -1; 51 | private int maxRadius = -1; 52 | private int centerIcon = android.R.drawable.ic_menu_mylocation; 53 | private int resizerIcon = android.R.drawable.ic_menu_mylocation; 54 | private Bitmap centerBitmap; 55 | private float centerOffsetHorizontal = 0.5f; 56 | private float centerOffsetVertical = 0.5f; 57 | private float resizerOffsetHorizontal = 0.5f; 58 | private float resizerOffsetVertical = 0.5f; 59 | private CircleManagerListener circleManagerListener; 60 | 61 | public Builder(Context context) { 62 | this.context = context; 63 | } 64 | 65 | public Builder map(GoogleMap googleMap) { 66 | this.googleMap = googleMap; 67 | return this; 68 | } 69 | 70 | public Builder listener(CircleManagerListener circleManagerListener) { 71 | this.circleManagerListener = circleManagerListener; 72 | return this; 73 | } 74 | 75 | public Builder enabled(boolean isEnabled) { 76 | this.isEnabled = isEnabled; 77 | return this; 78 | } 79 | 80 | public Builder radius(double radius) { 81 | this.radius = radius; 82 | return this; 83 | } 84 | 85 | public Builder circleId(long circleId) { 86 | this.circleId = circleId; 87 | return this; 88 | } 89 | 90 | public Builder strokeWidth(float strokeWidth) { 91 | this.strokeWidth = strokeWidth; 92 | return this; 93 | } 94 | 95 | public Builder strokeColor(int strokeColor) { 96 | this.strokeColor = strokeColor; 97 | return this; 98 | } 99 | 100 | public Builder fillColor(int fillColor) { 101 | this.fillColor = fillColor; 102 | return this; 103 | } 104 | 105 | public Builder minRadius(int minRadius) { 106 | this.minRadius = minRadius; 107 | return this; 108 | } 109 | 110 | public Builder maxRadius(int maxRadius) { 111 | this.maxRadius = maxRadius; 112 | return this; 113 | } 114 | 115 | public Builder centerIcon(int centerIcon) { 116 | this.centerIcon = centerIcon; 117 | return this; 118 | } 119 | 120 | public Builder centerBitmap(Bitmap centerBitmap) { 121 | this.centerBitmap = centerBitmap; 122 | return this; 123 | } 124 | 125 | public Builder resizerIcon(int resizerIcon) { 126 | this.resizerIcon = resizerIcon; 127 | return this; 128 | } 129 | 130 | public Builder centerOffsetHorizontal(float centerOffsetHorizontal) { 131 | this.centerOffsetHorizontal = centerOffsetHorizontal; 132 | return this; 133 | } 134 | 135 | public Builder centerOffsetVertical(float centerOffsetVertical) { 136 | this.centerOffsetVertical = centerOffsetVertical; 137 | return this; 138 | } 139 | 140 | public Builder resizerOffsetHorizontal(float resizerOffsetHorizontal) { 141 | this.resizerOffsetHorizontal = resizerOffsetHorizontal; 142 | return this; 143 | } 144 | 145 | public Builder resizerOffsetVertical(float resizerOffsetVertical) { 146 | this.resizerOffsetVertical = resizerOffsetVertical; 147 | return this; 148 | } 149 | public MarkerBuilderManagerV2 build(){ 150 | return new MarkerBuilderManagerV2(this); 151 | } 152 | } 153 | 154 | private MarkerBuilderManagerV2(Builder b) { 155 | this.context = b.context; 156 | this.googleMap = b.googleMap; 157 | this.circleManagerListener = b.circleManagerListener; 158 | this.isEnabled = b.isEnabled; 159 | this.radius = b.radius; 160 | this.circleId = b.circleId; 161 | this.strokeWidth = b.strokeWidth; 162 | this.strokeColor = b.strokeColor; 163 | this.fillColor = b.fillColor; 164 | this.minRadius = b.minRadius; 165 | this.maxRadius = b.maxRadius; 166 | this.centerIcon = b.centerIcon; 167 | this.centerBitmap = b.centerBitmap; 168 | this.resizerIcon = b.resizerIcon; 169 | this.centerOffsetHorizontal = b.centerOffsetHorizontal; 170 | this.centerOffsetVertical = b.centerOffsetVertical; 171 | 172 | googleMap.setOnMarkerDragListener(this); 173 | googleMap.setOnMapLongClickListener(this); 174 | googleMap.setOnMapClickListener(this); 175 | googleMap.setOnMarkerClickListener(this); 176 | } 177 | 178 | /** 179 | * When marker is moved, notify circles 180 | * The circle containing the marker will execute necessary actions 181 | * 182 | * @param marker 183 | * @return 184 | */ 185 | private MarkerMoveResultWithCircle onMarkerMoved(Marker marker) { 186 | GeofenceCircle.MarkerMoveResult result = GeofenceCircle.MarkerMoveResult.none; 187 | GeofenceCircle affectedDraggableCircle = null; 188 | 189 | ArrayList allMarkers = new ArrayList<>(); 190 | allMarkers.addAll(areas); 191 | allMarkers.addAll(savedPoints); 192 | allMarkers.addAll(savedDataPoints); 193 | 194 | for(int i = 0; i < allMarkers.size(); i++) { 195 | GeofenceCircle draggableCircle = allMarkers.get(i); 196 | result = draggableCircle.onMarkerMoved(marker); 197 | if (result != GeofenceCircle.MarkerMoveResult.none) { 198 | affectedDraggableCircle = draggableCircle; 199 | break; 200 | } 201 | } 202 | 203 | return new MarkerMoveResultWithCircle(result, affectedDraggableCircle); 204 | } 205 | 206 | /** 207 | * Clear current circles plotted on the map 208 | */ 209 | public void clearCircles() { 210 | 211 | for(int i = 0; i < areas.size(); i++) { 212 | getCircles().get(i).removeArea(); 213 | } 214 | } 215 | 216 | public void removeCircle(long geofenceCircleId) { 217 | 218 | for(int i = 0; i < savedPoints.size(); i++) { 219 | 220 | GeofenceCircle savedCircle = savedPoints.get(i); 221 | if(savedCircle.getCircleId() == geofenceCircleId){ 222 | savedCircle.removeArea(); 223 | break; 224 | } 225 | } 226 | } 227 | 228 | public void clearSavedCircles() { 229 | 230 | for(int i = 0; i < savedPoints.size(); i++) { 231 | GeofenceCircle oldCircle = savedPoints.get(i); 232 | oldCircle.removeArea(); 233 | } 234 | savedPoints.clear(); 235 | } 236 | 237 | public void markThis(LatLng point, boolean isSaved) { 238 | 239 | clearCircles(); 240 | double initRadiusMetersFinal; 241 | 242 | if(radius == 0) { 243 | Point screenCenterPoint = googleMap.getProjection().toScreenLocation(point); 244 | LatLng radiusLatLng = googleMap.getProjection().fromScreenLocation(new Point(screenCenterPoint.x + (int)radius, screenCenterPoint.y)); 245 | initRadiusMetersFinal = MarkerAreasUtils.toRadiusMeters(point, radiusLatLng); 246 | } else { 247 | initRadiusMetersFinal = radius; 248 | } 249 | 250 | GeofenceCircle geofenceCircle = new GeofenceCircle.Builder(context) 251 | .map(googleMap) 252 | .enabled(isEnabled) 253 | .radius(initRadiusMetersFinal) 254 | .circleId(circleId) 255 | .strokeWidth(strokeWidth) 256 | .strokeColor(strokeColor) 257 | .fillColor(fillColor) 258 | .minRadius(minRadius) 259 | .maxRadius(maxRadius) 260 | .centerIcon(centerIcon) 261 | .centerBitmap(centerBitmap) 262 | .resizerIcon(resizerIcon) 263 | .centerOffsetHorizontal(centerOffsetHorizontal) 264 | .centerOffsetVertical(centerOffsetVertical) 265 | .center(point) 266 | .build(); 267 | 268 | if(!isSaved) { 269 | areas.add(geofenceCircle); 270 | } else { 271 | savedPoints.add(geofenceCircle); 272 | } 273 | 274 | if(circleManagerListener != null) circleManagerListener.onCreateCircle(geofenceCircle); 275 | } 276 | 277 | public void plotPoints(LatLng point, Integer radius, long circularGeofenceId, int fillColor) { 278 | GeofenceCircle circle = addSavedPoint(point, radius, circularGeofenceId, fillColor); 279 | if(circleManagerListener != null) circleManagerListener.onInitCreateCircle(circle); 280 | 281 | } 282 | 283 | /** 284 | * adds a point to non clearable circle 285 | * 286 | * @param savedPoint a successfully saved point returned by the server 287 | */ 288 | public GeofenceCircle addSavedPoint(LatLng savedPoint, Integer radius, long geofenceCircleId, int fillColor) { 289 | 290 | GeofenceCircle circle = new GeofenceCircle.Builder(context) 291 | .map(googleMap) 292 | .enabled(isEnabled) 293 | .radius(radius) 294 | .circleId(circleId) 295 | .circleId(circleId) 296 | .strokeWidth(strokeWidth) 297 | .strokeColor(strokeColor) 298 | .fillColor(fillColor) 299 | .minRadius(minRadius) 300 | .maxRadius(maxRadius) 301 | .centerIcon(centerIcon) 302 | .centerBitmap(centerBitmap) 303 | .resizerIcon(resizerIcon) 304 | .centerOffsetHorizontal(centerOffsetHorizontal) 305 | .centerOffsetVertical(centerOffsetVertical) 306 | .center(savedPoint) 307 | .build(); 308 | 309 | savedPoints.add(circle); 310 | return circle; 311 | } 312 | 313 | public List getCircles() { 314 | return areas; 315 | } 316 | 317 | @Override 318 | public void onMapClick(LatLng latLng) { 319 | markThis(latLng, false); 320 | } 321 | 322 | @Override 323 | public void onMapLongClick(LatLng latLng) { 324 | 325 | } 326 | 327 | @Override 328 | public boolean onMarkerClick(Marker marker) { 329 | 330 | if(circleManagerListener == null) return false; 331 | MarkerMoveResultWithCircle result = onMarkerMoved(marker); 332 | circleManagerListener.onCircleMarkerClick(result.circle); 333 | return false; 334 | } 335 | 336 | @Override 337 | public void onMarkerDragStart(Marker marker) { 338 | MarkerMoveResultWithCircle result = onMarkerMoved(marker); 339 | if(circleManagerListener == null) return; 340 | switch (result.markerMoveResult) { 341 | case minRadius: { 342 | circleManagerListener.onMinRadius(result.circle); 343 | break; 344 | } 345 | case maxRadius: { 346 | circleManagerListener.onMaxRadius(result.circle); 347 | break; 348 | } 349 | case radiusChange: { 350 | circleManagerListener.onResizeCircleStart(result.circle); 351 | break; 352 | } 353 | case moved: { 354 | circleManagerListener.onMoveCircleStart(result.circle); 355 | break; 356 | } 357 | default: break; 358 | } 359 | } 360 | 361 | @Override 362 | public void onMarkerDrag(Marker marker) { 363 | MarkerMoveResultWithCircle result = onMarkerMoved(marker); 364 | if(circleManagerListener == null) return; 365 | switch (result.markerMoveResult) { 366 | case minRadius: { 367 | circleManagerListener.onMinRadius(result.circle); 368 | break; 369 | } 370 | case maxRadius: { 371 | circleManagerListener.onMaxRadius(result.circle); 372 | break; 373 | } 374 | default: break; 375 | } 376 | } 377 | 378 | @Override 379 | public void onMarkerDragEnd(Marker marker) { 380 | MarkerMoveResultWithCircle result = onMarkerMoved(marker); 381 | if(circleManagerListener == null) return; 382 | switch (result.markerMoveResult) { 383 | case minRadius: { 384 | circleManagerListener.onMinRadius(result.circle); 385 | break; 386 | } 387 | case maxRadius: { 388 | circleManagerListener.onMaxRadius(result.circle); 389 | break; 390 | } 391 | case radiusChange: { 392 | circleManagerListener.onResizeCircleEnd(result.circle); 393 | break; 394 | } 395 | case moved: { 396 | circleManagerListener.onMoveCircleEnd(result.circle); 397 | break; 398 | } 399 | default: break; 400 | } 401 | } 402 | } 403 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MarkerMoveResultWithCircle.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | /** 4 | * Created by andrewconcepcion on 4/28/15. 5 | */ 6 | public class MarkerMoveResultWithCircle { 7 | GeofenceCircle.MarkerMoveResult markerMoveResult; 8 | GeofenceCircle circle; 9 | 10 | public MarkerMoveResultWithCircle(GeofenceCircle.MarkerMoveResult markerMoveResult, GeofenceCircle circle) { 11 | this.markerMoveResult = markerMoveResult; 12 | this.circle = circle; 13 | } 14 | } -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/java/com/aconcepcion/geofencemarkerbuilder/MetricsUtils.java: -------------------------------------------------------------------------------- 1 | package com.aconcepcion.geofencemarkerbuilder; 2 | 3 | import android.content.Context; 4 | import android.util.TypedValue; 5 | 6 | /** 7 | * @author A-Ar Andrew Concepcion 8 | */ 9 | public class MetricsUtils { 10 | 11 | public static int convertDIPsToPixels (Context context, float DIPs) { 12 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DIPs, context.getResources().getDisplayMetrics()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /geofencemarkerbuilder/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | geofencemarkerbuilder 3 | 4 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ac-opensource/MarkerBuilder/aa5d5417ca1571e73a88bba85b45a187591022f7/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.14.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':geofencemarkerbuilder' 2 | --------------------------------------------------------------------------------