[android] - update dependencies, target SDK, support library (#15135)

This commit is contained in:
Tobrun
2019-07-19 11:46:38 +02:00
committed by GitHub
parent de667d2fe5
commit 79bdce6cd4
34 changed files with 409 additions and 236 deletions

View File

@@ -1,2 +1,4 @@
[*.{kt,kts}]
indent_size=2
indent_size=2
insert_final_newline=false
disabled_rules=no-wildcard-imports

View File

@@ -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)
===========================================================================

View File

@@ -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);
}
}

View File

@@ -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)

View File

@@ -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

View File

@@ -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()
}
}

View File

@@ -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<View> {
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<View> = 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<View> = 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)

View File

@@ -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.*

View File

@@ -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

View File

@@ -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

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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)

View File

@@ -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

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapbox.mapboxsdk.testapp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.mapbox.mapboxsdk.testapp">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@@ -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">
<activity
android:name=".activity.FeatureOverviewActivity"

View File

@@ -19,8 +19,8 @@ import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
import com.mapbox.mapboxsdk.testapp.R
import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil.loadStringFromAssets
import com.mapbox.mapboxsdk.utils.BitmapUtils
import kotlinx.android.synthetic.main.activity_latlngbounds.*
import java.net.URISyntaxException
import kotlinx.android.synthetic.main.activity_latlngbounds.*
/**
* Test activity showcasing using the LatLngBounds camera API.

View File

@@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.maps.SupportMapFragment
@@ -28,7 +27,7 @@ class FragmentBackStackActivity : AppCompatActivity() {
add(R.id.container, mapFragment)
}.commit()
button.setOnClickListener { handleClick(it) }
button.setOnClickListener { handleClick() }
}
private fun initMap(mapboxMap: MapboxMap) {
@@ -37,7 +36,7 @@ class FragmentBackStackActivity : AppCompatActivity() {
}
}
private fun handleClick(button: View) {
private fun handleClick() {
supportFragmentManager.beginTransaction().apply {
replace(R.id.container, NestedViewPagerActivity.ItemAdapter.EmptyFragment())
addToBackStack("map_empty_fragment")

View File

@@ -40,7 +40,7 @@ class SnapshotActivity : AppCompatActivity(), OnMapReadyCallback {
override fun onMapReady(map: MapboxMap) {
mapboxMap = map
mapboxMap.setStyle(Style.Builder().fromUrl(Style.OUTDOORS)) { mapView.addOnDidFinishRenderingFrameListener(idleListener) }
mapboxMap.setStyle(Style.Builder().fromUri(Style.OUTDOORS)) { mapView.addOnDidFinishRenderingFrameListener(idleListener) }
}
override fun onStart() {

View File

@@ -1,8 +1,8 @@
package com.mapbox.mapboxsdk.testapp.activity.location
import android.annotation.SuppressLint
import android.app.Fragment
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.app.AppCompatActivity
import android.view.LayoutInflater
import android.view.View
@@ -30,9 +30,9 @@ class LocationFragmentActivity : AppCompatActivity() {
setContentView(R.layout.activity_location_layer_fragment)
fab.setOnClickListener {
val fragment = fragmentManager.findFragmentByTag(EmptyFragment.TAG)
val fragment = supportFragmentManager.findFragmentByTag(EmptyFragment.TAG)
if (fragment == null) {
fragmentManager
supportFragmentManager
.beginTransaction()
.replace(R.id.container, EmptyFragment.newInstance(), EmptyFragment.TAG)
.addToBackStack("transaction2")
@@ -45,7 +45,7 @@ class LocationFragmentActivity : AppCompatActivity() {
if (PermissionsManager.areLocationPermissionsGranted(this)) {
if (savedInstanceState == null) {
fragmentManager
supportFragmentManager
.beginTransaction()
.replace(R.id.container, LocationFragment.newInstance(), LocationFragment.TAG)
.commit()
@@ -60,7 +60,7 @@ class LocationFragmentActivity : AppCompatActivity() {
override fun onPermissionResult(granted: Boolean) {
if (granted) {
if (savedInstanceState == null) {
fragmentManager
supportFragmentManager
.beginTransaction()
.replace(R.id.container, LocationFragment.newInstance(), LocationFragment.TAG)
.commit()
@@ -96,7 +96,8 @@ class LocationFragmentActivity : AppCompatActivity() {
}
@SuppressLint("MissingPermission")
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mapView.onCreate(savedInstanceState)
mapView.getMapAsync {
mapboxMap = it
@@ -104,9 +105,9 @@ class LocationFragmentActivity : AppCompatActivity() {
val component = mapboxMap.locationComponent
component.activateLocationComponent(LocationComponentActivationOptions
.builder(activity, style)
.useDefaultLocationEngine(true)
.build())
.builder(activity!!, style)
.useDefaultLocationEngine(true)
.build())
component.isLocationComponentEnabled = true
component.locationEngine?.getLastLocation(this)
@@ -166,8 +167,8 @@ class LocationFragmentActivity : AppCompatActivity() {
}
}
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
val textView = TextView(inflater?.context)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val textView = TextView(inflater.context)
textView.text = "This is an empty Fragment"
return textView
}

View File

@@ -17,8 +17,8 @@ import com.mapbox.mapboxsdk.offline.OfflineManager
import com.mapbox.mapboxsdk.offline.OfflineRegion
import com.mapbox.mapboxsdk.storage.FileSource
import com.mapbox.mapboxsdk.testapp.R
import kotlinx.android.synthetic.main.activity_change_resources_cache_path.*
import java.io.File
import kotlinx.android.synthetic.main.activity_change_resources_cache_path.*
class ChangeResourcesCachePathActivity : AppCompatActivity(),
AdapterView.OnItemClickListener,

View File

@@ -14,10 +14,10 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.offline.*
import com.mapbox.mapboxsdk.testapp.R
import kotlinx.android.synthetic.main.activity_region_download.*
import timber.log.Timber
import java.util.*
import java.util.concurrent.TimeUnit
import kotlinx.android.synthetic.main.activity_region_download.*
import timber.log.Timber
/**
* Example showcasing how to download an offline region headless, allows to test pausing and resuming the download.

View File

@@ -40,7 +40,7 @@ class MergeOfflineRegionsActivity : AppCompatActivity() {
private val onRegionMergedListener = object : OfflineManager.MergeOfflineRegionsCallback {
override fun onMerge(offlineRegions: Array<OfflineRegion>) {
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))
}
}

View File

@@ -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()

View File

@@ -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)

View File

@@ -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)),

View File

@@ -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

View File

@@ -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}",

View File

@@ -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")

View File

@@ -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])
}

View File

@@ -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