summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-07-03 20:14:26 +0200
committerTobrun <tobrun.van.nuland@gmail.com>2019-07-04 12:08:49 +0200
commitdd16eadc382fe853f4b877fbcfd909d103a339f5 (patch)
treeaa1ec40ae3fccc4745434a16a108d9814a8a51ec
parent16f1854a9ca98c00a5058c55e8a59df2c3463f4d (diff)
downloadqtlocation-mapboxgl-dd16eadc382fe853f4b877fbcfd909d103a339f5.tar.gz
[android] - add ktlint, optimise code for ktlint validation
-rw-r--r--Makefile15
-rw-r--r--platform/android/.editorconfig2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/log/LoggerTest.kt16
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKLint/src/main/java/com/mapbox/mapboxsdk/lint/KeepDetector.kt6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt7
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt3
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt432
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt152
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/LocationComponentAction.kt6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt7
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt8
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt3
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/CacheTest.kt3
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.kt8
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt9
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/GLSurfaceRecyclerViewActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/OverlayMapActivity.kt4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/ChangeResourcesCachePathActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DownloadRegionActivity.kt17
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/MergeOfflineRegionsActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/CacheManagementActivity.kt1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DraggableMarkerActivity.kt18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FileUtils.kt1
-rw-r--r--platform/android/build.gradle4
-rw-r--r--platform/android/gradle/dependencies.gradle6
-rw-r--r--platform/android/gradle/download-schema.gradle8
-rw-r--r--platform/android/gradle/ktlint.gradle27
51 files changed, 564 insertions, 274 deletions
diff --git a/Makefile b/Makefile
index aefd0b0458..2e5e8f623b 100644
--- a/Makefile
+++ b/Makefile
@@ -791,21 +791,26 @@ android-gfxinfo:
test-code-android:
node platform/android/scripts/generate-test-code.js
-# Runs checkstyle and lint on the Android code
+# Runs checkstyle and lint on the java code
.PHONY: android-check
-android-check : android-checkstyle run-android-nitpick android-lint-sdk android-lint-test-app
+android-check : android-checkstyle run-android-nitpick android-lint-sdk android-lint-test-app android-ktlint
-# Runs checkstyle on the Android code
+# Runs checkstyle on the java code
.PHONY: android-checkstyle
android-checkstyle: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:checkstyle :MapboxGLAndroidSDKTestApp:checkstyle
-# Runs lint on the Android SDK code
+# Runs checkstyle on the kotlin code
+.PHONY: android-ktlint
+android-ktlint:
+ cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none ktlint
+
+# Runs lint on the Android SDK java code
.PHONY: android-lint-sdk
android-lint-sdk: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:lint
-# Runs lint on the Android test app code
+# Runs lint on the Android test app java code
.PHONY: android-lint-test-app
android-lint-test-app: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDKTestApp:lint
diff --git a/platform/android/.editorconfig b/platform/android/.editorconfig
new file mode 100644
index 0000000000..7ebd2b7bb0
--- /dev/null
+++ b/platform/android/.editorconfig
@@ -0,0 +1,2 @@
+[*.{kt,kts}]
+indent_size=2 \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt
index 0091c50b08..1b927d213a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt
@@ -529,4 +529,4 @@ private fun <E> SparseArray<E>.contains(listener: AnimationsValueChangeListener<
}
}
return false
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/log/LoggerTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/log/LoggerTest.kt
index 8b55419ea4..82e1c67f67 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/log/LoggerTest.kt
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/log/LoggerTest.kt
@@ -28,7 +28,7 @@ class LoggerTest {
fun verbosityLogLevelIgnore() {
Logger.setVerbosity(Logger.DEBUG)
Logger.v(TAG, MESSAGE)
- verify(exactly = 0){ logger.v(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.v(TAG, MESSAGE) }
}
@Test
@@ -42,7 +42,7 @@ class LoggerTest {
fun debugLogLevelIgnore() {
Logger.setVerbosity(Logger.WARN)
Logger.d(TAG, MESSAGE)
- verify(exactly = 0){ logger.d(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.d(TAG, MESSAGE) }
}
@Test
@@ -56,7 +56,7 @@ class LoggerTest {
fun warnLogLevelIgnore() {
Logger.setVerbosity(Logger.ERROR)
Logger.w(TAG, MESSAGE)
- verify(exactly = 0){ logger.w(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.w(TAG, MESSAGE) }
}
@Test
@@ -70,7 +70,7 @@ class LoggerTest {
fun errorLogLevelIgnore() {
Logger.setVerbosity(Logger.NONE)
Logger.e(TAG, MESSAGE)
- verify(exactly = 0){ logger.e(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.e(TAG, MESSAGE) }
}
@Test
@@ -80,10 +80,10 @@ class LoggerTest {
Logger.d(TAG, MESSAGE)
Logger.w(TAG, MESSAGE)
Logger.e(TAG, MESSAGE)
- verify(exactly = 0){ logger.v(TAG, MESSAGE) }
- verify(exactly = 0){ logger.d(TAG, MESSAGE) }
- verify(exactly = 0){ logger.w(TAG, MESSAGE) }
- verify(exactly = 0){ logger.e(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.v(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.d(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.w(TAG, MESSAGE) }
+ verify(exactly = 0) { logger.e(TAG, MESSAGE) }
}
companion object {
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt
index ef30d46a7f..7b5ed67184 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt
@@ -287,7 +287,7 @@ class StyleTest {
@Test
fun testAddImage() {
- val bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)
+ val bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)
val builder = Style.Builder().fromUrl(Style.SATELLITE).withImage("id", bitmap)
mapboxMap.setStyle(builder)
verify(exactly = 1) { nativeMapView.styleUri = Style.SATELLITE }
@@ -408,4 +408,4 @@ class StyleTest {
Assert.assertEquals("Layer that failed to be added shouldn't be cached", layer1, mapboxMap.style!!.getLayer("layer1"))
}
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKLint/src/main/java/com/mapbox/mapboxsdk/lint/KeepDetector.kt b/platform/android/MapboxGLAndroidSDKLint/src/main/java/com/mapbox/mapboxsdk/lint/KeepDetector.kt
index 64838f91db..21093fc15b 100644
--- a/platform/android/MapboxGLAndroidSDKLint/src/main/java/com/mapbox/mapboxsdk/lint/KeepDetector.kt
+++ b/platform/android/MapboxGLAndroidSDKLint/src/main/java/com/mapbox/mapboxsdk/lint/KeepDetector.kt
@@ -45,9 +45,9 @@ class KeepDetector : Detector(), SourceCodeScanner, FileScanner {
context.report(ISSUE_NOT_KEPT, node,
context.getNameLocation(node),
"This method contains native references and will be minified.")
- } else if (node.isConstructor
- && node.parameterList.parameters.find { it.type == PsiType.LONG && it.name!!.contains("native") } != null
- && checkKeepAnnotation(node)) {
+ } else if (node.isConstructor &&
+ node.parameterList.parameters.find { it.type == PsiType.LONG && it.name!!.contains("native") } != null &&
+ checkKeepAnnotation(node)) {
context.report(ISSUE_NOT_KEPT, node,
context.getNameLocation(node as UElement),
"This constructor might contain native references and will be minified. " +
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt
index fb946a9c31..16eb3d1f1a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt
@@ -8,7 +8,6 @@ abstract class AppCenter {
@get:Rule
var reportHelper = Factory.getReportHelper()!!
-
@After
open fun afterTest() {
reportHelper.label(javaClass.simpleName)
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt
index 6873b33262..5c275df078 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/InstrumentationRunner.kt
@@ -8,4 +8,4 @@ class InstrumentationRunner : AndroidJUnitRunner() {
override fun newApplication(cl: ClassLoader?, className: String?, context: Context?): Application {
return super.newApplication(cl, InstrumentationApplication::class.java.name, context)
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt
index 446b731a61..50b9626edc 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactoryTest.kt
@@ -140,5 +140,4 @@ class CameraUpdateFactoryTest : BaseTest() {
assertEquals("tilt should match:", 40.0, cameraPosition.tilt, 0.1)
}
}
-
} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt
index 554ab644b6..2afff34d34 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt
@@ -10,7 +10,7 @@ import org.junit.Before
const val TIMEOUT_UI_SEARCH_WAIT = 5000L
-abstract class BaseIntegrationTest : AppCenter(){
+abstract class BaseIntegrationTest : AppCenter() {
protected lateinit var device: UiDevice
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt
index b0f6436bdd..5673ffd4c1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt
@@ -3,15 +3,8 @@ package com.mapbox.mapboxsdk.integration
import android.support.test.filters.LargeTest
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
-import android.support.test.uiautomator.By
-import android.support.test.uiautomator.SearchCondition
import android.support.test.uiautomator.UiSelector
-import android.support.test.uiautomator.Until
-import com.mapbox.mapboxsdk.testapp.R
import com.mapbox.mapboxsdk.testapp.activity.fragment.FragmentBackStackActivity
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
-import kotlinx.android.synthetic.main.activity_backstack_fragment.view.*
-import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt
index f22b5f7c9d..40bc182bd7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt
@@ -8,7 +8,6 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
-
/**
* Regression test that validates reopening an Activity with a GLSurfaceView
*/
@@ -27,4 +26,4 @@ class GLSurfaceViewReopenTest : BaseIntegrationTest() {
device.launchActivity(activityRule.activity, SimpleMapActivity::class.java)
device.waitForIdle()
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt
index 945fac677e..5bf45518ec 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt
@@ -4,8 +4,6 @@ import android.support.test.filters.LargeTest
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
-import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt
index 941b7ea8dc..8d5b5eb8aa 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt
@@ -3,9 +3,7 @@ package com.mapbox.mapboxsdk.integration
import android.support.test.filters.LargeTest
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
-import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt
index 076bcba7e6..e94d568e86 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/QueryRenderedFeaturesBoxCountTest.kt
@@ -27,4 +27,4 @@ class QueryRenderedFeaturesBoxCountTest : BaseIntegrationTest() {
device.launchActivity(activityRule.activity, QueryRenderedFeaturesBoxCountActivity::class.java)
device.waitForIdle()
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt
index 44da557904..cbfd5d6d55 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt
@@ -3,14 +3,10 @@ package com.mapbox.mapboxsdk.integration
import android.support.test.filters.LargeTest
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity
import com.mapbox.mapboxsdk.testapp.activity.textureview.TextureViewDebugModeActivity
-import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
-import java.lang.Thread.sleep
/**
* Regression test that validates reopening an Activity with a TextureView
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt
index 5c3d66c462..dc2f74df4a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt
@@ -3,9 +3,7 @@ package com.mapbox.mapboxsdk.integration
import android.support.test.filters.LargeTest
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
import com.mapbox.mapboxsdk.testapp.activity.maplayout.TextureRecyclerViewActivity
-import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt
index b918801296..5178ea9fc0 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt
@@ -5,8 +5,6 @@ import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
import android.support.test.uiautomator.UiSelector
import com.mapbox.mapboxsdk.testapp.activity.fragment.ViewPagerActivity
-import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity
-import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
index f9827c767e..fb113502ee 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
@@ -54,7 +54,6 @@ class LocationComponentTest : EspressoTest() {
private lateinit var locationComponentActivationOptions: LocationComponentActivationOptions
-
override fun validateTestSetup() {
super.validateTestSetup()
assertThat(mapboxMap.style, notNullValue())
@@ -71,8 +70,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponent_initializesLocationEngineCorrectlyWhenOnesNotProvided() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
@@ -93,9 +97,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponent_initializesLocationEngineCorrectlyWhenOnesNotProvidedButHasOptions() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.locationComponentOptions(
@@ -131,9 +139,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponent_doesntInitializeEngineWhenNullProvided() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.locationEngine(null)
@@ -170,8 +182,13 @@ class LocationComponentTest : EspressoTest() {
fun settingMapStyleImmediatelyBeforeLoadingComponent_throwsInvalidStyle() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
component.activateLocationComponent(LocationComponentActivationOptions
@@ -188,9 +205,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponent_doesntShowUntilFirstLocationFix() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -222,10 +243,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponentOptions_disablingStaleStateDoesWorkCorrectly() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -258,9 +282,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponentOptions_loadsForegroundBitmapFromNameOption() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -306,9 +334,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponentOptions_loadsGpsNameWithGpsRenderMode() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -343,9 +375,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponentOptions_customIconNameRevertsToDefault() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -379,9 +415,13 @@ class LocationComponentTest : EspressoTest() {
fun locationComponentOptions_customGpsIconNameChangeBackWithMode() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -414,9 +454,13 @@ class LocationComponentTest : EspressoTest() {
fun stillStaleAfterResuming() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -451,9 +495,13 @@ class LocationComponentTest : EspressoTest() {
fun stillNotStaleAfterResuming() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -483,9 +531,13 @@ class LocationComponentTest : EspressoTest() {
val rgbaColor = ColorUtils.colorToRgbaString(color)
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -516,9 +568,13 @@ class LocationComponentTest : EspressoTest() {
fun forceLocationUpdate_doesMoveLocationLayerIconToCorrectPosition() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -541,9 +597,13 @@ class LocationComponentTest : EspressoTest() {
fun disablingComponentHidesPuck() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -568,9 +628,13 @@ class LocationComponentTest : EspressoTest() {
fun disablingComponentAndChangingStyleAllowsToEnableAgain() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -592,9 +656,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_isDisabledOnStart() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.onStop()
component.onStart()
@@ -619,9 +687,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_keepsEnabledWhenStoppedAndStarted() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
-
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -641,8 +713,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_keepsDisabledWhenStoppedAndStarted() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(
LocationComponentActivationOptions
.builder(context, style)
@@ -663,8 +740,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_ableToChangeStyleAfterResuming() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -685,8 +767,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_interruptedDuringStyleChange() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -705,8 +792,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_forceLocationUpdateAfterStopped() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -726,8 +818,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_acceptAndReuseLocationUpdatesBeforeLayerStarted() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -750,8 +847,13 @@ class LocationComponentTest : EspressoTest() {
fun lifecycle_lifecycleChangeRightAfterStyleReload() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -781,8 +883,13 @@ class LocationComponentTest : EspressoTest() {
fun mapChange_settingComponentStyle() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -810,8 +917,13 @@ class LocationComponentTest : EspressoTest() {
fun mapChange_forcingLocation() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -836,8 +948,13 @@ class LocationComponentTest : EspressoTest() {
fun mapChange_settingMapStyleBeforeComponentCreation() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
TestingAsyncUtils.waitForLayer(uiController, mapView)
@@ -868,8 +985,13 @@ class LocationComponentTest : EspressoTest() {
fun animators_layerBearingCorrect() {
validateTestSetup()
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -896,8 +1018,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_cameraLatLngBearingCorrect() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -932,8 +1059,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_cameraBearingCorrect() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -971,8 +1103,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_cameraNoneCorrect() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1011,8 +1148,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_focalPointAdjustment() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1033,8 +1175,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_dontZoomWhileNotTracking() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1056,8 +1203,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_zoomWhileTracking() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1079,8 +1231,13 @@ class LocationComponentTest : EspressoTest() {
@Ignore
fun animators_zoomWhileTrackingCanceledOnModeChange() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1103,8 +1260,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_dontZoomWhileStopped() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1130,8 +1292,13 @@ class LocationComponentTest : EspressoTest() {
@Ignore
fun animators_cancelZoomWhileTracking() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1154,8 +1321,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_dontTiltWhileNotTracking() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1177,8 +1349,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_tiltWhileTracking() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1200,8 +1377,13 @@ class LocationComponentTest : EspressoTest() {
@Ignore
fun animators_tiltWhileTrackingCanceledOnModeChange() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1224,8 +1406,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun animators_dontTiltWhileStopped() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1250,8 +1437,13 @@ class LocationComponentTest : EspressoTest() {
@Ignore
fun animators_cancelTiltWhileTracking() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1273,8 +1465,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun cameraPositionAdjustedToTrackingModeWhenComponentEnabled() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1301,8 +1498,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun cameraPositionSnappedToTargetIfExceedsThreshold() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1330,8 +1532,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun compassEngine_onComponentInitializedDefaultIsProvided() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -1347,8 +1554,13 @@ class LocationComponentTest : EspressoTest() {
@Test
fun compassEngine_changesWhenNewProvided() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
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 95a3891b6d..110d879bf3 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
@@ -35,6 +35,7 @@ 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() {
@@ -67,8 +68,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun renderModeNormal_sourceDoesGetAdded() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -90,8 +96,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun renderModeNormal_trackingNormalLayersDoGetAdded() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -114,8 +125,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun renderModeCompass_bearingLayersDoGetAdded() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -138,8 +154,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun renderModeGps_navigationLayersDoGetAdded() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -162,8 +183,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun dontShowPuckWhenRenderModeSetAndComponentDisabled() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -187,8 +213,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun whenLocationComponentDisabled_doesSetAllLayersToVisibilityNone() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -213,8 +244,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun onMapChange_locationComponentLayersDoGetRedrawn() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -245,8 +281,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun whenStyleChanged_continuesUsingStaleIcons() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -271,8 +312,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun whenStyleChanged_isDisabled_hasLayerBelow_staysHidden() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -300,8 +346,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun whenStyleChanged_staleStateChanges() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -323,8 +374,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun whenStyleChanged_layerVisibilityUpdates() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
uiController.loopMainThreadForAtLeast(100)
var show = true
@@ -349,8 +405,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun accuracy_visibleWithNewLocation() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -372,8 +433,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun accuracy_visibleWhenCameraEased() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -387,10 +453,9 @@ 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,
+ 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*/
@@ -405,8 +470,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun accuracy_visibleWhenCameraMoved() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -419,9 +489,10 @@ class LocationLayerControllerTest : EspressoTest() {
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(target, zoom))
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,
+ 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))
val expectedRadius = Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/
@@ -436,8 +507,13 @@ class LocationLayerControllerTest : EspressoTest() {
@Test
fun applyStyle_layerBelow_restoreLayerVisibility() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
- override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
- style: Style, uiController: UiController, context: Context) {
+ override fun onLocationComponentAction(
+ component: LocationComponent,
+ mapboxMap: MapboxMap,
+ style: Style,
+ uiController: UiController,
+ context: Context
+ ) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
@@ -467,4 +543,4 @@ class LocationLayerControllerTest : EspressoTest() {
private fun executeComponentTest(listener: LocationComponentAction.OnPerformLocationComponentAction) {
onView(withId(R.id.content)).perform(LocationComponentAction(mapboxMap, listener))
}
-}
+} \ No newline at end of file
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 64123cc8c4..daf6b89f59 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
@@ -10,8 +10,10 @@ import com.mapbox.mapboxsdk.location.LocationComponent
import com.mapbox.mapboxsdk.maps.Style
import org.hamcrest.Matcher
-class LocationComponentAction(private val mapboxMap: MapboxMap,
- private val onPerformLocationComponentAction: OnPerformLocationComponentAction) : ViewAction {
+class LocationComponentAction(
+ private val mapboxMap: MapboxMap,
+ private val onPerformLocationComponentAction: OnPerformLocationComponentAction
+) : ViewAction {
override fun getConstraints(): Matcher<View> {
return isDisplayed()
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt
index edbb1c6c65..18da6d1d10 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/MapboxLocationTestingUtils.kt
@@ -7,7 +7,6 @@ import android.graphics.drawable.Drawable
import android.location.Location
import android.os.Handler
import android.os.Looper
-import android.support.test.espresso.UiController
import com.mapbox.geojson.Feature
import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.maps.MapboxMap
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt
index 5aded25d1e..050535f6df 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/utils/StyleChangeIdlingResource.kt
@@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.location.utils
import android.support.test.espresso.IdlingResource
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
-import java.util.logging.Handler
/**
* Resource, that's idling until the provided style is loaded.
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt
index 7019129e6e..27c040fbb6 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt
@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.style.layers.Layer
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
-abstract class BaseLayerTest : AppCenter(){
+abstract class BaseLayerTest : AppCenter() {
private lateinit var nativeMapView: NativeMap
companion object {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
index 409d956a13..d5834db553 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt
@@ -95,7 +95,6 @@ class NativeMapViewTest : AppCenter() {
assertEquals("Longitude should match", expected.longitude, actual.longitude, DELTA)
}
-
@Test
@UiThreadTest
fun testBearingDefault() {
@@ -160,7 +159,7 @@ class NativeMapViewTest : AppCenter() {
@UiThreadTest
fun testLatLngForPixel() {
val expected = LATLNG_TEST
- nativeMapView.setLatLng(LATLNG_TEST,0)
+ nativeMapView.setLatLng(LATLNG_TEST, 0)
val actual = nativeMapView.latLngForPixel(
PointF((WIDTH / 2).toFloat(), (HEIGHT / 2).toFloat())
)
@@ -367,11 +366,11 @@ class NativeMapViewTest : AppCenter() {
class DummyRenderer(context: Context) : MapRenderer(context, null) {
override fun requestRender() {
- //no-op
+ // no-op
}
override fun queueEvent(runnable: Runnable?) {
- //no-op
+ // no-op
}
}
} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt
index 85a4bd65a8..6b59411ae8 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt
@@ -8,10 +8,10 @@ import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
import org.junit.Assert.assertEquals
import org.junit.Test
-class TransformTest: EspressoTest() {
+class TransformTest : EspressoTest() {
companion object {
- val initialCameraUpdate = CameraUpdateFactory.newLatLngZoom(LatLng(12.0,12.0), 12.0)!!
+ val initialCameraUpdate = CameraUpdateFactory.newLatLngZoom(LatLng(12.0, 12.0), 12.0)!!
}
@Test
@@ -23,7 +23,7 @@ class TransformTest: EspressoTest() {
val expectedCameraPosition = mapboxMap.cameraPosition
mapboxMap.moveCamera(initialCameraUpdate)
- mapboxMap.setPadding(250,250,0,0)
+ mapboxMap.setPadding(250, 250, 0, 0)
mapboxMap.scrollBy(400.0f, 0.0f)
val actualCameraPosition = mapboxMap.cameraPosition
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 24c7bc0226..684b13af5d 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
@@ -384,9 +384,8 @@ class VisibleRegionTest : BaseTest() {
mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f)
)
-
for (bearing in 45 until 360 step 45) {
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble()));
+ mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble()))
val visibleRegion = mapboxMap.projection.visibleRegion
assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) })
}
@@ -398,7 +397,7 @@ class VisibleRegionTest : BaseTest() {
validateTestSetup()
invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap ->
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0))
- val d = Math.min(mapboxMap.width, mapboxMap.height) / 4;
+ val d = Math.min(mapboxMap.width, mapboxMap.height) / 4
val latLngs = listOf(
mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f),
mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f),
@@ -408,9 +407,8 @@ class VisibleRegionTest : BaseTest() {
mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f)
)
-
for (bearing in 45 until 360 step 45) {
- mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble()));
+ mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble()))
val visibleRegion = mapboxMap.projection.visibleRegion
assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) })
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt
index 2abee8095c..f695f3efe2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt
@@ -9,7 +9,6 @@ import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
import com.mapbox.mapboxsdk.AppCenter
import com.mapbox.mapboxsdk.testapp.R
-import com.mapbox.mapboxsdk.testapp.action.WaitAction
import com.mapbox.mapboxsdk.testapp.activity.maplayout.MapInDialogActivity
import org.junit.Ignore
import org.junit.Rule
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 539cc85035..b569f7ca3d 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
@@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException
@RunWith(AndroidJUnit4::class)
-class ImageMissingTest : AppCenter(){
+class ImageMissingTest : AppCenter() {
@Rule
@JvmField
@@ -152,4 +152,4 @@ class ImageMissingTest : AppCenter(){
}
"""
}
-}
+} \ No newline at end of file
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 492a75b7cf..41b100b4d2 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
@@ -36,7 +36,7 @@ class RemoveUnusedImagesTest : AppCenter() {
rule.runOnUiThread {
mapView = rule.activity.findViewById(R.id.mapView)
mapView.getMapAsync {
- mapboxMap = it;
+ mapboxMap = it
mapboxMap.setStyle(Style.Builder().fromJson(styleJson))
}
}
@@ -47,7 +47,7 @@ class RemoveUnusedImagesTest : AppCenter() {
var callbackLatch = CountDownLatch(2)
rule.runOnUiThread {
mapView.addOnStyleImageMissingListener {
- mapboxMap.style!!.addImage(it, Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888))
+ mapboxMap.style!!.addImage(it, Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888))
}
// Remove layer and source, so that rendered tiles are no longer used, therefore, map must
@@ -69,7 +69,7 @@ class RemoveUnusedImagesTest : AppCenter() {
}
}
- if(!latch.await(5, TimeUnit.SECONDS) && !callbackLatch.await(5, TimeUnit.SECONDS)){
+ if (!latch.await(5, TimeUnit.SECONDS) && !callbackLatch.await(5, TimeUnit.SECONDS)) {
throw TimeoutException()
}
}
@@ -78,7 +78,7 @@ class RemoveUnusedImagesTest : AppCenter() {
fun testRemoveUnusedImagesDefaultListener() {
rule.runOnUiThread {
mapView.addOnStyleImageMissingListener {
- mapboxMap.style!!.addImage(it, Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888))
+ mapboxMap.style!!.addImage(it, Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888))
}
// Remove layer and source, so that rendered tiles are no longer used, thus
@@ -97,7 +97,7 @@ class RemoveUnusedImagesTest : AppCenter() {
}
}
- if(!latch.await(5, TimeUnit.SECONDS)){
+ if (!latch.await(5, TimeUnit.SECONDS)) {
throw TimeoutException()
}
}
@@ -160,4 +160,4 @@ class RemoveUnusedImagesTest : AppCenter() {
}
"""
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt
index ac73b028f3..951750f354 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt
@@ -2,16 +2,13 @@ package com.mapbox.mapboxsdk.testapp.maps
import android.support.test.espresso.UiController
import android.support.test.runner.AndroidJUnit4
-import com.mapbox.mapboxsdk.maps.MapView
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.style.layers.SymbolLayer
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils
-import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
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 299e193c96..e28aec558c 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
@@ -85,5 +85,4 @@ class CacheTest {
}
countDownLatch.await()
}
-
-}
+} \ No newline at end of file
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 7a5801a814..b67e6eded5 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
@@ -43,8 +43,8 @@ open class FileSourceMapTest : AppCenter() {
}
override fun onError(message: String) {
- Assert.assertEquals("Cannot set path, file source is activated."
- + " Make sure that the map or a resources download is not running.", message)
+ Assert.assertEquals("Cannot set path, file source is activated." +
+ " Make sure that the map or a resources download is not running.", message)
latch.countDown()
}
})
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.kt
index 6f318f77eb..23707f52a5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.kt
@@ -32,11 +32,11 @@ class LatLngBoundsActivity : AppCompatActivity() {
private lateinit var bounds: LatLngBounds
private val peekHeight by lazy {
- 375.toPx(this) //375dp
+ 375.toPx(this) // 375dp
}
private val additionalPadding by lazy {
- 32.toPx(this) //32dp
+ 32.toPx(this) // 32dp
}
override fun onCreate(savedInstanceState: Bundle?) {
@@ -160,8 +160,6 @@ class LatLngBoundsActivity : AppCompatActivity() {
super.onSaveInstanceState(outState)
mapView.onSaveInstanceState(outState)
}
-
}
-fun Int.toPx(context: Context): Int = (this * context.resources.displayMetrics.density).toInt()
-
+fun Int.toPx(context: Context): Int = (this * context.resources.displayMetrics.density).toInt() \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt
index b69d1ee5ed..7de4da1985 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt
@@ -63,4 +63,4 @@ class PixelTestActivity : AppCompatActivity(), OnMapReadyCallback {
super.onLowMemory()
mapView.onLowMemory()
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt
index 37909662ab..67e0d678d7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt
@@ -17,7 +17,6 @@ import android.widget.TextView
import com.mapbox.mapboxsdk.camera.CameraPosition
import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.maps.MapboxMapOptions
-import com.mapbox.mapboxsdk.maps.OnMapReadyCallback
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.maps.SupportMapFragment
import com.mapbox.mapboxsdk.testapp.R
@@ -127,7 +126,8 @@ class NestedViewPagerActivity : AppCompatActivity() {
options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build())
val fragment = SupportMapFragment.newInstance(options)
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.DARK) }
- return fragment }
+ return fragment
+ }
3 -> {
return EmptyFragment.newInstance()
}
@@ -135,7 +135,8 @@ class NestedViewPagerActivity : AppCompatActivity() {
options.camera(CameraPosition.Builder().target(LatLng(-25.007786, 133.623852)).zoom(3.0).build())
val fragment = SupportMapFragment.newInstance(options)
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) }
- return fragment }
+ return fragment
+ }
5 -> {
return EmptyFragment.newInstance()
}
@@ -162,4 +163,4 @@ class NestedViewPagerActivity : AppCompatActivity() {
}
}
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.kt
index d01c8eb508..7c111865d1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.kt
@@ -83,7 +83,7 @@ class SnapshotActivity : AppCompatActivity(), OnMapReadyCallback {
}
companion object {
- const val TAG ="Mbgl-SnapshotActivity"
+ const val TAG = "Mbgl-SnapshotActivity"
const val LOG_MESSAGE = "OnSnapshot"
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt
index 6a01d14249..9411c1c6a7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt
@@ -119,7 +119,7 @@ class LocationFragmentActivity : AppCompatActivity() {
}
override fun onFailure(exception: Exception) {
- //noop
+ // noop
}
override fun onStart() {
@@ -172,4 +172,4 @@ class LocationFragmentActivity : AppCompatActivity() {
return textView
}
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/GLSurfaceRecyclerViewActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/GLSurfaceRecyclerViewActivity.kt
index 3acb7aa382..eae8c71f7e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/GLSurfaceRecyclerViewActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/GLSurfaceRecyclerViewActivity.kt
@@ -151,4 +151,4 @@ open class GLSurfaceRecyclerViewActivity : AppCompatActivity() {
}
}
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/OverlayMapActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/OverlayMapActivity.kt
index d0f3f2e964..3666459951 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/OverlayMapActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/OverlayMapActivity.kt
@@ -65,7 +65,7 @@ class OverlayMapActivity : AppCompatActivity() {
class OverlayView(context: Context) : View(context) {
private lateinit var paint: Paint
-
+
@SuppressLint("DrawAllocation") // only happens once
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
@@ -83,4 +83,4 @@ class OverlayMapActivity : AppCompatActivity() {
}
}
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt
index 940d4b4f19..2f3017435b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt
@@ -12,4 +12,4 @@ class TextureRecyclerViewActivity : GLSurfaceRecyclerViewActivity() {
override fun getMapItemLayoutId(): Int {
return R.layout.item_map_texture
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/ChangeResourcesCachePathActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/ChangeResourcesCachePathActivity.kt
index 74b5bde17d..4e1963d7fc 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/ChangeResourcesCachePathActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/ChangeResourcesCachePathActivity.kt
@@ -74,7 +74,7 @@ class ChangeResourcesCachePathActivity : AppCompatActivity(),
offlineManager.listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback {
override fun onList(offlineRegions: Array<out OfflineRegion>?) {
- Logger.i(TAG, "Number of saved offline regions in the new path: ${offlineRegions?.size.toString()}")
+ Logger.i(TAG, "Number of saved offline regions in the new path: ${offlineRegions?.size}")
}
override fun onError(error: String?) {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DownloadRegionActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DownloadRegionActivity.kt
index 41dbe56112..36a8ccf0f1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DownloadRegionActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DownloadRegionActivity.kt
@@ -145,7 +145,8 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
}
if (status.completedResourceCount > status.requiredResourceCount &&
- previousCompletedResourceCount <= status.requiredResourceCount) {
+ previousCompletedResourceCount <= status.requiredResourceCount
+ ) {
logMessage("FAILURE! Completed > required")
}
}
@@ -279,11 +280,9 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
}
override fun onStartTrackingTouch(seekBar: SeekBar) {
-
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
-
}
})
@@ -293,17 +292,19 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
}
override fun onStartTrackingTouch(seekBar: SeekBar) {
-
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
-
}
})
}
- private fun validCoordinates(latitudeNorth: Double, longitudeEast: Double, latitudeSouth: Double,
- longitudeWest: Double): Boolean {
+ private fun validCoordinates(
+ latitudeNorth: Double,
+ longitudeEast: Double,
+ latitudeSouth: Double,
+ longitudeWest: Double
+ ): Boolean {
if (latitudeNorth < -90 || latitudeNorth > 90) {
return false
} else if (longitudeEast < -180 || longitudeEast > 180) {
@@ -315,4 +316,4 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
}
return true
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/MergeOfflineRegionsActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/MergeOfflineRegionsActivity.kt
index 12169dbe8f..0f59191d06 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/MergeOfflineRegionsActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/MergeOfflineRegionsActivity.kt
@@ -144,4 +144,4 @@ class MergeOfflineRegionsActivity : AppCompatActivity() {
super.onSaveInstanceState(outState)
mapView.onSaveInstanceState(outState)
}
-}
+} \ No newline at end of file
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 c9fdb79e6e..54427ad20d 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
@@ -5,7 +5,6 @@ import android.os.Looper
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import com.mapbox.mapboxsdk.offline.OfflineManager
-import com.mapbox.mapboxsdk.storage.FileSource
import com.mapbox.mapboxsdk.testapp.R
import junit.framework.Assert.assertTrue
import kotlinx.android.synthetic.main.activity_cache_management.*
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 0b784675e9..6de00e24f9 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
@@ -171,11 +171,17 @@ class DraggableMarkerActivity : AppCompatActivity() {
* @param touchAreaMaxX maximum value of X-axis motion event
* @param touchAreaMaxY maximum value of Y-axis motion event
*/
- class DraggableSymbolsManager(mapView: MapView, private val mapboxMap: MapboxMap,
- private val symbolsCollection: FeatureCollection,
- private val symbolsSource: GeoJsonSource, private val symbolsLayerId: String,
- private val touchAreaShiftX: Int = 0, private val touchAreaShiftY: Int = 0,
- private val touchAreaMaxX: Int = mapView.width, private val touchAreaMaxY: Int = mapView.height) {
+ class DraggableSymbolsManager(
+ mapView: MapView,
+ private val mapboxMap: MapboxMap,
+ private val symbolsCollection: FeatureCollection,
+ private val symbolsSource: GeoJsonSource,
+ private val symbolsLayerId: String,
+ private val touchAreaShiftY: Int = 0,
+ private val touchAreaShiftX: Int = 0,
+ private val touchAreaMaxX: Int = mapView.width,
+ private val touchAreaMaxY: Int = mapView.height
+ ) {
private val androidGesturesManager: AndroidGesturesManager = AndroidGesturesManager(mapView.context, false)
private var draggedSymbolId: String? = null
@@ -322,4 +328,4 @@ class DraggableMarkerActivity : AppCompatActivity() {
private fun MapboxMap.queryRenderedSymbols(latLng: LatLng, layerId: String): List<Feature> {
return this.queryRenderedFeatures(this.projection.toScreenLocation(latLng), layerId)
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FileUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FileUtils.kt
index 457ad928db..e0c1ca4207 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FileUtils.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FileUtils.kt
@@ -19,7 +19,6 @@ class FileUtils {
override fun doInBackground(vararg strings: String): Boolean? {
val assetName = strings[0]
val destinationPath = strings[1]
-
contextWeakReference.get()?.let {
try {
copyAsset(it, assetName, destinationPath)
diff --git a/platform/android/build.gradle b/platform/android/build.gradle
index 947e5adb1a..ed6c8d1208 100644
--- a/platform/android/build.gradle
+++ b/platform/android/build.gradle
@@ -26,6 +26,7 @@ allprojects {
// Snapshot repository
// maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
+ apply from: "${rootDir}/gradle/ktlint.gradle"
}
subprojects {
@@ -34,5 +35,4 @@ subprojects {
// Load build system information. If this file does not exist, run
// `make platform/android/gradle/configuration.gradle`
-apply from: "${rootDir}/gradle/configuration.gradle"
-apply from: "${rootDir}/gradle/download-schema.gradle" \ No newline at end of file
+apply from: "${rootDir}/gradle/configuration.gradle" \ No newline at end of file
diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle
index a7ff1dbfe6..de14666e71 100644
--- a/platform/android/gradle/dependencies.gradle
+++ b/platform/android/gradle/dependencies.gradle
@@ -33,7 +33,8 @@ ext {
gms : '16.0.0',
soLoader : '0.6.0',
jacoco : '0.8.3',
- appcenter : '1.4'
+ appcenter : '1.4',
+ ktlint : '0.33.0'
]
dependenciesList = [
@@ -82,6 +83,7 @@ ext {
lint : "com.android.tools.lint:lint:${versions.lint}",
lintApi : "com.android.tools.lint:lint-api:${versions.lint}",
lintChecks : "com.android.tools.lint:lint-checks:${versions.lint}",
- lintTests : "com.android.tools.lint:lint-tests:${versions.lint}"
+ lintTests : "com.android.tools.lint:lint-tests:${versions.lint}",
+ ktlint : "com.pinterest:ktlint:${versions.ktlint}"
]
}
diff --git a/platform/android/gradle/download-schema.gradle b/platform/android/gradle/download-schema.gradle
deleted file mode 100644
index 3d3beac651..0000000000
--- a/platform/android/gradle/download-schema.gradle
+++ /dev/null
@@ -1,8 +0,0 @@
-task downloadSchema(type: Copy) {
- def address='https://mapbox.s3.amazonaws.com/mapbox-gl-native/event-schema/mobile-event-schemas.jsonl.gz'
- def target='MapboxGLAndroidSDK/src/test/resources/'
-
- new File(target + "${address.tokenize('/')[-1]}").withOutputStream { out ->
- new URL(address).withInputStream { from -> out << from }
- }
-} \ No newline at end of file
diff --git a/platform/android/gradle/ktlint.gradle b/platform/android/gradle/ktlint.gradle
new file mode 100644
index 0000000000..31743ccd49
--- /dev/null
+++ b/platform/android/gradle/ktlint.gradle
@@ -0,0 +1,27 @@
+apply from: "${rootDir}/gradle/dependencies.gradle"
+
+repositories {
+ jcenter()
+}
+
+configurations {
+ ktlint
+}
+
+dependencies {
+ ktlint dependenciesList.ktlint
+}
+
+task ktlint(type: JavaExec, group: "verification") {
+ description = "Check Kotlin code style."
+ classpath = configurations.ktlint
+ main = "com.pinterest.ktlint.Main"
+ args "src/**/*.kt"
+}
+
+task ktlintFormat(type: JavaExec, group: "formatting") {
+ description = "Fix Kotlin code style deviations."
+ classpath = configurations.ktlint
+ main = "com.pinterest.ktlint.Main"
+ args "-F", "src/**/*.kt"
+} \ No newline at end of file