summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlangsmith <langstonlmcs@gmail.com>2019-03-05 09:43:17 -0800
committerlangsmith <langstonlmcs@gmail.com>2019-03-05 09:46:58 -0800
commit00673b6dd57c00ee6764b1649928250b6bf9df40 (patch)
treebd45eb3dea9f74729342714dfef91a740a333516
parent1c3c563d94825e82598068d08a337fb7e1e7032d (diff)
downloadqtlocation-mapboxgl-upstream/ls-builder-pattern-for-android-LocationComponent-activation.tar.gz
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java3
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java16
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt14
3 files changed, 10 insertions, 23 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java
index 8bcfd11367..3f71209d10 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java
@@ -198,6 +198,9 @@ public class LocationComponentActivationOptions {
* @param useDefaultLocationEngine true if you want to initialize and use the
* built-in location engine or false if there
* should be no location engine initialized
+ * This is ignored when null is set as the parameter
+ * for {@link LocationComponentActivationOptions#builder
+ * (Context, Style)#locationEngine()}.
* @return the {@link Builder} object being constructed
*/
public Builder useDefaultLocationEngine(boolean useDefaultLocationEngine) {
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java
index f1448a60c6..2660c819d4 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java
@@ -77,7 +77,6 @@ public class LocationComponentActivationOptionsTest {
LocationComponentOptions locationComponentOptions = LocationComponentOptions.builder(context)
.accuracyAlpha(0.5f)
.build();
- assertNotNull(locationComponentOptions);
LocationComponentActivationOptions.builder(context, style)
.locationComponentOptions(locationComponentOptions)
@@ -90,11 +89,6 @@ public class LocationComponentActivationOptionsTest {
thrown.expect(NullPointerException.class);
thrown.expectMessage("Context in LocationComponentActivationOptions is null.");
- LocationComponentOptions locationComponentOptions = LocationComponentOptions.builder(context)
- .accuracyAlpha(0.5f)
- .build();
- assertNotNull(locationComponentOptions);
-
LocationComponentActivationOptions.builder(null, style)
.build();
}
@@ -105,11 +99,6 @@ public class LocationComponentActivationOptionsTest {
thrown.expectMessage("Style in LocationComponentActivationOptions is null. Make sure the Style object isn't null."
+ " Wait for the map to fully load before passing the Style object to LocationComponentActivationOptions.");
- LocationComponentOptions locationComponentOptions = LocationComponentOptions.builder(context)
- .accuracyAlpha(0.5f)
- .build();
- assertNotNull(locationComponentOptions);
-
LocationComponentActivationOptions.builder(context, null)
.build();
}
@@ -124,11 +113,6 @@ public class LocationComponentActivationOptionsTest {
+ "map to fully load before passing the Style object to "
+ "LocationComponentActivationOptions.");
- LocationComponentOptions locationComponentOptions = LocationComponentOptions.builder(context)
- .accuracyAlpha(0.5f)
- .build();
- assertNotNull(locationComponentOptions);
-
LocationComponentActivationOptions.builder(context, style)
.build();
}
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 e91f6e9996..da06ba7173 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
@@ -228,7 +228,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.staleStateTimeout(200)
@@ -263,7 +263,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.foregroundName("custom-foreground-bitmap")
@@ -311,7 +311,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.foregroundName("custom-foreground-bitmap")
@@ -348,7 +348,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.foregroundName("custom-foreground-bitmap")
@@ -384,7 +384,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.gpsName("custom-gps-bitmap")
@@ -419,7 +419,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.staleStateTimeout(200)
@@ -488,7 +488,7 @@ class LocationComponentTest : EspressoTest() {
locationComponentActivationOptions = LocationComponentActivationOptions
.builder(context, style)
- .locationEngine(null)
+ .useDefaultLocationEngine(false)
.locationComponentOptions(
LocationComponentOptions.builder(context)
.accuracyColor(color)