diff --git a/maps-ktx/.gitignore b/maps-ktx/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/maps-ktx/.gitignore @@ -0,0 +1 @@ +/build diff --git a/maps-ktx/build.gradle b/maps-ktx/build.gradle new file mode 100644 index 00000000..e57c121c --- /dev/null +++ b/maps-ktx/build.gradle @@ -0,0 +1,45 @@ +/* + * Copyright 2020 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion versions.android.compileSdk + buildToolsVersion versions.android.buildTools + + defaultConfig { + minSdkVersion versions.android.minSdk + targetSdkVersion versions.android.targetSdk + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles 'consumer-rules.pro' + } +} + +dependencies { + api deps.kotlin + implementation deps.playServicesMaps + implementation deps.kotlinxCoroutines + + // Tests + testImplementation deps.androidx.test + testImplementation deps.androidx.junit + testImplementation deps.junit + testImplementation deps.mockito + testImplementation deps.mockitoKotlin +} diff --git a/maps-ktx/consumer-rules.pro b/maps-ktx/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/maps-ktx/proguard-rules.pro b/maps-ktx/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/maps-ktx/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/maps-ktx/src/main/AndroidManifest.xml b/maps-ktx/src/main/AndroidManifest.xml new file mode 100644 index 00000000..f9032cff --- /dev/null +++ b/maps-ktx/src/main/AndroidManifest.xml @@ -0,0 +1,19 @@ + + + diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/core/PolygonOptions.kt b/maps-ktx/src/main/java/com/google/maps/android/ktx/PolygonOptions.kt similarity index 95% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/core/PolygonOptions.kt rename to maps-ktx/src/main/java/com/google/maps/android/ktx/PolygonOptions.kt index d8393b59..38fd8d24 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/core/PolygonOptions.kt +++ b/maps-ktx/src/main/java/com/google/maps/android/ktx/PolygonOptions.kt @@ -15,7 +15,7 @@ * */ -package com.google.maps.android.ktx.core +package com.google.maps.android.ktx import com.google.android.gms.maps.model.PolygonOptions diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/core/SupportMapFragment.kt b/maps-ktx/src/main/java/com/google/maps/android/ktx/SupportMapFragment.kt similarity index 95% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/core/SupportMapFragment.kt rename to maps-ktx/src/main/java/com/google/maps/android/ktx/SupportMapFragment.kt index fd1c25c7..7649ef22 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/core/SupportMapFragment.kt +++ b/maps-ktx/src/main/java/com/google/maps/android/ktx/SupportMapFragment.kt @@ -15,7 +15,7 @@ * */ -package com.google.maps.android.ktx.core +package com.google.maps.android.ktx import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.SupportMapFragment diff --git a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/core/PolygonOptionsTest.kt b/maps-ktx/src/test/java/com/google/maps/android/ktx/PolygonOptionsTest.kt similarity index 79% rename from maps-utils-ktx/src/test/java/com/google/maps/android/ktx/core/PolygonOptionsTest.kt rename to maps-ktx/src/test/java/com/google/maps/android/ktx/PolygonOptionsTest.kt index 175f39b2..24b49511 100644 --- a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/core/PolygonOptionsTest.kt +++ b/maps-ktx/src/test/java/com/google/maps/android/ktx/PolygonOptionsTest.kt @@ -15,7 +15,7 @@ * */ -package com.google.maps.android.ktx.core +package com.google.maps.android.ktx import android.graphics.Color import com.google.android.gms.maps.model.LatLng @@ -25,11 +25,12 @@ import org.junit.Test class PolygonOptionsTest { @Test fun testBuilder() { - val polygonOptions = buildPolygonOptions { - strokeWidth(1.0f) - strokeColor(Color.BLACK) - add(LatLng(0.0, 0.0)) - } + val polygonOptions = + com.google.maps.android.ktx.buildPolygonOptions { + strokeWidth(1.0f) + strokeColor(Color.BLACK) + add(LatLng(0.0, 0.0)) + } assertEquals(1.0f, polygonOptions.strokeWidth) assertEquals(Color.BLACK, polygonOptions.strokeColor) assertEquals(listOf(LatLng(0.0, 0.0)), polygonOptions.points) diff --git a/maps-utils-ktx/build.gradle b/maps-utils-ktx/build.gradle index a183fe6f..1414bba2 100644 --- a/maps-utils-ktx/build.gradle +++ b/maps-utils-ktx/build.gradle @@ -27,19 +27,10 @@ android { defaultConfig { minSdkVersion versions.android.minSdk targetSdkVersion versions.android.targetSdk - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - libraryVariants.all { it.generateBuildConfig.enabled = false } @@ -49,7 +40,6 @@ dependencies { api deps.kotlin api deps.androidMapsUtils implementation deps.playServicesMaps - implementation deps.kotlinxCoroutines // Tests testImplementation deps.androidx.test diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/LatLng.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/LatLng.kt similarity index 99% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/LatLng.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/LatLng.kt index f468e98c..5eb0a6ec 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/LatLng.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/LatLng.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx +package com.google.maps.android.ktx.utils import com.google.android.gms.maps.model.LatLng import com.google.maps.android.PolyUtil diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/Polygon.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/Polygon.kt similarity index 98% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/Polygon.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/Polygon.kt index ae39759e..ab23ac49 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/Polygon.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/Polygon.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx +package com.google.maps.android.ktx.utils import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.Polygon diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/Polyline.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/Polyline.kt similarity index 96% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/Polyline.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/Polyline.kt index 90d6a6d9..86b54836 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/Polyline.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/Polyline.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx +package com.google.maps.android.ktx.utils import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.Polyline diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/geojson/GeoJson.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/geojson/GeoJson.kt similarity index 96% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/geojson/GeoJson.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/geojson/GeoJson.kt index 982f5ca5..8cfa3506 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/geojson/GeoJson.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/geojson/GeoJson.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx.geojson +package com.google.maps.android.ktx.utils.geojson import com.google.android.gms.maps.GoogleMap import com.google.maps.android.collections.GroundOverlayManager diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/geometry/Point.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/geometry/Point.kt similarity index 94% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/geometry/Point.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/geometry/Point.kt index 48393369..c138c645 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/geometry/Point.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/geometry/Point.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx.geometry +package com.google.maps.android.ktx.utils.geometry import com.google.maps.android.geometry.Point diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/heatmaps/Heatmap.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/heatmaps/Heatmap.kt similarity index 97% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/heatmaps/Heatmap.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/heatmaps/Heatmap.kt index 468a2bbf..a97060bb 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/heatmaps/Heatmap.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/heatmaps/Heatmap.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx.heatmaps +package com.google.maps.android.ktx.utils.heatmaps import com.google.android.gms.maps.model.LatLng import com.google.maps.android.heatmaps.Gradient diff --git a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/kml/Kml.kt b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/kml/Kml.kt similarity index 98% rename from maps-utils-ktx/src/main/java/com/google/maps/android/ktx/kml/Kml.kt rename to maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/kml/Kml.kt index 7f30c2fd..2aa55645 100644 --- a/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/kml/Kml.kt +++ b/maps-utils-ktx/src/main/java/com/google/maps/android/ktx/utils/kml/Kml.kt @@ -16,7 +16,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") -package com.google.maps.android.ktx.kml +package com.google.maps.android.ktx.utils.kml import android.content.Context import androidx.annotation.RawRes diff --git a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/LatLngTest.kt b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/LatLngTest.kt similarity index 99% rename from maps-utils-ktx/src/test/java/com/google/maps/android/ktx/LatLngTest.kt rename to maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/LatLngTest.kt index 14767ccc..4552fc8c 100644 --- a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/LatLngTest.kt +++ b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/LatLngTest.kt @@ -15,7 +15,7 @@ * */ -package com.google.maps.android.ktx +package com.google.maps.android.ktx.utils import com.google.android.gms.maps.model.LatLng import org.junit.Assert.* diff --git a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/PolygonTest.kt b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/PolygonTest.kt similarity index 92% rename from maps-utils-ktx/src/test/java/com/google/maps/android/ktx/PolygonTest.kt rename to maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/PolygonTest.kt index b036d884..45509d50 100644 --- a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/PolygonTest.kt +++ b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/PolygonTest.kt @@ -15,10 +15,12 @@ * */ -package com.google.maps.android.ktx +package com.google.maps.android.ktx.utils import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.Polygon +import com.google.maps.android.ktx.utils.contains +import com.google.maps.android.ktx.utils.isOnEdge import com.nhaarman.mockitokotlin2.doReturn import com.nhaarman.mockitokotlin2.mock import org.junit.Assert.assertFalse diff --git a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/PolylineTest.kt b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/PolylineTest.kt similarity index 93% rename from maps-utils-ktx/src/test/java/com/google/maps/android/ktx/PolylineTest.kt rename to maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/PolylineTest.kt index f8dfb994..3f9ff470 100644 --- a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/PolylineTest.kt +++ b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/PolylineTest.kt @@ -15,10 +15,12 @@ * */ -package com.google.maps.android.ktx +package com.google.maps.android.ktx.utils import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.Polyline +import com.google.maps.android.ktx.utils.contains +import com.google.maps.android.ktx.utils.sphericalPathLength import com.nhaarman.mockitokotlin2.doReturn import com.nhaarman.mockitokotlin2.mock import org.junit.Assert.* diff --git a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/geometry/PointTest.kt b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/geometry/PointTest.kt similarity index 95% rename from maps-utils-ktx/src/test/java/com/google/maps/android/ktx/geometry/PointTest.kt rename to maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/geometry/PointTest.kt index c361e010..5d5c7b7f 100644 --- a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/geometry/PointTest.kt +++ b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/geometry/PointTest.kt @@ -15,7 +15,7 @@ * */ -package com.google.maps.android.ktx.geometry +package com.google.maps.android.ktx.utils.geometry import com.google.maps.android.geometry.Point import org.junit.Assert.assertEquals diff --git a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/heatmap/HeatmapTest.kt b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/heatmap/HeatmapTest.kt similarity index 91% rename from maps-utils-ktx/src/test/java/com/google/maps/android/ktx/heatmap/HeatmapTest.kt rename to maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/heatmap/HeatmapTest.kt index e12ea21e..2634bdd8 100644 --- a/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/heatmap/HeatmapTest.kt +++ b/maps-utils-ktx/src/test/java/com/google/maps/android/ktx/utils/heatmap/HeatmapTest.kt @@ -15,11 +15,11 @@ * */ -package com.google.maps.android.ktx.heatmap +package com.google.maps.android.ktx.utils.heatmap import com.google.android.gms.maps.model.LatLng import com.google.maps.android.heatmaps.WeightedLatLng -import com.google.maps.android.ktx.heatmaps.toWeightedLatLng +import com.google.maps.android.ktx.utils.heatmaps.toWeightedLatLng import org.junit.Assert.* import org.junit.Test diff --git a/settings.gradle b/settings.gradle index a2dad226..3ab1f4cc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -include ':app', ':maps-utils-ktx' +include ':app', ':maps-ktx', ':maps-utils-ktx' rootProject.name='android-maps-ktx'