From 79bdce6cd4649eda6aedfd7034f844df299ab70d Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 19 Jul 2019 11:46:38 +0200 Subject: [android] - update dependencies, target SDK, support library (#15135) --- platform/android/.editorconfig | 4 +- platform/android/LICENSE.md | 98 +++++++++- .../mapboxsdk/camera/CameraUpdateFactory.java | 5 +- .../location/LocationLayerControllerTest.kt | 217 +++++++++++++-------- .../location/utils/LocationComponentAction.kt | 2 +- .../utils/OnMapFragmentReadyIdlingResource.kt | 39 ---- .../mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt | 140 +++++++++---- .../com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt | 1 - .../mapboxsdk/offline/OfflineDownloadTest.kt | 6 +- .../mapboxsdk/snapshotter/MapSnapshotterTest.kt | 8 +- .../mapboxsdk/testapp/maps/ImageMissingTest.kt | 6 +- .../testapp/maps/RemoveUnusedImagesTest.kt | 6 +- .../mapbox/mapboxsdk/testapp/offline/CacheTest.kt | 2 +- .../testapp/offline/OfflineManagerTest.kt | 4 +- .../mapboxsdk/testapp/storage/FileSourceMapTest.kt | 2 +- .../testapp/storage/FileSourceStandaloneTest.kt | 4 +- .../testapp/storage/FileSourceTestUtils.kt | 2 +- .../mapbox/mapboxsdk/testapp/style/ImageTest.kt | 2 +- .../src/main/AndroidManifest.xml | 8 +- .../activity/camera/LatLngBoundsActivity.kt | 2 +- .../activity/fragment/FragmentBackStackActivity.kt | 5 +- .../activity/imagegenerator/SnapshotActivity.kt | 2 +- .../activity/location/LocationFragmentActivity.kt | 23 +-- .../offline/ChangeResourcesCachePathActivity.kt | 2 +- .../activity/offline/DownloadRegionActivity.kt | 4 +- .../offline/MergeOfflineRegionsActivity.kt | 4 +- .../activity/storage/CacheManagementActivity.kt | 3 +- .../activity/style/DraggableMarkerActivity.kt | 2 +- .../activity/turf/PhysicalUnitCircleActivity.kt | 2 +- platform/android/build.gradle | 2 +- platform/android/gradle/dependencies.gradle | 29 +-- platform/android/gradle/gradle-javadoc.gradle | 1 - platform/android/gradle/jacoco-report.gradle | 6 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 34 files changed, 409 insertions(+), 236 deletions(-) delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/OnMapFragmentReadyIdlingResource.kt diff --git a/platform/android/.editorconfig b/platform/android/.editorconfig index 7ebd2b7bb0..8a6c90a0d5 100644 --- a/platform/android/.editorconfig +++ b/platform/android/.editorconfig @@ -1,2 +1,4 @@ [*.{kt,kts}] -indent_size=2 \ No newline at end of file +indent_size=2 +insert_final_newline=false +disabled_rules=no-wildcard-imports \ No newline at end of file diff --git a/platform/android/LICENSE.md b/platform/android/LICENSE.md index 1079b4696a..fdb2d43849 100644 --- a/platform/android/LICENSE.md +++ b/platform/android/LICENSE.md @@ -12,6 +12,12 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens =========================================================================== +Mapbox GL uses portions of the Android Lifecycle LiveData. +URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html) +License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + Mapbox GL uses portions of the Android Lifecycle LiveData Core. URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html) License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -42,12 +48,30 @@ License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2. =========================================================================== +Mapbox GL uses portions of the Android Support Library Async Layout Inflater. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library collections. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + Mapbox GL uses portions of the Android Support Library compat. URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) =========================================================================== +Mapbox GL uses portions of the Android Support Library Coordinator Layout. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + Mapbox GL uses portions of the Android Support Library core UI. URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -60,12 +84,78 @@ License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2. =========================================================================== +Mapbox GL uses portions of the Android Support Library Cursor Adapter. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Custom View. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Custom View. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Document File. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Drawer Layout. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + Mapbox GL uses portions of the Android Support Library fragment. URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) =========================================================================== +Mapbox GL uses portions of the Android Support Library Interpolators. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library loader. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Local Broadcast Manager. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Print. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library Sliding Pane Layout. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + +Mapbox GL uses portions of the Android Support Library View Pager. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + Mapbox GL uses portions of the Gson. License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -119,7 +209,13 @@ License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) Mapbox GL uses portions of the SoLoader. URL: [https://github.com/facebook/soloader](https://github.com/facebook/soloader) -License: [BSD License](https://github.com/facebook/soloader/blob/master/LICENSE) +License: [Apache-2](https://github.com/facebook/soloader/blob/master/LICENSE) + +=========================================================================== + +Mapbox GL uses portions of the VersionedParcelable and friends. +URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html) +License: [The Apache Software License](http://www.apache.org/licenses/LICENSE-2.0.txt) =========================================================================== diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 5ff4104ea8..16285468ee 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -10,7 +10,6 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.Projection; import com.mapbox.mapboxsdk.maps.UiSettings; -import junit.framework.Assert; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -329,8 +328,8 @@ public final class CameraUpdateFactory { return mapboxMap.getCameraForLatLngBounds(bounds, padding); } else { // use provided tilt and bearing - Assert.assertNotNull(bearing); - Assert.assertNotNull(tilt); + assert bearing != null; + assert tilt != null; return mapboxMap.getCameraForLatLngBounds(bounds, padding, bearing, tilt); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt index c2d95d0e80..ab70f188c3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt @@ -27,6 +27,7 @@ import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.activity.EspressoTest import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils import com.mapbox.mapboxsdk.utils.BitmapUtils +import kotlin.math.abs import org.hamcrest.CoreMatchers.`is` import org.hamcrest.CoreMatchers.notNullValue import org.hamcrest.Matchers.equalTo @@ -37,7 +38,6 @@ import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import kotlin.math.abs @RunWith(AndroidJUnit4::class) class LocationLayerControllerTest : EspressoTest() { @@ -77,10 +77,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.renderMode = RenderMode.NORMAL TestingAsyncUtils.waitForLayer(uiController, mapView) @@ -105,10 +107,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.renderMode = RenderMode.NORMAL component.forceLocationUpdate(location) @@ -134,10 +138,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.renderMode = RenderMode.COMPASS component.forceLocationUpdate(location) @@ -163,10 +169,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.renderMode = RenderMode.GPS component.forceLocationUpdate(location) @@ -192,10 +200,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) component.isLocationComponentEnabled = false @@ -222,10 +232,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.renderMode = RenderMode.NORMAL component.forceLocationUpdate(location) @@ -253,10 +265,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.renderMode = RenderMode.NORMAL component.forceLocationUpdate(location) @@ -290,22 +304,30 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(100).build()) component.forceLocationUpdate(location) TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(150) - assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true)) + assertThat( + mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), + `is`(true) + ) mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT)) TestingAsyncUtils.waitForLayer(uiController, mapView) - assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true)) + assertThat( + mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), + `is`(true) + ) } } executeComponentTest(componentAction) @@ -321,10 +343,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) TestingAsyncUtils.waitForLayer(uiController, mapView) @@ -333,9 +357,9 @@ class LocationLayerControllerTest : EspressoTest() { assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true)) val options = component.locationComponentOptions - .toBuilder() - .layerBelow("road-label") - .build() + .toBuilder() + .layerBelow("road-label") + .build() component.applyStyle(options) TestingAsyncUtils.waitForLayer(uiController, mapView) @@ -355,10 +379,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(1).build()) styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE) @@ -386,10 +412,12 @@ class LocationLayerControllerTest : EspressoTest() { styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE) uiController.loopMainThreadForAtLeast(100) var show = true - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, mapboxMap.style!!) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, mapboxMap.style!!) + .useDefaultLocationEngine(false) + .build() + ) pushSourceUpdates(styleChangeIdlingResource) { component.isLocationComponentEnabled = show show = !show @@ -414,19 +442,23 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(location), 16.0)) component.forceLocationUpdate(location) TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(ACCURACY_RADIUS_ANIMATION_DURATION) - assertEquals(Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/, + assertEquals( + Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0] - .getNumberProperty(PROPERTY_ACCURACY_RADIUS).toFloat(), 0.1f) + .getNumberProperty(PROPERTY_ACCURACY_RADIUS).toFloat(), 0.1f + ) } } executeComponentTest(componentAction) @@ -442,10 +474,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) @@ -455,15 +489,23 @@ class LocationLayerControllerTest : EspressoTest() { uiController.loopMainThreadForAtLeast(300) TestingAsyncUtils.waitForLayer(uiController, mapView) - assertThat(Math.abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 && - Math.abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 && - Math.abs(target.longitude - mapboxMap.cameraPosition.target.longitude) < 0.1, - `is`(true)) - - val expectedRadius = Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/ assertThat( - Math.abs(expectedRadius - mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_ACCURACY_RADIUS).toFloat()) < 0.1, - `is`(true)) + Math.abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 && + Math.abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 && + Math.abs(target.longitude - mapboxMap.cameraPosition.target.longitude) < 0.1, + `is`(true) + ) + + val expectedRadius = + Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/ + assertThat( + Math.abs( + expectedRadius - mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty( + PROPERTY_ACCURACY_RADIUS + ).toFloat() + ) < 0.1, + `is`(true) + ) } } executeComponentTest(componentAction) @@ -479,10 +521,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) @@ -493,14 +537,21 @@ class LocationLayerControllerTest : EspressoTest() { assertThat( abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 && - abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 && - abs(target.longitude - mapboxMap.cameraPosition.target.longitude) < 0.1, - `is`(true)) + abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 && + abs(target.longitude - mapboxMap.cameraPosition.target.longitude) < 0.1, + `is`(true) + ) - val expectedRadius = Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/ + val expectedRadius = + Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/ assertThat( - Math.abs(expectedRadius - mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_ACCURACY_RADIUS).toFloat()) < 0.1, - `is`(true)) + Math.abs( + expectedRadius - mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty( + PROPERTY_ACCURACY_RADIUS + ).toFloat() + ) < 0.1, + `is`(true) + ) } } executeComponentTest(componentAction) @@ -516,10 +567,12 @@ class LocationLayerControllerTest : EspressoTest() { uiController: UiController, context: Context ) { - component.activateLocationComponent(LocationComponentActivationOptions - .builder(context, style) - .useDefaultLocationEngine(false) - .build()) + component.activateLocationComponent( + LocationComponentActivationOptions + .builder(context, style) + .useDefaultLocationEngine(false) + .build() + ) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) TestingAsyncUtils.waitForLayer(uiController, mapView) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt index daf6b89f59..3cb9e51bf7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt @@ -5,8 +5,8 @@ import android.support.test.espresso.UiController import android.support.test.espresso.ViewAction import android.support.test.espresso.matcher.ViewMatchers.isDisplayed import android.view.View -import com.mapbox.mapboxsdk.maps.MapboxMap import com.mapbox.mapboxsdk.location.LocationComponent +import com.mapbox.mapboxsdk.maps.MapboxMap import com.mapbox.mapboxsdk.maps.Style import org.hamcrest.Matcher diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/OnMapFragmentReadyIdlingResource.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/OnMapFragmentReadyIdlingResource.kt deleted file mode 100644 index 4d02a4d2bf..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/OnMapFragmentReadyIdlingResource.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.mapbox.mapboxsdk.location.utils - -import android.os.Handler -import android.os.Looper -import android.support.test.espresso.IdlingResource - -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback -import com.mapbox.mapboxsdk.maps.SupportMapFragment - -class OnMapFragmentReadyIdlingResource(fragment: SupportMapFragment?) : IdlingResource, OnMapReadyCallback { - - lateinit var mapboxMap: MapboxMap - - private var resourceCallback: IdlingResource.ResourceCallback? = null - - init { - Handler(Looper.getMainLooper()).post { - fragment?.getMapAsync(this) - } - } - - override fun getName(): String { - return javaClass.simpleName - } - - override fun isIdleNow(): Boolean { - return this::mapboxMap.isInitialized - } - - override fun registerIdleTransitionCallback(resourceCallback: IdlingResource.ResourceCallback) { - this.resourceCallback = resourceCallback - } - - override fun onMapReady(mapboxMap: MapboxMap) { - this.mapboxMap = mapboxMap - resourceCallback?.onTransitionToIdle() - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt index 2f6346d37d..f3af386457 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GesturesUiTestUtils.kt @@ -9,14 +9,18 @@ import android.support.test.espresso.ViewAction import android.support.test.espresso.matcher.ViewMatchers import android.view.MotionEvent import android.view.View - import org.hamcrest.Matcher object GesturesUiTestUtils { private const val DEFAULT_GESTURE_DURATION = 500L - fun pinch(startSpan: Float, endSpan: Float, center: PointF? = null, duration: Long = DEFAULT_GESTURE_DURATION): ViewAction { + fun pinch( + startSpan: Float, + endSpan: Float, + center: PointF? = null, + duration: Long = DEFAULT_GESTURE_DURATION + ): ViewAction { return object : ViewAction { override fun getConstraints(): Matcher { return ViewMatchers.isEnabled() @@ -40,7 +44,13 @@ object GesturesUiTestUtils { } } - fun quickScale(deltaY: Float, startPoint: PointF? = null, withVelocity: Boolean = true, duration: Long = DEFAULT_GESTURE_DURATION, interrupt: Boolean = false): ViewAction { + fun quickScale( + deltaY: Float, + startPoint: PointF? = null, + withVelocity: Boolean = true, + duration: Long = DEFAULT_GESTURE_DURATION, + interrupt: Boolean = false + ): ViewAction { return object : ViewAction { override fun getConstraints(): Matcher = ViewMatchers.isEnabled() @@ -59,7 +69,13 @@ object GesturesUiTestUtils { } } - fun move(deltaX: Float, deltaY: Float, startPoint: PointF? = null, withVelocity: Boolean = true, duration: Long = DEFAULT_GESTURE_DURATION): ViewAction { + fun move( + deltaX: Float, + deltaY: Float, + startPoint: PointF? = null, + withVelocity: Boolean = true, + duration: Long = DEFAULT_GESTURE_DURATION + ): ViewAction { return object : ViewAction { override fun getConstraints(): Matcher = ViewMatchers.isEnabled() @@ -85,7 +101,8 @@ object GesturesUiTestUtils { val viewWidth = view.width * view.scaleX return PointF( (locationOnScreen[0] + viewWidth / 2).toInt().toFloat(), - (locationOnScreen[1] + viewHeight / 2).toInt().toFloat()) + (locationOnScreen[1] + viewHeight / 2).toInt().toFloat() + ) } // https://stackoverflow.com/a/46443628/9126211 @@ -147,15 +164,19 @@ object GesturesUiTestUtils { try { // Step 1 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_DOWN, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 2 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_POINTER_DOWN + (pp2.id shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2, - properties, pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + properties, pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 3, 4 @@ -187,9 +208,11 @@ object GesturesUiTestUtils { pointerCoords[0] = pc1 pointerCoords[1] = pc2 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_MOVE, 2, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } @@ -202,23 +225,34 @@ object GesturesUiTestUtils { pointerCoords[1] = pc2 eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_POINTER_UP + (pp2.id shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 6 eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_UP, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } catch (ex: InjectEventSecurityException) { throw RuntimeException("Could not perform pinch", ex) } } - private fun performQuickScale(uiController: UiController, startPoint: PointF, endPoint: PointF, withVelocity: Boolean, duration: Long, interrupt: Boolean) { + private fun performQuickScale( + uiController: UiController, + startPoint: PointF, + endPoint: PointF, + withVelocity: Boolean, + duration: Long, + interrupt: Boolean + ) { val eventMinInterval: Long = 10 val tapDownMinInterval: Long = 40 // ViewConfiguration#DOUBLE_TAP_MIN_TIME = 40 val startTime = SystemClock.uptimeMillis() @@ -252,23 +286,29 @@ object GesturesUiTestUtils { */ try { // Step 1 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_DOWN, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 2 eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_UP, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 3 eventTime += tapDownMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_DOWN, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 4 @@ -293,9 +333,11 @@ object GesturesUiTestUtils { pointerCoords[0] = pc1 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_MOVE, if (interrupted) 2 else 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) if (interrupt && i == moveEventNumber / 2) { @@ -320,9 +362,11 @@ object GesturesUiTestUtils { pointerCoords[1] = pc2 eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_POINTER_DOWN + (pp2.id shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2, - properties, pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + properties, pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) interrupted = true } @@ -330,24 +374,34 @@ object GesturesUiTestUtils { if (!withVelocity) { eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_MOVE, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } // Step 5 eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_UP, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } catch (ex: InjectEventSecurityException) { throw RuntimeException("Could not perform quick scale", ex) } } - private fun performMove(uiController: UiController, startPoint: PointF, endPoint: PointF, withVelocity: Boolean, duration: Long) { + private fun performMove( + uiController: UiController, + startPoint: PointF, + endPoint: PointF, + withVelocity: Boolean, + duration: Long + ) { val eventMinInterval: Long = 10 val startTime = SystemClock.uptimeMillis() var eventTime = startTime @@ -378,9 +432,11 @@ object GesturesUiTestUtils { */ try { // Step 1 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_DOWN, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) // Step 2 @@ -403,25 +459,31 @@ object GesturesUiTestUtils { pointerCoords[0] = pc1 - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_MOVE, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } if (!withVelocity) { eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_MOVE, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } // Step 3 eventTime += eventMinInterval - event = MotionEvent.obtain(startTime, eventTime, + event = MotionEvent.obtain( + startTime, eventTime, MotionEvent.ACTION_UP, 1, properties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0) + pointerCoords, 0, 0, 1f, 1f, 0, 0, 0, 0 + ) injectMotionEventToUiController(uiController, event) } catch (ex: InjectEventSecurityException) { throw RuntimeException("Could not perform quick scale", ex) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt index 684b13af5d..14722ea37c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt @@ -5,7 +5,6 @@ import android.support.test.espresso.UiController import com.mapbox.mapboxsdk.camera.CameraUpdateFactory import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke - import com.mapbox.mapboxsdk.testapp.activity.BaseTest import com.mapbox.mapboxsdk.testapp.activity.espresso.PixelTestActivity import org.junit.Assert.* diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt index 5c574f9332..93b59d6e33 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/offline/OfflineDownloadTest.kt @@ -6,12 +6,12 @@ import com.mapbox.geojson.Point import com.mapbox.mapboxsdk.log.Logger import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith /** * Integration test that validates downloading an offline region from a point geometry at zoomlevel 17 diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt index b004ee1e4b..9fca11c017 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotterTest.kt @@ -6,15 +6,15 @@ import com.mapbox.mapboxsdk.camera.CameraPosition import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity -import junit.framework.Assert +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import java.util.concurrent.TimeoutException import junit.framework.Assert.assertNotNull +import org.junit.Assert import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit -import java.util.concurrent.TimeoutException /** * Integration test that validates if a snapshotter creation diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt index b569f7ca3d..dd046f0189 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt @@ -7,14 +7,14 @@ import com.mapbox.mapboxsdk.maps.MapView import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import java.util.concurrent.TimeoutException import junit.framework.Assert.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit -import java.util.concurrent.TimeoutException @RunWith(AndroidJUnit4::class) class ImageMissingTest : AppCenter() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt index 41b100b4d2..d586a7e2d1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt @@ -11,14 +11,14 @@ import com.mapbox.mapboxsdk.maps.MapboxMap import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import java.util.concurrent.TimeoutException import org.junit.Assert.* import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit -import java.util.concurrent.TimeoutException @RunWith(AndroidJUnit4::class) class RemoveUnusedImagesTest : AppCenter() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt index e28aec558c..a3214c9f11 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt @@ -5,11 +5,11 @@ import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 import com.mapbox.mapboxsdk.offline.OfflineManager import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity +import java.util.concurrent.CountDownLatch import org.junit.Assert import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import java.util.concurrent.CountDownLatch @RunWith(AndroidJUnit4::class) class CacheTest { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt index 6b73623ae7..e07dc1e9f1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt @@ -9,13 +9,13 @@ import com.mapbox.mapboxsdk.offline.OfflineRegion import com.mapbox.mapboxsdk.storage.FileSource import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity import com.mapbox.mapboxsdk.testapp.utils.FileUtils +import java.io.IOException +import java.util.concurrent.CountDownLatch import org.junit.FixMethodOrder import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters -import java.io.IOException -import java.util.concurrent.CountDownLatch @FixMethodOrder(MethodSorters.NAME_ASCENDING) @RunWith(AndroidJUnit4::class) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt index b67e6eded5..d08507470e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt @@ -6,6 +6,7 @@ import android.support.test.runner.AndroidJUnit4 import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.storage.FileSource import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity +import java.util.concurrent.CountDownLatch import junit.framework.Assert import org.junit.After import org.junit.Before @@ -13,7 +14,6 @@ import org.junit.Rule import org.junit.Test import org.junit.rules.TestName import org.junit.runner.RunWith -import java.util.concurrent.CountDownLatch @RunWith(AndroidJUnit4::class) open class FileSourceMapTest : AppCenter() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt index 428d0ed757..59f0d04237 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt @@ -6,11 +6,11 @@ import android.support.test.runner.AndroidJUnit4 import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.storage.FileSource import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit import org.junit.* import org.junit.rules.TestName import org.junit.runner.RunWith -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit @RunWith(AndroidJUnit4::class) class FileSourceStandaloneTest : AppCenter() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt index 0010880414..6bd97056a6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt @@ -4,9 +4,9 @@ import android.app.Activity import android.support.annotation.WorkerThread import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.storage.FileSource -import junit.framework.Assert import java.io.File import java.util.concurrent.CountDownLatch +import junit.framework.Assert class FileSourceTestUtils(private val activity: Activity) : AppCenter() { val originalPath = FileSource.getResourcesCachePath(activity) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt index 9cef677e7c..eb45ab52c6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt @@ -6,11 +6,11 @@ import android.support.test.runner.AndroidJUnit4 import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction import com.mapbox.mapboxsdk.testapp.activity.EspressoTest +import java.util.* import org.junit.Assert.assertNull import org.junit.Assert.assertTrue import org.junit.Test import org.junit.runner.RunWith -import java.util.* /** * CRUD tests around Image diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index d2a5032c81..03e530e174 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ - + @@ -13,7 +13,9 @@ android:label="@string/app_name" android:roundIcon="@drawable/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + tools:replace="android:appComponentFactory" + android:appComponentFactory="customComponentFactory"> ) { mapView.getMapAsync { - it.setStyle(Style.Builder().fromUrl(TEST_STYLE)) + it.setStyle(Style.Builder().fromUri(TEST_STYLE)) } Toast.makeText( this@MergeOfflineRegionsActivity, @@ -91,7 +91,7 @@ class MergeOfflineRegionsActivity : AppCompatActivity() { } mapView.getMapAsync { it.isDebugActive = true - it.setStyle(Style.Builder().fromUrl(TEST_STYLE)) + it.setStyle(Style.Builder().fromUri(TEST_STYLE)) } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/CacheManagementActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/CacheManagementActivity.kt index 54427ad20d..7ec6a5076f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/CacheManagementActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/CacheManagementActivity.kt @@ -6,7 +6,6 @@ import android.support.design.widget.Snackbar import android.support.v7.app.AppCompatActivity import com.mapbox.mapboxsdk.offline.OfflineManager import com.mapbox.mapboxsdk.testapp.R -import junit.framework.Assert.assertTrue import kotlinx.android.synthetic.main.activity_cache_management.* /** @@ -70,7 +69,7 @@ class CacheManagementActivity : AppCompatActivity() { fun showSnackbar(message: String) { // validate that all callbacks occur on main thread - assertTrue(Looper.myLooper() == Looper.getMainLooper()) + assert(Looper.myLooper() == Looper.getMainLooper()) // show snackbar Snackbar.make(container, message, Snackbar.LENGTH_SHORT).show() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DraggableMarkerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DraggableMarkerActivity.kt index 6de00e24f9..8a8c8939a0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DraggableMarkerActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DraggableMarkerActivity.kt @@ -70,7 +70,7 @@ class DraggableMarkerActivity : AppCompatActivity() { mapboxMap.setStyle( Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) .withImage(markerImageId, IconFactory.getInstance(this).defaultMarker().bitmap) .withSource(source) .withLayer(layer) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/turf/PhysicalUnitCircleActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/turf/PhysicalUnitCircleActivity.kt index e1a141433d..5f7377c920 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/turf/PhysicalUnitCircleActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/turf/PhysicalUnitCircleActivity.kt @@ -52,7 +52,7 @@ class PhysicalUnitCircleActivity : AppCompatActivity(), SeekBar.OnSeekBarChangeL radiusBar.setOnSeekBarChangeListener(this) mapboxMap.setStyle(Style.Builder() - .fromUrl(Style.SATELLITE_STREETS) + .fromUri(Style.SATELLITE_STREETS) .withLayer(FillLayer(LAYER_ID, SOURCE_ID).withProperties(fillColor(interpolate( exponential(0.5f), zoom(), stop(8, color(Color.RED)), diff --git a/platform/android/build.gradle b/platform/android/build.gradle index ed6c8d1208..46666e2ef1 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:3.4.2' classpath dependenciesList.licensesPlugin classpath dependenciesList.kotlinPlugin classpath dependenciesList.bintrayPlugin diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index d0036ebc8b..0bd5a67c9c 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -2,8 +2,8 @@ ext { androidVersions = [ minSdkVersion : 14, - targetSdkVersion : 27, - compileSdkVersion: 27, + targetSdkVersion : 28, + compileSdkVersion: 28, ] versions = [ @@ -12,29 +12,30 @@ ext { mapboxCore : '1.3.0', mapboxGestures : '0.4.2', mapboxAccounts : '0.2.0', - supportLib : '27.1.1', + supportLib : '28.0.0', constraintLayout: '1.1.2', uiAutomator : '2.1.3', espresso : '3.0.2', testRunner : '1.0.2', - leakCanary : '1.6.2', + leakCanary : '1.6.3', junit : '4.12', - mockito : '2.23.4', - mockk : '1.9', - robolectric : '4.1', + mockito : '3.0.0', + mockk : '1.9.3', + robolectric : '4.3', timber : '4.7.1', okhttp : '3.12.3', - kotlin : '1.3.11', - licenses : '0.8.42', + kotlin : '1.3.41', + licenses : '0.8.5', bintray : '1.8.4', artifactory : '4.9.3', androidPublish : '3.6.2', - lint : '26.1.4', + lint : '26.4.2', gms : '16.0.0', - soLoader : '0.6.0', - jacoco : '0.8.3', + soLoader : '0.6.1', + jacoco : '0.8.4', appcenter : '1.4', - ktlint : '0.33.0' + ktlint : '0.34.0', + commonsIO : '2.6' ] dependenciesList = [ @@ -56,7 +57,7 @@ ext { testEspressoContrib : "com.android.support.test.espresso:espresso-contrib:${versions.espresso}", testUiAutomator : "com.android.support.test.uiautomator:uiautomator-v18:${versions.uiAutomator}", appCenter : "com.microsoft.appcenter:espresso-test-extension:${versions.appcenter}", - commonsIO : 'commons-io:commons-io:2.5', + commonsIO : "commons-io:commons-io:${versions.commonsIO}", supportAnnotations : "com.android.support:support-annotations:${versions.supportLib}", supportAppcompatV7 : "com.android.support:appcompat-v7:${versions.supportLib}", supportFragmentV4 : "com.android.support:support-fragment:${versions.supportLib}", diff --git a/platform/android/gradle/gradle-javadoc.gradle b/platform/android/gradle/gradle-javadoc.gradle index 3a634433b5..ba530a9b62 100644 --- a/platform/android/gradle/gradle-javadoc.gradle +++ b/platform/android/gradle/gradle-javadoc.gradle @@ -4,7 +4,6 @@ android.libraryVariants.all { variant -> description = "Generates javadoc for build $name" destinationDir = new File(destinationDir, variant.baseName) source = variant.sourceSets.collect { it.java.sourceFiles }.inject { m, i -> m + i } - classpath += variant.javaCompile.classpath classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) options.windowTitle("Mapbox Maps SDK for Android $VERSION_NAME Reference") options.docTitle("Mapbox Maps SDK for Android $VERSION_NAME") diff --git a/platform/android/gradle/jacoco-report.gradle b/platform/android/gradle/jacoco-report.gradle index e50facb683..c4e0bb9131 100644 --- a/platform/android/gradle/jacoco-report.gradle +++ b/platform/android/gradle/jacoco-report.gradle @@ -27,7 +27,7 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { files.each { file -> println file } } - sourceDirectories = files([mainSrc]) - classDirectories = files([debugTree]) - executionData = files([ecSrc, execSrc]) + sourceDirectories.from = files([mainSrc]) + classDirectories.from = files([debugTree]) + executionData.from = files([ecSrc, execSrc]) } \ No newline at end of file diff --git a/platform/android/gradle/wrapper/gradle-wrapper.properties b/platform/android/gradle/wrapper/gradle-wrapper.properties index 588169cdf4..a60d82ac08 100644 --- a/platform/android/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip -- cgit v1.2.1