diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2017-11-07 13:12:34 +0100 |
---|---|---|
committer | tobrun <tobrun.van.nuland@gmail.com> | 2017-11-07 13:12:34 +0100 |
commit | 278fe039e12d22846996ec23d7aa4c8221013a4b (patch) | |
tree | 355af4f916bd224326e11c099121a673de15aa84 | |
parent | ff68cc738018620144f84837f3ef1c8d9837e4db (diff) | |
download | qtlocation-mapboxgl-278fe039e12d22846996ec23d7aa4c8221013a4b.tar.gz |
[android] - replace anonymous class with lamba, optimise dependencies
242 files changed, 8244 insertions, 10729 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index d1ac19a1a7..4d801bd6e9 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -10,7 +10,9 @@ dependencies { api rootProject.ext.dep.mapboxAndroidTelemetry api rootProject.ext.dep.mapboxAndroidCore - compileOnly rootProject.ext.dep.lost + compileOnly(rootProject.ext.dep.lost) { + exclude group: 'com.android.support' + } testImplementation rootProject.ext.dep.junit testImplementation rootProject.ext.dep.mockito @@ -112,7 +114,7 @@ android { } lintOptions { - disable 'MissingTranslation', 'TypographyQuotes' + disable 'MissingTranslation', 'TypographyQuotes', 'ClickableViewAccessibility' , 'CustomViewStyleable', 'MissingPermission' baseline file("lint-baseline-local.xml") checkAllWarnings true warningsAsErrors false diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java index d24ed5a113..bd2c9ba58a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk; import android.location.Location; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.location.LocationSource; import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.android.core.location.LocationEngineListener; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index e575dc9062..47ca043ab3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -7,7 +7,6 @@ import android.net.NetworkInfo; import android.support.annotation.NonNull; import android.support.annotation.UiThread; import android.text.TextUtils; - import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException; import com.mapbox.mapboxsdk.location.LocationSource; @@ -16,7 +15,6 @@ import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.android.core.location.LocationEnginePriority; import com.mapbox.services.android.core.location.LocationEngineProvider; import com.mapbox.services.android.telemetry.MapboxTelemetry; - import timber.log.Timber; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java index a588ff6d23..def5dccd56 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java index 82868e2888..112648dfbc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import android.os.Parcelable; - import com.mapbox.mapboxsdk.geometry.LatLng; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java index 3fd2fa4ebf..370e4e0838 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.annotations; import android.os.Parcelable; import android.support.annotation.FloatRange; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.geometry.LatLng; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java index c58cc310a8..3cef56704a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java @@ -8,7 +8,6 @@ import android.graphics.RectF; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.widget.LinearLayout; - import com.mapbox.mapboxsdk.R; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubblePopupHelper.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubblePopupHelper.java index 215445abaa..b5c5fde6a3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubblePopupHelper.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubblePopupHelper.java @@ -6,7 +6,6 @@ import android.os.Build; import android.support.annotation.NonNull; import android.view.ViewGroup; import android.widget.PopupWindow; - import com.mapbox.mapboxsdk.R; class BubblePopupHelper { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java index 3c9cb31211..c2a81cd84d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java @@ -12,7 +12,6 @@ import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.util.DisplayMetrics; import android.view.WindowManager; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.exceptions.TooManyIconsException; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java index cf42bfe738..d3d73b50db 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java @@ -8,7 +8,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java index 18f74cd990..6da20f6c70 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.annotations; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.View; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerOptions.java index 49d4867801..90b089616e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java index eb82c7bf53..e193ec3798 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.annotations; import android.support.annotation.FloatRange; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java index 8304d0e6ed..76e161c136 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java @@ -12,7 +12,6 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.ImageView; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java index 79c72e5f70..de232ef701 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java index dd2c37762a..acaf57f626 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.Color; - import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java index eaad25133e..5a099e4b49 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolygonOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.annotations; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.geometry.LatLng; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java index 6cea29ef81..1d55e79b3b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.Color; - import com.mapbox.mapboxsdk.maps.MapboxMap; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolylineOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolylineOptions.java index ab22109a4e..a9a600f20f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolylineOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/PolylineOptions.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.annotations; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.geometry.LatLng; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java index c2f19072db..c841c65c23 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java @@ -4,7 +4,6 @@ import android.content.res.TypedArray; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.FloatRange; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java index 31f13cbcff..7697ed86ba 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.camera; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.maps.MapboxMap; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 50e33f4f9f..c66768c413 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -4,7 +4,6 @@ import android.graphics.Point; import android.graphics.PointF; import android.support.annotation.IntDef; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapboxMap; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java index ceac862f39..b70fde4d87 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.constants; import android.support.annotation.IntDef; - import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java index 1283283fa5..ab203bf181 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.constants; import android.support.annotation.IntDef; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.TrackingSettings; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java index 9943a72e06..b313b5cf41 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.constants; import android.support.annotation.StringDef; - import com.mapbox.mapboxsdk.maps.MapView; import java.lang.annotation.Retention; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java index eb57241196..91b0e00a1e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java @@ -4,7 +4,6 @@ import android.location.Location; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.FloatRange; - import com.mapbox.services.android.telemetry.constants.GeoConstants; import com.mapbox.services.android.telemetry.utils.MathUtils; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java index 4fcb91033c..cbb0878964 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java @@ -4,7 +4,6 @@ import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.exceptions.InvalidLatLngBoundsException; import com.mapbox.services.android.telemetry.constants.GeoConstants; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index e2626a026b..20d7dc05eb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -5,21 +5,9 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.os.Build; import android.text.TextUtils; - import com.mapbox.mapboxsdk.BuildConfig; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.constants.MapboxConstants; - -import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.NoRouteToHostException; -import java.net.ProtocolException; -import java.net.SocketException; -import java.net.UnknownHostException; -import java.util.concurrent.locks.ReentrantLock; - -import javax.net.ssl.SSLException; - import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -29,6 +17,15 @@ import okhttp3.Response; import okhttp3.internal.Util; import timber.log.Timber; +import javax.net.ssl.SSLException; +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.NoRouteToHostException; +import java.net.ProtocolException; +import java.net.SocketException; +import java.net.UnknownHostException; +import java.util.concurrent.locks.ReentrantLock; + class HTTPRequest implements Callback { private static OkHttpClient mClient = new OkHttpClient(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java index 5129db08e8..ccc822142d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.location; import android.content.Context; import android.location.Location; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.android.core.location.LocationEngineListener; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java index 939fadc9c2..bce24665be 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; import android.support.v4.util.LongSparseArray; - import com.mapbox.mapboxsdk.annotations.Annotation; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java index c09c926eb5..9bb872873d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java @@ -8,7 +8,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.util.LongSparseArray; import android.view.View; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.annotations.Annotation; @@ -22,12 +21,11 @@ import com.mapbox.mapboxsdk.annotations.PolygonOptions; import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; import com.mapbox.services.commons.geojson.Feature; +import timber.log.Timber; import java.util.ArrayList; import java.util.List; -import timber.log.Timber; - /** * Responsible for managing and tracking state of Annotations linked to Map. All events related to * annotations that occur on {@link MapboxMap} are forwarded to this class. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Annotations.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Annotations.java index ae41cbb0cb..bb2a668238 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Annotations.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Annotations.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.annotations.Annotation; import java.util.List; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java index 9ccff387f5..76946bc3fe 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java @@ -14,7 +14,6 @@ import android.text.style.URLSpan; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Toast; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.style.sources.Source; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java index b1d6df2103..9105d17b41 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.maps; import android.graphics.Bitmap; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java index af207204d9..fc3f0c897d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/InfoWindowManager.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.Nullable; import android.text.TextUtils; - import com.mapbox.mapboxsdk.annotations.InfoWindow; import com.mapbox.mapboxsdk.annotations.Marker; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java index 01c6da4971..ebc7de0f21 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java @@ -8,7 +8,6 @@ import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.utils.MapFragmentUtils; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index 2394e52193..9465b64e6a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -10,7 +10,6 @@ import android.view.InputDevice; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ViewConfiguration; - import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector; import com.almeros.android.multitouch.gesturedetectors.ShoveGestureDetector; import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 92153f7f0b..470e88082a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -22,21 +22,23 @@ import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ZoomButtonsController; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.MarkerViewManager; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.constants.Style; -import com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer; import com.mapbox.mapboxsdk.maps.renderer.MapRenderer; +import com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer; import com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer; import com.mapbox.mapboxsdk.maps.widgets.CompassView; import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.services.android.telemetry.MapboxTelemetry; +import timber.log.Timber; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; @@ -44,11 +46,6 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -import timber.log.Timber; - import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION; import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java index 018c8eb5bb..50fcf326c9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; import android.widget.ZoomButtonsController; - import com.mapbox.mapboxsdk.constants.MapboxConstants; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java index 97734de493..2c01ff0cc5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import android.location.Location; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.services.android.telemetry.MapboxEvent; import java.util.Hashtable; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 2533f9753f..70d2dcc673 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -16,7 +16,6 @@ import android.support.v4.util.Pools; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; @@ -45,12 +44,11 @@ import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.Geometry; +import timber.log.Timber; import java.lang.reflect.ParameterizedType; import java.util.List; -import timber.log.Timber; - /** * The general class to interact with in the Android Mapbox SDK. It exposes the entry point for all * methods related to the MapView. You cannot instantiate {@link MapboxMap} object directly, rather, diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index f26e0b9d3b..a152e623d2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -16,7 +16,6 @@ import android.support.v4.content.ContextCompat; import android.support.v4.content.res.ResourcesCompat; import android.util.AttributeSet; import android.view.Gravity; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java index 072382ce07..99dc800a25 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java @@ -5,7 +5,6 @@ import android.graphics.RectF; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.util.LongSparseArray; - import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java index d646e0ac49..4beb41e607 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java @@ -4,7 +4,6 @@ package com.mapbox.mapboxsdk.maps; import android.graphics.RectF; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; import com.mapbox.mapboxsdk.annotations.Marker; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index bd8a54783e..cb1d0cab39 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -9,7 +9,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.DisplayMetrics; - import com.mapbox.mapboxsdk.LibraryLoader; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.Marker; @@ -30,14 +29,13 @@ import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.utils.BitmapUtils; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.Geometry; +import timber.log.Timber; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import timber.log.Timber; - // Class that wraps the native methods for convenience final class NativeMapView { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java index 016862bddc..b19baf2fcd 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; import android.support.v4.util.LongSparseArray; - import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.PolygonOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polygons.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polygons.java index 2a0190b5ba..6db61f7e5c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polygons.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polygons.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.PolygonOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java index 303b25fb55..7e6f3b2273 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; import android.support.v4.util.LongSparseArray; - import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polylines.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polylines.java index c9a865cdd0..85d3548513 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polylines.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Polylines.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java index 16c73b1ca5..14d8232d6d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import android.graphics.PointF; import android.support.annotation.FloatRange; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.geometry.ProjectedMeters; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java index 6c90cd95ec..aa0f44862b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java @@ -8,7 +8,6 @@ import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.utils.MapFragmentUtils; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java index 2f85c82587..b48f009b37 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java @@ -5,7 +5,6 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; @@ -15,7 +14,6 @@ import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.android.core.location.LocationEngineListener; import com.mapbox.services.android.telemetry.permissions.PermissionsManager; - import timber.log.Timber; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java index 6f63c2eba8..4544707314 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java @@ -4,7 +4,6 @@ import android.graphics.PointF; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; - import com.mapbox.mapboxsdk.annotations.MarkerViewManager; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdate; @@ -12,7 +11,6 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; - import timber.log.Timber; import static com.mapbox.mapboxsdk.maps.MapView.REGION_DID_CHANGE_ANIMATED; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java index e71d509fcf..c9f27ae1d7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java @@ -19,7 +19,6 @@ import android.support.v4.content.res.ResourcesCompat; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java index 961438ed14..efc762bbf8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps.renderer; import android.content.Context; import android.support.annotation.CallSuper; - import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.storage.FileSource; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java index b6f467708f..95ddeab64e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java @@ -2,16 +2,14 @@ package com.mapbox.mapboxsdk.maps.renderer.egl; import android.opengl.GLSurfaceView; import android.support.annotation.NonNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import timber.log.Timber; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLDisplay; - -import timber.log.Timber; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import static com.mapbox.mapboxsdk.utils.Compare.compare; import static javax.microedition.khronos.egl.EGL10.EGL_ALPHA_MASK_SIZE; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java index ba2e118faa..bd6e76cca9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.maps.renderer.glsurfaceview; import android.content.Context; import android.opengl.GLSurfaceView; - import com.mapbox.mapboxsdk.maps.renderer.MapRenderer; import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java index 8cd724a828..1bf6d084fb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps.renderer.textureview; import android.content.Context; import android.support.annotation.NonNull; import android.view.TextureView; - import com.mapbox.mapboxsdk.maps.renderer.MapRenderer; import javax.microedition.khronos.egl.EGLConfig; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java index c34833e9ce..bec6f13333 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java @@ -4,11 +4,8 @@ import android.graphics.SurfaceTexture; import android.support.annotation.NonNull; import android.support.annotation.UiThread; import android.view.TextureView; - import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; +import timber.log.Timber; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL11; @@ -17,8 +14,8 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL10; - -import timber.log.Timber; +import java.lang.ref.WeakReference; +import java.util.ArrayList; /** * The render thread is responsible for managing the communication between the diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java index 1e604c9bef..c13a6c75ac 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java @@ -10,7 +10,6 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; - import com.mapbox.mapboxsdk.maps.MapboxMap; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java index cc7602e056..3f6503a8ea 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java @@ -26,7 +26,6 @@ import android.support.annotation.NonNull; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -39,11 +38,10 @@ import com.mapbox.mapboxsdk.maps.Projection; import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.android.core.location.LocationEngineListener; import com.mapbox.services.android.core.location.LocationEnginePriority; +import timber.log.Timber; import java.lang.ref.WeakReference; -import timber.log.Timber; - /** * UI element overlaid on a map to show the user's location. * <p> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettings.java index a1d5b13b8b..d963dcacd2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettings.java @@ -4,7 +4,6 @@ import android.graphics.drawable.Drawable; import android.support.annotation.ColorInt; import android.support.annotation.IntRange; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.maps.FocalPointChangeListener; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java index 817dcdb438..da8dae0c53 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java @@ -9,14 +9,12 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.annotation.NonNull; import android.support.annotation.UiThread; - import com.mapbox.mapboxsdk.Mapbox; +import timber.log.Timber; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import timber.log.Timber; - /** * Interface definition for a callback to be invoked when connectivity changes. * Not public api. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index 130284e88d..40135ea6ee 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -5,17 +5,15 @@ import android.content.Context; import android.os.Handler; import android.os.Looper; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.LibraryLoader; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.mapboxsdk.storage.FileSource; +import timber.log.Timber; import java.io.File; -import timber.log.Timber; - /** * The offline manager is the main entry point for offline-related functionality. * It'll help you list and create offline regions. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java index f210729037..443354a726 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java @@ -5,7 +5,6 @@ import android.os.Looper; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.LibraryLoader; import com.mapbox.mapboxsdk.storage.FileSource; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java index 2a32f0bdd6..c5a3a0bc52 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.offline; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java index eb4f94c428..66c5262be5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.snapshotter; import android.graphics.Bitmap; import android.graphics.PointF; - import com.mapbox.mapboxsdk.geometry.LatLng; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java index 5206606c83..be5b6e6112 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java @@ -8,7 +8,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; import android.util.DisplayMetrics; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java index a968cdf192..b3677e4072 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java @@ -6,10 +6,8 @@ import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.os.Environment; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.constants.MapboxConstants; - import timber.log.Timber; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java index bb87fe8a39..3f0f84738e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.style.functions; import android.support.annotation.Keep; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java index 15e4474105..9b1f3423c5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.style.functions; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java index e7bb52ebb3..b1244339e5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java @@ -2,18 +2,16 @@ package com.mapbox.mapboxsdk.style.functions; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops; import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; import com.mapbox.mapboxsdk.style.functions.stops.Stops; +import timber.log.Timber; import java.util.Map; -import timber.log.Timber; - /** * Functions are used to change properties in relation to the state of the map. * <p> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java index 33f436ae71..8e8004ef98 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/SourceFunction.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.style.functions; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.PropertyValue; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java index 978fa29ef8..324b845dda 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java @@ -8,8 +8,6 @@ import android.support.annotation.UiThread; import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * The background color or pattern of the map. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java index 10663142b5..ea96e4e9c3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java @@ -8,8 +8,6 @@ import android.support.annotation.UiThread; import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * A filled circle. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java index 6772da73b1..d4cdb2a425 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java @@ -8,8 +8,6 @@ import android.support.annotation.UiThread; import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * An extruded (3D) polygon. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java index 3719ae9e1b..e639823ee1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java @@ -8,8 +8,6 @@ import android.support.annotation.UiThread; import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * A filled polygon with an optional stroked border. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java index 5015dd009d..f78a2e8767 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.style.functions.Function; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java index ca106cc106..bbcfb98f07 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java @@ -8,8 +8,6 @@ import android.support.annotation.UiThread; import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * A stroked line. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java index d4ddbe48ef..4801d3ca07 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java @@ -4,9 +4,8 @@ package com.mapbox.mapboxsdk.style.layers; import android.annotation.SuppressLint; import android.support.annotation.ColorInt; - -import com.mapbox.mapboxsdk.style.functions.Function; import com.mapbox.mapboxsdk.style.functions.CameraFunction; +import com.mapbox.mapboxsdk.style.functions.Function; /** * Constructs paint/layout properties for Layers diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java index a57c440df4..0334af74b0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java @@ -3,11 +3,9 @@ package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; - import com.mapbox.mapboxsdk.exceptions.ConversionException; import com.mapbox.mapboxsdk.style.functions.Function; import com.mapbox.mapboxsdk.utils.ColorUtils; - import timber.log.Timber; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java index e67e71b61d..0a056d8fac 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java @@ -2,14 +2,9 @@ package com.mapbox.mapboxsdk.style.layers; -import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; -import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * Raster map textures such as satellite imagery. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java index d0fb82dce5..3d2c3881b2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java @@ -8,8 +8,6 @@ import android.support.annotation.UiThread; import static com.mapbox.mapboxsdk.utils.ColorUtils.rgbaToColor; -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; - /** * An icon or a text label. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java index 8f23e7d01e..e127a3b116 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java @@ -5,7 +5,6 @@ package com.mapbox.mapboxsdk.style.light; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.UiThread; - import com.mapbox.mapboxsdk.style.layers.Property; import com.mapbox.mapboxsdk.style.layers.PropertyFactory; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java index 10ecb945ad..ea6742cf9a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.style.sources; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; - import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java index 84e5e96fa4..777ee7fd60 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java @@ -9,7 +9,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; import android.support.v4.content.ContextCompat; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.geometry.LatLngQuad; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java index 54e4e5f5d3..ab1fd48475 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.style.sources; import android.support.annotation.Size; - import com.mapbox.mapboxsdk.geometry.LatLng; import java.util.HashMap; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java index 9b59cf8967..e49ed062a3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java @@ -4,7 +4,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.Size; import android.support.annotation.UiThread; - import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.services.commons.geojson.Feature; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java index 1c0e439afc..22f36640fd 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java @@ -11,7 +11,6 @@ import android.support.annotation.NonNull; import android.support.v4.graphics.drawable.DrawableCompat; import android.util.TypedValue; import android.widget.ImageView; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.exceptions.ConversionException; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java index 007880acd1..0c904e930d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java @@ -4,7 +4,6 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.content.ContextCompat; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java index 09acf3feef..0fa8647ad8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java @@ -3,10 +3,8 @@ package com.mapbox.mapboxsdk; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; - import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException; import com.mapbox.services.android.core.location.LocationEngine; - import org.junit.Before; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java index 605e159b84..9ba44584c0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import com.mapbox.mapboxsdk.maps.MapboxMap; - import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/IconTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/IconTest.java index 1c259af2d0..e56ca559d4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/IconTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/IconTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.Bitmap; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/InfoWindowTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/InfoWindowTest.java index 94b629860e..8f36c88a11 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/InfoWindowTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/InfoWindowTest.java @@ -1,12 +1,10 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.PointF; - import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.Projection; - import org.junit.Test; import org.mockito.InjectMocks; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerTest.java index fa571e06b1..43d2da1d25 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerTest.java @@ -2,11 +2,9 @@ package com.mapbox.mapboxsdk.annotations; import android.graphics.Bitmap; import android.os.Parcelable; - import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java index ebd30f5422..284ca5daf1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java @@ -1,12 +1,10 @@ package com.mapbox.mapboxsdk.annotations; import android.os.Parcelable; - import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolygonTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolygonTest.java index 3933c68887..c8701358ce 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolygonTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolygonTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import com.mapbox.mapboxsdk.geometry.LatLng; - import org.junit.Test; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolylineTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolylineTest.java index 54bb0e8cf4..56ef9b1771 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolylineTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/PolylineTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.annotations; import com.mapbox.mapboxsdk.geometry.LatLng; - import org.junit.Test; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java index 0c5f3a4be2..d36fff3a0c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java @@ -2,11 +2,9 @@ package com.mapbox.mapboxsdk.camera; import android.content.res.TypedArray; import android.os.Parcelable; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java index 8d9a360714..4c7d047e91 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java @@ -1,10 +1,8 @@ package com.mapbox.mapboxsdk.geometry; import android.os.Parcelable; - import com.mapbox.mapboxsdk.exceptions.InvalidLatLngBoundsException; import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Before; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngSpanTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngSpanTest.java index 12297247cf..bbd1ce639d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngSpanTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngSpanTest.java @@ -1,9 +1,7 @@ package com.mapbox.mapboxsdk.geometry; import android.os.Parcelable; - import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngTest.java index 06e93b9d2f..3ce4344a5e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngTest.java @@ -2,11 +2,9 @@ package com.mapbox.mapboxsdk.geometry; import android.location.Location; import android.os.Parcelable; - import com.mapbox.mapboxsdk.utils.MockParcel; - -import org.junit.Test; import org.junit.Rule; +import org.junit.Test; import org.junit.rules.ExpectedException; import static org.junit.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/ProjectedMetersTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/ProjectedMetersTest.java index 00fd125a1a..f820e6e192 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/ProjectedMetersTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/ProjectedMetersTest.java @@ -1,9 +1,7 @@ package com.mapbox.mapboxsdk.geometry; import android.os.Parcelable; - import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/VisibleRegionTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/VisibleRegionTest.java index 12b779de5d..52d4c8e896 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/VisibleRegionTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/VisibleRegionTest.java @@ -1,9 +1,7 @@ package com.mapbox.mapboxsdk.geometry; import android.os.Parcelable; - import com.mapbox.mapboxsdk.utils.MockParcel; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java index 0d592f9bb3..e6a5a568c9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java @@ -1,14 +1,12 @@ package com.mapbox.mapboxsdk.maps; import android.support.v4.util.LongSparseArray; - import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.annotations.MarkerViewManager; import com.mapbox.mapboxsdk.geometry.LatLng; - import org.junit.Test; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java index 4f929641f3..5ead859722 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java @@ -2,12 +2,10 @@ package com.mapbox.mapboxsdk.maps; import android.graphics.Color; import android.view.Gravity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; - import org.junit.Test; import java.util.Arrays; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java index 5e9f94db28..9c95b55175 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; - import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/TrackingSettingsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/TrackingSettingsTest.java index de5f364a5b..b39afa74e1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/TrackingSettingsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/TrackingSettingsTest.java @@ -4,10 +4,8 @@ import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.graphics.PointF; - import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; - import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java index fbe00b4dce..57a6c30b70 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java @@ -4,9 +4,7 @@ import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; - import com.mapbox.mapboxsdk.maps.widgets.CompassView; - import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettingsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettingsTest.java index c9ce19dc85..77968869f9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettingsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationViewSettingsTest.java @@ -2,11 +2,9 @@ package com.mapbox.mapboxsdk.maps.widgets; import android.graphics.Color; import android.graphics.drawable.Drawable; - import com.mapbox.mapboxsdk.maps.FocalPointChangeListener; import com.mapbox.mapboxsdk.maps.Projection; import com.mapbox.mapboxsdk.maps.TrackingSettings; - import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java index bac1154d62..1261e86182 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/layers/FunctionTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.style.layers; import com.mapbox.mapboxsdk.style.functions.Function; - import org.junit.Test; import static com.mapbox.mapboxsdk.style.functions.Function.zoom; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java index 94a6dc2194..048ed9c3fa 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java @@ -1,8 +1,7 @@ package com.mapbox.mapboxsdk.telemetry; -import org.junit.Test; - import okhttp3.internal.Util; +import org.junit.Test; import static junit.framework.Assert.assertEquals; diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/utils/MockParcel.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/utils/MockParcel.java index dd4c7b25ee..cf8d1c8f61 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/utils/MockParcel.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/utils/MockParcel.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.utils; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.NonNull; - import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index b1c652805e..3caba013fe 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -67,7 +67,11 @@ dependencies { implementation(rootProject.ext.dep.mapboxJavaServices) { transitive = true } - implementation rootProject.ext.dep.lost + + implementation (rootProject.ext.dep.lost) { + exclude group: 'com.android.support' + } + implementation rootProject.ext.dep.timber // Testing dependencies diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java index 3e226a7ec5..d42357de6f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/IconManagerResolver.java @@ -1,13 +1,12 @@ package com.mapbox.mapboxsdk.maps; import com.mapbox.mapboxsdk.annotations.Icon; +import timber.log.Timber; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; -import timber.log.Timber; - public class IconManagerResolver { private IconManager iconManager; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java index 294d57bce1..3359f997ae 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java @@ -1,12 +1,9 @@ package com.mapbox.mapboxsdk.maps; import android.graphics.Color; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.view.View; - import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; @@ -23,7 +20,6 @@ import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; import com.mapbox.mapboxsdk.testapp.utils.ViewUtils; - import org.hamcrest.Matcher; import org.junit.Ignore; import org.junit.Test; @@ -66,26 +62,21 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testTransitionDuration() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - long transitionDuration = 600; - mapboxMap.setTransitionDuration(transitionDuration); - assertEquals("TransitionDuration should match", transitionDuration, mapboxMap.getTransitionDuration(), 0); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + long transitionDuration = 600; + mapboxMap.setTransitionDuration(transitionDuration); + assertEquals("TransitionDuration should match", + transitionDuration, mapboxMap.getTransitionDuration(), 0); })); } @Test public void testTransitionDelay() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - long transitionDelay = 50; - mapboxMap.setTransitionDelay(transitionDelay); - assertEquals("TransitionDelay should match", transitionDelay, mapboxMap.getTransitionDelay(), 0); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + long transitionDelay = 50; + mapboxMap.setTransitionDelay(transitionDelay); + assertEquals("TransitionDelay should match", transitionDelay, mapboxMap.getTransitionDelay(), 0); })); } @@ -95,15 +86,12 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testCameraForLatLngBounds() { ViewUtils.checkViewIsDisplayed(R.id.mapView); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - // set - mapboxMap.setLatLngBoundsForCameraTarget( - new LatLngBounds.Builder().include(new LatLng()).include(new LatLng(1, 1)).build()); - // reset - mapboxMap.setLatLngBoundsForCameraTarget(null); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + // set + mapboxMap.setLatLngBoundsForCameraTarget( + new LatLngBounds.Builder().include(new LatLng()).include(new LatLng(1, 1)).build()); + // reset + mapboxMap.setLatLngBoundsForCameraTarget(null); })); } @@ -114,12 +102,9 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testMinZoom() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setMinZoomPreference(10); - assertEquals("MinZoom should match", 10, mapboxMap.getMinZoomLevel(), 10); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setMinZoomPreference(10); + assertEquals("MinZoom should match", 10, mapboxMap.getMinZoomLevel(), 10); })); } @@ -127,12 +112,9 @@ public class MapboxMapTest extends BaseActivityTest { public void testMaxZoom() { validateTestSetup(); final double zoom = 10; - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setMaxZoomPreference(zoom); - assertEquals("MaxZoom should match", zoom, mapboxMap.getMaxZoomLevel(), 10); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setMaxZoomPreference(zoom); + assertEquals("MaxZoom should match", zoom, mapboxMap.getMaxZoomLevel(), 10); })); } @@ -140,14 +122,11 @@ public class MapboxMapTest extends BaseActivityTest { @Ignore public void testInitialZoomLevels() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - assertEquals("MaxZoom should match", MapboxConstants.MAXIMUM_ZOOM, mapboxMap.getMaxZoomLevel(), - TestConstants.ZOOM_DELTA); - assertEquals("MinZoom should match", MapboxConstants.MINIMUM_ZOOM, mapboxMap.getMinZoomLevel(), - TestConstants.ZOOM_DELTA); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + assertEquals("MaxZoom should match", MapboxConstants.MAXIMUM_ZOOM, mapboxMap.getMaxZoomLevel(), + TestConstants.ZOOM_DELTA); + assertEquals("MinZoom should match", MapboxConstants.MINIMUM_ZOOM, mapboxMap.getMinZoomLevel(), + TestConstants.ZOOM_DELTA); })); } @@ -168,43 +147,28 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testConcurrentInfoWindowEnabled() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true); - assertTrue("ConcurrentWindows should be true", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true); + assertTrue("ConcurrentWindows should be true", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows()); })); } @Test public void testConcurrentInfoWindowDisabled() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(false); - assertFalse("ConcurrentWindows should be false", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(false); + assertFalse("ConcurrentWindows should be false", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows()); })); } @Test public void testInfoWindowAdapter() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MapboxMap.InfoWindowAdapter infoWindowAdapter = new MapboxMap.InfoWindowAdapter() { - @Nullable - @Override - public View getInfoWindow(@NonNull Marker marker) { - return null; - } - }; - mapboxMap.setInfoWindowAdapter(infoWindowAdapter); - assertEquals("InfoWindowAdpter should be the same", infoWindowAdapter, mapboxMap.getInfoWindowAdapter()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MapboxMap.InfoWindowAdapter infoWindowAdapter = marker -> null; + mapboxMap.setInfoWindowAdapter(infoWindowAdapter); + assertEquals("InfoWindowAdpter should be the same", infoWindowAdapter, mapboxMap.getInfoWindowAdapter()); })); } @@ -216,12 +180,9 @@ public class MapboxMapTest extends BaseActivityTest { @Ignore /* disabled due to enabling permissions during test #7177 */ public void testMyLocationEnabled() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setMyLocationEnabled(true); - assertTrue("MyLocationEnabled should be true", mapboxMap.isMyLocationEnabled()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setMyLocationEnabled(true); + assertTrue("MyLocationEnabled should be true", mapboxMap.isMyLocationEnabled()); })); } @@ -229,12 +190,9 @@ public class MapboxMapTest extends BaseActivityTest { @Ignore /* can't create handler inside thread that not called Looper.prepare() */ public void testMyLocationDisabled() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setMyLocationEnabled(false); - assertFalse("MyLocationEnabled should be false", mapboxMap.isMyLocationEnabled()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setMyLocationEnabled(false); + assertFalse("MyLocationEnabled should be false", mapboxMap.isMyLocationEnabled()); })); } @@ -245,73 +203,49 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testFpsListener() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MapboxMap.OnFpsChangedListener fpsChangedListener = new MapboxMap.OnFpsChangedListener() { - @Override - public void onFpsChanged(double fps) { + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MapboxMap.OnFpsChangedListener fpsChangedListener = fps -> { - } - }; - mapboxMap.setOnFpsChangedListener(fpsChangedListener); - assertEquals("FpsListener should match", fpsChangedListener, mapboxMap.getOnFpsChangedListener()); - } + }; + mapboxMap.setOnFpsChangedListener(fpsChangedListener); + assertEquals("FpsListener should match", fpsChangedListener, mapboxMap.getOnFpsChangedListener()); })); } @Test public void testInfoWindowClickListener() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MapboxMap.OnInfoWindowClickListener clickListener = new MapboxMap.OnInfoWindowClickListener() { - @Override - public boolean onInfoWindowClick(@NonNull Marker marker) { - return false; - } - }; - mapboxMap.setOnInfoWindowClickListener(clickListener); - assertEquals("InfoWidowClickListener should match", clickListener, mapboxMap.getOnInfoWindowClickListener()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MapboxMap.OnInfoWindowClickListener clickListener = marker -> false; + mapboxMap.setOnInfoWindowClickListener(clickListener); + assertEquals("InfoWidowClickListener should match", + clickListener, mapboxMap.getOnInfoWindowClickListener()); })); } @Test public void testInfoWindowCloseListener() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MapboxMap.OnInfoWindowCloseListener listener = new MapboxMap.OnInfoWindowCloseListener() { - @Override - public void onInfoWindowClose(Marker marker) { + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MapboxMap.OnInfoWindowCloseListener listener = marker -> { - } - }; - mapboxMap.setOnInfoWindowCloseListener(listener); - assertEquals("InfoWindowCloseListener should match", listener, mapboxMap.getOnInfoWindowCloseListener()); - } + }; + mapboxMap.setOnInfoWindowCloseListener(listener); + assertEquals("InfoWindowCloseListener should match", + listener, mapboxMap.getOnInfoWindowCloseListener()); })); } @Test public void testInfoWindowLongClickListener() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MapboxMap.OnInfoWindowLongClickListener listener = new MapboxMap.OnInfoWindowLongClickListener() { - @Override - public void onInfoWindowLongClick(Marker marker) { + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MapboxMap.OnInfoWindowLongClickListener listener = marker -> { - } - }; - mapboxMap.setOnInfoWindowLongClickListener(listener); - assertEquals("InfoWindowLongClickListener should match", listener, - mapboxMap.getOnInfoWindowLongClickListener()); - } + }; + mapboxMap.setOnInfoWindowLongClickListener(listener); + assertEquals("InfoWindowLongClickListener should match", listener, + mapboxMap.getOnInfoWindowLongClickListener()); })); } @@ -322,13 +256,10 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testAddMarker() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker marker = mapboxMap.addMarker(markerOptions); - assertTrue("Marker should be contained", mapboxMap.getMarkers().contains(marker)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker marker = mapboxMap.addMarker(markerOptions); + assertTrue("Marker should be contained", mapboxMap.getMarkers().contains(marker)); })); } @@ -340,442 +271,348 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testAddMarkers() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<BaseMarkerOptions> markerList = new ArrayList<>(); - MarkerOptions markerOptions1 = new MarkerOptions().position(new LatLng()).title("a"); - MarkerOptions markerOptions2 = new MarkerOptions().position(new LatLng()).title("b"); - markerList.add(markerOptions1); - markerList.add(markerOptions2); - List<Marker> markers = mapboxMap.addMarkers(markerList); - assertEquals("Markers size should be 2", 2, mapboxMap.getMarkers().size()); - assertTrue(mapboxMap.getMarkers().contains(markers.get(0))); - assertTrue(mapboxMap.getMarkers().contains(markers.get(1))); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<BaseMarkerOptions> markerList = new ArrayList<>(); + MarkerOptions markerOptions1 = new MarkerOptions().position(new LatLng()).title("a"); + MarkerOptions markerOptions2 = new MarkerOptions().position(new LatLng()).title("b"); + markerList.add(markerOptions1); + markerList.add(markerOptions2); + List<Marker> markers = mapboxMap.addMarkers(markerList); + assertEquals("Markers size should be 2", 2, mapboxMap.getMarkers().size()); + assertTrue(mapboxMap.getMarkers().contains(markers.get(0))); + assertTrue(mapboxMap.getMarkers().contains(markers.get(1))); })); } @Test public void testAddMarkersEmpty() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<BaseMarkerOptions> markerList = new ArrayList<>(); - mapboxMap.addMarkers(markerList); - assertEquals("Markers size should be 0", 0, mapboxMap.getMarkers().size()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<BaseMarkerOptions> markerList = new ArrayList<>(); + mapboxMap.addMarkers(markerList); + assertEquals("Markers size should be 0", 0, mapboxMap.getMarkers().size()); })); } @Test public void testAddMarkersSingleMarker() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<BaseMarkerOptions> markerList = new ArrayList<>(); - MarkerOptions markerOptions = new MarkerOptions().title("a").position(new LatLng()); - markerList.add(markerOptions); - List<Marker> markers = mapboxMap.addMarkers(markerList); - assertEquals("Markers size should be 1", 1, mapboxMap.getMarkers().size()); - assertTrue(mapboxMap.getMarkers().contains(markers.get(0))); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<BaseMarkerOptions> markerList = new ArrayList<>(); + MarkerOptions markerOptions = new MarkerOptions().title("a").position(new LatLng()); + markerList.add(markerOptions); + List<Marker> markers = mapboxMap.addMarkers(markerList); + assertEquals("Markers size should be 1", 1, mapboxMap.getMarkers().size()); + assertTrue(mapboxMap.getMarkers().contains(markers.get(0))); })); } @Test public void testAddPolygon() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - PolygonOptions polygonOptions = new PolygonOptions().add(new LatLng()); - Polygon polygon = mapboxMap.addPolygon(polygonOptions); - assertTrue("Polygon should be contained", mapboxMap.getPolygons().contains(polygon)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + PolygonOptions polygonOptions = new PolygonOptions().add(new LatLng()); + Polygon polygon = mapboxMap.addPolygon(polygonOptions); + assertTrue("Polygon should be contained", mapboxMap.getPolygons().contains(polygon)); })); } @Test public void testAddEmptyPolygon() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - PolygonOptions polygonOptions = new PolygonOptions(); - Polygon polygon = mapboxMap.addPolygon(polygonOptions); - assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygon)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + PolygonOptions polygonOptions = new PolygonOptions(); + Polygon polygon = mapboxMap.addPolygon(polygonOptions); + assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygon)); })); } @Test public void testAddPolygons() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<PolygonOptions> polygonList = new ArrayList<>(); - PolygonOptions polygonOptions1 = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng()); - PolygonOptions polygonOptions2 = new PolygonOptions().fillColor(Color.WHITE).add(new LatLng()); - PolygonOptions polygonOptions3 = new PolygonOptions(); - polygonList.add(polygonOptions1); - polygonList.add(polygonOptions2); - polygonList.add(polygonOptions3); - mapboxMap.addPolygons(polygonList); - assertEquals("Polygons size should be 2", 2, mapboxMap.getPolygons().size()); - assertTrue(mapboxMap.getPolygons().contains(polygonOptions1.getPolygon())); - assertTrue(mapboxMap.getPolygons().contains(polygonOptions2.getPolygon())); - assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygonOptions3.getPolygon())); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<PolygonOptions> polygonList = new ArrayList<>(); + PolygonOptions polygonOptions1 = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng()); + PolygonOptions polygonOptions2 = new PolygonOptions().fillColor(Color.WHITE).add(new LatLng()); + PolygonOptions polygonOptions3 = new PolygonOptions(); + polygonList.add(polygonOptions1); + polygonList.add(polygonOptions2); + polygonList.add(polygonOptions3); + mapboxMap.addPolygons(polygonList); + assertEquals("Polygons size should be 2", 2, mapboxMap.getPolygons().size()); + assertTrue(mapboxMap.getPolygons().contains(polygonOptions1.getPolygon())); + assertTrue(mapboxMap.getPolygons().contains(polygonOptions2.getPolygon())); + assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygonOptions3.getPolygon())); })); } @Test public void addPolygonsEmpty() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.addPolygons(new ArrayList<PolygonOptions>()); - assertEquals("Polygons size should be 0", 0, mapboxMap.getPolygons().size()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.addPolygons(new ArrayList<PolygonOptions>()); + assertEquals("Polygons size should be 0", 0, mapboxMap.getPolygons().size()); })); } @Test public void addPolygonsSingle() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<PolygonOptions> polygonList = new ArrayList<>(); - PolygonOptions polygonOptions = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng()); - polygonList.add(polygonOptions); - mapboxMap.addPolygons(polygonList); - assertEquals("Polygons size should be 1", 1, mapboxMap.getPolygons().size()); - assertTrue(mapboxMap.getPolygons().contains(polygonOptions.getPolygon())); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<PolygonOptions> polygonList = new ArrayList<>(); + PolygonOptions polygonOptions = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng()); + polygonList.add(polygonOptions); + mapboxMap.addPolygons(polygonList); + assertEquals("Polygons size should be 1", 1, mapboxMap.getPolygons().size()); + assertTrue(mapboxMap.getPolygons().contains(polygonOptions.getPolygon())); })); } @Test public void testAddPolyline() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - PolylineOptions polylineOptions = new PolylineOptions().add(new LatLng()); - Polyline polyline = mapboxMap.addPolyline(polylineOptions); - assertTrue("Polyline should be contained", mapboxMap.getPolylines().contains(polyline)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + PolylineOptions polylineOptions = new PolylineOptions().add(new LatLng()); + Polyline polyline = mapboxMap.addPolyline(polylineOptions); + assertTrue("Polyline should be contained", mapboxMap.getPolylines().contains(polyline)); })); } @Test public void testAddEmptyPolyline() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - PolylineOptions polylineOptions = new PolylineOptions(); - Polyline polyline = mapboxMap.addPolyline(polylineOptions); - assertTrue("Polyline should be ignored", !mapboxMap.getPolylines().contains(polyline)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + PolylineOptions polylineOptions = new PolylineOptions(); + Polyline polyline = mapboxMap.addPolyline(polylineOptions); + assertTrue("Polyline should be ignored", !mapboxMap.getPolylines().contains(polyline)); })); } @Test public void testAddPolylines() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<PolylineOptions> polylineList = new ArrayList<>(); - PolylineOptions polygonOptions1 = new PolylineOptions().color(Color.BLACK).add(new LatLng()); - PolylineOptions polygonOptions2 = new PolylineOptions().color(Color.WHITE).add(new LatLng()); - PolylineOptions polygonOptions3 = new PolylineOptions(); - polylineList.add(polygonOptions1); - polylineList.add(polygonOptions2); - polylineList.add(polygonOptions3); - mapboxMap.addPolylines(polylineList); - assertEquals("Polygons size should be 2", 2, mapboxMap.getPolylines().size()); - assertTrue(mapboxMap.getPolylines().contains(polygonOptions1.getPolyline())); - assertTrue(mapboxMap.getPolylines().contains(polygonOptions2.getPolyline())); - assertTrue("Polyline should be ignored", !mapboxMap.getPolylines().contains(polygonOptions3.getPolyline())); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<PolylineOptions> polylineList = new ArrayList<>(); + PolylineOptions polygonOptions1 = new PolylineOptions().color(Color.BLACK).add(new LatLng()); + PolylineOptions polygonOptions2 = new PolylineOptions().color(Color.WHITE).add(new LatLng()); + PolylineOptions polygonOptions3 = new PolylineOptions(); + polylineList.add(polygonOptions1); + polylineList.add(polygonOptions2); + polylineList.add(polygonOptions3); + mapboxMap.addPolylines(polylineList); + assertEquals("Polygons size should be 2", 2, mapboxMap.getPolylines().size()); + assertTrue(mapboxMap.getPolylines().contains(polygonOptions1.getPolyline())); + assertTrue(mapboxMap.getPolylines().contains(polygonOptions2.getPolyline())); + assertTrue("Polyline should be ignored", + !mapboxMap.getPolylines().contains(polygonOptions3.getPolyline())); })); } @Test public void testAddPolylinesEmpty() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.addPolylines(new ArrayList<PolylineOptions>()); - assertEquals("Polygons size should be 0", 0, mapboxMap.getPolylines().size()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.addPolylines(new ArrayList<PolylineOptions>()); + assertEquals("Polygons size should be 0", 0, mapboxMap.getPolylines().size()); })); } @Test public void testAddPolylinesSingle() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<PolylineOptions> polylineList = new ArrayList<>(); - PolylineOptions polygonOptions = new PolylineOptions().color(Color.BLACK).add(new LatLng()); - polylineList.add(polygonOptions); - mapboxMap.addPolylines(polylineList); - assertEquals("Polygons size should be 1", 1, mapboxMap.getPolylines().size()); - assertTrue(mapboxMap.getPolylines().contains(polygonOptions.getPolyline())); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<PolylineOptions> polylineList = new ArrayList<>(); + PolylineOptions polygonOptions = new PolylineOptions().color(Color.BLACK).add(new LatLng()); + polylineList.add(polygonOptions); + mapboxMap.addPolylines(polylineList); + assertEquals("Polygons size should be 1", 1, mapboxMap.getPolylines().size()); + assertTrue(mapboxMap.getPolylines().contains(polygonOptions.getPolyline())); })); } @Test public void testRemoveMarker() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker marker = mapboxMap.addMarker(markerOptions); - mapboxMap.removeMarker(marker); - assertTrue("Markers should be empty", mapboxMap.getMarkers().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker marker = mapboxMap.addMarker(markerOptions); + mapboxMap.removeMarker(marker); + assertTrue("Markers should be empty", mapboxMap.getMarkers().isEmpty()); })); } @Test public void testRemovePolygon() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - PolygonOptions polygonOptions = new PolygonOptions(); - Polygon polygon = mapboxMap.addPolygon(polygonOptions); - mapboxMap.removePolygon(polygon); - assertTrue("Polygons should be empty", mapboxMap.getPolylines().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + PolygonOptions polygonOptions = new PolygonOptions(); + Polygon polygon = mapboxMap.addPolygon(polygonOptions); + mapboxMap.removePolygon(polygon); + assertTrue("Polygons should be empty", mapboxMap.getPolylines().isEmpty()); })); } @Test public void testRemovePolyline() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - PolylineOptions polylineOptions = new PolylineOptions(); - Polyline polyline = mapboxMap.addPolyline(polylineOptions); - mapboxMap.removePolyline(polyline); - assertTrue("Polylines should be empty", mapboxMap.getPolylines().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + PolylineOptions polylineOptions = new PolylineOptions(); + Polyline polyline = mapboxMap.addPolyline(polylineOptions); + mapboxMap.removePolyline(polyline); + assertTrue("Polylines should be empty", mapboxMap.getPolylines().isEmpty()); })); } @Test public void testRemoveAnnotation() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker marker = mapboxMap.addMarker(markerOptions); - mapboxMap.removeAnnotation(marker); - assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker marker = mapboxMap.addMarker(markerOptions); + mapboxMap.removeAnnotation(marker); + assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); })); } @Test public void testRemoveAnnotationById() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - mapboxMap.addMarker(markerOptions); - // id will always be 0 in unit tests - mapboxMap.removeAnnotation(0); - assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + mapboxMap.addMarker(markerOptions); + // id will always be 0 in unit tests + mapboxMap.removeAnnotation(0); + assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); })); } @Test public void testRemoveAnnotations() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<BaseMarkerOptions> markerList = new ArrayList<>(); - MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng()); - MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng()); - markerList.add(markerOptions1); - markerList.add(markerOptions2); - mapboxMap.addMarkers(markerList); - mapboxMap.removeAnnotations(); - assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<BaseMarkerOptions> markerList = new ArrayList<>(); + MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng()); + MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng()); + markerList.add(markerOptions1); + markerList.add(markerOptions2); + mapboxMap.addMarkers(markerList); + mapboxMap.removeAnnotations(); + assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); })); } @Test public void testClear() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<BaseMarkerOptions> markerList = new ArrayList<>(); - MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng()); - MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng()); - markerList.add(markerOptions1); - markerList.add(markerOptions2); - mapboxMap.addMarkers(markerList); - mapboxMap.clear(); - assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<BaseMarkerOptions> markerList = new ArrayList<>(); + MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng()); + MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng()); + markerList.add(markerOptions1); + markerList.add(markerOptions2); + mapboxMap.addMarkers(markerList); + mapboxMap.clear(); + assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty()); })); } @Test public void testRemoveAnnotationsByList() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - List<BaseMarkerOptions> markerList = new ArrayList<>(); - MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng()); - MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng()); - markerList.add(markerOptions1); - markerList.add(markerOptions2); - List<Marker> markers = mapboxMap.addMarkers(markerList); - Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng()).title("c")); - mapboxMap.removeAnnotations(markers); - assertTrue("Annotations should not be empty", mapboxMap.getAnnotations().size() == 1); - assertTrue("Marker should be contained", mapboxMap.getAnnotations().contains(marker)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + List<BaseMarkerOptions> markerList = new ArrayList<>(); + MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng()); + MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng()); + markerList.add(markerOptions1); + markerList.add(markerOptions2); + List<Marker> markers = mapboxMap.addMarkers(markerList); + Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng()).title("c")); + mapboxMap.removeAnnotations(markers); + assertTrue("Annotations should not be empty", mapboxMap.getAnnotations().size() == 1); + assertTrue("Marker should be contained", mapboxMap.getAnnotations().contains(marker)); })); } @Test public void testGetAnnotationById() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker initialMarker = mapboxMap.addMarker(markerOptions); - Marker retrievedMarker = (Marker) mapboxMap.getAnnotation(0); - assertEquals("Markers should match", initialMarker, retrievedMarker); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker initialMarker = mapboxMap.addMarker(markerOptions); + Marker retrievedMarker = (Marker) mapboxMap.getAnnotation(0); + assertEquals("Markers should match", initialMarker, retrievedMarker); })); } @Test public void testGetAnnotations() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - assertNotNull("Annotations should be non null", mapboxMap.getAnnotations()); - } - })); + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> + assertNotNull("Annotations should be non null", mapboxMap.getAnnotations()))); } @Test public void testGetMarkers() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - assertNotNull("Markers should be non null", mapboxMap.getMarkers()); - } - })); + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> + assertNotNull("Markers should be non null", mapboxMap.getMarkers()))); } @Test public void testGetPolygons() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - assertNotNull("Polygons should be non null", mapboxMap.getPolygons()); - } - })); + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> + assertNotNull("Polygons should be non null", mapboxMap.getPolygons()))); } @Test public void testGetPolylines() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - assertNotNull("Polylines should be non null", mapboxMap.getPolylines()); - } - })); + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> + assertNotNull("Polylines should be non null", mapboxMap.getPolylines()))); } @Test public void testGetSelectedMarkers() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - assertNotNull("Selected markers should be non null", mapboxMap.getSelectedMarkers()); - } - })); + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> + assertNotNull("Selected markers should be non null", mapboxMap.getSelectedMarkers()))); } @Test public void testSelectMarker() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker marker = mapboxMap.addMarker(markerOptions); - mapboxMap.selectMarker(marker); - assertTrue("Marker should be contained", mapboxMap.getSelectedMarkers().contains(marker)); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker marker = mapboxMap.addMarker(markerOptions); + mapboxMap.selectMarker(marker); + assertTrue("Marker should be contained", mapboxMap.getSelectedMarkers().contains(marker)); })); } @Test public void testDeselectMarker() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker marker = mapboxMap.addMarker(markerOptions); - mapboxMap.selectMarker(marker); - mapboxMap.deselectMarker(marker); - assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker marker = mapboxMap.addMarker(markerOptions); + mapboxMap.selectMarker(marker); + mapboxMap.deselectMarker(marker); + assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty()); })); } @Test public void testDeselectMarkers() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); - Marker marker1 = mapboxMap.addMarker(markerOptions); - Marker marker2 = mapboxMap.addMarker(markerOptions); - mapboxMap.selectMarker(marker1); - mapboxMap.selectMarker(marker2); - mapboxMap.deselectMarkers(); - assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + MarkerOptions markerOptions = new MarkerOptions().position(new LatLng()); + Marker marker1 = mapboxMap.addMarker(markerOptions); + Marker marker2 = mapboxMap.addMarker(markerOptions); + mapboxMap.selectMarker(marker1); + mapboxMap.selectMarker(marker2); + mapboxMap.deselectMarkers(); + assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty()); })); } @@ -784,14 +621,11 @@ public class MapboxMapTest extends BaseActivityTest { @Test public void testTilePrefetch() { validateTestSetup(); - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - mapboxMap.setPrefetchesTiles(true); - assertTrue(mapboxMap.getPrefetchesTiles()); - mapboxMap.setPrefetchesTiles(false); - assertFalse(mapboxMap.getPrefetchesTiles()); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + mapboxMap.setPrefetchesTiles(true); + assertTrue(mapboxMap.getPrefetchesTiles()); + mapboxMap.setPrefetchesTiles(false); + assertFalse(mapboxMap.getPrefetchesTiles()); })); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java index 47af80cab9..688dd60e4b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/MapboxMapAction.java @@ -3,9 +3,7 @@ package com.mapbox.mapboxsdk.testapp.action; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapboxMap; - import org.hamcrest.Matcher; import static android.support.test.espresso.Espresso.onView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java index c029bc09c4..b5cb53bdc9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java @@ -10,18 +10,14 @@ import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.rule.ActivityTestRule; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource; - import junit.framework.Assert; - import org.hamcrest.Matcher; import org.junit.After; import org.junit.Before; import org.junit.Rule; - import timber.log.Timber; import static android.support.test.espresso.Espresso.onView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java index 33a946d0a1..632f78955a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.annotations; import android.app.Activity; import android.support.v4.content.res.ResourcesCompat; - import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.Marker; @@ -14,7 +13,6 @@ import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.IconUtils; - import org.junit.Before; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java index e511135b99..8f1db33f70 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java @@ -1,16 +1,12 @@ package com.mapbox.mapboxsdk.testapp.annotations; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -34,25 +30,22 @@ public class MarkerTest extends BaseActivityTest { @Ignore public void addMarkerTest() { validateTestSetup(); - MapboxMapAction.invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size()); + MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> { + assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size()); - MarkerOptions options = new MarkerOptions(); - options.setPosition(new LatLng()); - options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET); - options.setTitle(TestConstants.TEXT_MARKER_TITLE); - marker = mapboxMap.addMarker(options); + MarkerOptions options = new MarkerOptions(); + options.setPosition(new LatLng()); + options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET); + options.setTitle(TestConstants.TEXT_MARKER_TITLE); + marker = mapboxMap.addMarker(options); - assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size()); - assertEquals("Marker id should be 0", 0, marker.getId()); - assertEquals("Marker target should match", new LatLng(), marker.getPosition()); - assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet()); - assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle()); - mapboxMap.clear(); - assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size()); - } + assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size()); + assertEquals("Marker id should be 0", 0, marker.getId()); + assertEquals("Marker target should match", new LatLng(), marker.getPosition()); + assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet()); + assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle()); + mapboxMap.clear(); + assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size()); }); } @@ -60,16 +53,13 @@ public class MarkerTest extends BaseActivityTest { @Ignore public void showInfoWindowTest() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final MarkerOptions options = new MarkerOptions(); - options.setPosition(new LatLng()); - options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET); - options.setTitle(TestConstants.TEXT_MARKER_TITLE); - marker = mapboxMap.addMarker(options); - mapboxMap.selectMarker(marker); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final MarkerOptions options = new MarkerOptions(); + options.setPosition(new LatLng()); + options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET); + options.setTitle(TestConstants.TEXT_MARKER_TITLE); + marker = mapboxMap.addMarker(options); + mapboxMap.selectMarker(marker); }); onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed())); onView(withText(TestConstants.TEXT_MARKER_SNIPPET)).check(matches(isDisplayed())); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java index 8bf847c2e7..33a5d54d10 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java @@ -1,17 +1,12 @@ package com.mapbox.mapboxsdk.testapp.annotations; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.annotation.MarkerViewActivity; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerViewOptions; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -36,24 +31,21 @@ public class MarkerViewTest extends BaseActivityTest { public void addMarkerViewTest() { validateTestSetup(); addAdapter(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size()); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size()); - TextMarkerViewOptions options = new TextMarkerViewOptions(); - options.text(TestConstants.TEXT_MARKER_TEXT); - options.position(new LatLng()); - options.snippet(TestConstants.TEXT_MARKER_SNIPPET); - options.title(TestConstants.TEXT_MARKER_TITLE); - marker = mapboxMap.addMarker(options); - assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size()); - assertEquals("Marker id should be 0", 0, marker.getId()); - assertEquals("Marker target should match", new LatLng(), marker.getPosition()); - assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet()); - assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle()); - uiController.loopMainThreadForAtLeast(500); - } + TextMarkerViewOptions options = new TextMarkerViewOptions(); + options.text(TestConstants.TEXT_MARKER_TEXT); + options.position(new LatLng()); + options.snippet(TestConstants.TEXT_MARKER_SNIPPET); + options.title(TestConstants.TEXT_MARKER_TITLE); + marker = mapboxMap.addMarker(options); + assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size()); + assertEquals("Marker id should be 0", 0, marker.getId()); + assertEquals("Marker target should match", new LatLng(), marker.getPosition()); + assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet()); + assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle()); + uiController.loopMainThreadForAtLeast(500); }); onView(withText(TestConstants.TEXT_MARKER_TEXT)).check(matches(isDisplayed())); } @@ -63,18 +55,15 @@ public class MarkerViewTest extends BaseActivityTest { public void showInfoWindowTest() { validateTestSetup(); addAdapter(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final TextMarkerViewOptions options = new TextMarkerViewOptions(); - options.position(new LatLng()); - options.text(TestConstants.TEXT_MARKER_TEXT); - options.snippet(TestConstants.TEXT_MARKER_SNIPPET); - options.title(TestConstants.TEXT_MARKER_TITLE); - marker = mapboxMap.addMarker(options); - uiController.loopMainThreadForAtLeast(500); - mapboxMap.selectMarker(marker); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final TextMarkerViewOptions options = new TextMarkerViewOptions(); + options.position(new LatLng()); + options.text(TestConstants.TEXT_MARKER_TEXT); + options.snippet(TestConstants.TEXT_MARKER_SNIPPET); + options.title(TestConstants.TEXT_MARKER_TITLE); + marker = mapboxMap.addMarker(options); + uiController.loopMainThreadForAtLeast(500); + mapboxMap.selectMarker(marker); }); onView(withText(TestConstants.TEXT_MARKER_TEXT)).check(matches(isDisplayed())); onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed())); @@ -82,13 +71,8 @@ public class MarkerViewTest extends BaseActivityTest { } private void addAdapter() { - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - mapboxMap.getMarkerViewManager().addMarkerViewAdapter( - new MarkerViewActivity.TextAdapter(rule.getActivity(), mapboxMap)); - } - }); + invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.getMarkerViewManager().addMarkerViewAdapter( + new MarkerViewActivity.TextAdapter(rule.getActivity(), mapboxMap))); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java index c90a5f60c6..7d936009b9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java @@ -1,16 +1,11 @@ package com.mapbox.mapboxsdk.testapp.annotations; import android.graphics.Color; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.PolygonOptions; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; - import org.junit.Ignore; import org.junit.Test; @@ -28,31 +23,28 @@ public class PolygonTest extends BaseActivityTest { @Ignore public void addPolygonTest() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - LatLng latLngOne = new LatLng(); - LatLng latLngTwo = new LatLng(1, 0); - LatLng latLngThree = new LatLng(1, 1); - - assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size()); - - final PolygonOptions options = new PolygonOptions(); - options.strokeColor(Color.BLUE); - options.fillColor(Color.RED); - options.add(latLngOne); - options.add(latLngTwo); - options.add(latLngThree); - Polygon polygon = mapboxMap.addPolygon(options); - - assertEquals("Polygons should be 1", 1, mapboxMap.getPolygons().size()); - assertEquals("Polygon id should be 0", 0, polygon.getId()); - assertEquals("Polygon points size should match", 3, polygon.getPoints().size()); - assertEquals("Polygon stroke color should match", Color.BLUE, polygon.getStrokeColor()); - assertEquals("Polygon target should match", Color.RED, polygon.getFillColor()); - mapboxMap.clear(); - assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + LatLng latLngOne = new LatLng(); + LatLng latLngTwo = new LatLng(1, 0); + LatLng latLngThree = new LatLng(1, 1); + + assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size()); + + final PolygonOptions options = new PolygonOptions(); + options.strokeColor(Color.BLUE); + options.fillColor(Color.RED); + options.add(latLngOne); + options.add(latLngTwo); + options.add(latLngThree); + Polygon polygon = mapboxMap.addPolygon(options); + + assertEquals("Polygons should be 1", 1, mapboxMap.getPolygons().size()); + assertEquals("Polygon id should be 0", 0, polygon.getId()); + assertEquals("Polygon points size should match", 3, polygon.getPoints().size()); + assertEquals("Polygon stroke color should match", Color.BLUE, polygon.getStrokeColor()); + assertEquals("Polygon target should match", Color.RED, polygon.getFillColor()); + mapboxMap.clear(); + assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size()); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java index e6aa661729..77b13d7c46 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java @@ -1,16 +1,11 @@ package com.mapbox.mapboxsdk.testapp.annotations; import android.graphics.Color; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; - import org.junit.Ignore; import org.junit.Test; @@ -28,27 +23,24 @@ public class PolylineTest extends BaseActivityTest { @Ignore public void addPolylineTest() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - LatLng latLngOne = new LatLng(); - LatLng latLngTwo = new LatLng(1, 0); - - assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size()); - - final PolylineOptions options = new PolylineOptions(); - options.color(Color.BLUE); - options.add(latLngOne); - options.add(latLngTwo); - Polyline polyline = mapboxMap.addPolyline(options); - - assertEquals("Polylines should be 1", 1, mapboxMap.getPolylines().size()); - assertEquals("Polyline id should be 0", 0, polyline.getId()); - assertEquals("Polyline points size should match", 2, polyline.getPoints().size()); - assertEquals("Polyline stroke color should match", Color.BLUE, polyline.getColor()); - mapboxMap.clear(); - assertEquals("Polyline should be empty", 0, mapboxMap.getPolylines().size()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + LatLng latLngOne = new LatLng(); + LatLng latLngTwo = new LatLng(1, 0); + + assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size()); + + final PolylineOptions options = new PolylineOptions(); + options.color(Color.BLUE); + options.add(latLngOne); + options.add(latLngTwo); + Polyline polyline = mapboxMap.addPolyline(options); + + assertEquals("Polylines should be 1", 1, mapboxMap.getPolylines().size()); + assertEquals("Polyline id should be 0", 0, polyline.getId()); + assertEquals("Polyline points size should match", 2, polyline.getPoints().size()); + assertEquals("Polyline stroke color should match", Color.BLUE, polyline.getColor()); + mapboxMap.clear(); + assertEquals("Polyline should be empty", 0, mapboxMap.getPolylines().size()); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java index c16c8f05bb..04eecc8eb8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java @@ -1,18 +1,13 @@ package com.mapbox.mapboxsdk.testapp.camera; import android.graphics.PointF; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -30,23 +25,20 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToCameraPositionTarget() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - LatLng moveTarget = new LatLng(1, 1); - CameraPosition initialPosition = new CameraPosition.Builder().target( - new LatLng()).zoom(zoom).bearing(0).tilt(0).build(); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Default camera position should match default", cameraPosition, initialPosition); - mapboxMap.animateCamera(CameraUpdateFactory.newLatLng(moveTarget)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + LatLng moveTarget = new LatLng(1, 1); + CameraPosition initialPosition = new CameraPosition.Builder().target( + new LatLng()).zoom(zoom).bearing(0).tilt(0).build(); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Default camera position should match default", cameraPosition, initialPosition); + mapboxMap.animateCamera(CameraUpdateFactory.newLatLng(moveTarget)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); }); } @@ -54,20 +46,17 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToCameraPositionTargetZoom() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final float moveZoom = 15.5f; - final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final float moveZoom = 15.5f; + final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); }); } @@ -75,32 +64,29 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToCameraPosition() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); - final float moveZoom = 15.5f; - final float moveTilt = 45.5f; - final float moveBearing = 12.5f; - - mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .target(moveTarget) - .zoom(moveZoom) - .tilt(moveTilt) - .bearing(moveBearing) - .build()) - ); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); - assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA); - assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); + final float moveZoom = 15.5f; + final float moveTilt = 45.5f; + final float moveBearing = 12.5f; + + mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .target(moveTarget) + .zoom(moveZoom) + .tilt(moveTilt) + .bearing(moveBearing) + .build()) + ); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); + assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA); + assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA); }); } @@ -108,27 +94,24 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToBounds() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final LatLng centerBounds = new LatLng(1, 1); - LatLng cornerOne = new LatLng(); - LatLng cornerTwo = new LatLng(2, 2); - final LatLngBounds.Builder builder = new LatLngBounds.Builder(); - builder.include(cornerOne); - builder.include(cornerTwo); - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match center bounds", - cameraPosition.target.getLatitude(), - centerBounds.getLatitude(), - TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match center bounds", - cameraPosition.target.getLongitude(), - centerBounds.getLongitude(), - TestConstants.LAT_LNG_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final LatLng centerBounds = new LatLng(1, 1); + LatLng cornerOne = new LatLng(); + LatLng cornerTwo = new LatLng(2, 2); + final LatLngBounds.Builder builder = new LatLngBounds.Builder(); + builder.include(cornerOne); + builder.include(cornerTwo); + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match center bounds", + cameraPosition.target.getLatitude(), + centerBounds.getLatitude(), + TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match center bounds", + cameraPosition.target.getLongitude(), + centerBounds.getLongitude(), + TestConstants.LAT_LNG_DELTA); }); } @@ -136,21 +119,18 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToMoveBy() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - mapboxMap.animateCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); + final LatLng moveTarget = new LatLng(2, 2); + final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); + mapboxMap.animateCamera(CameraUpdateFactory.scrollBy( + moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE); }); } @@ -158,16 +138,13 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToZoomIn() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - mapboxMap.animateCamera(CameraUpdateFactory.zoomIn()); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + mapboxMap.animateCamera(CameraUpdateFactory.zoomIn()); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1, + TestConstants.ZOOM_DELTA); }); } @@ -175,18 +152,15 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToZoomOut() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 10.0f; - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - mapboxMap.animateCamera(CameraUpdateFactory.zoomOut()); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 10.0f; + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + mapboxMap.animateCamera(CameraUpdateFactory.zoomOut()); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1, + TestConstants.ZOOM_DELTA); }); } @@ -194,17 +168,14 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToZoomBy() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - final float zoomBy = 2.45f; - mapboxMap.animateCamera(CameraUpdateFactory.zoomBy(zoomBy)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + final float zoomBy = 2.45f; + mapboxMap.animateCamera(CameraUpdateFactory.zoomBy(zoomBy)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy, + TestConstants.ZOOM_DELTA); }); } @@ -212,16 +183,13 @@ public class CameraAnimateTest extends BaseActivityTest { @Ignore public void testAnimateToZoomTo() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final float zoomTo = 2.45f; - mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(zoomTo)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final float zoomTo = 2.45f; + mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(zoomTo)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo, + TestConstants.ZOOM_DELTA); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java index 8c67af7da3..356266bc2a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java @@ -1,18 +1,13 @@ package com.mapbox.mapboxsdk.testapp.camera; import android.graphics.PointF; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -30,23 +25,20 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToCameraPositionTarget() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - LatLng moveTarget = new LatLng(1, 1); - CameraPosition initialPosition = new CameraPosition.Builder().target( - new LatLng()).zoom(zoom).bearing(0).tilt(0).build(); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Default camera position should match default", cameraPosition, initialPosition); - mapboxMap.easeCamera(CameraUpdateFactory.newLatLng(moveTarget)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + LatLng moveTarget = new LatLng(1, 1); + CameraPosition initialPosition = new CameraPosition.Builder().target( + new LatLng()).zoom(zoom).bearing(0).tilt(0).build(); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Default camera position should match default", cameraPosition, initialPosition); + mapboxMap.easeCamera(CameraUpdateFactory.newLatLng(moveTarget)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); }); } @@ -54,20 +46,17 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToCameraPositionTargetZoom() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final float moveZoom = 15.5f; - final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); - mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final float moveZoom = 15.5f; + final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); + mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); }); } @@ -75,32 +64,29 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToCameraPosition() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); - final float moveZoom = 15.5f; - final float moveTilt = 45.5f; - final float moveBearing = 12.5f; - - mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .target(moveTarget) - .zoom(moveZoom) - .tilt(moveTilt) - .bearing(moveBearing) - .build()) - ); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); - assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA); - assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); + final float moveZoom = 15.5f; + final float moveTilt = 45.5f; + final float moveBearing = 12.5f; + + mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .target(moveTarget) + .zoom(moveZoom) + .tilt(moveTilt) + .bearing(moveBearing) + .build()) + ); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); + assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA); + assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA); }); } @@ -108,27 +94,24 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToBounds() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final LatLng centerBounds = new LatLng(1, 1); - LatLng cornerOne = new LatLng(); - LatLng cornerTwo = new LatLng(2, 2); - final LatLngBounds.Builder builder = new LatLngBounds.Builder(); - builder.include(cornerOne); - builder.include(cornerTwo); - mapboxMap.easeCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match center bounds", - cameraPosition.target.getLatitude(), - centerBounds.getLatitude(), - TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match center bounds", - cameraPosition.target.getLongitude(), - centerBounds.getLongitude(), - TestConstants.LAT_LNG_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final LatLng centerBounds = new LatLng(1, 1); + LatLng cornerOne = new LatLng(); + LatLng cornerTwo = new LatLng(2, 2); + final LatLngBounds.Builder builder = new LatLngBounds.Builder(); + builder.include(cornerOne); + builder.include(cornerTwo); + mapboxMap.easeCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match center bounds", + cameraPosition.target.getLatitude(), + centerBounds.getLatitude(), + TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match center bounds", + cameraPosition.target.getLongitude(), + centerBounds.getLongitude(), + TestConstants.LAT_LNG_DELTA); }); } @@ -136,21 +119,18 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToMoveBy() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); + final LatLng moveTarget = new LatLng(2, 2); + final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); + mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( + moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE); }); } @@ -158,16 +138,13 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToZoomIn() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - mapboxMap.easeCamera(CameraUpdateFactory.zoomIn()); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + mapboxMap.easeCamera(CameraUpdateFactory.zoomIn()); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1, + TestConstants.ZOOM_DELTA); }); } @@ -175,18 +152,15 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToZoomOut() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 10.0f; - mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - mapboxMap.easeCamera(CameraUpdateFactory.zoomOut()); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 10.0f; + mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + mapboxMap.easeCamera(CameraUpdateFactory.zoomOut()); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1, + TestConstants.ZOOM_DELTA); }); } @@ -194,17 +168,14 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToZoomBy() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - final float zoomBy = 2.45f; - mapboxMap.easeCamera(CameraUpdateFactory.zoomBy(zoomBy)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + final float zoomBy = 2.45f; + mapboxMap.easeCamera(CameraUpdateFactory.zoomBy(zoomBy)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy, + TestConstants.ZOOM_DELTA); }); } @@ -212,16 +183,13 @@ public class CameraEaseTest extends BaseActivityTest { @Ignore public void testEaseToZoomTo() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final float zoomTo = 2.45f; - mapboxMap.easeCamera(CameraUpdateFactory.zoomTo(zoomTo)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final float zoomTo = 2.45f; + mapboxMap.easeCamera(CameraUpdateFactory.zoomTo(zoomTo)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo, + TestConstants.ZOOM_DELTA); }); } }
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java index 883e76653d..ff7eb26570 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java @@ -4,7 +4,6 @@ import android.support.test.espresso.Espresso; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapViewUtils; @@ -13,7 +12,6 @@ import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.hamcrest.Matcher; import org.junit.After; import org.junit.Ignore; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java index 54590981fa..e643e1fb80 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java @@ -1,18 +1,13 @@ package com.mapbox.mapboxsdk.testapp.camera; import android.graphics.PointF; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -30,23 +25,20 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToCameraPositionTarget() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - LatLng moveTarget = new LatLng(1, 1); - CameraPosition initialPosition = new CameraPosition.Builder().target( - new LatLng()).zoom(zoom).bearing(0).tilt(0).build(); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Default camera position should match default", cameraPosition, initialPosition); - mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(moveTarget)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + LatLng moveTarget = new LatLng(1, 1); + CameraPosition initialPosition = new CameraPosition.Builder().target( + new LatLng()).zoom(zoom).bearing(0).tilt(0).build(); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Default camera position should match default", cameraPosition, initialPosition); + mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(moveTarget)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); }); } @@ -54,20 +46,17 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToCameraPositionTargetZoom() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final float moveZoom = 15.5f; - final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final float moveZoom = 15.5f; + final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); }); } @@ -75,32 +64,29 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToCameraPosition() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); - final float moveZoom = 15.5f; - final float moveTilt = 45.5f; - final float moveBearing = 12.5f; - - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .target(moveTarget) - .zoom(moveZoom) - .tilt(moveTilt) - .bearing(moveBearing) - .build()) - ); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); - assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA); - assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003); + final float moveZoom = 15.5f; + final float moveTilt = 45.5f; + final float moveBearing = 12.5f; + + mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .target(moveTarget) + .zoom(moveZoom) + .tilt(moveTilt) + .bearing(moveBearing) + .build()) + ); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA); + assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA); + assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA); + assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA); }); } @@ -108,27 +94,24 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToBounds() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final LatLng centerBounds = new LatLng(1, 1); - LatLng cornerOne = new LatLng(); - LatLng cornerTwo = new LatLng(2, 2); - final LatLngBounds.Builder builder = new LatLngBounds.Builder(); - builder.include(cornerOne); - builder.include(cornerTwo); - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match center bounds", - cameraPosition.target.getLatitude(), - centerBounds.getLatitude(), - TestConstants.LAT_LNG_DELTA); - assertEquals("Moved camera position longitude should match center bounds", - cameraPosition.target.getLongitude(), - centerBounds.getLongitude(), - TestConstants.LAT_LNG_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final LatLng centerBounds = new LatLng(1, 1); + LatLng cornerOne = new LatLng(); + LatLng cornerTwo = new LatLng(2, 2); + final LatLngBounds.Builder builder = new LatLngBounds.Builder(); + builder.include(cornerOne); + builder.include(cornerTwo); + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match center bounds", + cameraPosition.target.getLatitude(), + centerBounds.getLatitude(), + TestConstants.LAT_LNG_DELTA); + assertEquals("Moved camera position longitude should match center bounds", + cameraPosition.target.getLongitude(), + centerBounds.getLongitude(), + TestConstants.LAT_LNG_DELTA); }); } @@ -136,21 +119,18 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToMoveBy() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - mapboxMap.moveCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), - moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE); - assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), - moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); + final LatLng moveTarget = new LatLng(2, 2); + final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); + mapboxMap.moveCamera(CameraUpdateFactory.scrollBy( + moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(), + moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE); + assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(), + moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE); }); } @@ -158,16 +138,13 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToZoomIn() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - mapboxMap.moveCamera(CameraUpdateFactory.zoomIn()); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + mapboxMap.moveCamera(CameraUpdateFactory.zoomIn()); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1, + TestConstants.ZOOM_DELTA); }); } @@ -175,18 +152,15 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToZoomOut() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 10.0f; - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - mapboxMap.moveCamera(CameraUpdateFactory.zoomOut()); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 10.0f; + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + mapboxMap.moveCamera(CameraUpdateFactory.zoomOut()); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1, + TestConstants.ZOOM_DELTA); }); } @@ -194,17 +168,14 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToZoomBy() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - float zoom = 1.0f; - final float zoomBy = 2.45f; - mapboxMap.moveCamera(CameraUpdateFactory.zoomBy(zoomBy)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + float zoom = 1.0f; + final float zoomBy = 2.45f; + mapboxMap.moveCamera(CameraUpdateFactory.zoomBy(zoomBy)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy, + TestConstants.ZOOM_DELTA); }); } @@ -212,16 +183,13 @@ public class CameraMoveTest extends BaseActivityTest { @Ignore public void testMoveToZoomTo() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - final float zoomTo = 2.45f; - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(zoomTo)); - uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo, - TestConstants.ZOOM_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + final float zoomTo = 2.45f; + mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(zoomTo)); + uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME); + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo, + TestConstants.ZOOM_DELTA); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java index 5ef93c72b3..cca37d1e08 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.feature; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxCountActivity; - import org.junit.Ignore; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java index 307700e847..ede64e6cc3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.feature; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxHighlightActivity; - import org.junit.Ignore; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java index 8e6987b712..a2a0f64831 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java @@ -2,17 +2,13 @@ package com.mapbox.mapboxsdk.testapp.feature; import android.graphics.PointF; import android.support.test.espresso.ViewAction; -import android.support.test.espresso.action.CoordinatesProvider; import android.support.test.espresso.action.GeneralClickAction; import android.support.test.espresso.action.Press; import android.support.test.espresso.action.Tap; -import android.view.View; - import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesPropertiesActivity; - import org.junit.Ignore; import org.junit.Test; @@ -44,15 +40,12 @@ public class QueryRenderedFeaturesPropertiesTest extends BaseActivityTest { private static ViewAction clickXY(final float x, final float y) { return new GeneralClickAction( Tap.SINGLE, - new CoordinatesProvider() { - @Override - public float[] calculateCoordinates(View view) { - final int[] screenPos = new int[2]; - view.getLocationOnScreen(screenPos); - final float screenX = screenPos[0] + x; - final float screenY = screenPos[1] + y; - return new float[] {screenX, screenY}; - } + view -> { + final int[] screenPos = new int[2]; + view.getLocationOnScreen(screenPos); + final float screenX = screenPos[0] + x; + final float screenY = screenPos[1] + y; + return new float[] {screenX, screenY}; }, Press.FINGER); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java index a31c3db89e..d7d5588123 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.feature; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxSymbolCountActivity; - import org.junit.Ignore; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java index f3ce9994a3..61ce2c1f0c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java @@ -1,15 +1,11 @@ package com.mapbox.mapboxsdk.testapp.geometry; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxHighlightActivity; - import org.junit.Test; /** @@ -26,15 +22,12 @@ public class LatLngBoundsTest extends BaseActivityTest { public void testLatLngBounds() { // regression test for #9322 validateTestSetup(); - MapboxMapAction.invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - LatLngBounds bounds = new LatLngBounds.Builder() - .include(new LatLng(48.8589506, 2.2773457)) - .include(new LatLng(47.2383171, -1.6309316)) - .build(); - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); - } + MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> { + LatLngBounds bounds = new LatLngBounds.Builder() + .include(new LatLng(48.8589506, 2.2773457)) + .include(new LatLng(47.2383171, -1.6309316)) + .build(); + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); }); } }
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java index d37c6db2d5..9f76e0add8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java @@ -11,13 +11,11 @@ import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.style.URLSpan; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; - import org.hamcrest.Matcher; import org.junit.After; import org.junit.Before; @@ -146,15 +144,12 @@ public class AttributionTest extends BaseActivityTest { } private void buildUrlSpans() { - onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() { - @Override - public void onViewAction(UiController uiController, View view) { - for (Source source : mapboxMap.getSources()) { - String attributionSource = source.getAttribution(); - if (!TextUtils.isEmpty(attributionSource)) { - SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource); - urlSpans = htmlBuilder.getSpans(0, htmlBuilder.length(), URLSpan.class); - } + onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> { + for (Source source : mapboxMap.getSources()) { + String attributionSource = source.getAttribution(); + if (!TextUtils.isEmpty(attributionSource)) { + SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource); + urlSpans = htmlBuilder.getSpans(0, htmlBuilder.length(), URLSpan.class); } } })); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java index 28389a3386..62506252e3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java @@ -1,17 +1,12 @@ package com.mapbox.mapboxsdk.testapp.maps.widgets; -import android.support.test.espresso.UiController; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -41,18 +36,15 @@ public class CompassViewTest extends BaseActivityTest { @Ignore public void testVisible() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .bearing(45) - .zoom(1) - .target(new LatLng()) - .build() - )); - uiController.loopMainThreadForAtLeast(500); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .bearing(45) + .zoom(1) + .target(new LatLng()) + .build() + )); + uiController.loopMainThreadForAtLeast(500); }); onView(withId(R.id.compassView)).check(matches(isDisplayed())); } @@ -61,27 +53,19 @@ public class CompassViewTest extends BaseActivityTest { @Ignore public void testClick() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .bearing(45) - .zoom(1) - .target(new LatLng()) - .build() - )); - } - }); + invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .bearing(45) + .zoom(1) + .target(new LatLng()) + .build() + ))); onView(withId(R.id.compassView)).perform(click()); waitLoop(); onView(withId(R.id.compassView)).check(matches(not(isDisplayed()))); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Camera bearing should face north, ", 0, cameraPosition.bearing, TestConstants.BEARING_DELTA); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + assertEquals("Camera bearing should face north, ", 0, cameraPosition.bearing, TestConstants.BEARING_DELTA); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java index 0c189aa316..ea14ef87fe 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java @@ -3,12 +3,10 @@ package com.mapbox.mapboxsdk.testapp.maps.widgets; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; - import org.hamcrest.Matcher; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java index cf58ba50a6..0dd3c65021 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java @@ -9,7 +9,6 @@ import android.graphics.drawable.Drawable; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.view.View; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -21,7 +20,6 @@ import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; - import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java index 0e4cf6a8ca..e7f68f5aa5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java @@ -3,38 +3,31 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; -import com.mapbox.mapboxsdk.style.functions.SourceFunction; -import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; -import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops; import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; -import com.mapbox.mapboxsdk.style.functions.stops.Stop; -import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.BackgroundLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundPattern; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for BackgroundLayer @@ -51,12 +44,7 @@ public class BackgroundLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - layer = mapboxMap.getLayerAs("background"); - } - }); + invoke(mapboxMap, (uiController, mapboxMap) -> layer = mapboxMap.getLayerAs("background")); } @Test @@ -64,18 +52,15 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); - - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); + + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -84,16 +69,13 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setBackgroundColorTransition(options); - assertEquals(layer.getBackgroundColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setBackgroundColorTransition(options); + assertEquals(layer.getBackgroundColorTransition(), options); }); } @@ -102,15 +84,12 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -119,30 +98,27 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - backgroundColor( - zoom( - exponential( - stop(2, backgroundColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + backgroundColor( + zoom( + exponential( + stop(2, backgroundColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getBackgroundColor()); - assertNotNull(layer.getBackgroundColor().getFunction()); - assertEquals(CameraFunction.class, layer.getBackgroundColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getBackgroundColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getBackgroundColor()); + assertNotNull(layer.getBackgroundColor().getFunction()); + assertEquals(CameraFunction.class, layer.getBackgroundColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getBackgroundColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).size()); }); } @@ -151,15 +127,12 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(backgroundColor(Color.RED)); - assertEquals(layer.getBackgroundColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(backgroundColor(Color.RED)); + assertEquals(layer.getBackgroundColorAsInt(), Color.RED); }); } @@ -168,16 +141,13 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-patternTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setBackgroundPatternTransition(options); - assertEquals(layer.getBackgroundPatternTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setBackgroundPatternTransition(options); + assertEquals(layer.getBackgroundPatternTransition(), options); }); } @@ -186,15 +156,12 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(backgroundPattern("pedestrian-polygon")); - assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(backgroundPattern("pedestrian-polygon")); + assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon"); }); } @@ -203,29 +170,26 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - backgroundPattern( - zoom( - interval( - stop(2, backgroundPattern("pedestrian-polygon")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + backgroundPattern( + zoom( + interval( + stop(2, backgroundPattern("pedestrian-polygon")) ) ) - ); - - // Verify - assertNotNull(layer.getBackgroundPattern()); - assertNotNull(layer.getBackgroundPattern().getFunction()); - assertEquals(CameraFunction.class, layer.getBackgroundPattern().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getBackgroundPattern().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getBackgroundPattern().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getBackgroundPattern()); + assertNotNull(layer.getBackgroundPattern().getFunction()); + assertEquals(CameraFunction.class, layer.getBackgroundPattern().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getBackgroundPattern().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getBackgroundPattern().getFunction().getStops()).size()); }); } @@ -234,16 +198,13 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setBackgroundOpacityTransition(options); - assertEquals(layer.getBackgroundOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setBackgroundOpacityTransition(options); + assertEquals(layer.getBackgroundOpacityTransition(), options); }); } @@ -252,15 +213,12 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(backgroundOpacity(0.3f)); - assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(backgroundOpacity(0.3f)); + assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f); }); } @@ -269,30 +227,27 @@ public class BackgroundLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("background-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - backgroundOpacity( - zoom( - exponential( - stop(2, backgroundOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + backgroundOpacity( + zoom( + exponential( + stop(2, backgroundOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getBackgroundOpacity()); - assertNotNull(layer.getBackgroundOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getBackgroundOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getBackgroundOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getBackgroundOpacity()); + assertNotNull(layer.getBackgroundOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getBackgroundOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getBackgroundOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java index 559e446307..5af6701678 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java @@ -3,14 +3,9 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; +import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.SourceFunction; import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; @@ -19,22 +14,40 @@ import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.CircleLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.composite; +import static com.mapbox.mapboxsdk.style.functions.Function.property; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.CIRCLE_PITCH_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.CIRCLE_PITCH_SCALE_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.CIRCLE_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleBlur; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circlePitchAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circlePitchScale; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleStrokeColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleStrokeOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleStrokeWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for CircleLayer @@ -51,17 +64,14 @@ public class CircleLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { - Timber.i("Adding layer"); - layer = new CircleLayer("my-layer", "composite"); - layer.setSourceLayer("composite"); - mapboxMap.addLayer(layer); - // Layer reference is now stale, get new reference - layer = mapboxMap.getLayerAs("my-layer"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { + Timber.i("Adding layer"); + layer = new CircleLayer("my-layer", "composite"); + layer.setSourceLayer("composite"); + mapboxMap.addLayer(layer); + // Layer reference is now stale, get new reference + layer = mapboxMap.getLayerAs("my-layer"); } }); } @@ -71,18 +81,15 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,19 +98,16 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); - - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); + + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); }); } @@ -112,16 +116,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radiusTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleRadiusTransition(options); - assertEquals(layer.getCircleRadiusTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleRadiusTransition(options); + assertEquals(layer.getCircleRadiusTransition(), options); }); } @@ -130,15 +131,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radius"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleRadius(0.3f)); - assertEquals((Float) layer.getCircleRadius().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleRadius(0.3f)); + assertEquals((Float) layer.getCircleRadius().getValue(), (Float) 0.3f); }); } @@ -147,30 +145,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radius"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleRadius( - zoom( - exponential( - stop(2, circleRadius(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleRadius( + zoom( + exponential( + stop(2, circleRadius(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleRadius()); - assertNotNull(layer.getCircleRadius().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleRadius().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleRadius()); + assertNotNull(layer.getCircleRadius().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleRadius().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).size()); }); } @@ -179,23 +174,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radius"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleRadius(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getCircleRadius()); - assertNotNull(layer.getCircleRadius().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleRadius(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getCircleRadius()); + assertNotNull(layer.getCircleRadius().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); }); } @@ -204,30 +196,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radius"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleRadius( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, circleRadius(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleRadius( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, circleRadius(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleRadius()); - assertNotNull(layer.getCircleRadius().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleRadius()); + assertNotNull(layer.getCircleRadius().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); }); } @@ -236,33 +225,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radius"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleRadius( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, circleRadius(0.3f)) - ) - ).withDefaultValue(circleRadius(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleRadius()); - assertNotNull(layer.getCircleRadius().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleRadius( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, circleRadius(0.3f)) + ) + ).withDefaultValue(circleRadius(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleRadius()); + assertNotNull(layer.getCircleRadius().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue().getValue()); }); } @@ -272,38 +258,35 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-radius"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleRadius( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, circleRadius(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(circleRadius(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleRadius()); - assertNotNull(layer.getCircleRadius().getFunction()); - assertEquals(CompositeFunction.class, layer.getCircleRadius().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleRadius().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleRadius().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleRadius( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, circleRadius(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(circleRadius(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleRadius()); + assertNotNull(layer.getCircleRadius().getFunction()); + assertEquals(CompositeFunction.class, layer.getCircleRadius().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleRadius().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleRadius().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -312,16 +295,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleColorTransition(options); - assertEquals(layer.getCircleColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleColorTransition(options); + assertEquals(layer.getCircleColorTransition(), options); }); } @@ -330,15 +310,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getCircleColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getCircleColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -347,30 +324,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleColor( - zoom( - exponential( - stop(2, circleColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleColor( + zoom( + exponential( + stop(2, circleColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleColor()); - assertNotNull(layer.getCircleColor().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleColor()); + assertNotNull(layer.getCircleColor().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleColor().getFunction().getStops()).size()); }); } @@ -379,23 +353,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getCircleColor()); - assertNotNull(layer.getCircleColor().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getCircleColor()); + assertNotNull(layer.getCircleColor().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleColor().getFunction().getStops().getClass()); }); } @@ -404,30 +375,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, circleColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, circleColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleColor()); - assertNotNull(layer.getCircleColor().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleColor()); + assertNotNull(layer.getCircleColor().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleColor().getFunction().getStops().getClass()); }); } @@ -436,33 +404,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", circleColor(Color.RED)) - ) - ).withDefaultValue(circleColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getCircleColor()); - assertNotNull(layer.getCircleColor().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", circleColor(Color.RED)) + ) + ).withDefaultValue(circleColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getCircleColor()); + assertNotNull(layer.getCircleColor().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -472,15 +437,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleColor(Color.RED)); - assertEquals(layer.getCircleColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleColor(Color.RED)); + assertEquals(layer.getCircleColorAsInt(), Color.RED); }); } @@ -489,16 +451,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blurTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleBlurTransition(options); - assertEquals(layer.getCircleBlurTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleBlurTransition(options); + assertEquals(layer.getCircleBlurTransition(), options); }); } @@ -507,15 +466,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleBlur(0.3f)); - assertEquals((Float) layer.getCircleBlur().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleBlur(0.3f)); + assertEquals((Float) layer.getCircleBlur().getValue(), (Float) 0.3f); }); } @@ -524,30 +480,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleBlur( - zoom( - exponential( - stop(2, circleBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleBlur( + zoom( + exponential( + stop(2, circleBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleBlur()); - assertNotNull(layer.getCircleBlur().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleBlur().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleBlur()); + assertNotNull(layer.getCircleBlur().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleBlur().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).size()); }); } @@ -556,23 +509,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleBlur(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getCircleBlur()); - assertNotNull(layer.getCircleBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleBlur(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getCircleBlur()); + assertNotNull(layer.getCircleBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); }); } @@ -581,30 +531,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleBlur( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, circleBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleBlur( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, circleBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleBlur()); - assertNotNull(layer.getCircleBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleBlur()); + assertNotNull(layer.getCircleBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); }); } @@ -613,33 +560,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleBlur( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, circleBlur(0.3f)) - ) - ).withDefaultValue(circleBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleBlur()); - assertNotNull(layer.getCircleBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleBlur( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, circleBlur(0.3f)) + ) + ).withDefaultValue(circleBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleBlur()); + assertNotNull(layer.getCircleBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue().getValue()); }); } @@ -649,38 +593,35 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleBlur( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, circleBlur(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(circleBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleBlur()); - assertNotNull(layer.getCircleBlur().getFunction()); - assertEquals(CompositeFunction.class, layer.getCircleBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleBlur().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleBlur( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, circleBlur(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(circleBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleBlur()); + assertNotNull(layer.getCircleBlur().getFunction()); + assertEquals(CompositeFunction.class, layer.getCircleBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleBlur().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -689,16 +630,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleOpacityTransition(options); - assertEquals(layer.getCircleOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleOpacityTransition(options); + assertEquals(layer.getCircleOpacityTransition(), options); }); } @@ -707,15 +645,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleOpacity(0.3f)); - assertEquals((Float) layer.getCircleOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleOpacity(0.3f)); + assertEquals((Float) layer.getCircleOpacity().getValue(), (Float) 0.3f); }); } @@ -724,30 +659,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleOpacity( - zoom( - exponential( - stop(2, circleOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleOpacity( + zoom( + exponential( + stop(2, circleOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleOpacity()); - assertNotNull(layer.getCircleOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleOpacity()); + assertNotNull(layer.getCircleOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).size()); }); } @@ -756,23 +688,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleOpacity(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getCircleOpacity()); - assertNotNull(layer.getCircleOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleOpacity(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getCircleOpacity()); + assertNotNull(layer.getCircleOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); }); } @@ -781,30 +710,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, circleOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleOpacity( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, circleOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleOpacity()); - assertNotNull(layer.getCircleOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleOpacity()); + assertNotNull(layer.getCircleOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); }); } @@ -813,33 +739,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, circleOpacity(0.3f)) - ) - ).withDefaultValue(circleOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleOpacity()); - assertNotNull(layer.getCircleOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, circleOpacity(0.3f)) + ) + ).withDefaultValue(circleOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleOpacity()); + assertNotNull(layer.getCircleOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue().getValue()); }); } @@ -849,38 +772,35 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleOpacity( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, circleOpacity(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(circleOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleOpacity()); - assertNotNull(layer.getCircleOpacity().getFunction()); - assertEquals(CompositeFunction.class, layer.getCircleOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleOpacity().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleOpacity( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, circleOpacity(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(circleOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleOpacity()); + assertNotNull(layer.getCircleOpacity().getFunction()); + assertEquals(CompositeFunction.class, layer.getCircleOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleOpacity().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -889,16 +809,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleTranslateTransition(options); - assertEquals(layer.getCircleTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleTranslateTransition(options); + assertEquals(layer.getCircleTranslateTransition(), options); }); } @@ -907,15 +824,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getCircleTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getCircleTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -924,30 +838,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleTranslate( - zoom( - exponential( - stop(2, circleTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleTranslate( + zoom( + exponential( + stop(2, circleTranslate(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleTranslate()); - assertNotNull(layer.getCircleTranslate().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleTranslate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleTranslate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleTranslate()); + assertNotNull(layer.getCircleTranslate().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleTranslate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleTranslate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).size()); }); } @@ -956,15 +867,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getCircleTranslateAnchor().getValue(), (String) CIRCLE_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getCircleTranslateAnchor().getValue(), (String) CIRCLE_TRANSLATE_ANCHOR_MAP); }); } @@ -973,29 +881,26 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleTranslateAnchor( - zoom( - interval( - stop(2, circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleTranslateAnchor( + zoom( + interval( + stop(2, circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getCircleTranslateAnchor()); - assertNotNull(layer.getCircleTranslateAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleTranslateAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getCircleTranslateAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getCircleTranslateAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleTranslateAnchor()); + assertNotNull(layer.getCircleTranslateAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleTranslateAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getCircleTranslateAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getCircleTranslateAnchor().getFunction().getStops()).size()); }); } @@ -1004,15 +909,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-pitch-scale"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circlePitchScale(CIRCLE_PITCH_SCALE_MAP)); - assertEquals((String) layer.getCirclePitchScale().getValue(), (String) CIRCLE_PITCH_SCALE_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circlePitchScale(CIRCLE_PITCH_SCALE_MAP)); + assertEquals((String) layer.getCirclePitchScale().getValue(), (String) CIRCLE_PITCH_SCALE_MAP); }); } @@ -1021,29 +923,26 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-pitch-scale"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circlePitchScale( - zoom( - interval( - stop(2, circlePitchScale(CIRCLE_PITCH_SCALE_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circlePitchScale( + zoom( + interval( + stop(2, circlePitchScale(CIRCLE_PITCH_SCALE_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getCirclePitchScale()); - assertNotNull(layer.getCirclePitchScale().getFunction()); - assertEquals(CameraFunction.class, layer.getCirclePitchScale().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getCirclePitchScale().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getCirclePitchScale().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCirclePitchScale()); + assertNotNull(layer.getCirclePitchScale().getFunction()); + assertEquals(CameraFunction.class, layer.getCirclePitchScale().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getCirclePitchScale().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getCirclePitchScale().getFunction().getStops()).size()); }); } @@ -1052,15 +951,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP)); - assertEquals((String) layer.getCirclePitchAlignment().getValue(), (String) CIRCLE_PITCH_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getCirclePitchAlignment().getValue(), (String) CIRCLE_PITCH_ALIGNMENT_MAP); }); } @@ -1069,29 +965,26 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circlePitchAlignment( - zoom( - interval( - stop(2, circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circlePitchAlignment( + zoom( + interval( + stop(2, circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getCirclePitchAlignment()); - assertNotNull(layer.getCirclePitchAlignment().getFunction()); - assertEquals(CameraFunction.class, layer.getCirclePitchAlignment().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getCirclePitchAlignment().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getCirclePitchAlignment().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCirclePitchAlignment()); + assertNotNull(layer.getCirclePitchAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getCirclePitchAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getCirclePitchAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getCirclePitchAlignment().getFunction().getStops()).size()); }); } @@ -1100,16 +993,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleStrokeWidthTransition(options); - assertEquals(layer.getCircleStrokeWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleStrokeWidthTransition(options); + assertEquals(layer.getCircleStrokeWidthTransition(), options); }); } @@ -1118,15 +1008,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleStrokeWidth(0.3f)); - assertEquals((Float) layer.getCircleStrokeWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleStrokeWidth(0.3f)); + assertEquals((Float) layer.getCircleStrokeWidth().getValue(), (Float) 0.3f); }); } @@ -1135,30 +1022,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeWidth( - zoom( - exponential( - stop(2, circleStrokeWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeWidth( + zoom( + exponential( + stop(2, circleStrokeWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeWidth()); - assertNotNull(layer.getCircleStrokeWidth().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeWidth()); + assertNotNull(layer.getCircleStrokeWidth().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).size()); }); } @@ -1167,23 +1051,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeWidth(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getCircleStrokeWidth()); - assertNotNull(layer.getCircleStrokeWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeWidth(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getCircleStrokeWidth()); + assertNotNull(layer.getCircleStrokeWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); }); } @@ -1192,30 +1073,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, circleStrokeWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, circleStrokeWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeWidth()); - assertNotNull(layer.getCircleStrokeWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeWidth()); + assertNotNull(layer.getCircleStrokeWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); }); } @@ -1224,33 +1102,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, circleStrokeWidth(0.3f)) - ) - ).withDefaultValue(circleStrokeWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeWidth()); - assertNotNull(layer.getCircleStrokeWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, circleStrokeWidth(0.3f)) + ) + ).withDefaultValue(circleStrokeWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeWidth()); + assertNotNull(layer.getCircleStrokeWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -1260,38 +1135,35 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, circleStrokeWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(circleStrokeWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeWidth()); - assertNotNull(layer.getCircleStrokeWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleStrokeWidth().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, circleStrokeWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(circleStrokeWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeWidth()); + assertNotNull(layer.getCircleStrokeWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getCircleStrokeWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleStrokeWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleStrokeWidth().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1300,16 +1172,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleStrokeColorTransition(options); - assertEquals(layer.getCircleStrokeColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleStrokeColorTransition(options); + assertEquals(layer.getCircleStrokeColorTransition(), options); }); } @@ -1318,15 +1187,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleStrokeColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getCircleStrokeColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleStrokeColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getCircleStrokeColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -1335,30 +1201,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeColor( - zoom( - exponential( - stop(2, circleStrokeColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeColor( + zoom( + exponential( + stop(2, circleStrokeColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeColor()); - assertNotNull(layer.getCircleStrokeColor().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleStrokeColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeColor()); + assertNotNull(layer.getCircleStrokeColor().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleStrokeColor().getFunction().getStops()).size()); }); } @@ -1367,23 +1230,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getCircleStrokeColor()); - assertNotNull(layer.getCircleStrokeColor().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getCircleStrokeColor()); + assertNotNull(layer.getCircleStrokeColor().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); }); } @@ -1392,30 +1252,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, circleStrokeColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, circleStrokeColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeColor()); - assertNotNull(layer.getCircleStrokeColor().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeColor()); + assertNotNull(layer.getCircleStrokeColor().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); }); } @@ -1424,33 +1281,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", circleStrokeColor(Color.RED)) - ) - ).withDefaultValue(circleStrokeColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeColor()); - assertNotNull(layer.getCircleStrokeColor().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", circleStrokeColor(Color.RED)) + ) + ).withDefaultValue(circleStrokeColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeColor()); + assertNotNull(layer.getCircleStrokeColor().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -1460,15 +1314,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleStrokeColor(Color.RED)); - assertEquals(layer.getCircleStrokeColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleStrokeColor(Color.RED)); + assertEquals(layer.getCircleStrokeColorAsInt(), Color.RED); }); } @@ -1477,16 +1328,13 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setCircleStrokeOpacityTransition(options); - assertEquals(layer.getCircleStrokeOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setCircleStrokeOpacityTransition(options); + assertEquals(layer.getCircleStrokeOpacityTransition(), options); }); } @@ -1495,15 +1343,12 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(circleStrokeOpacity(0.3f)); - assertEquals((Float) layer.getCircleStrokeOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(circleStrokeOpacity(0.3f)); + assertEquals((Float) layer.getCircleStrokeOpacity().getValue(), (Float) 0.3f); }); } @@ -1512,30 +1357,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeOpacity( - zoom( - exponential( - stop(2, circleStrokeOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeOpacity( + zoom( + exponential( + stop(2, circleStrokeOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeOpacity()); - assertNotNull(layer.getCircleStrokeOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeOpacity()); + assertNotNull(layer.getCircleStrokeOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).size()); }); } @@ -1544,23 +1386,20 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeOpacity(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getCircleStrokeOpacity()); - assertNotNull(layer.getCircleStrokeOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeOpacity(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getCircleStrokeOpacity()); + assertNotNull(layer.getCircleStrokeOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); }); } @@ -1569,30 +1408,27 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, circleStrokeOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeOpacity( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, circleStrokeOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeOpacity()); - assertNotNull(layer.getCircleStrokeOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeOpacity()); + assertNotNull(layer.getCircleStrokeOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); }); } @@ -1601,33 +1437,30 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, circleStrokeOpacity(0.3f)) - ) - ).withDefaultValue(circleStrokeOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeOpacity()); - assertNotNull(layer.getCircleStrokeOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, circleStrokeOpacity(0.3f)) + ) + ).withDefaultValue(circleStrokeOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeOpacity()); + assertNotNull(layer.getCircleStrokeOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue().getValue()); }); } @@ -1637,38 +1470,35 @@ public class CircleLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - circleStrokeOpacity( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, circleStrokeOpacity(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(circleStrokeOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getCircleStrokeOpacity()); - assertNotNull(layer.getCircleStrokeOpacity().getFunction()); - assertEquals(CompositeFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleStrokeOpacity().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + circleStrokeOpacity( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, circleStrokeOpacity(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(circleStrokeOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getCircleStrokeOpacity()); + assertNotNull(layer.getCircleStrokeOpacity().getFunction()); + assertEquals(CompositeFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleStrokeOpacity().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java index 66c6093537..60748b1747 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java @@ -3,14 +3,9 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; +import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.SourceFunction; import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; @@ -19,22 +14,34 @@ import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.composite; +import static com.mapbox.mapboxsdk.style.functions.Function.property; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBase; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionPattern; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for FillExtrusionLayer @@ -51,17 +58,14 @@ public class FillExtrusionLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { - Timber.i("Adding layer"); - layer = new FillExtrusionLayer("my-layer", "composite"); - layer.setSourceLayer("composite"); - mapboxMap.addLayer(layer); - // Layer reference is now stale, get new reference - layer = mapboxMap.getLayerAs("my-layer"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { + Timber.i("Adding layer"); + layer = new FillExtrusionLayer("my-layer", "composite"); + layer.setSourceLayer("composite"); + mapboxMap.addLayer(layer); + // Layer reference is now stale, get new reference + layer = mapboxMap.getLayerAs("my-layer"); } }); } @@ -71,18 +75,15 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,19 +92,16 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); - - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); + + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); }); } @@ -112,16 +110,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillExtrusionOpacityTransition(options); - assertEquals(layer.getFillExtrusionOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillExtrusionOpacityTransition(options); + assertEquals(layer.getFillExtrusionOpacityTransition(), options); }); } @@ -130,15 +125,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionOpacity(0.3f)); - assertEquals((Float) layer.getFillExtrusionOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionOpacity(0.3f)); + assertEquals((Float) layer.getFillExtrusionOpacity().getValue(), (Float) 0.3f); }); } @@ -147,30 +139,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionOpacity( - zoom( - exponential( - stop(2, fillExtrusionOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionOpacity( + zoom( + exponential( + stop(2, fillExtrusionOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionOpacity()); - assertNotNull(layer.getFillExtrusionOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionOpacity()); + assertNotNull(layer.getFillExtrusionOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionOpacity().getFunction().getStops()).size()); }); } @@ -179,16 +168,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillExtrusionColorTransition(options); - assertEquals(layer.getFillExtrusionColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillExtrusionColorTransition(options); + assertEquals(layer.getFillExtrusionColorTransition(), options); }); } @@ -197,15 +183,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getFillExtrusionColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getFillExtrusionColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -214,30 +197,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionColor( - zoom( - exponential( - stop(2, fillExtrusionColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionColor( + zoom( + exponential( + stop(2, fillExtrusionColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionColor()); - assertNotNull(layer.getFillExtrusionColor().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionColor()); + assertNotNull(layer.getFillExtrusionColor().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionColor().getFunction().getStops()).size()); }); } @@ -246,23 +226,20 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getFillExtrusionColor()); - assertNotNull(layer.getFillExtrusionColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getFillExtrusionColor()); + assertNotNull(layer.getFillExtrusionColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); }); } @@ -271,30 +248,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, fillExtrusionColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, fillExtrusionColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionColor()); - assertNotNull(layer.getFillExtrusionColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionColor()); + assertNotNull(layer.getFillExtrusionColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); }); } @@ -303,33 +277,30 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", fillExtrusionColor(Color.RED)) - ) - ).withDefaultValue(fillExtrusionColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionColor()); - assertNotNull(layer.getFillExtrusionColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", fillExtrusionColor(Color.RED)) + ) + ).withDefaultValue(fillExtrusionColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionColor()); + assertNotNull(layer.getFillExtrusionColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -339,15 +310,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionColor(Color.RED)); - assertEquals(layer.getFillExtrusionColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionColor(Color.RED)); + assertEquals(layer.getFillExtrusionColorAsInt(), Color.RED); }); } @@ -356,16 +324,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillExtrusionTranslateTransition(options); - assertEquals(layer.getFillExtrusionTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillExtrusionTranslateTransition(options); + assertEquals(layer.getFillExtrusionTranslateTransition(), options); }); } @@ -374,15 +339,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getFillExtrusionTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getFillExtrusionTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -391,30 +353,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionTranslate( - zoom( - exponential( - stop(2, fillExtrusionTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionTranslate( + zoom( + exponential( + stop(2, fillExtrusionTranslate(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionTranslate()); - assertNotNull(layer.getFillExtrusionTranslate().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionTranslate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionTranslate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionTranslate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionTranslate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionTranslate()); + assertNotNull(layer.getFillExtrusionTranslate().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionTranslate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionTranslate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionTranslate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionTranslate().getFunction().getStops()).size()); }); } @@ -423,15 +382,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getFillExtrusionTranslateAnchor().getValue(), (String) FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getFillExtrusionTranslateAnchor().getValue(), (String) FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP); }); } @@ -440,29 +396,26 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionTranslateAnchor( - zoom( - interval( - stop(2, fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionTranslateAnchor( + zoom( + interval( + stop(2, fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionTranslateAnchor()); - assertNotNull(layer.getFillExtrusionTranslateAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionTranslateAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getFillExtrusionTranslateAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getFillExtrusionTranslateAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionTranslateAnchor()); + assertNotNull(layer.getFillExtrusionTranslateAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionTranslateAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getFillExtrusionTranslateAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getFillExtrusionTranslateAnchor().getFunction().getStops()).size()); }); } @@ -471,16 +424,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-patternTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillExtrusionPatternTransition(options); - assertEquals(layer.getFillExtrusionPatternTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillExtrusionPatternTransition(options); + assertEquals(layer.getFillExtrusionPatternTransition(), options); }); } @@ -489,15 +439,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionPattern("pedestrian-polygon")); - assertEquals((String) layer.getFillExtrusionPattern().getValue(), (String) "pedestrian-polygon"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionPattern("pedestrian-polygon")); + assertEquals((String) layer.getFillExtrusionPattern().getValue(), (String) "pedestrian-polygon"); }); } @@ -506,29 +453,26 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionPattern( - zoom( - interval( - stop(2, fillExtrusionPattern("pedestrian-polygon")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionPattern( + zoom( + interval( + stop(2, fillExtrusionPattern("pedestrian-polygon")) ) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionPattern()); - assertNotNull(layer.getFillExtrusionPattern().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionPattern().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getFillExtrusionPattern().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getFillExtrusionPattern().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionPattern()); + assertNotNull(layer.getFillExtrusionPattern().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionPattern().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getFillExtrusionPattern().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getFillExtrusionPattern().getFunction().getStops()).size()); }); } @@ -537,16 +481,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-heightTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillExtrusionHeightTransition(options); - assertEquals(layer.getFillExtrusionHeightTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillExtrusionHeightTransition(options); + assertEquals(layer.getFillExtrusionHeightTransition(), options); }); } @@ -555,15 +496,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionHeight(0.3f)); - assertEquals((Float) layer.getFillExtrusionHeight().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionHeight(0.3f)); + assertEquals((Float) layer.getFillExtrusionHeight().getValue(), (Float) 0.3f); }); } @@ -572,30 +510,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionHeight( - zoom( - exponential( - stop(2, fillExtrusionHeight(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionHeight( + zoom( + exponential( + stop(2, fillExtrusionHeight(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionHeight()); - assertNotNull(layer.getFillExtrusionHeight().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionHeight()); + assertNotNull(layer.getFillExtrusionHeight().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).size()); }); } @@ -604,23 +539,20 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionHeight(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getFillExtrusionHeight()); - assertNotNull(layer.getFillExtrusionHeight().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionHeight(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getFillExtrusionHeight()); + assertNotNull(layer.getFillExtrusionHeight().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); }); } @@ -629,30 +561,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionHeight( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, fillExtrusionHeight(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionHeight( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, fillExtrusionHeight(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionHeight()); - assertNotNull(layer.getFillExtrusionHeight().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionHeight()); + assertNotNull(layer.getFillExtrusionHeight().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); }); } @@ -661,33 +590,30 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionHeight( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, fillExtrusionHeight(0.3f)) - ) - ).withDefaultValue(fillExtrusionHeight(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionHeight()); - assertNotNull(layer.getFillExtrusionHeight().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionHeight( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, fillExtrusionHeight(0.3f)) + ) + ).withDefaultValue(fillExtrusionHeight(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionHeight()); + assertNotNull(layer.getFillExtrusionHeight().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue().getValue()); }); } @@ -697,38 +623,35 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionHeight( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, fillExtrusionHeight(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(fillExtrusionHeight(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionHeight()); - assertNotNull(layer.getFillExtrusionHeight().getFunction()); - assertEquals(CompositeFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillExtrusionHeight().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionHeight( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, fillExtrusionHeight(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(fillExtrusionHeight(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionHeight()); + assertNotNull(layer.getFillExtrusionHeight().getFunction()); + assertEquals(CompositeFunction.class, layer.getFillExtrusionHeight().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillExtrusionHeight().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillExtrusionHeight().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -737,16 +660,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-baseTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillExtrusionBaseTransition(options); - assertEquals(layer.getFillExtrusionBaseTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillExtrusionBaseTransition(options); + assertEquals(layer.getFillExtrusionBaseTransition(), options); }); } @@ -755,15 +675,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-base"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillExtrusionBase(0.3f)); - assertEquals((Float) layer.getFillExtrusionBase().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillExtrusionBase(0.3f)); + assertEquals((Float) layer.getFillExtrusionBase().getValue(), (Float) 0.3f); }); } @@ -772,30 +689,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-base"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionBase( - zoom( - exponential( - stop(2, fillExtrusionBase(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionBase( + zoom( + exponential( + stop(2, fillExtrusionBase(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionBase()); - assertNotNull(layer.getFillExtrusionBase().getFunction()); - assertEquals(CameraFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionBase()); + assertNotNull(layer.getFillExtrusionBase().getFunction()); + assertEquals(CameraFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).size()); }); } @@ -804,23 +718,20 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-base"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionBase(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getFillExtrusionBase()); - assertNotNull(layer.getFillExtrusionBase().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionBase(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getFillExtrusionBase()); + assertNotNull(layer.getFillExtrusionBase().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); }); } @@ -829,30 +740,27 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-base"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionBase( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, fillExtrusionBase(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionBase( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, fillExtrusionBase(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionBase()); - assertNotNull(layer.getFillExtrusionBase().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionBase()); + assertNotNull(layer.getFillExtrusionBase().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); }); } @@ -861,33 +769,30 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-base"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionBase( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, fillExtrusionBase(0.3f)) - ) - ).withDefaultValue(fillExtrusionBase(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionBase()); - assertNotNull(layer.getFillExtrusionBase().getFunction()); - assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionBase( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, fillExtrusionBase(0.3f)) + ) + ).withDefaultValue(fillExtrusionBase(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionBase()); + assertNotNull(layer.getFillExtrusionBase().getFunction()); + assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue().getValue()); }); } @@ -897,38 +802,35 @@ public class FillExtrusionLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-extrusion-base"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillExtrusionBase( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, fillExtrusionBase(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(fillExtrusionBase(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getFillExtrusionBase()); - assertNotNull(layer.getFillExtrusionBase().getFunction()); - assertEquals(CompositeFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillExtrusionBase().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillExtrusionBase( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, fillExtrusionBase(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(fillExtrusionBase(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getFillExtrusionBase()); + assertNotNull(layer.getFillExtrusionBase().getFunction()); + assertEquals(CompositeFunction.class, layer.getFillExtrusionBase().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillExtrusionBase().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillExtrusionBase().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java index 939bcb6892..f1cd6f9da8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java @@ -3,14 +3,9 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; +import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.SourceFunction; import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; @@ -19,22 +14,34 @@ import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.FillLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.composite; +import static com.mapbox.mapboxsdk.style.functions.Function.property; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.FILL_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillAntialias; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillOutlineColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillPattern; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for FillLayer @@ -51,17 +58,14 @@ public class FillLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { - Timber.i("Adding layer"); - layer = new FillLayer("my-layer", "composite"); - layer.setSourceLayer("composite"); - mapboxMap.addLayer(layer); - // Layer reference is now stale, get new reference - layer = mapboxMap.getLayerAs("my-layer"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { + Timber.i("Adding layer"); + layer = new FillLayer("my-layer", "composite"); + layer.setSourceLayer("composite"); + mapboxMap.addLayer(layer); + // Layer reference is now stale, get new reference + layer = mapboxMap.getLayerAs("my-layer"); } }); } @@ -71,18 +75,15 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,19 +92,16 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); - - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); + + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); }); } @@ -112,15 +110,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-antialias"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillAntialias(true)); - assertEquals((Boolean) layer.getFillAntialias().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillAntialias(true)); + assertEquals((Boolean) layer.getFillAntialias().getValue(), (Boolean) true); }); } @@ -129,29 +124,26 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-antialias"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillAntialias( - zoom( - interval( - stop(2, fillAntialias(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillAntialias( + zoom( + interval( + stop(2, fillAntialias(true)) ) ) - ); - - // Verify - assertNotNull(layer.getFillAntialias()); - assertNotNull(layer.getFillAntialias().getFunction()); - assertEquals(CameraFunction.class, layer.getFillAntialias().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getFillAntialias().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getFillAntialias().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillAntialias()); + assertNotNull(layer.getFillAntialias().getFunction()); + assertEquals(CameraFunction.class, layer.getFillAntialias().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getFillAntialias().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getFillAntialias().getFunction().getStops()).size()); }); } @@ -160,16 +152,13 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillOpacityTransition(options); - assertEquals(layer.getFillOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillOpacityTransition(options); + assertEquals(layer.getFillOpacityTransition(), options); }); } @@ -178,15 +167,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillOpacity(0.3f)); - assertEquals((Float) layer.getFillOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillOpacity(0.3f)); + assertEquals((Float) layer.getFillOpacity().getValue(), (Float) 0.3f); }); } @@ -195,30 +181,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOpacity( - zoom( - exponential( - stop(2, fillOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOpacity( + zoom( + exponential( + stop(2, fillOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillOpacity()); - assertNotNull(layer.getFillOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getFillOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillOpacity()); + assertNotNull(layer.getFillOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getFillOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).size()); }); } @@ -227,23 +210,20 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOpacity(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getFillOpacity()); - assertNotNull(layer.getFillOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOpacity(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getFillOpacity()); + assertNotNull(layer.getFillOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); }); } @@ -252,30 +232,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, fillOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOpacity( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, fillOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillOpacity()); - assertNotNull(layer.getFillOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillOpacity()); + assertNotNull(layer.getFillOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); }); } @@ -284,33 +261,30 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, fillOpacity(0.3f)) - ) - ).withDefaultValue(fillOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getFillOpacity()); - assertNotNull(layer.getFillOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, fillOpacity(0.3f)) + ) + ).withDefaultValue(fillOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getFillOpacity()); + assertNotNull(layer.getFillOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue().getValue()); }); } @@ -320,38 +294,35 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOpacity( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, fillOpacity(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(fillOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getFillOpacity()); - assertNotNull(layer.getFillOpacity().getFunction()); - assertEquals(CompositeFunction.class, layer.getFillOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillOpacity().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOpacity( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, fillOpacity(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(fillOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getFillOpacity()); + assertNotNull(layer.getFillOpacity().getFunction()); + assertEquals(CompositeFunction.class, layer.getFillOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillOpacity().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -360,16 +331,13 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillColorTransition(options); - assertEquals(layer.getFillColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillColorTransition(options); + assertEquals(layer.getFillColorTransition(), options); }); } @@ -378,15 +346,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getFillColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getFillColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -395,30 +360,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillColor( - zoom( - exponential( - stop(2, fillColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillColor( + zoom( + exponential( + stop(2, fillColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillColor()); - assertNotNull(layer.getFillColor().getFunction()); - assertEquals(CameraFunction.class, layer.getFillColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillColor()); + assertNotNull(layer.getFillColor().getFunction()); + assertEquals(CameraFunction.class, layer.getFillColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillColor().getFunction().getStops()).size()); }); } @@ -427,23 +389,20 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getFillColor()); - assertNotNull(layer.getFillColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getFillColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getFillColor()); + assertNotNull(layer.getFillColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getFillColor().getFunction().getStops().getClass()); }); } @@ -452,30 +411,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, fillColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, fillColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillColor()); - assertNotNull(layer.getFillColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillColor()); + assertNotNull(layer.getFillColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillColor().getFunction().getStops().getClass()); }); } @@ -484,33 +440,30 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", fillColor(Color.RED)) - ) - ).withDefaultValue(fillColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getFillColor()); - assertNotNull(layer.getFillColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getFillColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", fillColor(Color.RED)) + ) + ).withDefaultValue(fillColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getFillColor()); + assertNotNull(layer.getFillColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getFillColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -520,15 +473,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillColor(Color.RED)); - assertEquals(layer.getFillColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillColor(Color.RED)); + assertEquals(layer.getFillColorAsInt(), Color.RED); }); } @@ -537,16 +487,13 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillOutlineColorTransition(options); - assertEquals(layer.getFillOutlineColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillOutlineColorTransition(options); + assertEquals(layer.getFillOutlineColorTransition(), options); }); } @@ -555,15 +502,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillOutlineColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getFillOutlineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillOutlineColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getFillOutlineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -572,30 +516,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOutlineColor( - zoom( - exponential( - stop(2, fillOutlineColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOutlineColor( + zoom( + exponential( + stop(2, fillOutlineColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillOutlineColor()); - assertNotNull(layer.getFillOutlineColor().getFunction()); - assertEquals(CameraFunction.class, layer.getFillOutlineColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillOutlineColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillOutlineColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillOutlineColor()); + assertNotNull(layer.getFillOutlineColor().getFunction()); + assertEquals(CameraFunction.class, layer.getFillOutlineColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillOutlineColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillOutlineColor().getFunction().getStops()).size()); }); } @@ -604,23 +545,20 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOutlineColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getFillOutlineColor()); - assertNotNull(layer.getFillOutlineColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOutlineColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getFillOutlineColor()); + assertNotNull(layer.getFillOutlineColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); }); } @@ -629,30 +567,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOutlineColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, fillOutlineColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOutlineColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, fillOutlineColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillOutlineColor()); - assertNotNull(layer.getFillOutlineColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillOutlineColor()); + assertNotNull(layer.getFillOutlineColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); }); } @@ -661,33 +596,30 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillOutlineColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", fillOutlineColor(Color.RED)) - ) - ).withDefaultValue(fillOutlineColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getFillOutlineColor()); - assertNotNull(layer.getFillOutlineColor().getFunction()); - assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillOutlineColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", fillOutlineColor(Color.RED)) + ) + ).withDefaultValue(fillOutlineColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getFillOutlineColor()); + assertNotNull(layer.getFillOutlineColor().getFunction()); + assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -697,15 +629,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-outline-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillOutlineColor(Color.RED)); - assertEquals(layer.getFillOutlineColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillOutlineColor(Color.RED)); + assertEquals(layer.getFillOutlineColorAsInt(), Color.RED); }); } @@ -714,16 +643,13 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillTranslateTransition(options); - assertEquals(layer.getFillTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillTranslateTransition(options); + assertEquals(layer.getFillTranslateTransition(), options); }); } @@ -732,15 +658,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getFillTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getFillTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -749,30 +672,27 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillTranslate( - zoom( - exponential( - stop(2, fillTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillTranslate( + zoom( + exponential( + stop(2, fillTranslate(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getFillTranslate()); - assertNotNull(layer.getFillTranslate().getFunction()); - assertEquals(CameraFunction.class, layer.getFillTranslate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getFillTranslate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillTranslate()); + assertNotNull(layer.getFillTranslate().getFunction()); + assertEquals(CameraFunction.class, layer.getFillTranslate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getFillTranslate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).size()); }); } @@ -781,15 +701,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getFillTranslateAnchor().getValue(), (String) FILL_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getFillTranslateAnchor().getValue(), (String) FILL_TRANSLATE_ANCHOR_MAP); }); } @@ -798,29 +715,26 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillTranslateAnchor( - zoom( - interval( - stop(2, fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillTranslateAnchor( + zoom( + interval( + stop(2, fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getFillTranslateAnchor()); - assertNotNull(layer.getFillTranslateAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getFillTranslateAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getFillTranslateAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getFillTranslateAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillTranslateAnchor()); + assertNotNull(layer.getFillTranslateAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getFillTranslateAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getFillTranslateAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getFillTranslateAnchor().getFunction().getStops()).size()); }); } @@ -829,16 +743,13 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-patternTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setFillPatternTransition(options); - assertEquals(layer.getFillPatternTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setFillPatternTransition(options); + assertEquals(layer.getFillPatternTransition(), options); }); } @@ -847,15 +758,12 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(fillPattern("pedestrian-polygon")); - assertEquals((String) layer.getFillPattern().getValue(), (String) "pedestrian-polygon"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(fillPattern("pedestrian-polygon")); + assertEquals((String) layer.getFillPattern().getValue(), (String) "pedestrian-polygon"); }); } @@ -864,29 +772,26 @@ public class FillLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("fill-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - fillPattern( - zoom( - interval( - stop(2, fillPattern("pedestrian-polygon")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + fillPattern( + zoom( + interval( + stop(2, fillPattern("pedestrian-polygon")) ) ) - ); - - // Verify - assertNotNull(layer.getFillPattern()); - assertNotNull(layer.getFillPattern().getFunction()); - assertEquals(CameraFunction.class, layer.getFillPattern().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getFillPattern().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getFillPattern()); + assertNotNull(layer.getFillPattern().getFunction()); + assertEquals(CameraFunction.class, layer.getFillPattern().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getFillPattern().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java index 5d10cfa38a..5356d8f9c8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java @@ -5,7 +5,6 @@ import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.runner.AndroidJUnit4; import android.view.View; - import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; @@ -16,15 +15,13 @@ import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; import com.mapbox.services.commons.geojson.Point; - import org.hamcrest.Matcher; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; import java.io.IOException; -import timber.log.Timber; - import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java index 60cf4ced3d..7a825c52d1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java @@ -3,15 +3,11 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity; - import org.junit.Test; import org.junit.runner.RunWith; @@ -34,21 +30,18 @@ public class ImageTest extends BaseActivityTest { @Test public void testAddGetImage() { validateTestSetup(); - MapboxMapAction.invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - Drawable drawable = rule.getActivity().getResources().getDrawable(R.drawable.ic_launcher_round); - assertTrue(drawable instanceof BitmapDrawable); + MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> { + Drawable drawable = rule.getActivity().getResources().getDrawable(R.drawable.ic_launcher_round); + assertTrue(drawable instanceof BitmapDrawable); - Bitmap bitmapSet = ((BitmapDrawable) drawable).getBitmap(); - mapboxMap.addImage(IMAGE_ID, bitmapSet); + Bitmap bitmapSet = ((BitmapDrawable) drawable).getBitmap(); + mapboxMap.addImage(IMAGE_ID, bitmapSet); - Bitmap bitmapGet = mapboxMap.getImage(IMAGE_ID); - assertTrue(bitmapGet.sameAs(bitmapSet)); + Bitmap bitmapGet = mapboxMap.getImage(IMAGE_ID); + assertTrue(bitmapGet.sameAs(bitmapSet)); - mapboxMap.removeImage(IMAGE_ID); - assertNull(mapboxMap.getImage(IMAGE_ID)); - } + mapboxMap.removeImage(IMAGE_ID); + assertNull(mapboxMap.getImage(IMAGE_ID)); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java index 88da6e45be..8dee5de328 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java @@ -5,24 +5,19 @@ import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.runner.AndroidJUnit4; import android.view.View; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.functions.Function; import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops; import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; +import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.light.Position; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.style.FillExtrusionStyleTestActivity; - -import timber.log.Timber; - import org.hamcrest.Matcher; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; @@ -33,7 +28,6 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBas import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity; - import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; @@ -48,14 +42,11 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - light.setAnchor(ANCHOR_MAP); - assertEquals("Anchor should match", ANCHOR_MAP, light.getAnchor()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + light.setAnchor(ANCHOR_MAP); + assertEquals("Anchor should match", ANCHOR_MAP, light.getAnchor()); }); } @@ -64,15 +55,12 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("positionTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - light.setPositionTransition(options); - assertEquals("Transition options should match", options, light.getPositionTransition()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + light.setPositionTransition(options); + assertEquals("Transition options should match", options, light.getPositionTransition()); }); } @@ -81,15 +69,12 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("position"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - Position position = new Position(1, 2, 3); - light.setPosition(position); - assertEquals("Position should match", position, light.getPosition()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + Position position = new Position(1, 2, 3); + light.setPosition(position); + assertEquals("Position should match", position, light.getPosition()); }); } @@ -98,15 +83,12 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - light.setColorTransition(options); - assertEquals("Transition options should match", options, light.getColorTransition()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + light.setColorTransition(options); + assertEquals("Transition options should match", options, light.getColorTransition()); }); } @@ -115,14 +97,11 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - light.setColor("rgba(0, 0, 0, 1)"); - assertEquals("Color should match", "rgba(0, 0, 0, 1)".replaceAll("\\s+", ""), light.getColor()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + light.setColor("rgba(0, 0, 0, 1)"); + assertEquals("Color should match", "rgba(0, 0, 0, 1)".replaceAll("\\s+", ""), light.getColor()); }); } @@ -131,15 +110,12 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("intensityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - light.setIntensityTransition(options); - assertEquals("Transition options should match", options, light.getIntensityTransition()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + light.setIntensityTransition(options); + assertEquals("Transition options should match", options, light.getIntensityTransition()); }); } @@ -148,14 +124,11 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("intensity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - light.setIntensity(0.3f); - assertEquals("Intensity should match", 0.3f, light.getIntensity()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + light.setIntensity(0.3f); + assertEquals("Intensity should match", 0.3f, light.getIntensity()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java index 8123d24be8..db9733c11b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java @@ -3,14 +3,9 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; +import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.SourceFunction; import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; @@ -19,22 +14,43 @@ import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.composite; +import static com.mapbox.mapboxsdk.style.functions.Function.property; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.LINE_CAP_BUTT; +import static com.mapbox.mapboxsdk.style.layers.Property.LINE_JOIN_BEVEL; +import static com.mapbox.mapboxsdk.style.layers.Property.LINE_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineBlur; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineCap; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineDasharray; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineGapWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineJoin; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineMiterLimit; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineOffset; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.linePattern; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineRoundLimit; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for LineLayer @@ -51,17 +67,14 @@ public class LineLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { - Timber.i("Adding layer"); - layer = new LineLayer("my-layer", "composite"); - layer.setSourceLayer("composite"); - mapboxMap.addLayer(layer); - // Layer reference is now stale, get new reference - layer = mapboxMap.getLayerAs("my-layer"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { + Timber.i("Adding layer"); + layer = new LineLayer("my-layer", "composite"); + layer.setSourceLayer("composite"); + mapboxMap.addLayer(layer); + // Layer reference is now stale, get new reference + layer = mapboxMap.getLayerAs("my-layer"); } }); } @@ -71,18 +84,15 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,19 +101,16 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); - - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); + + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); }); } @@ -112,15 +119,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-cap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineCap(LINE_CAP_BUTT)); - assertEquals((String) layer.getLineCap().getValue(), (String) LINE_CAP_BUTT); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineCap(LINE_CAP_BUTT)); + assertEquals((String) layer.getLineCap().getValue(), (String) LINE_CAP_BUTT); }); } @@ -129,29 +133,26 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-cap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineCap( - zoom( - interval( - stop(2, lineCap(LINE_CAP_BUTT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineCap( + zoom( + interval( + stop(2, lineCap(LINE_CAP_BUTT)) ) ) - ); - - // Verify - assertNotNull(layer.getLineCap()); - assertNotNull(layer.getLineCap().getFunction()); - assertEquals(CameraFunction.class, layer.getLineCap().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getLineCap().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getLineCap().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineCap()); + assertNotNull(layer.getLineCap().getFunction()); + assertEquals(CameraFunction.class, layer.getLineCap().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getLineCap().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getLineCap().getFunction().getStops()).size()); }); } @@ -160,15 +161,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-join"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineJoin(LINE_JOIN_BEVEL)); - assertEquals((String) layer.getLineJoin().getValue(), (String) LINE_JOIN_BEVEL); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineJoin(LINE_JOIN_BEVEL)); + assertEquals((String) layer.getLineJoin().getValue(), (String) LINE_JOIN_BEVEL); }); } @@ -177,29 +175,26 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-join"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineJoin( - zoom( - interval( - stop(2, lineJoin(LINE_JOIN_BEVEL)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineJoin( + zoom( + interval( + stop(2, lineJoin(LINE_JOIN_BEVEL)) ) ) - ); - - // Verify - assertNotNull(layer.getLineJoin()); - assertNotNull(layer.getLineJoin().getFunction()); - assertEquals(CameraFunction.class, layer.getLineJoin().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getLineJoin().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getLineJoin().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineJoin()); + assertNotNull(layer.getLineJoin().getFunction()); + assertEquals(CameraFunction.class, layer.getLineJoin().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getLineJoin().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getLineJoin().getFunction().getStops()).size()); }); } @@ -208,23 +203,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-join"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineJoin(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getLineJoin()); - assertNotNull(layer.getLineJoin().getFunction()); - assertEquals(SourceFunction.class, layer.getLineJoin().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineJoin().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineJoin().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineJoin(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getLineJoin()); + assertNotNull(layer.getLineJoin().getFunction()); + assertEquals(SourceFunction.class, layer.getLineJoin().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineJoin().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineJoin().getFunction().getStops().getClass()); }); } @@ -233,30 +225,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-join"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineJoin( - property( - "FeaturePropertyA", - interval( - stop(1, lineJoin(LINE_JOIN_BEVEL)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineJoin( + property( + "FeaturePropertyA", + interval( + stop(1, lineJoin(LINE_JOIN_BEVEL)) ) ) - ); - - // Verify - assertNotNull(layer.getLineJoin()); - assertNotNull(layer.getLineJoin().getFunction()); - assertEquals(SourceFunction.class, layer.getLineJoin().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineJoin().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getLineJoin().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineJoin()); + assertNotNull(layer.getLineJoin().getFunction()); + assertEquals(SourceFunction.class, layer.getLineJoin().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineJoin().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getLineJoin().getFunction().getStops().getClass()); }); } @@ -265,15 +254,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-miter-limit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineMiterLimit(0.3f)); - assertEquals((Float) layer.getLineMiterLimit().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineMiterLimit(0.3f)); + assertEquals((Float) layer.getLineMiterLimit().getValue(), (Float) 0.3f); }); } @@ -282,30 +268,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-miter-limit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineMiterLimit( - zoom( - exponential( - stop(2, lineMiterLimit(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineMiterLimit( + zoom( + exponential( + stop(2, lineMiterLimit(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineMiterLimit()); - assertNotNull(layer.getLineMiterLimit().getFunction()); - assertEquals(CameraFunction.class, layer.getLineMiterLimit().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineMiterLimit().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineMiterLimit()); + assertNotNull(layer.getLineMiterLimit().getFunction()); + assertEquals(CameraFunction.class, layer.getLineMiterLimit().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineMiterLimit().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).size()); }); } @@ -314,15 +297,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-round-limit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineRoundLimit(0.3f)); - assertEquals((Float) layer.getLineRoundLimit().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineRoundLimit(0.3f)); + assertEquals((Float) layer.getLineRoundLimit().getValue(), (Float) 0.3f); }); } @@ -331,30 +311,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-round-limit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineRoundLimit( - zoom( - exponential( - stop(2, lineRoundLimit(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineRoundLimit( + zoom( + exponential( + stop(2, lineRoundLimit(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineRoundLimit()); - assertNotNull(layer.getLineRoundLimit().getFunction()); - assertEquals(CameraFunction.class, layer.getLineRoundLimit().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineRoundLimit().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineRoundLimit().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineRoundLimit().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineRoundLimit()); + assertNotNull(layer.getLineRoundLimit().getFunction()); + assertEquals(CameraFunction.class, layer.getLineRoundLimit().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineRoundLimit().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineRoundLimit().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineRoundLimit().getFunction().getStops()).size()); }); } @@ -363,16 +340,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineOpacityTransition(options); - assertEquals(layer.getLineOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineOpacityTransition(options); + assertEquals(layer.getLineOpacityTransition(), options); }); } @@ -381,15 +355,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineOpacity(0.3f)); - assertEquals((Float) layer.getLineOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineOpacity(0.3f)); + assertEquals((Float) layer.getLineOpacity().getValue(), (Float) 0.3f); }); } @@ -398,30 +369,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOpacity( - zoom( - exponential( - stop(2, lineOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOpacity( + zoom( + exponential( + stop(2, lineOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineOpacity()); - assertNotNull(layer.getLineOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getLineOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineOpacity()); + assertNotNull(layer.getLineOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getLineOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).size()); }); } @@ -430,23 +398,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOpacity(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getLineOpacity()); - assertNotNull(layer.getLineOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOpacity(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getLineOpacity()); + assertNotNull(layer.getLineOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); }); } @@ -455,30 +420,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, lineOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOpacity( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, lineOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineOpacity()); - assertNotNull(layer.getLineOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineOpacity()); + assertNotNull(layer.getLineOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); }); } @@ -487,33 +449,30 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, lineOpacity(0.3f)) - ) - ).withDefaultValue(lineOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineOpacity()); - assertNotNull(layer.getLineOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, lineOpacity(0.3f)) + ) + ).withDefaultValue(lineOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineOpacity()); + assertNotNull(layer.getLineOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue().getValue()); }); } @@ -523,38 +482,35 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOpacity( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, lineOpacity(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(lineOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineOpacity()); - assertNotNull(layer.getLineOpacity().getFunction()); - assertEquals(CompositeFunction.class, layer.getLineOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineOpacity().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOpacity( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, lineOpacity(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(lineOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineOpacity()); + assertNotNull(layer.getLineOpacity().getFunction()); + assertEquals(CompositeFunction.class, layer.getLineOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineOpacity().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -563,16 +519,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineColorTransition(options); - assertEquals(layer.getLineColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineColorTransition(options); + assertEquals(layer.getLineColorTransition(), options); }); } @@ -581,15 +534,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getLineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getLineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -598,30 +548,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineColor( - zoom( - exponential( - stop(2, lineColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineColor( + zoom( + exponential( + stop(2, lineColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineColor()); - assertNotNull(layer.getLineColor().getFunction()); - assertEquals(CameraFunction.class, layer.getLineColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineColor()); + assertNotNull(layer.getLineColor().getFunction()); + assertEquals(CameraFunction.class, layer.getLineColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineColor().getFunction().getStops()).size()); }); } @@ -630,23 +577,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getLineColor()); - assertNotNull(layer.getLineColor().getFunction()); - assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getLineColor()); + assertNotNull(layer.getLineColor().getFunction()); + assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineColor().getFunction().getStops().getClass()); }); } @@ -655,30 +599,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, lineColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, lineColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineColor()); - assertNotNull(layer.getLineColor().getFunction()); - assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineColor()); + assertNotNull(layer.getLineColor().getFunction()); + assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineColor().getFunction().getStops().getClass()); }); } @@ -687,33 +628,30 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", lineColor(Color.RED)) - ) - ).withDefaultValue(lineColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getLineColor()); - assertNotNull(layer.getLineColor().getFunction()); - assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getLineColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", lineColor(Color.RED)) + ) + ).withDefaultValue(lineColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getLineColor()); + assertNotNull(layer.getLineColor().getFunction()); + assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getLineColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -723,15 +661,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineColor(Color.RED)); - assertEquals(layer.getLineColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineColor(Color.RED)); + assertEquals(layer.getLineColorAsInt(), Color.RED); }); } @@ -740,16 +675,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineTranslateTransition(options); - assertEquals(layer.getLineTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineTranslateTransition(options); + assertEquals(layer.getLineTranslateTransition(), options); }); } @@ -758,15 +690,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getLineTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getLineTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -775,30 +704,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineTranslate( - zoom( - exponential( - stop(2, lineTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineTranslate( + zoom( + exponential( + stop(2, lineTranslate(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineTranslate()); - assertNotNull(layer.getLineTranslate().getFunction()); - assertEquals(CameraFunction.class, layer.getLineTranslate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineTranslate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineTranslate()); + assertNotNull(layer.getLineTranslate().getFunction()); + assertEquals(CameraFunction.class, layer.getLineTranslate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineTranslate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).size()); }); } @@ -807,15 +733,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getLineTranslateAnchor().getValue(), (String) LINE_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getLineTranslateAnchor().getValue(), (String) LINE_TRANSLATE_ANCHOR_MAP); }); } @@ -824,29 +747,26 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineTranslateAnchor( - zoom( - interval( - stop(2, lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineTranslateAnchor( + zoom( + interval( + stop(2, lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getLineTranslateAnchor()); - assertNotNull(layer.getLineTranslateAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getLineTranslateAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getLineTranslateAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getLineTranslateAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineTranslateAnchor()); + assertNotNull(layer.getLineTranslateAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getLineTranslateAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getLineTranslateAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getLineTranslateAnchor().getFunction().getStops()).size()); }); } @@ -855,16 +775,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineWidthTransition(options); - assertEquals(layer.getLineWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineWidthTransition(options); + assertEquals(layer.getLineWidthTransition(), options); }); } @@ -873,15 +790,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineWidth(0.3f)); - assertEquals((Float) layer.getLineWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineWidth(0.3f)); + assertEquals((Float) layer.getLineWidth().getValue(), (Float) 0.3f); }); } @@ -890,30 +804,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineWidth( - zoom( - exponential( - stop(2, lineWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineWidth( + zoom( + exponential( + stop(2, lineWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineWidth()); - assertNotNull(layer.getLineWidth().getFunction()); - assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineWidth()); + assertNotNull(layer.getLineWidth().getFunction()); + assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size()); }); } @@ -922,23 +833,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineWidth(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getLineWidth()); - assertNotNull(layer.getLineWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineWidth(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getLineWidth()); + assertNotNull(layer.getLineWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineWidth().getFunction().getStops().getClass()); }); } @@ -947,30 +855,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, lineWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, lineWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineWidth()); - assertNotNull(layer.getLineWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineWidth()); + assertNotNull(layer.getLineWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass()); }); } @@ -979,33 +884,30 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, lineWidth(0.3f)) - ) - ).withDefaultValue(lineWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineWidth()); - assertNotNull(layer.getLineWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getLineWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, lineWidth(0.3f)) + ) + ).withDefaultValue(lineWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineWidth()); + assertNotNull(layer.getLineWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getLineWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -1015,38 +917,35 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, lineWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(lineWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineWidth()); - assertNotNull(layer.getLineWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getLineWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineWidth().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, lineWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(lineWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineWidth()); + assertNotNull(layer.getLineWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getLineWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineWidth().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1055,16 +954,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineGapWidthTransition(options); - assertEquals(layer.getLineGapWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineGapWidthTransition(options); + assertEquals(layer.getLineGapWidthTransition(), options); }); } @@ -1073,15 +969,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineGapWidth(0.3f)); - assertEquals((Float) layer.getLineGapWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineGapWidth(0.3f)); + assertEquals((Float) layer.getLineGapWidth().getValue(), (Float) 0.3f); }); } @@ -1090,30 +983,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineGapWidth( - zoom( - exponential( - stop(2, lineGapWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineGapWidth( + zoom( + exponential( + stop(2, lineGapWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineGapWidth()); - assertNotNull(layer.getLineGapWidth().getFunction()); - assertEquals(CameraFunction.class, layer.getLineGapWidth().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineGapWidth()); + assertNotNull(layer.getLineGapWidth().getFunction()); + assertEquals(CameraFunction.class, layer.getLineGapWidth().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).size()); }); } @@ -1122,23 +1012,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineGapWidth(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getLineGapWidth()); - assertNotNull(layer.getLineGapWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineGapWidth(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getLineGapWidth()); + assertNotNull(layer.getLineGapWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); }); } @@ -1147,30 +1034,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineGapWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, lineGapWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineGapWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, lineGapWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineGapWidth()); - assertNotNull(layer.getLineGapWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineGapWidth()); + assertNotNull(layer.getLineGapWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); }); } @@ -1179,33 +1063,30 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineGapWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, lineGapWidth(0.3f)) - ) - ).withDefaultValue(lineGapWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineGapWidth()); - assertNotNull(layer.getLineGapWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineGapWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, lineGapWidth(0.3f)) + ) + ).withDefaultValue(lineGapWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineGapWidth()); + assertNotNull(layer.getLineGapWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -1215,38 +1096,35 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-gap-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineGapWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, lineGapWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(lineGapWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineGapWidth()); - assertNotNull(layer.getLineGapWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getLineGapWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineGapWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineGapWidth().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineGapWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, lineGapWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(lineGapWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineGapWidth()); + assertNotNull(layer.getLineGapWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getLineGapWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineGapWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineGapWidth().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1255,16 +1133,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offsetTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineOffsetTransition(options); - assertEquals(layer.getLineOffsetTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineOffsetTransition(options); + assertEquals(layer.getLineOffsetTransition(), options); }); } @@ -1273,15 +1148,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineOffset(0.3f)); - assertEquals((Float) layer.getLineOffset().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineOffset(0.3f)); + assertEquals((Float) layer.getLineOffset().getValue(), (Float) 0.3f); }); } @@ -1290,30 +1162,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOffset( - zoom( - exponential( - stop(2, lineOffset(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOffset( + zoom( + exponential( + stop(2, lineOffset(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineOffset()); - assertNotNull(layer.getLineOffset().getFunction()); - assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineOffset()); + assertNotNull(layer.getLineOffset().getFunction()); + assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size()); }); } @@ -1322,23 +1191,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOffset(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getLineOffset()); - assertNotNull(layer.getLineOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineOffset().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOffset(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getLineOffset()); + assertNotNull(layer.getLineOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineOffset().getFunction().getStops().getClass()); }); } @@ -1347,30 +1213,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOffset( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, lineOffset(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOffset( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, lineOffset(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineOffset()); - assertNotNull(layer.getLineOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineOffset()); + assertNotNull(layer.getLineOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass()); }); } @@ -1379,33 +1242,30 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOffset( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, lineOffset(0.3f)) - ) - ).withDefaultValue(lineOffset(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineOffset()); - assertNotNull(layer.getLineOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getLineOffset().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOffset( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, lineOffset(0.3f)) + ) + ).withDefaultValue(lineOffset(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineOffset()); + assertNotNull(layer.getLineOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getLineOffset().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue().getValue()); }); } @@ -1415,38 +1275,35 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineOffset( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, lineOffset(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(lineOffset(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineOffset()); - assertNotNull(layer.getLineOffset().getFunction()); - assertEquals(CompositeFunction.class, layer.getLineOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineOffset().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineOffset().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineOffset( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, lineOffset(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(lineOffset(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineOffset()); + assertNotNull(layer.getLineOffset().getFunction()); + assertEquals(CompositeFunction.class, layer.getLineOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineOffset().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineOffset().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1455,16 +1312,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blurTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineBlurTransition(options); - assertEquals(layer.getLineBlurTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineBlurTransition(options); + assertEquals(layer.getLineBlurTransition(), options); }); } @@ -1473,15 +1327,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineBlur(0.3f)); - assertEquals((Float) layer.getLineBlur().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineBlur(0.3f)); + assertEquals((Float) layer.getLineBlur().getValue(), (Float) 0.3f); }); } @@ -1490,30 +1341,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineBlur( - zoom( - exponential( - stop(2, lineBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineBlur( + zoom( + exponential( + stop(2, lineBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineBlur()); - assertNotNull(layer.getLineBlur().getFunction()); - assertEquals(CameraFunction.class, layer.getLineBlur().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineBlur()); + assertNotNull(layer.getLineBlur().getFunction()); + assertEquals(CameraFunction.class, layer.getLineBlur().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).size()); }); } @@ -1522,23 +1370,20 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineBlur(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getLineBlur()); - assertNotNull(layer.getLineBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getLineBlur().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineBlur(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getLineBlur()); + assertNotNull(layer.getLineBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getLineBlur().getFunction().getStops().getClass()); }); } @@ -1547,30 +1392,27 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineBlur( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, lineBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineBlur( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, lineBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getLineBlur()); - assertNotNull(layer.getLineBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineBlur()); + assertNotNull(layer.getLineBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass()); }); } @@ -1579,33 +1421,30 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineBlur( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, lineBlur(0.3f)) - ) - ).withDefaultValue(lineBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineBlur()); - assertNotNull(layer.getLineBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getLineBlur().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineBlur( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, lineBlur(0.3f)) + ) + ).withDefaultValue(lineBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineBlur()); + assertNotNull(layer.getLineBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getLineBlur().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue().getValue()); }); } @@ -1615,38 +1454,35 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineBlur( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, lineBlur(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(lineBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getLineBlur()); - assertNotNull(layer.getLineBlur().getFunction()); - assertEquals(CompositeFunction.class, layer.getLineBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineBlur().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineBlur( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, lineBlur(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(lineBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getLineBlur()); + assertNotNull(layer.getLineBlur().getFunction()); + assertEquals(CompositeFunction.class, layer.getLineBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineBlur().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1655,16 +1491,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-dasharrayTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLineDasharrayTransition(options); - assertEquals(layer.getLineDasharrayTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLineDasharrayTransition(options); + assertEquals(layer.getLineDasharrayTransition(), options); }); } @@ -1673,15 +1506,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-dasharray"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(lineDasharray(new Float[] {})); - assertEquals((Float[]) layer.getLineDasharray().getValue(), (Float[]) new Float[] {}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(lineDasharray(new Float[] {})); + assertEquals((Float[]) layer.getLineDasharray().getValue(), (Float[]) new Float[] {}); }); } @@ -1690,29 +1520,26 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-dasharray"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - lineDasharray( - zoom( - interval( - stop(2, lineDasharray(new Float[] {})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + lineDasharray( + zoom( + interval( + stop(2, lineDasharray(new Float[] {})) ) ) - ); - - // Verify - assertNotNull(layer.getLineDasharray()); - assertNotNull(layer.getLineDasharray().getFunction()); - assertEquals(CameraFunction.class, layer.getLineDasharray().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getLineDasharray().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getLineDasharray().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLineDasharray()); + assertNotNull(layer.getLineDasharray().getFunction()); + assertEquals(CameraFunction.class, layer.getLineDasharray().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getLineDasharray().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getLineDasharray().getFunction().getStops()).size()); }); } @@ -1721,16 +1548,13 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-patternTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setLinePatternTransition(options); - assertEquals(layer.getLinePatternTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setLinePatternTransition(options); + assertEquals(layer.getLinePatternTransition(), options); }); } @@ -1739,15 +1563,12 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(linePattern("pedestrian-polygon")); - assertEquals((String) layer.getLinePattern().getValue(), (String) "pedestrian-polygon"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(linePattern("pedestrian-polygon")); + assertEquals((String) layer.getLinePattern().getValue(), (String) "pedestrian-polygon"); }); } @@ -1756,29 +1577,26 @@ public class LineLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("line-pattern"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - linePattern( - zoom( - interval( - stop(2, linePattern("pedestrian-polygon")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + linePattern( + zoom( + interval( + stop(2, linePattern("pedestrian-polygon")) ) ) - ); - - // Verify - assertNotNull(layer.getLinePattern()); - assertNotNull(layer.getLinePattern().getFunction()); - assertEquals(CameraFunction.class, layer.getLinePattern().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getLinePattern().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getLinePattern()); + assertNotNull(layer.getLinePattern().getFunction()); + assertEquals(CameraFunction.class, layer.getLinePattern().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getLinePattern().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java index 020effe331..7c537e020c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java @@ -2,39 +2,33 @@ package com.mapbox.mapboxsdk.testapp.style; -import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; -import com.mapbox.mapboxsdk.style.functions.SourceFunction; -import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; -import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops; -import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; -import com.mapbox.mapboxsdk.style.functions.stops.Stop; -import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.RasterLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterBrightnessMax; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterBrightnessMin; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterContrast; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterFadeDuration; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterHueRotate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterSaturation; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for RasterLayer @@ -51,17 +45,14 @@ public class RasterLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { - Timber.i("Adding layer"); - layer = new RasterLayer("my-layer", "composite"); - layer.setSourceLayer("composite"); - mapboxMap.addLayer(layer); - // Layer reference is now stale, get new reference - layer = mapboxMap.getLayerAs("my-layer"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { + Timber.i("Adding layer"); + layer = new RasterLayer("my-layer", "composite"); + layer.setSourceLayer("composite"); + mapboxMap.addLayer(layer); + // Layer reference is now stale, get new reference + layer = mapboxMap.getLayerAs("my-layer"); } }); } @@ -71,18 +62,15 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,16 +79,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterOpacityTransition(options); - assertEquals(layer.getRasterOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterOpacityTransition(options); + assertEquals(layer.getRasterOpacityTransition(), options); }); } @@ -109,15 +94,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterOpacity(0.3f)); - assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterOpacity(0.3f)); + assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f); }); } @@ -126,30 +108,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterOpacity( - zoom( - exponential( - stop(2, rasterOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterOpacity( + zoom( + exponential( + stop(2, rasterOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterOpacity()); - assertNotNull(layer.getRasterOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterOpacity()); + assertNotNull(layer.getRasterOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).size()); }); } @@ -158,16 +137,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-hue-rotateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterHueRotateTransition(options); - assertEquals(layer.getRasterHueRotateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterHueRotateTransition(options); + assertEquals(layer.getRasterHueRotateTransition(), options); }); } @@ -176,15 +152,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-hue-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterHueRotate(0.3f)); - assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterHueRotate(0.3f)); + assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f); }); } @@ -193,30 +166,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-hue-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterHueRotate( - zoom( - exponential( - stop(2, rasterHueRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterHueRotate( + zoom( + exponential( + stop(2, rasterHueRotate(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterHueRotate()); - assertNotNull(layer.getRasterHueRotate().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterHueRotate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterHueRotate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterHueRotate()); + assertNotNull(layer.getRasterHueRotate().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterHueRotate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterHueRotate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).size()); }); } @@ -225,16 +195,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-brightness-minTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterBrightnessMinTransition(options); - assertEquals(layer.getRasterBrightnessMinTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterBrightnessMinTransition(options); + assertEquals(layer.getRasterBrightnessMinTransition(), options); }); } @@ -243,15 +210,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-brightness-min"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterBrightnessMin(0.3f)); - assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterBrightnessMin(0.3f)); + assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f); }); } @@ -260,30 +224,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-brightness-min"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterBrightnessMin( - zoom( - exponential( - stop(2, rasterBrightnessMin(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterBrightnessMin( + zoom( + exponential( + stop(2, rasterBrightnessMin(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterBrightnessMin()); - assertNotNull(layer.getRasterBrightnessMin().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterBrightnessMin().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterBrightnessMin().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterBrightnessMin()); + assertNotNull(layer.getRasterBrightnessMin().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterBrightnessMin().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterBrightnessMin().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).size()); }); } @@ -292,16 +253,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-brightness-maxTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterBrightnessMaxTransition(options); - assertEquals(layer.getRasterBrightnessMaxTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterBrightnessMaxTransition(options); + assertEquals(layer.getRasterBrightnessMaxTransition(), options); }); } @@ -310,15 +268,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-brightness-max"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterBrightnessMax(0.3f)); - assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterBrightnessMax(0.3f)); + assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f); }); } @@ -327,30 +282,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-brightness-max"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterBrightnessMax( - zoom( - exponential( - stop(2, rasterBrightnessMax(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterBrightnessMax( + zoom( + exponential( + stop(2, rasterBrightnessMax(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterBrightnessMax()); - assertNotNull(layer.getRasterBrightnessMax().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterBrightnessMax().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterBrightnessMax().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterBrightnessMax()); + assertNotNull(layer.getRasterBrightnessMax().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterBrightnessMax().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterBrightnessMax().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).size()); }); } @@ -359,16 +311,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-saturationTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterSaturationTransition(options); - assertEquals(layer.getRasterSaturationTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterSaturationTransition(options); + assertEquals(layer.getRasterSaturationTransition(), options); }); } @@ -377,15 +326,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-saturation"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterSaturation(0.3f)); - assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterSaturation(0.3f)); + assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f); }); } @@ -394,30 +340,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-saturation"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterSaturation( - zoom( - exponential( - stop(2, rasterSaturation(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterSaturation( + zoom( + exponential( + stop(2, rasterSaturation(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterSaturation()); - assertNotNull(layer.getRasterSaturation().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterSaturation().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterSaturation().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterSaturation()); + assertNotNull(layer.getRasterSaturation().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterSaturation().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterSaturation().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).size()); }); } @@ -426,16 +369,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-contrastTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterContrastTransition(options); - assertEquals(layer.getRasterContrastTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterContrastTransition(options); + assertEquals(layer.getRasterContrastTransition(), options); }); } @@ -444,15 +384,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-contrast"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterContrast(0.3f)); - assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterContrast(0.3f)); + assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f); }); } @@ -461,30 +398,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-contrast"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterContrast( - zoom( - exponential( - stop(2, rasterContrast(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterContrast( + zoom( + exponential( + stop(2, rasterContrast(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterContrast()); - assertNotNull(layer.getRasterContrast().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterContrast().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterContrast().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterContrast()); + assertNotNull(layer.getRasterContrast().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterContrast().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterContrast().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).size()); }); } @@ -493,16 +427,13 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-fade-durationTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setRasterFadeDurationTransition(options); - assertEquals(layer.getRasterFadeDurationTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setRasterFadeDurationTransition(options); + assertEquals(layer.getRasterFadeDurationTransition(), options); }); } @@ -511,15 +442,12 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-fade-duration"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(rasterFadeDuration(0.3f)); - assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(rasterFadeDuration(0.3f)); + assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f); }); } @@ -528,30 +456,27 @@ public class RasterLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("raster-fade-duration"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - rasterFadeDuration( - zoom( - exponential( - stop(2, rasterFadeDuration(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + rasterFadeDuration( + zoom( + exponential( + stop(2, rasterFadeDuration(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getRasterFadeDuration()); - assertNotNull(layer.getRasterFadeDuration().getFunction()); - assertEquals(CameraFunction.class, layer.getRasterFadeDuration().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getRasterFadeDuration().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getRasterFadeDuration()); + assertNotNull(layer.getRasterFadeDuration().getFunction()); + assertEquals(CameraFunction.class, layer.getRasterFadeDuration().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getRasterFadeDuration().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java index bf8bcb9f66..d714950425 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java @@ -7,8 +7,6 @@ import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.runner.AndroidJUnit4; import android.view.View; - -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.FillLayer; @@ -22,23 +20,19 @@ import com.mapbox.mapboxsdk.style.sources.RasterSource; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.style.sources.VectorSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity; - import junit.framework.Assert; - import org.hamcrest.Matcher; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; import java.net.MalformedURLException; import java.net.URL; import java.util.List; -import timber.log.Timber; - import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; @@ -192,41 +186,38 @@ public class RuntimeStyleTests extends BaseActivityTest { @Test public void testAddRemoveSource() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2")); - mapboxMap.removeSource("my-source"); + invoke(mapboxMap, (uiController, mapboxMap) -> { + mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2")); + mapboxMap.removeSource("my-source"); - // Add initial source - mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2")); + // Add initial source + mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2")); - // Remove - Source mySource = mapboxMap.removeSource("my-source"); - assertNotNull(mySource); - assertNull(mapboxMap.getLayer("my-source")); + // Remove + Source mySource = mapboxMap.removeSource("my-source"); + assertNotNull(mySource); + assertNull(mapboxMap.getLayer("my-source")); - // Add - Source source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); - mapboxMap.addSource(source); + // Add + Source source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); + mapboxMap.addSource(source); - // Remove, preserving the reference - mapboxMap.removeSource(source); + // Remove, preserving the reference + mapboxMap.removeSource(source); - // Re-add the reference... - mapboxMap.addSource(source); + // Re-add the reference... + mapboxMap.addSource(source); - // Ensure it's there - Assert.assertNotNull(mapboxMap.getSource(source.getId())); + // Ensure it's there + Assert.assertNotNull(mapboxMap.getSource(source.getId())); - // Test adding a duplicate source - try { - Source source2 = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); - mapboxMap.addSource(source2); - fail("Should not have been allowed to add a source with a duplicate id"); - } catch (CannotAddSourceException cannotAddSourceException) { - // OK - } + // Test adding a duplicate source + try { + Source source2 = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); + mapboxMap.addSource(source2); + fail("Should not have been allowed to add a source with a duplicate id"); + } catch (CannotAddSourceException cannotAddSourceException) { + // OK } }); @@ -235,45 +226,36 @@ public class RuntimeStyleTests extends BaseActivityTest { @Test public void testVectorSourceUrlGetter() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); - mapboxMap.addSource(source); - assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); + mapboxMap.addSource(source); + assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl()); }); } @Test public void testRasterSourceUrlGetter() { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); - mapboxMap.addSource(source); - assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); + mapboxMap.addSource(source); + assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl()); }); } @Test public void testGeoJsonSourceUrlGetter() throws MalformedURLException { validateTestSetup(); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - GeoJsonSource source = new GeoJsonSource("my-source"); - mapboxMap.addSource(source); - assertNull(source.getUrl()); - try { - source.setUrl(new URL("http://mapbox.com/my-file.json")); - } catch (MalformedURLException exception) { - fail(); - } - assertEquals("http://mapbox.com/my-file.json", source.getUrl()); + invoke(mapboxMap, (uiController, mapboxMap) -> { + GeoJsonSource source = new GeoJsonSource("my-source"); + mapboxMap.addSource(source); + assertNull(source.getUrl()); + try { + source.setUrl(new URL("http://mapbox.com/my-file.json")); + } catch (MalformedURLException exception) { + fail(); } + assertEquals("http://mapbox.com/my-file.json", source.getUrl()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java index 75c8b57787..50bde9c1f2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java @@ -1,10 +1,8 @@ package com.mapbox.mapboxsdk.testapp.style; import android.support.test.runner.AndroidJUnit4; - import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTimingTestActivity; - import org.junit.Test; import org.junit.runner.RunWith; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java index f8248ae4a7..c74582d6f2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java @@ -3,14 +3,9 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; import android.support.test.runner.AndroidJUnit4; - -import timber.log.Timber; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.CameraFunction; +import com.mapbox.mapboxsdk.style.functions.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.SourceFunction; import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; @@ -19,22 +14,88 @@ import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; - +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import static com.mapbox.mapboxsdk.style.functions.Function.composite; +import static com.mapbox.mapboxsdk.style.functions.Function.property; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_CENTER; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_PITCH_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_ROTATION_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_TEXT_FIT_NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.SYMBOL_PLACEMENT_POINT; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_CENTER; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_JUSTIFY_LEFT; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_PITCH_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ROTATION_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_TRANSFORM_NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconHaloBlur; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconHaloColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconHaloWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconKeepUpright; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOffset; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOptional; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconPadding; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconPitchAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotationAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTextFit; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTextFitPadding; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.symbolAvoidEdges; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.symbolPlacement; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.symbolSpacing; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAllowOverlap; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textField; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textFont; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textHaloBlur; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textHaloColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textHaloWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textIgnorePlacement; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textJustify; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textKeepUpright; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textLetterSpacing; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textLineHeight; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textMaxAngle; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textMaxWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textOffset; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textOptional; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textPadding; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textPitchAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textRotate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textRotationAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textSize; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textTransform; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; - -import com.mapbox.mapboxsdk.style.layers.TransitionOptions; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for SymbolLayer @@ -51,17 +112,14 @@ public class SymbolLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { - Timber.i("Adding layer"); - layer = new SymbolLayer("my-layer", "composite"); - layer.setSourceLayer("composite"); - mapboxMap.addLayer(layer); - // Layer reference is now stale, get new reference - layer = mapboxMap.getLayerAs("my-layer"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + if ((layer = mapboxMap.getLayerAs("my-layer")) == null) { + Timber.i("Adding layer"); + layer = new SymbolLayer("my-layer", "composite"); + layer.setSourceLayer("composite"); + mapboxMap.addLayer(layer); + // Layer reference is now stale, get new reference + layer = mapboxMap.getLayerAs("my-layer"); } }); } @@ -71,18 +129,15 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,19 +146,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); - - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); + + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); }); } @@ -112,15 +164,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); - assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); + assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); }); } @@ -129,29 +178,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - symbolPlacement( - zoom( - interval( - stop(2, symbolPlacement(SYMBOL_PLACEMENT_POINT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + symbolPlacement( + zoom( + interval( + stop(2, symbolPlacement(SYMBOL_PLACEMENT_POINT)) ) ) - ); - - // Verify - assertNotNull(layer.getSymbolPlacement()); - assertNotNull(layer.getSymbolPlacement().getFunction()); - assertEquals(CameraFunction.class, layer.getSymbolPlacement().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getSymbolPlacement().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getSymbolPlacement().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getSymbolPlacement()); + assertNotNull(layer.getSymbolPlacement().getFunction()); + assertEquals(CameraFunction.class, layer.getSymbolPlacement().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getSymbolPlacement().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getSymbolPlacement().getFunction().getStops()).size()); }); } @@ -160,15 +206,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(symbolSpacing(0.3f)); - assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(symbolSpacing(0.3f)); + assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); }); } @@ -177,30 +220,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - symbolSpacing( - zoom( - exponential( - stop(2, symbolSpacing(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + symbolSpacing( + zoom( + exponential( + stop(2, symbolSpacing(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getSymbolSpacing()); - assertNotNull(layer.getSymbolSpacing().getFunction()); - assertEquals(CameraFunction.class, layer.getSymbolSpacing().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getSymbolSpacing().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getSymbolSpacing()); + assertNotNull(layer.getSymbolSpacing().getFunction()); + assertEquals(CameraFunction.class, layer.getSymbolSpacing().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getSymbolSpacing().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).size()); }); } @@ -209,15 +249,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-avoid-edges"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(symbolAvoidEdges(true)); - assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(symbolAvoidEdges(true)); + assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); }); } @@ -226,29 +263,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-avoid-edges"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - symbolAvoidEdges( - zoom( - interval( - stop(2, symbolAvoidEdges(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + symbolAvoidEdges( + zoom( + interval( + stop(2, symbolAvoidEdges(true)) ) ) - ); - - // Verify - assertNotNull(layer.getSymbolAvoidEdges()); - assertNotNull(layer.getSymbolAvoidEdges().getFunction()); - assertEquals(CameraFunction.class, layer.getSymbolAvoidEdges().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getSymbolAvoidEdges().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getSymbolAvoidEdges().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getSymbolAvoidEdges()); + assertNotNull(layer.getSymbolAvoidEdges().getFunction()); + assertEquals(CameraFunction.class, layer.getSymbolAvoidEdges().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getSymbolAvoidEdges().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getSymbolAvoidEdges().getFunction().getStops()).size()); }); } @@ -257,15 +291,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconAllowOverlap(true)); - assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconAllowOverlap(true)); + assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); }); } @@ -274,29 +305,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAllowOverlap( - zoom( - interval( - stop(2, iconAllowOverlap(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAllowOverlap( + zoom( + interval( + stop(2, iconAllowOverlap(true)) ) ) - ); - - // Verify - assertNotNull(layer.getIconAllowOverlap()); - assertNotNull(layer.getIconAllowOverlap().getFunction()); - assertEquals(CameraFunction.class, layer.getIconAllowOverlap().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconAllowOverlap().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconAllowOverlap().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconAllowOverlap()); + assertNotNull(layer.getIconAllowOverlap().getFunction()); + assertEquals(CameraFunction.class, layer.getIconAllowOverlap().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconAllowOverlap().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconAllowOverlap().getFunction().getStops()).size()); }); } @@ -305,15 +333,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconIgnorePlacement(true)); - assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconIgnorePlacement(true)); + assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); }); } @@ -322,29 +347,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconIgnorePlacement( - zoom( - interval( - stop(2, iconIgnorePlacement(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconIgnorePlacement( + zoom( + interval( + stop(2, iconIgnorePlacement(true)) ) ) - ); - - // Verify - assertNotNull(layer.getIconIgnorePlacement()); - assertNotNull(layer.getIconIgnorePlacement().getFunction()); - assertEquals(CameraFunction.class, layer.getIconIgnorePlacement().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconIgnorePlacement().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconIgnorePlacement().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconIgnorePlacement()); + assertNotNull(layer.getIconIgnorePlacement().getFunction()); + assertEquals(CameraFunction.class, layer.getIconIgnorePlacement().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconIgnorePlacement().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconIgnorePlacement().getFunction().getStops()).size()); }); } @@ -353,15 +375,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconOptional(true)); - assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconOptional(true)); + assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); }); } @@ -370,29 +389,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOptional( - zoom( - interval( - stop(2, iconOptional(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOptional( + zoom( + interval( + stop(2, iconOptional(true)) ) ) - ); - - // Verify - assertNotNull(layer.getIconOptional()); - assertNotNull(layer.getIconOptional().getFunction()); - assertEquals(CameraFunction.class, layer.getIconOptional().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconOptional().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconOptional().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconOptional()); + assertNotNull(layer.getIconOptional().getFunction()); + assertEquals(CameraFunction.class, layer.getIconOptional().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconOptional().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconOptional().getFunction().getStops()).size()); }); } @@ -401,15 +417,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); - assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); + assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); }); } @@ -418,29 +431,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotationAlignment( - zoom( - interval( - stop(2, iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotationAlignment( + zoom( + interval( + stop(2, iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getIconRotationAlignment()); - assertNotNull(layer.getIconRotationAlignment().getFunction()); - assertEquals(CameraFunction.class, layer.getIconRotationAlignment().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconRotationAlignment().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconRotationAlignment().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconRotationAlignment()); + assertNotNull(layer.getIconRotationAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getIconRotationAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconRotationAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconRotationAlignment().getFunction().getStops()).size()); }); } @@ -449,15 +459,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconSize(0.3f)); - assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconSize(0.3f)); + assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); }); } @@ -466,30 +473,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - zoom( - exponential( - stop(2, iconSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize( + zoom( + exponential( + stop(2, iconSize(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconSize()); - assertNotNull(layer.getIconSize().getFunction()); - assertEquals(CameraFunction.class, layer.getIconSize().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconSize()); + assertNotNull(layer.getIconSize().getFunction()); + assertEquals(CameraFunction.class, layer.getIconSize().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size()); }); } @@ -498,23 +502,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getIconSize()); - assertNotNull(layer.getIconSize().getFunction()); - assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconSize().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getIconSize()); + assertNotNull(layer.getIconSize().getFunction()); + assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconSize().getFunction().getStops().getClass()); }); } @@ -523,30 +524,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, iconSize(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconSize()); - assertNotNull(layer.getIconSize().getFunction()); - assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconSize()); + assertNotNull(layer.getIconSize().getFunction()); + assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass()); }); } @@ -555,33 +553,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconSize(0.3f)) - ) - ).withDefaultValue(iconSize(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconSize()); - assertNotNull(layer.getIconSize().getFunction()); - assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconSize().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconSize(0.3f)) + ) + ).withDefaultValue(iconSize(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconSize()); + assertNotNull(layer.getIconSize().getFunction()); + assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconSize().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue().getValue()); }); } @@ -591,38 +586,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, iconSize(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(iconSize(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconSize()); - assertNotNull(layer.getIconSize().getFunction()); - assertEquals(CompositeFunction.class, layer.getIconSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconSize().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconSize().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, iconSize(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(iconSize(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconSize()); + assertNotNull(layer.getIconSize().getFunction()); + assertEquals(CompositeFunction.class, layer.getIconSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconSize().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconSize().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -631,15 +623,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); - assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); + assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); }); } @@ -648,29 +637,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTextFit( - zoom( - interval( - stop(2, iconTextFit(ICON_TEXT_FIT_NONE)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconTextFit( + zoom( + interval( + stop(2, iconTextFit(ICON_TEXT_FIT_NONE)) ) ) - ); - - // Verify - assertNotNull(layer.getIconTextFit()); - assertNotNull(layer.getIconTextFit().getFunction()); - assertEquals(CameraFunction.class, layer.getIconTextFit().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconTextFit().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconTextFit().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconTextFit()); + assertNotNull(layer.getIconTextFit().getFunction()); + assertEquals(CameraFunction.class, layer.getIconTextFit().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconTextFit().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconTextFit().getFunction().getStops()).size()); }); } @@ -679,15 +665,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})); - assertEquals((Float[]) layer.getIconTextFitPadding().getValue(), (Float[]) new Float[] {0f, 0f, 0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})); + assertEquals((Float[]) layer.getIconTextFitPadding().getValue(), (Float[]) new Float[] {0f, 0f, 0f, 0f}); }); } @@ -696,30 +679,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTextFitPadding( - zoom( - exponential( - stop(2, iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconTextFitPadding( + zoom( + exponential( + stop(2, iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconTextFitPadding()); - assertNotNull(layer.getIconTextFitPadding().getFunction()); - assertEquals(CameraFunction.class, layer.getIconTextFitPadding().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconTextFitPadding().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconTextFitPadding()); + assertNotNull(layer.getIconTextFitPadding().getFunction()); + assertEquals(CameraFunction.class, layer.getIconTextFitPadding().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconTextFitPadding().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).size()); }); } @@ -728,15 +708,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconImage("undefined")); - assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconImage("undefined")); + assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); }); } @@ -745,29 +722,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage( - zoom( - interval( - stop(2, iconImage("undefined")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconImage( + zoom( + interval( + stop(2, iconImage("undefined")) ) ) - ); - - // Verify - assertNotNull(layer.getIconImage()); - assertNotNull(layer.getIconImage().getFunction()); - assertEquals(CameraFunction.class, layer.getIconImage().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconImage().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconImage().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconImage()); + assertNotNull(layer.getIconImage().getFunction()); + assertEquals(CameraFunction.class, layer.getIconImage().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconImage().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconImage().getFunction().getStops()).size()); }); } @@ -776,23 +750,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getIconImage()); - assertNotNull(layer.getIconImage().getFunction()); - assertEquals(SourceFunction.class, layer.getIconImage().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconImage().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconImage().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconImage(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getIconImage()); + assertNotNull(layer.getIconImage().getFunction()); + assertEquals(SourceFunction.class, layer.getIconImage().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconImage().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconImage().getFunction().getStops().getClass()); }); } @@ -801,30 +772,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage( - property( - "FeaturePropertyA", - interval( - stop(1, iconImage("undefined")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconImage( + property( + "FeaturePropertyA", + interval( + stop(1, iconImage("undefined")) ) ) - ); - - // Verify - assertNotNull(layer.getIconImage()); - assertNotNull(layer.getIconImage().getFunction()); - assertEquals(SourceFunction.class, layer.getIconImage().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconImage().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getIconImage().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconImage()); + assertNotNull(layer.getIconImage().getFunction()); + assertEquals(SourceFunction.class, layer.getIconImage().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconImage().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getIconImage().getFunction().getStops().getClass()); }); } @@ -833,15 +801,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconRotate(0.3f)); - assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconRotate(0.3f)); + assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); }); } @@ -850,30 +815,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - zoom( - exponential( - stop(2, iconRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate( + zoom( + exponential( + stop(2, iconRotate(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconRotate()); - assertNotNull(layer.getIconRotate().getFunction()); - assertEquals(CameraFunction.class, layer.getIconRotate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconRotate()); + assertNotNull(layer.getIconRotate().getFunction()); + assertEquals(CameraFunction.class, layer.getIconRotate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).size()); }); } @@ -882,23 +844,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getIconRotate()); - assertNotNull(layer.getIconRotate().getFunction()); - assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconRotate().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getIconRotate()); + assertNotNull(layer.getIconRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconRotate().getFunction().getStops().getClass()); }); } @@ -907,30 +866,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, iconRotate(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconRotate()); - assertNotNull(layer.getIconRotate().getFunction()); - assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconRotate()); + assertNotNull(layer.getIconRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass()); }); } @@ -939,33 +895,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconRotate(0.3f)) - ) - ).withDefaultValue(iconRotate(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconRotate()); - assertNotNull(layer.getIconRotate().getFunction()); - assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconRotate().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconRotate(0.3f)) + ) + ).withDefaultValue(iconRotate(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconRotate()); + assertNotNull(layer.getIconRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconRotate().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue().getValue()); }); } @@ -975,38 +928,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, iconRotate(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(iconRotate(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconRotate()); - assertNotNull(layer.getIconRotate().getFunction()); - assertEquals(CompositeFunction.class, layer.getIconRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconRotate().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconRotate().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, iconRotate(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(iconRotate(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconRotate()); + assertNotNull(layer.getIconRotate().getFunction()); + assertEquals(CompositeFunction.class, layer.getIconRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconRotate().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconRotate().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1015,15 +965,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconPadding(0.3f)); - assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconPadding(0.3f)); + assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); }); } @@ -1032,30 +979,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconPadding( - zoom( - exponential( - stop(2, iconPadding(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconPadding( + zoom( + exponential( + stop(2, iconPadding(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconPadding()); - assertNotNull(layer.getIconPadding().getFunction()); - assertEquals(CameraFunction.class, layer.getIconPadding().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconPadding().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconPadding()); + assertNotNull(layer.getIconPadding().getFunction()); + assertEquals(CameraFunction.class, layer.getIconPadding().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconPadding().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).size()); }); } @@ -1064,15 +1008,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconKeepUpright(true)); - assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconKeepUpright(true)); + assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); }); } @@ -1081,29 +1022,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconKeepUpright( - zoom( - interval( - stop(2, iconKeepUpright(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconKeepUpright( + zoom( + interval( + stop(2, iconKeepUpright(true)) ) ) - ); - - // Verify - assertNotNull(layer.getIconKeepUpright()); - assertNotNull(layer.getIconKeepUpright().getFunction()); - assertEquals(CameraFunction.class, layer.getIconKeepUpright().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconKeepUpright().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconKeepUpright().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconKeepUpright()); + assertNotNull(layer.getIconKeepUpright().getFunction()); + assertEquals(CameraFunction.class, layer.getIconKeepUpright().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconKeepUpright().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconKeepUpright().getFunction().getStops()).size()); }); } @@ -1112,15 +1050,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconOffset(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconOffset(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -1129,30 +1064,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset( - zoom( - exponential( - stop(2, iconOffset(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOffset( + zoom( + exponential( + stop(2, iconOffset(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconOffset()); - assertNotNull(layer.getIconOffset().getFunction()); - assertEquals(CameraFunction.class, layer.getIconOffset().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconOffset().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconOffset().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconOffset().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconOffset()); + assertNotNull(layer.getIconOffset().getFunction()); + assertEquals(CameraFunction.class, layer.getIconOffset().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconOffset().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconOffset().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconOffset().getFunction().getStops()).size()); }); } @@ -1161,23 +1093,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset(property("FeaturePropertyA", Stops.<Float[]>identity())) - ); - - // Verify - assertNotNull(layer.getIconOffset()); - assertNotNull(layer.getIconOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getIconOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOffset().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconOffset().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOffset(property("FeaturePropertyA", Stops.<Float[]>identity())) + ); + + // Verify + assertNotNull(layer.getIconOffset()); + assertNotNull(layer.getIconOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getIconOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOffset().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconOffset().getFunction().getStops().getClass()); }); } @@ -1186,30 +1115,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset( - property( - "FeaturePropertyA", - interval( - stop(1, iconOffset(new Float[] {0f, 0f})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOffset( + property( + "FeaturePropertyA", + interval( + stop(1, iconOffset(new Float[] {0f, 0f})) ) ) - ); - - // Verify - assertNotNull(layer.getIconOffset()); - assertNotNull(layer.getIconOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getIconOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOffset().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getIconOffset().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconOffset()); + assertNotNull(layer.getIconOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getIconOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOffset().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getIconOffset().getFunction().getStops().getClass()); }); } @@ -1218,15 +1144,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconAnchor(ICON_ANCHOR_CENTER)); - assertEquals((String) layer.getIconAnchor().getValue(), (String) ICON_ANCHOR_CENTER); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconAnchor(ICON_ANCHOR_CENTER)); + assertEquals((String) layer.getIconAnchor().getValue(), (String) ICON_ANCHOR_CENTER); }); } @@ -1235,29 +1158,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAnchor( - zoom( - interval( - stop(2, iconAnchor(ICON_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor( + zoom( + interval( + stop(2, iconAnchor(ICON_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getIconAnchor()); - assertNotNull(layer.getIconAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getIconAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconAnchor().getFunction().getStops()).size()); }); } @@ -1266,23 +1186,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAnchor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getIconAnchor()); - assertNotNull(layer.getIconAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); }); } @@ -1291,30 +1208,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAnchor( - property( - "FeaturePropertyA", - interval( - stop(1, iconAnchor(ICON_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor( + property( + "FeaturePropertyA", + interval( + stop(1, iconAnchor(ICON_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getIconAnchor()); - assertNotNull(layer.getIconAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); }); } @@ -1323,15 +1237,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)); - assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP); }); } @@ -1340,29 +1251,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconPitchAlignment( - zoom( - interval( - stop(2, iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconPitchAlignment( + zoom( + interval( + stop(2, iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getIconPitchAlignment()); - assertNotNull(layer.getIconPitchAlignment().getFunction()); - assertEquals(CameraFunction.class, layer.getIconPitchAlignment().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconPitchAlignment().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconPitchAlignment().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconPitchAlignment()); + assertNotNull(layer.getIconPitchAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getIconPitchAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconPitchAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconPitchAlignment().getFunction().getStops()).size()); }); } @@ -1371,15 +1279,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); - assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); }); } @@ -1388,29 +1293,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textPitchAlignment( - zoom( - interval( - stop(2, textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textPitchAlignment( + zoom( + interval( + stop(2, textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getTextPitchAlignment()); - assertNotNull(layer.getTextPitchAlignment().getFunction()); - assertEquals(CameraFunction.class, layer.getTextPitchAlignment().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextPitchAlignment().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextPitchAlignment().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextPitchAlignment()); + assertNotNull(layer.getTextPitchAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getTextPitchAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextPitchAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextPitchAlignment().getFunction().getStops()).size()); }); } @@ -1419,15 +1321,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); - assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); + assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); }); } @@ -1436,29 +1335,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotationAlignment( - zoom( - interval( - stop(2, textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotationAlignment( + zoom( + interval( + stop(2, textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getTextRotationAlignment()); - assertNotNull(layer.getTextRotationAlignment().getFunction()); - assertEquals(CameraFunction.class, layer.getTextRotationAlignment().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextRotationAlignment().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextRotationAlignment().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextRotationAlignment()); + assertNotNull(layer.getTextRotationAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getTextRotationAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextRotationAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextRotationAlignment().getFunction().getStops()).size()); }); } @@ -1467,15 +1363,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textField("")); - assertEquals((String) layer.getTextField().getValue(), (String) ""); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textField("")); + assertEquals((String) layer.getTextField().getValue(), (String) ""); }); } @@ -1484,29 +1377,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textField( - zoom( - interval( - stop(2, textField("")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textField( + zoom( + interval( + stop(2, textField("")) ) ) - ); - - // Verify - assertNotNull(layer.getTextField()); - assertNotNull(layer.getTextField().getFunction()); - assertEquals(CameraFunction.class, layer.getTextField().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextField().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextField()); + assertNotNull(layer.getTextField().getFunction()); + assertEquals(CameraFunction.class, layer.getTextField().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextField().getFunction().getStops()).size()); }); } @@ -1515,23 +1405,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textField(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getTextField()); - assertNotNull(layer.getTextField().getFunction()); - assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextField().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textField(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getTextField()); + assertNotNull(layer.getTextField().getFunction()); + assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextField().getFunction().getStops().getClass()); }); } @@ -1540,30 +1427,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textField( - property( - "FeaturePropertyA", - interval( - stop(1, textField("")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textField( + property( + "FeaturePropertyA", + interval( + stop(1, textField("")) ) ) - ); - - // Verify - assertNotNull(layer.getTextField()); - assertNotNull(layer.getTextField().getFunction()); - assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextField()); + assertNotNull(layer.getTextField().getFunction()); + assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass()); }); } @@ -1572,15 +1456,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-font"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})); - assertEquals((String[]) layer.getTextFont().getValue(), (String[]) new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})); + assertEquals((String[]) layer.getTextFont().getValue(), (String[]) new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}); }); } @@ -1589,29 +1470,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-font"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textFont( - zoom( - interval( - stop(2, textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textFont( + zoom( + interval( + stop(2, textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})) ) ) - ); - - // Verify - assertNotNull(layer.getTextFont()); - assertNotNull(layer.getTextFont().getFunction()); - assertEquals(CameraFunction.class, layer.getTextFont().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextFont().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextFont().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextFont()); + assertNotNull(layer.getTextFont().getFunction()); + assertEquals(CameraFunction.class, layer.getTextFont().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextFont().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextFont().getFunction().getStops()).size()); }); } @@ -1620,15 +1498,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textSize(0.3f)); - assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textSize(0.3f)); + assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); }); } @@ -1637,30 +1512,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - zoom( - exponential( - stop(2, textSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize( + zoom( + exponential( + stop(2, textSize(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextSize()); - assertNotNull(layer.getTextSize().getFunction()); - assertEquals(CameraFunction.class, layer.getTextSize().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextSize()); + assertNotNull(layer.getTextSize().getFunction()); + assertEquals(CameraFunction.class, layer.getTextSize().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size()); }); } @@ -1669,23 +1541,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextSize()); - assertNotNull(layer.getTextSize().getFunction()); - assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextSize().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextSize()); + assertNotNull(layer.getTextSize().getFunction()); + assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextSize().getFunction().getStops().getClass()); }); } @@ -1694,30 +1563,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textSize(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextSize()); - assertNotNull(layer.getTextSize().getFunction()); - assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextSize()); + assertNotNull(layer.getTextSize().getFunction()); + assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass()); }); } @@ -1726,33 +1592,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textSize(0.3f)) - ) - ).withDefaultValue(textSize(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextSize()); - assertNotNull(layer.getTextSize().getFunction()); - assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextSize().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textSize(0.3f)) + ) + ).withDefaultValue(textSize(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextSize()); + assertNotNull(layer.getTextSize().getFunction()); + assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextSize().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue().getValue()); }); } @@ -1762,38 +1625,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textSize(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textSize(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextSize()); - assertNotNull(layer.getTextSize().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextSize().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextSize().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextSize().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textSize(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textSize(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextSize()); + assertNotNull(layer.getTextSize().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextSize().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextSize().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextSize().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1802,15 +1662,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textMaxWidth(0.3f)); - assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textMaxWidth(0.3f)); + assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); }); } @@ -1819,30 +1676,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - zoom( - exponential( - stop(2, textMaxWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + zoom( + exponential( + stop(2, textMaxWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(CameraFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(CameraFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); }); } @@ -1851,23 +1705,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); }); } @@ -1876,30 +1727,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textMaxWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textMaxWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); }); } @@ -1908,33 +1756,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textMaxWidth(0.3f)) - ) - ).withDefaultValue(textMaxWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textMaxWidth(0.3f)) + ) + ).withDefaultValue(textMaxWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -1944,38 +1789,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textMaxWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textMaxWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextMaxWidth().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textMaxWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textMaxWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextMaxWidth().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -1984,15 +1826,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-line-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textLineHeight(0.3f)); - assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textLineHeight(0.3f)); + assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); }); } @@ -2001,30 +1840,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-line-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLineHeight( - zoom( - exponential( - stop(2, textLineHeight(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLineHeight( + zoom( + exponential( + stop(2, textLineHeight(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextLineHeight()); - assertNotNull(layer.getTextLineHeight().getFunction()); - assertEquals(CameraFunction.class, layer.getTextLineHeight().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextLineHeight().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextLineHeight()); + assertNotNull(layer.getTextLineHeight().getFunction()); + assertEquals(CameraFunction.class, layer.getTextLineHeight().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextLineHeight().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).size()); }); } @@ -2033,15 +1869,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textLetterSpacing(0.3f)); - assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textLetterSpacing(0.3f)); + assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); }); } @@ -2050,30 +1883,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - zoom( - exponential( - stop(2, textLetterSpacing(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + zoom( + exponential( + stop(2, textLetterSpacing(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(CameraFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(CameraFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); }); } @@ -2082,23 +1912,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); }); } @@ -2107,30 +1934,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textLetterSpacing(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textLetterSpacing(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); }); } @@ -2139,33 +1963,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textLetterSpacing(0.3f)) - ) - ).withDefaultValue(textLetterSpacing(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textLetterSpacing(0.3f)) + ) + ).withDefaultValue(textLetterSpacing(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); }); } @@ -2175,38 +1996,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textLetterSpacing(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textLetterSpacing(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextLetterSpacing().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textLetterSpacing(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textLetterSpacing(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextLetterSpacing().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -2215,15 +2033,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); - assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); + assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); }); } @@ -2232,29 +2047,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify( - zoom( - interval( - stop(2, textJustify(TEXT_JUSTIFY_LEFT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify( + zoom( + interval( + stop(2, textJustify(TEXT_JUSTIFY_LEFT)) ) ) - ); - - // Verify - assertNotNull(layer.getTextJustify()); - assertNotNull(layer.getTextJustify().getFunction()); - assertEquals(CameraFunction.class, layer.getTextJustify().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextJustify().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(CameraFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextJustify().getFunction().getStops()).size()); }); } @@ -2263,23 +2075,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getTextJustify()); - assertNotNull(layer.getTextJustify().getFunction()); - assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextJustify().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextJustify().getFunction().getStops().getClass()); }); } @@ -2288,30 +2097,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify( - property( - "FeaturePropertyA", - interval( - stop(1, textJustify(TEXT_JUSTIFY_LEFT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify( + property( + "FeaturePropertyA", + interval( + stop(1, textJustify(TEXT_JUSTIFY_LEFT)) ) ) - ); - - // Verify - assertNotNull(layer.getTextJustify()); - assertNotNull(layer.getTextJustify().getFunction()); - assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); }); } @@ -2320,15 +2126,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); - assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); + assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); }); } @@ -2337,29 +2140,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor( - zoom( - interval( - stop(2, textAnchor(TEXT_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor( + zoom( + interval( + stop(2, textAnchor(TEXT_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getTextAnchor()); - assertNotNull(layer.getTextAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getTextAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextAnchor().getFunction().getStops()).size()); }); } @@ -2368,23 +2168,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getTextAnchor()); - assertNotNull(layer.getTextAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); }); } @@ -2393,30 +2190,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor( - property( - "FeaturePropertyA", - interval( - stop(1, textAnchor(TEXT_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor( + property( + "FeaturePropertyA", + interval( + stop(1, textAnchor(TEXT_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getTextAnchor()); - assertNotNull(layer.getTextAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); }); } @@ -2425,15 +2219,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-angle"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textMaxAngle(0.3f)); - assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textMaxAngle(0.3f)); + assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); }); } @@ -2442,30 +2233,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-angle"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxAngle( - zoom( - exponential( - stop(2, textMaxAngle(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxAngle( + zoom( + exponential( + stop(2, textMaxAngle(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextMaxAngle()); - assertNotNull(layer.getTextMaxAngle().getFunction()); - assertEquals(CameraFunction.class, layer.getTextMaxAngle().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextMaxAngle().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextMaxAngle()); + assertNotNull(layer.getTextMaxAngle().getFunction()); + assertEquals(CameraFunction.class, layer.getTextMaxAngle().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextMaxAngle().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).size()); }); } @@ -2474,15 +2262,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textRotate(0.3f)); - assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textRotate(0.3f)); + assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); }); } @@ -2491,30 +2276,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - zoom( - exponential( - stop(2, textRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + zoom( + exponential( + stop(2, textRotate(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextRotate()); - assertNotNull(layer.getTextRotate().getFunction()); - assertEquals(CameraFunction.class, layer.getTextRotate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(CameraFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size()); }); } @@ -2523,23 +2305,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextRotate()); - assertNotNull(layer.getTextRotate().getFunction()); - assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextRotate().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextRotate().getFunction().getStops().getClass()); }); } @@ -2548,30 +2327,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textRotate(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextRotate()); - assertNotNull(layer.getTextRotate().getFunction()); - assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); }); } @@ -2580,33 +2356,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textRotate(0.3f)) - ) - ).withDefaultValue(textRotate(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextRotate()); - assertNotNull(layer.getTextRotate().getFunction()); - assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextRotate().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textRotate(0.3f)) + ) + ).withDefaultValue(textRotate(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue()); }); } @@ -2616,38 +2389,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textRotate(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textRotate(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextRotate()); - assertNotNull(layer.getTextRotate().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextRotate().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextRotate().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextRotate().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textRotate(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textRotate(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextRotate().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -2656,15 +2426,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textPadding(0.3f)); - assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textPadding(0.3f)); + assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); }); } @@ -2673,30 +2440,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textPadding( - zoom( - exponential( - stop(2, textPadding(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textPadding( + zoom( + exponential( + stop(2, textPadding(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextPadding()); - assertNotNull(layer.getTextPadding().getFunction()); - assertEquals(CameraFunction.class, layer.getTextPadding().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextPadding().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextPadding()); + assertNotNull(layer.getTextPadding().getFunction()); + assertEquals(CameraFunction.class, layer.getTextPadding().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextPadding().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).size()); }); } @@ -2705,15 +2469,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textKeepUpright(true)); - assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textKeepUpright(true)); + assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); }); } @@ -2722,29 +2483,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textKeepUpright( - zoom( - interval( - stop(2, textKeepUpright(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textKeepUpright( + zoom( + interval( + stop(2, textKeepUpright(true)) ) ) - ); - - // Verify - assertNotNull(layer.getTextKeepUpright()); - assertNotNull(layer.getTextKeepUpright().getFunction()); - assertEquals(CameraFunction.class, layer.getTextKeepUpright().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextKeepUpright().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextKeepUpright().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextKeepUpright()); + assertNotNull(layer.getTextKeepUpright().getFunction()); + assertEquals(CameraFunction.class, layer.getTextKeepUpright().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextKeepUpright().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextKeepUpright().getFunction().getStops()).size()); }); } @@ -2753,15 +2511,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); - assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); + assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); }); } @@ -2770,29 +2525,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform( - zoom( - interval( - stop(2, textTransform(TEXT_TRANSFORM_NONE)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textTransform( + zoom( + interval( + stop(2, textTransform(TEXT_TRANSFORM_NONE)) ) ) - ); - - // Verify - assertNotNull(layer.getTextTransform()); - assertNotNull(layer.getTextTransform().getFunction()); - assertEquals(CameraFunction.class, layer.getTextTransform().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextTransform().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextTransform()); + assertNotNull(layer.getTextTransform().getFunction()); + assertEquals(CameraFunction.class, layer.getTextTransform().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextTransform().getFunction().getStops()).size()); }); } @@ -2801,23 +2553,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getTextTransform()); - assertNotNull(layer.getTextTransform().getFunction()); - assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextTransform().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textTransform(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getTextTransform()); + assertNotNull(layer.getTextTransform().getFunction()); + assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextTransform().getFunction().getStops().getClass()); }); } @@ -2826,30 +2575,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform( - property( - "FeaturePropertyA", - interval( - stop(1, textTransform(TEXT_TRANSFORM_NONE)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textTransform( + property( + "FeaturePropertyA", + interval( + stop(1, textTransform(TEXT_TRANSFORM_NONE)) ) ) - ); - - // Verify - assertNotNull(layer.getTextTransform()); - assertNotNull(layer.getTextTransform().getFunction()); - assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextTransform()); + assertNotNull(layer.getTextTransform().getFunction()); + assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass()); }); } @@ -2858,15 +2604,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textOffset(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textOffset(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -2875,30 +2618,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset( - zoom( - exponential( - stop(2, textOffset(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOffset( + zoom( + exponential( + stop(2, textOffset(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextOffset()); - assertNotNull(layer.getTextOffset().getFunction()); - assertEquals(CameraFunction.class, layer.getTextOffset().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextOffset().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextOffset().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextOffset().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextOffset()); + assertNotNull(layer.getTextOffset().getFunction()); + assertEquals(CameraFunction.class, layer.getTextOffset().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextOffset().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextOffset().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextOffset().getFunction().getStops()).size()); }); } @@ -2907,23 +2647,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset(property("FeaturePropertyA", Stops.<Float[]>identity())) - ); - - // Verify - assertNotNull(layer.getTextOffset()); - assertNotNull(layer.getTextOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getTextOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOffset().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextOffset().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOffset(property("FeaturePropertyA", Stops.<Float[]>identity())) + ); + + // Verify + assertNotNull(layer.getTextOffset()); + assertNotNull(layer.getTextOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getTextOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOffset().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextOffset().getFunction().getStops().getClass()); }); } @@ -2932,30 +2669,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset( - property( - "FeaturePropertyA", - interval( - stop(1, textOffset(new Float[] {0f, 0f})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOffset( + property( + "FeaturePropertyA", + interval( + stop(1, textOffset(new Float[] {0f, 0f})) ) ) - ); - - // Verify - assertNotNull(layer.getTextOffset()); - assertNotNull(layer.getTextOffset().getFunction()); - assertEquals(SourceFunction.class, layer.getTextOffset().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOffset().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextOffset().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextOffset()); + assertNotNull(layer.getTextOffset().getFunction()); + assertEquals(SourceFunction.class, layer.getTextOffset().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOffset().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextOffset().getFunction().getStops().getClass()); }); } @@ -2964,15 +2698,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textAllowOverlap(true)); - assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textAllowOverlap(true)); + assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); }); } @@ -2981,29 +2712,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAllowOverlap( - zoom( - interval( - stop(2, textAllowOverlap(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textAllowOverlap( + zoom( + interval( + stop(2, textAllowOverlap(true)) ) ) - ); - - // Verify - assertNotNull(layer.getTextAllowOverlap()); - assertNotNull(layer.getTextAllowOverlap().getFunction()); - assertEquals(CameraFunction.class, layer.getTextAllowOverlap().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextAllowOverlap().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextAllowOverlap().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextAllowOverlap()); + assertNotNull(layer.getTextAllowOverlap().getFunction()); + assertEquals(CameraFunction.class, layer.getTextAllowOverlap().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextAllowOverlap().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextAllowOverlap().getFunction().getStops()).size()); }); } @@ -3012,15 +2740,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textIgnorePlacement(true)); - assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textIgnorePlacement(true)); + assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); }); } @@ -3029,29 +2754,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textIgnorePlacement( - zoom( - interval( - stop(2, textIgnorePlacement(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textIgnorePlacement( + zoom( + interval( + stop(2, textIgnorePlacement(true)) ) ) - ); - - // Verify - assertNotNull(layer.getTextIgnorePlacement()); - assertNotNull(layer.getTextIgnorePlacement().getFunction()); - assertEquals(CameraFunction.class, layer.getTextIgnorePlacement().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextIgnorePlacement().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextIgnorePlacement().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextIgnorePlacement()); + assertNotNull(layer.getTextIgnorePlacement().getFunction()); + assertEquals(CameraFunction.class, layer.getTextIgnorePlacement().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextIgnorePlacement().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextIgnorePlacement().getFunction().getStops()).size()); }); } @@ -3060,15 +2782,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textOptional(true)); - assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textOptional(true)); + assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); }); } @@ -3077,29 +2796,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOptional( - zoom( - interval( - stop(2, textOptional(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOptional( + zoom( + interval( + stop(2, textOptional(true)) ) ) - ); - - // Verify - assertNotNull(layer.getTextOptional()); - assertNotNull(layer.getTextOptional().getFunction()); - assertEquals(CameraFunction.class, layer.getTextOptional().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextOptional().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextOptional().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextOptional()); + assertNotNull(layer.getTextOptional().getFunction()); + assertEquals(CameraFunction.class, layer.getTextOptional().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextOptional().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextOptional().getFunction().getStops()).size()); }); } @@ -3108,16 +2824,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconOpacityTransition(options); - assertEquals(layer.getIconOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconOpacityTransition(options); + assertEquals(layer.getIconOpacityTransition(), options); }); } @@ -3126,15 +2839,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconOpacity(0.3f)); - assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconOpacity(0.3f)); + assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); }); } @@ -3143,30 +2853,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - zoom( - exponential( - stop(2, iconOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity( + zoom( + exponential( + stop(2, iconOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconOpacity()); - assertNotNull(layer.getIconOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getIconOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconOpacity()); + assertNotNull(layer.getIconOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getIconOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).size()); }); } @@ -3175,23 +2882,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getIconOpacity()); - assertNotNull(layer.getIconOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getIconOpacity()); + assertNotNull(layer.getIconOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); }); } @@ -3200,30 +2904,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, iconOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconOpacity()); - assertNotNull(layer.getIconOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconOpacity()); + assertNotNull(layer.getIconOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); }); } @@ -3232,33 +2933,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconOpacity(0.3f)) - ) - ).withDefaultValue(iconOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconOpacity()); - assertNotNull(layer.getIconOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconOpacity(0.3f)) + ) + ).withDefaultValue(iconOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconOpacity()); + assertNotNull(layer.getIconOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue().getValue()); }); } @@ -3268,38 +2966,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, iconOpacity(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(iconOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconOpacity()); - assertNotNull(layer.getIconOpacity().getFunction()); - assertEquals(CompositeFunction.class, layer.getIconOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconOpacity().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, iconOpacity(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(iconOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconOpacity()); + assertNotNull(layer.getIconOpacity().getFunction()); + assertEquals(CompositeFunction.class, layer.getIconOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconOpacity().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -3308,16 +3003,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconColorTransition(options); - assertEquals(layer.getIconColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconColorTransition(options); + assertEquals(layer.getIconColorTransition(), options); }); } @@ -3326,15 +3018,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -3343,30 +3032,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - zoom( - exponential( - stop(2, iconColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconColor( + zoom( + exponential( + stop(2, iconColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconColor()); - assertNotNull(layer.getIconColor().getFunction()); - assertEquals(CameraFunction.class, layer.getIconColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconColor()); + assertNotNull(layer.getIconColor().getFunction()); + assertEquals(CameraFunction.class, layer.getIconColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconColor().getFunction().getStops()).size()); }); } @@ -3375,23 +3061,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getIconColor()); - assertNotNull(layer.getIconColor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getIconColor()); + assertNotNull(layer.getIconColor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconColor().getFunction().getStops().getClass()); }); } @@ -3400,30 +3083,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, iconColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, iconColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconColor()); - assertNotNull(layer.getIconColor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconColor()); + assertNotNull(layer.getIconColor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconColor().getFunction().getStops().getClass()); }); } @@ -3432,33 +3112,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", iconColor(Color.RED)) - ) - ).withDefaultValue(iconColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getIconColor()); - assertNotNull(layer.getIconColor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", iconColor(Color.RED)) + ) + ).withDefaultValue(iconColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getIconColor()); + assertNotNull(layer.getIconColor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -3468,15 +3145,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconColor(Color.RED)); - assertEquals(layer.getIconColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconColor(Color.RED)); + assertEquals(layer.getIconColorAsInt(), Color.RED); }); } @@ -3485,16 +3159,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloColorTransition(options); - assertEquals(layer.getIconHaloColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloColorTransition(options); + assertEquals(layer.getIconHaloColorTransition(), options); }); } @@ -3503,15 +3174,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -3520,30 +3188,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor( - zoom( - exponential( - stop(2, iconHaloColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloColor( + zoom( + exponential( + stop(2, iconHaloColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconHaloColor()); - assertNotNull(layer.getIconHaloColor().getFunction()); - assertEquals(CameraFunction.class, layer.getIconHaloColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconHaloColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconHaloColor()); + assertNotNull(layer.getIconHaloColor().getFunction()); + assertEquals(CameraFunction.class, layer.getIconHaloColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconHaloColor().getFunction().getStops()).size()); }); } @@ -3552,23 +3217,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getIconHaloColor()); - assertNotNull(layer.getIconHaloColor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getIconHaloColor()); + assertNotNull(layer.getIconHaloColor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); }); } @@ -3577,30 +3239,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, iconHaloColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, iconHaloColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconHaloColor()); - assertNotNull(layer.getIconHaloColor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconHaloColor()); + assertNotNull(layer.getIconHaloColor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); }); } @@ -3609,33 +3268,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", iconHaloColor(Color.RED)) - ) - ).withDefaultValue(iconHaloColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getIconHaloColor()); - assertNotNull(layer.getIconHaloColor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", iconHaloColor(Color.RED)) + ) + ).withDefaultValue(iconHaloColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getIconHaloColor()); + assertNotNull(layer.getIconHaloColor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconHaloColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -3645,15 +3301,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloColor(Color.RED)); - assertEquals(layer.getIconHaloColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloColor(Color.RED)); + assertEquals(layer.getIconHaloColorAsInt(), Color.RED); }); } @@ -3662,16 +3315,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloWidthTransition(options); - assertEquals(layer.getIconHaloWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloWidthTransition(options); + assertEquals(layer.getIconHaloWidthTransition(), options); }); } @@ -3680,15 +3330,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloWidth(0.3f)); - assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloWidth(0.3f)); + assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); }); } @@ -3697,30 +3344,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - zoom( - exponential( - stop(2, iconHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth( + zoom( + exponential( + stop(2, iconHaloWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconHaloWidth()); - assertNotNull(layer.getIconHaloWidth().getFunction()); - assertEquals(CameraFunction.class, layer.getIconHaloWidth().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconHaloWidth()); + assertNotNull(layer.getIconHaloWidth().getFunction()); + assertEquals(CameraFunction.class, layer.getIconHaloWidth().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).size()); }); } @@ -3729,23 +3373,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getIconHaloWidth()); - assertNotNull(layer.getIconHaloWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getIconHaloWidth()); + assertNotNull(layer.getIconHaloWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); }); } @@ -3754,30 +3395,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, iconHaloWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconHaloWidth()); - assertNotNull(layer.getIconHaloWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconHaloWidth()); + assertNotNull(layer.getIconHaloWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); }); } @@ -3786,33 +3424,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconHaloWidth(0.3f)) - ) - ).withDefaultValue(iconHaloWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconHaloWidth()); - assertNotNull(layer.getIconHaloWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconHaloWidth(0.3f)) + ) + ).withDefaultValue(iconHaloWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconHaloWidth()); + assertNotNull(layer.getIconHaloWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -3822,38 +3457,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, iconHaloWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(iconHaloWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconHaloWidth()); - assertNotNull(layer.getIconHaloWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getIconHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconHaloWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconHaloWidth().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, iconHaloWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(iconHaloWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconHaloWidth()); + assertNotNull(layer.getIconHaloWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getIconHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconHaloWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconHaloWidth().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -3862,16 +3494,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blurTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloBlurTransition(options); - assertEquals(layer.getIconHaloBlurTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloBlurTransition(options); + assertEquals(layer.getIconHaloBlurTransition(), options); }); } @@ -3880,15 +3509,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloBlur(0.3f)); - assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloBlur(0.3f)); + assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); }); } @@ -3897,30 +3523,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - zoom( - exponential( - stop(2, iconHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur( + zoom( + exponential( + stop(2, iconHaloBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconHaloBlur()); - assertNotNull(layer.getIconHaloBlur().getFunction()); - assertEquals(CameraFunction.class, layer.getIconHaloBlur().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconHaloBlur()); + assertNotNull(layer.getIconHaloBlur().getFunction()); + assertEquals(CameraFunction.class, layer.getIconHaloBlur().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).size()); }); } @@ -3929,23 +3552,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getIconHaloBlur()); - assertNotNull(layer.getIconHaloBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getIconHaloBlur()); + assertNotNull(layer.getIconHaloBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); }); } @@ -3954,30 +3574,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, iconHaloBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconHaloBlur()); - assertNotNull(layer.getIconHaloBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconHaloBlur()); + assertNotNull(layer.getIconHaloBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); }); } @@ -3986,33 +3603,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconHaloBlur(0.3f)) - ) - ).withDefaultValue(iconHaloBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconHaloBlur()); - assertNotNull(layer.getIconHaloBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconHaloBlur(0.3f)) + ) + ).withDefaultValue(iconHaloBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconHaloBlur()); + assertNotNull(layer.getIconHaloBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue().getValue()); }); } @@ -4022,38 +3636,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, iconHaloBlur(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(iconHaloBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getIconHaloBlur()); - assertNotNull(layer.getIconHaloBlur().getFunction()); - assertEquals(CompositeFunction.class, layer.getIconHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconHaloBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconHaloBlur().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, iconHaloBlur(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(iconHaloBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getIconHaloBlur()); + assertNotNull(layer.getIconHaloBlur().getFunction()); + assertEquals(CompositeFunction.class, layer.getIconHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconHaloBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconHaloBlur().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -4062,16 +3673,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconTranslateTransition(options); - assertEquals(layer.getIconTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconTranslateTransition(options); + assertEquals(layer.getIconTranslateTransition(), options); }); } @@ -4080,15 +3688,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -4097,30 +3702,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTranslate( - zoom( - exponential( - stop(2, iconTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconTranslate( + zoom( + exponential( + stop(2, iconTranslate(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getIconTranslate()); - assertNotNull(layer.getIconTranslate().getFunction()); - assertEquals(CameraFunction.class, layer.getIconTranslate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getIconTranslate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconTranslate()); + assertNotNull(layer.getIconTranslate().getFunction()); + assertEquals(CameraFunction.class, layer.getIconTranslate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getIconTranslate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).size()); }); } @@ -4129,15 +3731,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); }); } @@ -4146,29 +3745,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTranslateAnchor( - zoom( - interval( - stop(2, iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconTranslateAnchor( + zoom( + interval( + stop(2, iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getIconTranslateAnchor()); - assertNotNull(layer.getIconTranslateAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getIconTranslateAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconTranslateAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconTranslateAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconTranslateAnchor()); + assertNotNull(layer.getIconTranslateAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getIconTranslateAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconTranslateAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconTranslateAnchor().getFunction().getStops()).size()); }); } @@ -4177,16 +3773,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextOpacityTransition(options); - assertEquals(layer.getTextOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextOpacityTransition(options); + assertEquals(layer.getTextOpacityTransition(), options); }); } @@ -4195,15 +3788,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textOpacity(0.3f)); - assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textOpacity(0.3f)); + assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); }); } @@ -4212,30 +3802,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - zoom( - exponential( - stop(2, textOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity( + zoom( + exponential( + stop(2, textOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextOpacity()); - assertNotNull(layer.getTextOpacity().getFunction()); - assertEquals(CameraFunction.class, layer.getTextOpacity().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextOpacity()); + assertNotNull(layer.getTextOpacity().getFunction()); + assertEquals(CameraFunction.class, layer.getTextOpacity().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).size()); }); } @@ -4244,23 +3831,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextOpacity()); - assertNotNull(layer.getTextOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextOpacity()); + assertNotNull(layer.getTextOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); }); } @@ -4269,30 +3853,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textOpacity(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextOpacity()); - assertNotNull(layer.getTextOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextOpacity()); + assertNotNull(layer.getTextOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); }); } @@ -4301,33 +3882,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textOpacity(0.3f)) - ) - ).withDefaultValue(textOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextOpacity()); - assertNotNull(layer.getTextOpacity().getFunction()); - assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textOpacity(0.3f)) + ) + ).withDefaultValue(textOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextOpacity()); + assertNotNull(layer.getTextOpacity().getFunction()); + assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue().getValue()); }); } @@ -4337,38 +3915,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textOpacity(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textOpacity(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextOpacity()); - assertNotNull(layer.getTextOpacity().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextOpacity().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextOpacity().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextOpacity().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textOpacity(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textOpacity(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextOpacity()); + assertNotNull(layer.getTextOpacity().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextOpacity().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextOpacity().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextOpacity().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -4377,16 +3952,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextColorTransition(options); - assertEquals(layer.getTextColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextColorTransition(options); + assertEquals(layer.getTextColorTransition(), options); }); } @@ -4395,15 +3967,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -4412,30 +3981,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - zoom( - exponential( - stop(2, textColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textColor( + zoom( + exponential( + stop(2, textColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextColor()); - assertNotNull(layer.getTextColor().getFunction()); - assertEquals(CameraFunction.class, layer.getTextColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextColor()); + assertNotNull(layer.getTextColor().getFunction()); + assertEquals(CameraFunction.class, layer.getTextColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextColor().getFunction().getStops()).size()); }); } @@ -4444,23 +4010,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getTextColor()); - assertNotNull(layer.getTextColor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getTextColor()); + assertNotNull(layer.getTextColor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextColor().getFunction().getStops().getClass()); }); } @@ -4469,30 +4032,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, textColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, textColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextColor()); - assertNotNull(layer.getTextColor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextColor()); + assertNotNull(layer.getTextColor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextColor().getFunction().getStops().getClass()); }); } @@ -4501,33 +4061,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", textColor(Color.RED)) - ) - ).withDefaultValue(textColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getTextColor()); - assertNotNull(layer.getTextColor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", textColor(Color.RED)) + ) + ).withDefaultValue(textColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getTextColor()); + assertNotNull(layer.getTextColor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -4537,15 +4094,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textColor(Color.RED)); - assertEquals(layer.getTextColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textColor(Color.RED)); + assertEquals(layer.getTextColorAsInt(), Color.RED); }); } @@ -4554,16 +4108,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloColorTransition(options); - assertEquals(layer.getTextHaloColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloColorTransition(options); + assertEquals(layer.getTextHaloColorTransition(), options); }); } @@ -4572,15 +4123,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -4589,30 +4137,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor( - zoom( - exponential( - stop(2, textHaloColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloColor( + zoom( + exponential( + stop(2, textHaloColor("rgba(0, 0, 0, 1)")) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextHaloColor()); - assertNotNull(layer.getTextHaloColor().getFunction()); - assertEquals(CameraFunction.class, layer.getTextHaloColor().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloColor().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextHaloColor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextHaloColor()); + assertNotNull(layer.getTextHaloColor().getFunction()); + assertEquals(CameraFunction.class, layer.getTextHaloColor().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloColor().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextHaloColor().getFunction().getStops()).size()); }); } @@ -4621,23 +4166,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor(property("FeaturePropertyA", Stops.<String>identity())) - ); - - // Verify - assertNotNull(layer.getTextHaloColor()); - assertNotNull(layer.getTextHaloColor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloColor(property("FeaturePropertyA", Stops.<String>identity())) + ); + + // Verify + assertNotNull(layer.getTextHaloColor()); + assertNotNull(layer.getTextHaloColor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); }); } @@ -4646,30 +4188,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, textHaloColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloColor( + property( + "FeaturePropertyA", + exponential( + stop(Color.RED, textHaloColor(Color.RED)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextHaloColor()); - assertNotNull(layer.getTextHaloColor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextHaloColor()); + assertNotNull(layer.getTextHaloColor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); }); } @@ -4678,33 +4217,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", textHaloColor(Color.RED)) - ) - ).withDefaultValue(textHaloColor(Color.GREEN)) - ) - ); - - // Verify - assertNotNull(layer.getTextHaloColor()); - assertNotNull(layer.getTextHaloColor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue().getValue()); - assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue().getColorInt()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", textHaloColor(Color.RED)) + ) + ).withDefaultValue(textHaloColor(Color.GREEN)) + ) + ); + + // Verify + assertNotNull(layer.getTextHaloColor()); + assertNotNull(layer.getTextHaloColor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextHaloColor().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue().getValue()); + assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue().getColorInt()); }); } @@ -4714,15 +4250,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloColor(Color.RED)); - assertEquals(layer.getTextHaloColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloColor(Color.RED)); + assertEquals(layer.getTextHaloColorAsInt(), Color.RED); }); } @@ -4731,16 +4264,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloWidthTransition(options); - assertEquals(layer.getTextHaloWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloWidthTransition(options); + assertEquals(layer.getTextHaloWidthTransition(), options); }); } @@ -4749,15 +4279,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloWidth(0.3f)); - assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloWidth(0.3f)); + assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); }); } @@ -4766,30 +4293,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - zoom( - exponential( - stop(2, textHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth( + zoom( + exponential( + stop(2, textHaloWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextHaloWidth()); - assertNotNull(layer.getTextHaloWidth().getFunction()); - assertEquals(CameraFunction.class, layer.getTextHaloWidth().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextHaloWidth()); + assertNotNull(layer.getTextHaloWidth().getFunction()); + assertEquals(CameraFunction.class, layer.getTextHaloWidth().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).size()); }); } @@ -4798,23 +4322,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextHaloWidth()); - assertNotNull(layer.getTextHaloWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextHaloWidth()); + assertNotNull(layer.getTextHaloWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); }); } @@ -4823,30 +4344,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textHaloWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextHaloWidth()); - assertNotNull(layer.getTextHaloWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextHaloWidth()); + assertNotNull(layer.getTextHaloWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); }); } @@ -4855,33 +4373,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textHaloWidth(0.3f)) - ) - ).withDefaultValue(textHaloWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextHaloWidth()); - assertNotNull(layer.getTextHaloWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textHaloWidth(0.3f)) + ) + ).withDefaultValue(textHaloWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextHaloWidth()); + assertNotNull(layer.getTextHaloWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -4891,38 +4406,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textHaloWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textHaloWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextHaloWidth()); - assertNotNull(layer.getTextHaloWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextHaloWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextHaloWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextHaloWidth().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textHaloWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textHaloWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextHaloWidth()); + assertNotNull(layer.getTextHaloWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextHaloWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextHaloWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextHaloWidth().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -4931,16 +4443,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blurTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloBlurTransition(options); - assertEquals(layer.getTextHaloBlurTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloBlurTransition(options); + assertEquals(layer.getTextHaloBlurTransition(), options); }); } @@ -4949,15 +4458,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloBlur(0.3f)); - assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloBlur(0.3f)); + assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); }); } @@ -4966,30 +4472,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - zoom( - exponential( - stop(2, textHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur( + zoom( + exponential( + stop(2, textHaloBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextHaloBlur()); - assertNotNull(layer.getTextHaloBlur().getFunction()); - assertEquals(CameraFunction.class, layer.getTextHaloBlur().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextHaloBlur()); + assertNotNull(layer.getTextHaloBlur().getFunction()); + assertEquals(CameraFunction.class, layer.getTextHaloBlur().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).size()); }); } @@ -4998,23 +4501,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur(property("FeaturePropertyA", Stops.<Float>identity())) - ); - - // Verify - assertNotNull(layer.getTextHaloBlur()); - assertNotNull(layer.getTextHaloBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextHaloBlur()); + assertNotNull(layer.getTextHaloBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); }); } @@ -5023,30 +4523,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textHaloBlur(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextHaloBlur()); - assertNotNull(layer.getTextHaloBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextHaloBlur()); + assertNotNull(layer.getTextHaloBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); }); } @@ -5055,33 +4552,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textHaloBlur(0.3f)) - ) - ).withDefaultValue(textHaloBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextHaloBlur()); - assertNotNull(layer.getTextHaloBlur().getFunction()); - assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textHaloBlur(0.3f)) + ) + ).withDefaultValue(textHaloBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextHaloBlur()); + assertNotNull(layer.getTextHaloBlur().getFunction()); + assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue().getValue()); }); } @@ -5091,38 +4585,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textHaloBlur(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textHaloBlur(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextHaloBlur()); - assertNotNull(layer.getTextHaloBlur().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextHaloBlur().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextHaloBlur().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).size()); - - ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = - (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextHaloBlur().getFunction().getStops(); - Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); - assertEquals(0f, stop.in.zoom, 0.001); - assertEquals(0.3f, stop.in.value, 0.001f); - assertEquals(0.9f, stop.out, 0.001f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textHaloBlur(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textHaloBlur(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextHaloBlur()); + assertNotNull(layer.getTextHaloBlur().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextHaloBlur().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextHaloBlur().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextHaloBlur().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); }); } @@ -5131,16 +4622,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextTranslateTransition(options); - assertEquals(layer.getTextTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextTranslateTransition(options); + assertEquals(layer.getTextTranslateTransition(), options); }); } @@ -5149,15 +4637,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -5166,30 +4651,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTranslate( - zoom( - exponential( - stop(2, textTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textTranslate( + zoom( + exponential( + stop(2, textTranslate(new Float[] {0f, 0f})) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextTranslate()); - assertNotNull(layer.getTextTranslate().getFunction()); - assertEquals(CameraFunction.class, layer.getTextTranslate().getFunction().getClass()); - assertEquals(ExponentialStops.class, layer.getTextTranslate().getFunction().getStops().getClass()); - assertEquals(0.5f, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).getBase(), 0.001); - assertEquals(1, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextTranslate()); + assertNotNull(layer.getTextTranslate().getFunction()); + assertEquals(CameraFunction.class, layer.getTextTranslate().getFunction().getClass()); + assertEquals(ExponentialStops.class, layer.getTextTranslate().getFunction().getStops().getClass()); + assertEquals(0.5f, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).getBase(), 0.001); + assertEquals(1, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).size()); }); } @@ -5198,15 +4680,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); }); } @@ -5215,29 +4694,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTranslateAnchor( - zoom( - interval( - stop(2, textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textTranslateAnchor( + zoom( + interval( + stop(2, textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getTextTranslateAnchor()); - assertNotNull(layer.getTextTranslateAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getTextTranslateAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getTextTranslateAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getTextTranslateAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextTranslateAnchor()); + assertNotNull(layer.getTextTranslateAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getTextTranslateAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getTextTranslateAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getTextTranslateAnchor().getFunction().getStops()).size()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/DrawerUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/DrawerUtils.java index d9ced47369..63c787c59e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/DrawerUtils.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/DrawerUtils.java @@ -4,9 +4,7 @@ import android.support.annotation.StringRes; import android.support.test.espresso.Espresso; import android.support.test.espresso.action.ViewActions; import android.support.test.espresso.matcher.ViewMatchers; - import com.mapbox.mapboxsdk.testapp.R; - import org.hamcrest.Matchers; import static android.support.test.espresso.Espresso.onView; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java index 1c4981ca5e..357e1aa72d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.app.Activity; import android.support.test.espresso.IdlingResource; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java index fba33bb380..97c9e54293 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java @@ -3,11 +3,9 @@ package com.mapbox.mapboxsdk.testapp; import android.app.Application; import android.os.StrictMode; import android.text.TextUtils; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.testapp.utils.TokenUtils; import com.squareup.leakcanary.LeakCanary; - import timber.log.Timber; import static timber.log.Timber.DebugTree; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java index 3f20f19f5d..05f43d612d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java @@ -16,8 +16,6 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; -import android.view.View; - import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.adapter.FeatureAdapter; import com.mapbox.mapboxsdk.testapp.adapter.FeatureSectionAdapter; @@ -25,14 +23,13 @@ import com.mapbox.mapboxsdk.testapp.model.activity.Feature; import com.mapbox.mapboxsdk.testapp.utils.ItemClickSupport; import com.mapbox.services.android.telemetry.permissions.PermissionsListener; import com.mapbox.services.android.telemetry.permissions.PermissionsManager; +import timber.log.Timber; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import timber.log.Timber; - /** * Activity shown when application is started * <p> @@ -62,19 +59,16 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis recyclerView.addOnItemTouchListener(new RecyclerView.SimpleOnItemTouchListener()); recyclerView.setHasFixedSize(true); - ItemClickSupport.addTo(recyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() { - @Override - public void onItemClicked(RecyclerView recyclerView, int position, View view) { - if (!sectionAdapter.isSectionHeaderPosition(position)) { - int itemPosition = sectionAdapter.getConvertedPosition(position); - Feature feature = features.get(itemPosition); - if (feature.isRequiresLocationPermission()) { - if (requestLocationPermission(itemPosition)) { - return; - } + ItemClickSupport.addTo(recyclerView).setOnItemClickListener((recyclerView, position, view) -> { + if (!sectionAdapter.isSectionHeaderPosition(position)) { + int itemPosition = sectionAdapter.getConvertedPosition(position); + Feature feature = features.get(itemPosition); + if (feature.isRequiresLocationPermission()) { + if (requestLocationPermission(itemPosition)) { + return; } - startFeature(feature); } + startFeature(feature); } }); @@ -188,15 +182,12 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis } if (!features.isEmpty()) { - Comparator<Feature> comparator = new Comparator<Feature>() { - @Override - public int compare(Feature lhs, Feature rhs) { - int result = lhs.getCategory().compareToIgnoreCase(rhs.getCategory()); - if (result == 0) { - result = lhs.getLabel().compareToIgnoreCase(rhs.getLabel()); - } - return result; + Comparator<Feature> comparator = (lhs, rhs) -> { + int result = lhs.getCategory().compareToIgnoreCase(rhs.getCategory()); + if (result == 0) { + result = lhs.getLabel().compareToIgnoreCase(rhs.getLabel()); } + return result; }; Collections.sort(features, comparator); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java index 52181cee0c..c601487da7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java @@ -7,12 +7,10 @@ import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.os.Bundle; import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; - import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.Marker; @@ -24,7 +22,6 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.IconUtils; import com.mapbox.services.api.utils.turf.TurfMeasurement; @@ -59,25 +56,18 @@ public class AnimatedMarkerActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { + mapView.getMapAsync(mapboxMap -> { + AnimatedMarkerActivity.this.mapboxMap = mapboxMap; + setupMap(); - @Override - public void onMapReady(@NonNull final MapboxMap mapboxMap) { - AnimatedMarkerActivity.this.mapboxMap = mapboxMap; - setupMap(); - - animationRunnable = new Runnable() { - @Override - public void run() { - for (int i = 0; i < 10; i++) { - addRandomCar(); - } - addPassenger(); - addMainCar(); - } - }; - mapView.post(animationRunnable); - } + animationRunnable = () -> { + for (int i = 0; i < 10; i++) { + addRandomCar(); + } + addPassenger(); + addMainCar(); + }; + mapView.post(animationRunnable); }); } @@ -116,13 +106,10 @@ public class AnimatedMarkerActivity extends AppCompatActivity { if (carMarker == null) { carMarker = createCarMarker(randomLatLng, R.drawable.ic_taxi_top, - new MarkerViewManager.OnMarkerViewAddedListener() { - @Override - public void onViewAdded(@NonNull MarkerView markerView) { - // Make sure the car marker is selected so that it's always brought to the front (#5285) - mapboxMap.selectMarker(carMarker); - animateMoveToPassenger(carMarker); - } + markerView -> { + // Make sure the car marker is selected so that it's always brought to the front (#5285) + mapboxMap.selectMarker(carMarker); + animateMoveToPassenger(carMarker); }); markerViews.add(carMarker); } else { @@ -147,12 +134,7 @@ public class AnimatedMarkerActivity extends AppCompatActivity { protected void addRandomCar() { markerViews.add(createCarMarker(getLatLngInBounds(), R.drawable.ic_car_top, - new MarkerViewManager.OnMarkerViewAddedListener() { - @Override - public void onViewAdded(@NonNull MarkerView markerView) { - randomlyMoveMarker(markerView); - } - })); + markerView -> randomlyMoveMarker(markerView))); } private void randomlyMoveMarker(final MarkerView marker) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java index 50adeb2d74..02daf500f4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v4.content.res.ResourcesCompat; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity; @@ -17,20 +16,17 @@ import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; - import com.mapbox.mapboxsdk.annotations.Icon; -import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil; import com.mapbox.mapboxsdk.testapp.utils.IconUtils; - import org.json.JSONException; +import timber.log.Timber; import java.io.IOException; import java.text.DecimalFormat; @@ -39,8 +35,6 @@ import java.util.List; import java.util.Locale; import java.util.Random; -import timber.log.Timber; - /** * Test activity showcasing adding a large amount of Markers or MarkerViews. */ @@ -58,12 +52,7 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - BulkMarkerActivity.this.mapboxMap = mapboxMap; - } - }); + mapView.getMapAsync(mapboxMap -> BulkMarkerActivity.this.mapboxMap = mapboxMap); final View fab = findViewById(R.id.fab); if (fab != null) { @@ -228,29 +217,22 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView viewCountView = (TextView) findViewById(R.id.countView); - mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { - @Override - public void onMapChanged(@MapView.MapChange int change) { - if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) { - if (!mapboxMap.getMarkerViewManager().getMarkerViewAdapters().isEmpty()) { - viewCountView.setText(String.format(Locale.getDefault(), "ViewCache size %d", - mapboxMap.getMarkerViewManager().getMarkerViewContainer().getChildCount())); - } + mapView.addOnMapChangedListener(change -> { + if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) { + if (!mapboxMap.getMarkerViewManager().getMarkerViewAdapters().isEmpty()) { + viewCountView.setText(String.format(Locale.getDefault(), "ViewCache size %d", + mapboxMap.getMarkerViewManager().getMarkerViewContainer().getChildCount())); } } }); mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener( - new MapboxMap.OnMarkerViewClickListener() { - @Override - public boolean onMarkerClick( - @NonNull Marker marker, @NonNull View view, @NonNull MapboxMap.MarkerViewAdapter adapter) { - Toast.makeText( - BulkMarkerActivity.this, - "Hello " + marker.getId(), - Toast.LENGTH_SHORT).show(); - return false; - } + (marker, view1, adapter) -> { + Toast.makeText( + BulkMarkerActivity.this, + "Hello " + marker.getId(), + Toast.LENGTH_SHORT).show(); + return false; }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java index f7ffc61a7d..f2e4c15f3c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java @@ -1,19 +1,15 @@ package com.mapbox.mapboxsdk.testapp.activity.annotation; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.AppCompatActivity; -import android.view.View; - import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.IconUtils; @@ -37,29 +33,23 @@ public class DynamicMarkerChangeActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.setTag(false); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - DynamicMarkerChangeActivity.this.mapboxMap = mapboxMap; - // Create marker - MarkerOptions markerOptions = new MarkerOptions() - .position(LAT_LNG_CHELSEA) - .icon(IconUtils.drawableToIcon(DynamicMarkerChangeActivity.this, R.drawable.ic_stars, - ResourcesCompat.getColor(getResources(), R.color.blueAccent, getTheme()))) - .title(getString(R.string.dynamic_marker_chelsea_title)) - .snippet(getString(R.string.dynamic_marker_chelsea_snippet)); - marker = mapboxMap.addMarker(markerOptions); - } + mapView.getMapAsync(mapboxMap -> { + DynamicMarkerChangeActivity.this.mapboxMap = mapboxMap; + // Create marker + MarkerOptions markerOptions = new MarkerOptions() + .position(LAT_LNG_CHELSEA) + .icon(IconUtils.drawableToIcon(DynamicMarkerChangeActivity.this, R.drawable.ic_stars, + ResourcesCompat.getColor(getResources(), R.color.blueAccent, getTheme()))) + .title(getString(R.string.dynamic_marker_chelsea_title)) + .snippet(getString(R.string.dynamic_marker_chelsea_snippet)); + marker = mapboxMap.addMarker(markerOptions); }); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - updateMarker(); - } + fab.setOnClickListener(view -> { + if (mapboxMap != null) { + updateMarker(); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java index 61ece0a94f..cba8224424 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java @@ -18,7 +18,6 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; - import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.Marker; @@ -29,7 +28,6 @@ import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerView; import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerViewOptions; @@ -81,127 +79,117 @@ public class MarkerViewActivity extends AppCompatActivity { final TextView viewCountView = (TextView) findViewById(R.id.countView); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - MarkerViewActivity.this.mapboxMap = mapboxMap; - - final MarkerViewManager markerViewManager = mapboxMap.getMarkerViewManager(); - - Icon usFlag = IconFactory.getInstance(MarkerViewActivity.this) - .fromResource(R.drawable.ic_us); - - // add default ViewMarker markers - for (int i = 0; i < LAT_LNGS.length; i++) { - MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions() - .position(LAT_LNGS[i]) - .title(String.valueOf(i)) - .alpha(0.5f) - .icon(usFlag) - ); - } - - // add custom ViewMarker - CountryMarkerViewOptions options = new CountryMarkerViewOptions(); - options.flagRes(R.drawable.icon_burned); - options.abbrevName("Mapbox"); - options.title("Hello"); - options.position(new LatLng(38.899774, -77.023237)); - options.flat(true); - MarkerView markerView = mapboxMap.addMarker(options); - - // Use object animator to rotate MarkerView - ValueAnimator markerAnimator = ObjectAnimator.ofObject(markerView, "rotation", new FloatEvaluator(), -90, 90); - markerAnimator.setDuration(5000); - markerAnimator.start(); - - MarkerViewActivity.this.mapboxMap.addMarker(new MarkerOptions() - .title("United States") - .position(new LatLng(38.902580, -77.050102)) - ); - - rotateMarker = MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions() - .text("A") - .rotation(rotation = 270) - .position(new LatLng(38.889876, -77.008849)) - ); - loopMarkerRotate(); - + mapView.getMapAsync(mapboxMap -> { + MarkerViewActivity.this.mapboxMap = mapboxMap; - MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions() - .text("B") - .position(new LatLng(38.907327, -77.041293)) - ); - - MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions() - .text("C") - .position(new LatLng(38.897642, -77.041980)) - ); + final MarkerViewManager markerViewManager = mapboxMap.getMarkerViewManager(); - // if you want to customise a ViewMarker you need to extend ViewMarker and provide an adapter implementation - // set adapters for child classes of ViewMarker - markerViewManager.addMarkerViewAdapter(new CountryAdapter(MarkerViewActivity.this, mapboxMap)); - markerViewManager.addMarkerViewAdapter(new TextAdapter(MarkerViewActivity.this, mapboxMap)); - - final ViewGroup markerViewContainer = markerViewManager.getMarkerViewContainer(); - - // add a change listener to validate the size of amount of child views - mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { - @Override - public void onMapChanged(@MapView.MapChange int change) { - if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) { - if (!markerViewManager.getMarkerViewAdapters().isEmpty() && viewCountView != null) { - viewCountView.setText(String.format( - Locale.getDefault(), - getString(R.string.viewcache_size), - markerViewContainer.getChildCount()) - ); - } - } - } - }); + Icon usFlag = IconFactory.getInstance(MarkerViewActivity.this) + .fromResource(R.drawable.ic_us); - // add a OnMarkerView click listener - MarkerViewActivity.this.mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener( - new MapboxMap.OnMarkerViewClickListener() { - @Override - public boolean onMarkerClick(@NonNull Marker marker, @NonNull View view, - @NonNull MapboxMap.MarkerViewAdapter adapter) { - Toast.makeText(MarkerViewActivity.this, "Hello " + marker.getId(), Toast.LENGTH_SHORT).show(); - return false; - } - }); - - movingMarkerOne = MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions() - .position(CarLocation.CAR_0_LNGS[0]) - .icon(IconFactory.getInstance(mapView.getContext()) - .fromResource(R.drawable.ic_android)) + // add default ViewMarker markers + for (int i = 0; i < LAT_LNGS.length; i++) { + MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions() + .position(LAT_LNGS[i]) + .title(String.valueOf(i)) + .alpha(0.5f) + .icon(usFlag) ); + } - movingMarkerTwo = mapboxMap.addMarker(new MarkerViewOptions() - .position(CarLocation.CAR_1_LNGS[0]) - .icon(IconFactory.getInstance(mapView.getContext()) - .fromResource(R.drawable.ic_android_2)) - ); + // add custom ViewMarker + CountryMarkerViewOptions options = new CountryMarkerViewOptions(); + options.flagRes(R.drawable.icon_burned); + options.abbrevName("Mapbox"); + options.title("Hello"); + options.position(new LatLng(38.899774, -77.023237)); + options.flat(true); + MarkerView markerView = mapboxMap.addMarker(options); + + // Use object animator to rotate MarkerView + ValueAnimator markerAnimator = ObjectAnimator.ofObject(markerView, "rotation", new FloatEvaluator(), -90, 90); + markerAnimator.setDuration(5000); + markerAnimator.start(); + + MarkerViewActivity.this.mapboxMap.addMarker(new MarkerOptions() + .title("United States") + .position(new LatLng(38.902580, -77.050102)) + ); + + rotateMarker = MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions() + .text("A") + .rotation(rotation = 270) + .position(new LatLng(38.889876, -77.008849)) + ); + loopMarkerRotate(); - // allow more open infowindows at the same time - mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true); - // add offscreen markers - Marker markerRightOffScreen = mapboxMap.addMarker(new MarkerOptions() - .setPosition(new LatLng(38.892846, -76.909399)) - .title("InfoWindow") - .snippet("Offscreen, to the right of the Map.")); + MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions() + .text("B") + .position(new LatLng(38.907327, -77.041293)) + ); + + MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions() + .text("C") + .position(new LatLng(38.897642, -77.041980)) + ); + + // if you want to customise a ViewMarker you need to extend ViewMarker and provide an adapter implementation + // set adapters for child classes of ViewMarker + markerViewManager.addMarkerViewAdapter(new CountryAdapter(MarkerViewActivity.this, mapboxMap)); + markerViewManager.addMarkerViewAdapter(new TextAdapter(MarkerViewActivity.this, mapboxMap)); + + final ViewGroup markerViewContainer = markerViewManager.getMarkerViewContainer(); + + // add a change listener to validate the size of amount of child views + mapView.addOnMapChangedListener(change -> { + if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) { + if (!markerViewManager.getMarkerViewAdapters().isEmpty() && viewCountView != null) { + viewCountView.setText(String.format( + Locale.getDefault(), + getString(R.string.viewcache_size), + markerViewContainer.getChildCount()) + ); + } + } + }); - Marker markerRightBottomOffScreen = mapboxMap.addMarker(new MarkerOptions() - .setPosition(new LatLng(38.791645, -77.039006)) - .title("InfoWindow") - .snippet("Offscreen, to the bottom of the Map")); + // add a OnMarkerView click listener + MarkerViewActivity.this.mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener( + (marker, view, adapter) -> { + Toast.makeText(MarkerViewActivity.this, "Hello " + marker.getId(), Toast.LENGTH_SHORT).show(); + return false; + }); - // open infowindow offscreen markers - mapboxMap.selectMarker(markerRightOffScreen); - mapboxMap.selectMarker(markerRightBottomOffScreen); - } + movingMarkerOne = MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions() + .position(CarLocation.CAR_0_LNGS[0]) + .icon(IconFactory.getInstance(mapView.getContext()) + .fromResource(R.drawable.ic_android)) + ); + + movingMarkerTwo = mapboxMap.addMarker(new MarkerViewOptions() + .position(CarLocation.CAR_1_LNGS[0]) + .icon(IconFactory.getInstance(mapView.getContext()) + .fromResource(R.drawable.ic_android_2)) + ); + + // allow more open infowindows at the same time + mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true); + + // add offscreen markers + Marker markerRightOffScreen = mapboxMap.addMarker(new MarkerOptions() + .setPosition(new LatLng(38.892846, -76.909399)) + .title("InfoWindow") + .snippet("Offscreen, to the right of the Map.")); + + Marker markerRightBottomOffScreen = mapboxMap.addMarker(new MarkerOptions() + .setPosition(new LatLng(38.791645, -77.039006)) + .title("InfoWindow") + .snippet("Offscreen, to the bottom of the Map")); + + // open infowindow offscreen markers + mapboxMap.selectMarker(markerRightOffScreen); + mapboxMap.selectMarker(markerRightBottomOffScreen); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java index 848eab9a3c..cf4ad4acee 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java @@ -5,7 +5,6 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; - import com.mapbox.mapboxsdk.annotations.MarkerView; import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -14,11 +13,10 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.util.List; -import timber.log.Timber; - /** * Test activity showcasing counting MarkerViews in a rectangle. */ diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java index 49c9663672..acdc76bb35 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java @@ -2,12 +2,10 @@ package com.mapbox.mapboxsdk.testapp.activity.annotation; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; - import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.PolygonOptions; import com.mapbox.mapboxsdk.camera.CameraPosition; @@ -78,16 +76,11 @@ public class PolygonActivity extends AppCompatActivity implements OnMapReadyCall public void onMapReady(MapboxMap map) { mapboxMap = map; - map.setOnPolygonClickListener(new MapboxMap.OnPolygonClickListener() { - @Override - public void onPolygonClick(@NonNull Polygon polygon) { - Toast.makeText( - PolygonActivity.this, - "You clicked on polygon with id = " + polygon.getId(), - Toast.LENGTH_SHORT - ).show(); - } - }); + map.setOnPolygonClickListener(polygon -> Toast.makeText( + PolygonActivity.this, + "You clicked on polygon with id = " + polygon.getId(), + Toast.LENGTH_SHORT + ).show()); polygon = mapboxMap.addPolygon(new PolygonOptions() .addAll(STAR_SHAPE_POINTS) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java index b9dc39e5d4..ddd99290ac 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java @@ -2,19 +2,16 @@ package com.mapbox.mapboxsdk.testapp.activity.annotation; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; - import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import java.util.ArrayList; @@ -65,46 +62,35 @@ public class PolylineActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap mapboxMap) { - PolylineActivity.this.mapboxMap = mapboxMap; - - mapboxMap.setOnPolylineClickListener(new MapboxMap.OnPolylineClickListener() { - @Override - public void onPolylineClick(@NonNull Polyline polyline) { - Toast.makeText( - PolylineActivity.this, - "You clicked on polygon with id = " + polyline.getId(), - Toast.LENGTH_SHORT - ).show(); - } - }); + mapView.getMapAsync(mapboxMap -> { + PolylineActivity.this.mapboxMap = mapboxMap; - polylines = mapboxMap.addPolylines(polylineOptions); - } + mapboxMap.setOnPolylineClickListener(polyline -> Toast.makeText( + PolylineActivity.this, + "You clicked on polygon with id = " + polyline.getId(), + Toast.LENGTH_SHORT + ).show()); + + polylines = mapboxMap.addPolylines(polylineOptions); }); View fab = findViewById(R.id.fab); if (fab != null) { - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - if (polylines != null && polylines.size() > 0) { - if (polylines.size() == 1) { - // test for removing annotation - mapboxMap.removeAnnotation(polylines.get(0)); - } else { - // test for removing annotations - mapboxMap.removeAnnotations(polylines); - } + fab.setOnClickListener(view -> { + if (mapboxMap != null) { + if (polylines != null && polylines.size() > 0) { + if (polylines.size() == 1) { + // test for removing annotation + mapboxMap.removeAnnotation(polylines.get(0)); + } else { + // test for removing annotations + mapboxMap.removeAnnotations(polylines); } - polylineOptions.clear(); - polylineOptions.addAll(getRandomLine()); - polylines = mapboxMap.addPolylines(polylineOptions); - } + polylineOptions.clear(); + polylineOptions.addAll(getRandomLine()); + polylines = mapboxMap.addPolylines(polylineOptions); + } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java index 7cfe35f160..5954593987 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java @@ -2,17 +2,14 @@ package com.mapbox.mapboxsdk.testapp.activity.annotation; import android.graphics.PointF; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; - import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import java.text.DecimalFormat; @@ -41,30 +38,17 @@ public class PressForMarkerActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(final MapboxMap map) { - mapboxMap = map; - resetMap(); + mapView.getMapAsync(map -> { + mapboxMap = map; + resetMap(); + + mapboxMap.setOnMapLongClickListener(point -> addMarker(point)); + + mapboxMap.setOnMapClickListener(point -> addMarker(point)); - mapboxMap.setOnMapLongClickListener(new MapboxMap.OnMapLongClickListener() { - @Override - public void onMapLongClick(@NonNull LatLng point) { - addMarker(point); - } - }); - - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - addMarker(point); - } - }); - - if (savedInstanceState != null) { - markerList = savedInstanceState.getParcelableArrayList(STATE_MARKER_LIST); - mapboxMap.addMarkers(markerList); - } + if (savedInstanceState != null) { + markerList = savedInstanceState.getParcelableArrayList(STATE_MARKER_LIST); + mapboxMap.addMarkers(markerList); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java index 030785565e..8cdfeaedbf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java @@ -4,7 +4,6 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -12,7 +11,6 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** @@ -47,102 +45,88 @@ public class CameraAnimationTypeActivity extends AppCompatActivity implements On mapboxMap = map; mapboxMap.getUiSettings().setAttributionEnabled(false); mapboxMap.getUiSettings().setLogoEnabled(false); - mapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() { - @Override - public void onCameraChange(CameraPosition position) { - Timber.w(position.toString()); - } - }); + mapboxMap.setOnCameraChangeListener(position -> Timber.w(position.toString())); // handle move button clicks View moveButton = findViewById(R.id.cameraMoveButton); if (moveButton != null) { - moveButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - CameraPosition cameraPosition = new CameraPosition.Builder() - .target(getNextLatLng()) - .zoom(14) - .tilt(30) - .tilt(0) - .build(); - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); - } + moveButton.setOnClickListener(view -> { + CameraPosition cameraPosition = new CameraPosition.Builder() + .target(getNextLatLng()) + .zoom(14) + .tilt(30) + .tilt(0) + .build(); + mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); }); } // handle ease button clicks View easeButton = findViewById(R.id.cameraEaseButton); if (easeButton != null) { - easeButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - CameraPosition cameraPosition = new CameraPosition.Builder() - .target(getNextLatLng()) - .zoom(15) - .bearing(180) - .tilt(30) - .build(); - - MapboxMap.CancelableCallback callback = new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - Timber.i("Duration onCancel Callback called."); - Toast.makeText( - CameraAnimationTypeActivity.this, - "Ease onCancel Callback called.", - Toast.LENGTH_LONG).show(); - } - - @Override - public void onFinish() { - Timber.i("Duration onFinish Callback called."); - Toast.makeText( - CameraAnimationTypeActivity.this, - "Ease onFinish Callback called.", - Toast.LENGTH_LONG).show(); - } - }; - - mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 7500, callback); - } + easeButton.setOnClickListener(view -> { + CameraPosition cameraPosition = new CameraPosition.Builder() + .target(getNextLatLng()) + .zoom(15) + .bearing(180) + .tilt(30) + .build(); + + MapboxMap.CancelableCallback callback = new MapboxMap.CancelableCallback() { + @Override + public void onCancel() { + Timber.i("Duration onCancel Callback called."); + Toast.makeText( + CameraAnimationTypeActivity.this, + "Ease onCancel Callback called.", + Toast.LENGTH_LONG).show(); + } + + @Override + public void onFinish() { + Timber.i("Duration onFinish Callback called."); + Toast.makeText( + CameraAnimationTypeActivity.this, + "Ease onFinish Callback called.", + Toast.LENGTH_LONG).show(); + } + }; + + mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 7500, callback); }); } // handle animate button clicks View animateButton = findViewById(R.id.cameraAnimateButton); if (animateButton != null) { - animateButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - CameraPosition cameraPosition = new CameraPosition.Builder() - .target(getNextLatLng()) - .bearing(270) - .tilt(20) - .build(); - - MapboxMap.CancelableCallback callback = new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - Timber.i("Duration onCancel Callback called."); - Toast.makeText( - CameraAnimationTypeActivity.this, - "Duration onCancel Callback called.", - Toast.LENGTH_LONG).show(); - } - - @Override - public void onFinish() { - Timber.i("Duration onFinish Callback called."); - Toast.makeText( - CameraAnimationTypeActivity.this, - "Duration onFinish Callback called.", - Toast.LENGTH_LONG).show(); - } - }; - - mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 7500, callback); - } + animateButton.setOnClickListener(view -> { + CameraPosition cameraPosition = new CameraPosition.Builder() + .target(getNextLatLng()) + .bearing(270) + .tilt(20) + .build(); + + MapboxMap.CancelableCallback callback = new MapboxMap.CancelableCallback() { + @Override + public void onCancel() { + Timber.i("Duration onCancel Callback called."); + Toast.makeText( + CameraAnimationTypeActivity.this, + "Duration onCancel Callback called.", + Toast.LENGTH_LONG).show(); + } + + @Override + public void onFinish() { + Timber.i("Duration onFinish Callback called."); + Toast.makeText( + CameraAnimationTypeActivity.this, + "Duration onFinish Callback called.", + Toast.LENGTH_LONG).show(); + } + }; + + mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 7500, callback); }); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java index cc44ac9715..296bbf8ac0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java @@ -10,7 +10,6 @@ import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.AnticipateOvershootInterpolator; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; @@ -43,12 +42,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe @Override public void onMapReady(final MapboxMap map) { mapboxMap = map; - findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - view.setVisibility(View.GONE); - createAnimator(mapboxMap.getCameraPosition()).start(); - } + findViewById(R.id.fab).setOnClickListener(view -> { + view.setVisibility(View.GONE); + createAnimator(mapboxMap.getCameraPosition()).start(); }); } @@ -66,12 +62,7 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe ValueAnimator latLngAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), currentPosition, target); latLngAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR)); latLngAnimator.setInterpolator(new FastOutSlowInInterpolator()); - latLngAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - mapboxMap.setLatLng((LatLng) animation.getAnimatedValue()); - } - }); + latLngAnimator.addUpdateListener(animation -> mapboxMap.setLatLng((LatLng) animation.getAnimatedValue())); return latLngAnimator; } @@ -80,12 +71,7 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe zoomAnimator.setDuration((long) (2200 * ANIMATION_DELAY_FACTOR)); zoomAnimator.setStartDelay((long) (600 * ANIMATION_DELAY_FACTOR)); zoomAnimator.setInterpolator(new AnticipateOvershootInterpolator()); - zoomAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - mapboxMap.setZoom((Float) animation.getAnimatedValue()); - } - }); + zoomAnimator.addUpdateListener(animation -> mapboxMap.setZoom((Float) animation.getAnimatedValue())); return zoomAnimator; } @@ -94,12 +80,7 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe bearingAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR)); bearingAnimator.setStartDelay((long) (1000 * ANIMATION_DELAY_FACTOR)); bearingAnimator.setInterpolator(new FastOutLinearInInterpolator()); - bearingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - mapboxMap.setBearing((Float) animation.getAnimatedValue()); - } - }); + bearingAnimator.addUpdateListener(animation -> mapboxMap.setBearing((Float) animation.getAnimatedValue())); return bearingAnimator; } @@ -107,12 +88,7 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe ValueAnimator tiltAnimator = ValueAnimator.ofFloat((float) currentTilt, 60); tiltAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR)); tiltAnimator.setStartDelay((long) (1500 * ANIMATION_DELAY_FACTOR)); - tiltAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - mapboxMap.setTilt((Float) animation.getAnimatedValue()); - } - }); + tiltAnimator.addUpdateListener(animation -> mapboxMap.setTilt((Float) animation.getAnimatedValue())); return tiltAnimator; } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java index 1180b0336a..3b9731709c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java @@ -1,8 +1,6 @@ package com.mapbox.mapboxsdk.testapp.activity.camera; -import android.annotation.SuppressLint; import android.content.Context; -import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.IdRes; import android.support.annotation.NonNull; @@ -14,7 +12,6 @@ import android.view.LayoutInflater; import android.view.View; import android.widget.SeekBar; import android.widget.TextView; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -22,7 +19,6 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** @@ -48,27 +44,16 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; - mapboxMap.setOnCameraIdleListener(new MapboxMap.OnCameraIdleListener() { - @Override - public void onCameraIdle() { - Timber.e("OnCameraIdle"); - fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_green_dark)); - } + mapboxMap.setOnCameraIdleListener(() -> { + Timber.e("OnCameraIdle"); + fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_green_dark)); }); - mapboxMap.setOnCameraMoveCancelListener(new MapboxMap.OnCameraMoveCanceledListener() { - @Override - public void onCameraMoveCanceled() { - Timber.e("OnCameraMoveCanceled"); - } - }); + mapboxMap.setOnCameraMoveCancelListener(() -> Timber.e("OnCameraMoveCanceled")); - mapboxMap.setOnCameraMoveListener(new MapboxMap.OnCameraMoveListener() { - @Override - public void onCameraMove() { - Timber.e("OnCameraMove"); - fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_orange_dark)); - } + mapboxMap.setOnCameraMoveListener(() -> { + Timber.e("OnCameraMove"); + fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_orange_dark)); }); mapboxMap.setOnCameraMoveStartedListener(new MapboxMap.OnCameraMoveStartedListener() { @@ -86,56 +71,49 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe // add a listener to FAB fab = (FloatingActionButton) findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - @SuppressLint("InflateParams") - @Override - public void onClick(View view) { - Context context = view.getContext(); - - final View dialogContent = LayoutInflater.from(context).inflate(R.layout.dialog_camera_position, null); - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(R.string.dialog_camera_position); - builder.setView(onInflateDialogContent(dialogContent)); - builder.setPositiveButton("Animate", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - double latitude = Double.parseDouble( - ((TextView) dialogContent.findViewById(R.id.value_lat)).getText().toString()); - double longitude = Double.parseDouble( - ((TextView) dialogContent.findViewById(R.id.value_lon)).getText().toString()); - double zoom = Double.parseDouble( - ((TextView) dialogContent.findViewById(R.id.value_zoom)).getText().toString()); - double bearing = Double.parseDouble( - ((TextView) dialogContent.findViewById(R.id.value_bearing)).getText().toString()); - double tilt = Double.parseDouble( - ((TextView) dialogContent.findViewById(R.id.value_tilt)).getText().toString()); - - CameraPosition cameraPosition = new CameraPosition.Builder() - .target(new LatLng(latitude, longitude)) - .zoom(zoom) - .bearing(bearing) - .tilt(tilt) - .build(); - - mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 5000, - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - Timber.v("OnCancel called"); - } - - @Override - public void onFinish() { - Timber.v("OnFinish called"); - } - }); - Timber.v(cameraPosition.toString()); - } - }); - builder.setNegativeButton("Cancel", null); - builder.setCancelable(false); - builder.show(); - } + fab.setOnClickListener(view -> { + Context context = view.getContext(); + + final View dialogContent = LayoutInflater.from(context).inflate(R.layout.dialog_camera_position, null); + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(R.string.dialog_camera_position); + builder.setView(onInflateDialogContent(dialogContent)); + builder.setPositiveButton("Animate", (dialog, which) -> { + double latitude = Double.parseDouble( + ((TextView) dialogContent.findViewById(R.id.value_lat)).getText().toString()); + double longitude = Double.parseDouble( + ((TextView) dialogContent.findViewById(R.id.value_lon)).getText().toString()); + double zoom = Double.parseDouble( + ((TextView) dialogContent.findViewById(R.id.value_zoom)).getText().toString()); + double bearing = Double.parseDouble( + ((TextView) dialogContent.findViewById(R.id.value_bearing)).getText().toString()); + double tilt = Double.parseDouble( + ((TextView) dialogContent.findViewById(R.id.value_tilt)).getText().toString()); + + CameraPosition cameraPosition = new CameraPosition.Builder() + .target(new LatLng(latitude, longitude)) + .zoom(zoom) + .bearing(bearing) + .tilt(tilt) + .build(); + + mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 5000, + new MapboxMap.CancelableCallback() { + @Override + public void onCancel() { + Timber.v("OnCancel called"); + } + + @Override + public void onFinish() { + Timber.v("OnFinish called"); + } + }); + Timber.v(cameraPosition.toString()); + }); + builder.setNegativeButton("Cancel", null); + builder.setCancelable(false); + builder.show(); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java index e3a9551b8e..3422007762 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java @@ -5,14 +5,12 @@ import android.support.annotation.NonNull; import android.support.design.widget.BottomSheetBehavior; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.view.LockableBottomSheetBehavior; @@ -55,12 +53,9 @@ public class LatLngBoundsActivity extends AppCompatActivity implements View.OnCl setContentView(R.layout.activity_latlngbounds); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(final MapboxMap map) { - mapboxMap = map; - initMap(); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + initMap(); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java index b999572436..65f7bb79fc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java @@ -2,17 +2,14 @@ package com.mapbox.mapboxsdk.testapp.activity.camera; import android.graphics.Point; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; @@ -35,14 +32,11 @@ public class ManualZoomActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.setStyleUrl(Style.SATELLITE); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap mapboxMap) { - ManualZoomActivity.this.mapboxMap = mapboxMap; - - UiSettings uiSettings = ManualZoomActivity.this.mapboxMap.getUiSettings(); - uiSettings.setAllGesturesEnabled(false); - } + mapView.getMapAsync(mapboxMap -> { + ManualZoomActivity.this.mapboxMap = mapboxMap; + + UiSettings uiSettings = ManualZoomActivity.this.mapboxMap.getUiSettings(); + uiSettings.setAllGesturesEnabled(false); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java index 53a5800f26..588de933f1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java @@ -1,16 +1,12 @@ package com.mapbox.mapboxsdk.testapp.activity.camera; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.constants.Style; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** @@ -37,17 +33,7 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC mapboxMap = map; mapboxMap.setMinZoomPreference(3); mapboxMap.setMaxZoomPreference(5); - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - map.setStyle(Style.OUTDOORS, new MapboxMap.OnStyleLoadedListener() { - @Override - public void onStyleLoaded(String style) { - Timber.d("Style Loaded %s", style); - } - }); - } - }); + mapboxMap.setOnMapClickListener(point -> map.setStyle(Style.OUTDOORS, style -> Timber.d("Style Loaded %s", style))); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index 2e889f6e11..c644062f6d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -9,10 +9,8 @@ import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; -import android.view.View; import android.widget.SeekBar; import android.widget.TextView; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -69,15 +67,10 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(ScrollByActivity.this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( - seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, - seekBarY.getProgress() * MULTIPLIER_PER_PIXEL) - ); - } - }); + fab.setOnClickListener(view -> mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( + seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, + seekBarY.getProgress() * MULTIPLIER_PER_PIXEL) + )); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java index 1b49e9e3d6..d2f5870012 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java @@ -6,13 +6,10 @@ import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; -import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.CustomLayer; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.model.customlayer.ExampleCustomLayer; @@ -38,23 +35,17 @@ public class CustomLayerActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.91448, -243.60947), 10)); + mapView.getMapAsync(map -> { + mapboxMap = map; + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.91448, -243.60947), 10)); - } }); fab = (FloatingActionButton) findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - swapCustomLayer(); - } + fab.setOnClickListener(view -> { + if (mapboxMap != null) { + swapCustomLayer(); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java index ee9f20dceb..d94080764f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.activity.espresso; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java index 20174daeaa..b47f054c1a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java @@ -5,19 +5,16 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; - import com.google.gson.JsonElement; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.services.commons.geojson.Feature; +import timber.log.Timber; import java.util.List; import java.util.Map; -import timber.log.Timber; - /** * Test activity showcasing using the query rendered features API to count features in a rectangle. */ @@ -36,32 +33,25 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @SuppressWarnings("ConstantConditions") - @Override - public void onMapReady(final MapboxMap mapboxMap) { - QueryRenderedFeaturesBoxCountActivity.this.mapboxMap = mapboxMap; - selectionBox.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // Query - int top = selectionBox.getTop() - mapView.getTop(); - int left = selectionBox.getLeft() - mapView.getLeft(); - RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i("Querying box %s", box); - List<Feature> features = mapboxMap.queryRenderedFeatures(box); - - // Show count - Toast.makeText( - QueryRenderedFeaturesBoxCountActivity.this, - String.format("%s features in box", features.size()), - Toast.LENGTH_SHORT).show(); - - // Debug output - debugOutput(features); - } - }); - } + mapView.getMapAsync(mapboxMap -> { + QueryRenderedFeaturesBoxCountActivity.this.mapboxMap = mapboxMap; + selectionBox.setOnClickListener(view -> { + // Query + int top = selectionBox.getTop() - mapView.getTop(); + int left = selectionBox.getLeft() - mapView.getLeft(); + RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); + Timber.i("Querying box %s", box); + List<Feature> features = mapboxMap.queryRenderedFeatures(box); + + // Show count + Toast.makeText( + QueryRenderedFeaturesBoxCountActivity.this, + String.format("%s features in box", features.size()), + Toast.LENGTH_SHORT).show(); + + // Debug output + debugOutput(features); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java index 480e48437a..9784e088ea 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java @@ -6,21 +6,18 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.FillLayer; import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; +import timber.log.Timber; import java.util.List; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillColor; /** @@ -41,41 +38,34 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @SuppressWarnings("ConstantConditions") - @Override - public void onMapReady(final MapboxMap mapboxMap) { - QueryRenderedFeaturesBoxHighlightActivity.this.mapboxMap = mapboxMap; - - // Add layer / source - final GeoJsonSource source = new GeoJsonSource("highlighted-shapes-source"); - mapboxMap.addSource(source); - mapboxMap.addLayer( - new FillLayer("highlighted-shapes-layer", "highlighted-shapes-source") - .withProperties(fillColor(Color.RED)) - ); - - selectionBox.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // Query - int top = selectionBox.getTop() - mapView.getTop(); - int left = selectionBox.getLeft() - mapView.getLeft(); - RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i("Querying box %s for buildings", box); - List<Feature> features = mapboxMap.queryRenderedFeatures(box, Filter.lt("height", 10), "building"); - - // Show count - Toast.makeText( - QueryRenderedFeaturesBoxHighlightActivity.this, - String.format("%s features in box", features.size()), - Toast.LENGTH_SHORT).show(); - - // Update source data - source.setGeoJson(FeatureCollection.fromFeatures(features)); - } - }); - } + mapView.getMapAsync(mapboxMap -> { + QueryRenderedFeaturesBoxHighlightActivity.this.mapboxMap = mapboxMap; + + // Add layer / source + final GeoJsonSource source = new GeoJsonSource("highlighted-shapes-source"); + mapboxMap.addSource(source); + mapboxMap.addLayer( + new FillLayer("highlighted-shapes-layer", "highlighted-shapes-source") + .withProperties(fillColor(Color.RED)) + ); + + selectionBox.setOnClickListener(view -> { + // Query + int top = selectionBox.getTop() - mapView.getTop(); + int left = selectionBox.getLeft() - mapView.getLeft(); + RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); + Timber.i("Querying box %s for buildings", box); + List<Feature> features = mapboxMap.queryRenderedFeatures(box, Filter.lt("height", 10), "building"); + + // Show count + Toast.makeText( + QueryRenderedFeaturesBoxHighlightActivity.this, + String.format("%s features in box", features.size()), + Toast.LENGTH_SHORT).show(); + + // Update source data + source.setGeoJson(FeatureCollection.fromFeatures(features)); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java index 220137d07d..16e3a0dacb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java @@ -6,21 +6,18 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; import com.mapbox.services.commons.geojson.Feature; +import timber.log.Timber; import java.io.IOException; import java.util.List; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; /** @@ -43,49 +40,42 @@ public class QueryRenderedFeaturesBoxSymbolCountActivity extends AppCompatActivi // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @SuppressWarnings("ConstantConditions") - @Override - public void onMapReady(final MapboxMap mapboxMap) { - QueryRenderedFeaturesBoxSymbolCountActivity.this.mapboxMap = mapboxMap; - - // Add a symbol layer (also works with annotations) - try { - mapboxMap.addSource(new GeoJsonSource("symbols-source", ResourceUtils.readRawResource( - QueryRenderedFeaturesBoxSymbolCountActivity.this, R.raw.test_points_utrecht))); - } catch (IOException ioException) { - Timber.e(ioException, "Could not load geojson"); - return; - } - mapboxMap.addImage( - "test-icon", - BitmapFactory.decodeResource(getResources(), - R.drawable.mapbox_marker_icon_default) - ); - mapboxMap.addLayer(new SymbolLayer("symbols-layer", "symbols-source").withProperties(iconImage("test-icon"))); - - selectionBox.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // Query - int top = selectionBox.getTop() - mapView.getTop(); - int left = selectionBox.getLeft() - mapView.getLeft(); - RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i("Querying box %s", box); - List<Feature> features = mapboxMap.queryRenderedFeatures(box, "symbols-layer"); - - // Show count - if (toast != null) { - toast.cancel(); - } - toast = Toast.makeText( - QueryRenderedFeaturesBoxSymbolCountActivity.this, - String.format("%s features in box", features.size()), - Toast.LENGTH_SHORT); - toast.show(); - } - }); + mapView.getMapAsync(mapboxMap -> { + QueryRenderedFeaturesBoxSymbolCountActivity.this.mapboxMap = mapboxMap; + + // Add a symbol layer (also works with annotations) + try { + mapboxMap.addSource(new GeoJsonSource("symbols-source", ResourceUtils.readRawResource( + QueryRenderedFeaturesBoxSymbolCountActivity.this, R.raw.test_points_utrecht))); + } catch (IOException ioException) { + Timber.e(ioException, "Could not load geojson"); + return; } + mapboxMap.addImage( + "test-icon", + BitmapFactory.decodeResource(getResources(), + R.drawable.mapbox_marker_icon_default) + ); + mapboxMap.addLayer(new SymbolLayer("symbols-layer", "symbols-source").withProperties(iconImage("test-icon"))); + + selectionBox.setOnClickListener(view -> { + // Query + int top = selectionBox.getTop() - mapView.getTop(); + int left = selectionBox.getLeft() - mapView.getLeft(); + RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); + Timber.i("Querying box %s", box); + List<Feature> features = mapboxMap.queryRenderedFeatures(box, "symbols-layer"); + + // Show count + if (toast != null) { + toast.cancel(); + } + toast = Toast.makeText( + QueryRenderedFeaturesBoxSymbolCountActivity.this, + String.format("%s features in box", features.size()), + Toast.LENGTH_SHORT); + toast.show(); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java index 1bd6a34b7c..6bf135c50d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java @@ -10,22 +10,18 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; - import com.google.gson.JsonElement; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.Marker; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.services.commons.geojson.Feature; +import timber.log.Timber; import java.util.List; import java.util.Map; -import timber.log.Timber; - /** * Test activity showcasing using the query rendered features API to query feature properties on Map click. */ @@ -45,40 +41,34 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(final MapboxMap mapboxMap) { - QueryRenderedFeaturesPropertiesActivity.this.mapboxMap = mapboxMap; - - // Add custom window adapter - addCustomInfoWindowAdapter(mapboxMap); - - // Add a click listener - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - // Query - final PointF pixel = mapboxMap.getProjection().toScreenLocation(point); - Timber.i( - "Requesting features for %sx%s (%sx%s adjusted for density)", - pixel.x, pixel.y, pixel.x / density, pixel.y / density - ); - List<Feature> features = mapboxMap.queryRenderedFeatures(pixel); - - // Debug output - debugOutput(features); - - // Remove any previous markers - if (marker != null) { - mapboxMap.removeMarker(marker); - } - - // Add a marker on the clicked point - marker = mapboxMap.addMarker(new CustomMarkerOptions().position(point).features(features)); - mapboxMap.selectMarker(marker); - } - }); - } + mapView.getMapAsync(mapboxMap -> { + QueryRenderedFeaturesPropertiesActivity.this.mapboxMap = mapboxMap; + + // Add custom window adapter + addCustomInfoWindowAdapter(mapboxMap); + + // Add a click listener + mapboxMap.setOnMapClickListener(point -> { + // Query + final PointF pixel = mapboxMap.getProjection().toScreenLocation(point); + Timber.i( + "Requesting features for %sx%s (%sx%s adjusted for density)", + pixel.x, pixel.y, pixel.x / density, pixel.y / density + ); + List<Feature> features = mapboxMap.queryRenderedFeatures(pixel); + + // Debug output + debugOutput(features); + + // Remove any previous markers + if (marker != null) { + mapboxMap.removeMarker(marker); + } + + // Add a marker on the clicked point + marker = mapboxMap.addMarker(new CustomMarkerOptions().position(point).features(features)); + mapboxMap.selectMarker(marker); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java index 861f2fef34..4f29dc78ef 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java @@ -1,15 +1,11 @@ package com.mapbox.mapboxsdk.testapp.activity.feature; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.widget.Toast; - import com.google.gson.JsonObject; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; @@ -38,32 +34,26 @@ public class QuerySourceFeaturesActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(final MapboxMap mapboxMap) { - QuerySourceFeaturesActivity.this.mapboxMap = mapboxMap; - - JsonObject properties = new JsonObject(); - properties.addProperty("key1", "value1"); - final GeoJsonSource source = new GeoJsonSource("test-source", - FeatureCollection.fromFeatures(new Feature[] { - Feature.fromGeometry(Point.fromCoordinates(new double[] {0, 0}), properties) - })); - mapboxMap.addSource(source); - - mapboxMap.addLayer(new CircleLayer("test-layer", source.getId()).withFilter(Filter.neq("key1", "value1"))); - - // Add a click listener - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - // Query - List<Feature> features = source.querySourceFeatures(Filter.eq("key1", "value1")); - Toast.makeText(QuerySourceFeaturesActivity.this, String.format("Found %s features", - features.size()), Toast.LENGTH_SHORT).show(); - } - }); - } + mapView.getMapAsync(mapboxMap -> { + QuerySourceFeaturesActivity.this.mapboxMap = mapboxMap; + + JsonObject properties = new JsonObject(); + properties.addProperty("key1", "value1"); + final GeoJsonSource source = new GeoJsonSource("test-source", + FeatureCollection.fromFeatures(new Feature[] { + Feature.fromGeometry(Point.fromCoordinates(new double[] {0, 0}), properties) + })); + mapboxMap.addSource(source); + + mapboxMap.addLayer(new CircleLayer("test-layer", source.getId()).withFilter(Filter.neq("key1", "value1"))); + + // Add a click listener + mapboxMap.setOnMapClickListener(point -> { + // Query + List<Feature> features = source.querySourceFeatures(Filter.eq("key1", "value1")); + Toast.makeText(QuerySourceFeaturesActivity.this, String.format("Found %s features", + features.size()), Toast.LENGTH_SHORT).show(); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java index 930626078d..c15d7ceb16 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java index eec440afb0..2dd991564e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java @@ -1,8 +1,7 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment; -import android.support.v7.app.AppCompatActivity; import android.os.Bundle; - +import android.support.v7.app.AppCompatActivity; import com.mapbox.mapboxsdk.testapp.R; /** diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java index 4f828060ee..23500232fe 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java index bbdf450505..4185db63e3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java @@ -6,7 +6,6 @@ import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java index 18d80586c9..c220109ed4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java @@ -2,14 +2,11 @@ package com.mapbox.mapboxsdk.testapp.activity.imagegenerator; import android.graphics.Bitmap; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v4.print.PrintHelper; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; /** @@ -27,21 +24,13 @@ public class PrintActivity extends AppCompatActivity implements MapboxMap.Snapsh mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - PrintActivity.this.mapboxMap = mapboxMap; - } - }); + mapView.getMapAsync(mapboxMap -> PrintActivity.this.mapboxMap = mapboxMap); final View fab = findViewById(R.id.fab); if (fab != null) { - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - mapboxMap.snapshot(PrintActivity.this); - } + fab.setOnClickListener(view -> { + if (mapboxMap != null) { + mapboxMap.snapshot(PrintActivity.this); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java index 655012f799..4ad5edf13f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.activity.imagegenerator; -import android.graphics.Bitmap; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; @@ -8,7 +7,6 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; import android.widget.Toast; - import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -49,18 +47,15 @@ public class SnapshotActivity extends AppCompatActivity implements OnMapReadyCal @Override public void onClick(View view) { final long startTime = System.nanoTime(); - mapboxMap.snapshot(new MapboxMap.SnapshotReadyCallback() { - @Override - public void onSnapshotReady(Bitmap snapshot) { - long endTime = System.nanoTime(); - long duration = (long) ((endTime - startTime) / 1e6); - ImageView snapshotView = (ImageView) findViewById(R.id.imageView); - snapshotView.setImageBitmap(snapshot); - Toast.makeText( - SnapshotActivity.this, - String.format(Locale.getDefault(), "Snapshot taken in %d ms", duration), - Toast.LENGTH_LONG).show(); - } + mapboxMap.snapshot(snapshot -> { + long endTime = System.nanoTime(); + long duration = (long) ((endTime - startTime) / 1e6); + ImageView snapshotView = (ImageView) findViewById(R.id.imageView); + snapshotView.setImageBitmap(snapshot); + Toast.makeText( + SnapshotActivity.this, + String.format(Locale.getDefault(), "Snapshot taken in %d ms", duration), + Toast.LENGTH_LONG).show(); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java index 7fa4792a38..8006d9cb71 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java @@ -2,14 +2,10 @@ package com.mapbox.mapboxsdk.testapp.activity.infowindow; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.AppCompatActivity; -import android.view.View; import android.widget.TextView; - import com.mapbox.mapboxsdk.annotations.InfoWindow; -import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerView; import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -57,28 +53,22 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen mapboxMap.selectMarker(marker); // On map click, change the info window contents - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - // Distance from click to marker - double distanceKm = marker.getPosition().distanceTo(point) / 1000; - - // Get the info window - final InfoWindow infoWindow = marker.getInfoWindow(); - - // Get the view from the info window - if (infoWindow != null && infoWindow.getView() != null) { - // Set the new text on the text view in the info window - TextView textView = (TextView) infoWindow.getView(); - textView.setText(String.format(Locale.getDefault(), "%.2fkm", distanceKm)); - textView.post(new Runnable() { - @Override - public void run() { - // Update the info window position (as the text length changes) - infoWindow.update(); - } - }); - } + mapboxMap.setOnMapClickListener(point -> { + // Distance from click to marker + double distanceKm = marker.getPosition().distanceTo(point) / 1000; + + // Get the info window + final InfoWindow infoWindow = marker.getInfoWindow(); + + // Get the view from the info window + if (infoWindow != null && infoWindow.getView() != null) { + // Set the new text on the text view in the info window + TextView textView = (TextView) infoWindow.getView(); + textView.setText(String.format(Locale.getDefault(), "%.2fkm", distanceKm)); + textView.post(() -> { + // Update the info window position (as the text length changes) + infoWindow.update(); + }); } }); @@ -97,17 +87,13 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen private void addCustomInfoWindowAdapter(final MapboxMap mapboxMap) { final int padding = (int) getResources().getDimension(R.dimen.attr_margin); - mapboxMap.setInfoWindowAdapter(new MapboxMap.InfoWindowAdapter() { - - @Override - public View getInfoWindow(@NonNull Marker marker) { - TextView textView = new TextView(DynamicInfoWindowAdapterActivity.this); - textView.setText(marker.getTitle()); - textView.setBackgroundColor(Color.WHITE); - textView.setText(R.string.action_calculate_distance); - textView.setPadding(padding, padding, padding, padding); - return textView; - } + mapboxMap.setInfoWindowAdapter(marker -> { + TextView textView = new TextView(DynamicInfoWindowAdapterActivity.this); + textView.setText(marker.getTitle()); + textView.setBackgroundColor(Color.WHITE); + textView.setText(R.string.action_calculate_distance); + textView.setPadding(padding, padding, padding, padding); + return textView; }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java index b8083dfa74..87f18198dd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java @@ -6,7 +6,6 @@ import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; - import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java index 22347f8a92..f8ad8144b5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java @@ -6,13 +6,11 @@ import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; - import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.model.annotations.CityStateMarker; import com.mapbox.mapboxsdk.testapp.model.annotations.CityStateMarkerOptions; @@ -33,13 +31,10 @@ public class InfoWindowAdapterActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap map) { - mapboxMap = map; - addMarkers(); - addCustomInfoWindowAdapter(); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + addMarkers(); + addCustomInfoWindowAdapter(); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java index 2c83f6d908..7c863fd428 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java @@ -15,7 +15,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -48,19 +47,9 @@ public class BottomSheetActivity extends AppCompatActivity { actionBar.setDisplayHomeAsUpEnabled(true); } - findViewById(R.id.fabFragment).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - addMapFragment(); - } - }); + findViewById(R.id.fabFragment).setOnClickListener(v -> addMapFragment()); - findViewById(R.id.fabBottomSheet).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - toggleBottomSheetMapFragment(); - } - }); + findViewById(R.id.fabBottomSheet).setOnClickListener(v -> toggleBottomSheetMapFragment()); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.bottom_sheet)); bottomSheetBehavior.setPeekHeight((int) (64 * getResources().getDisplayMetrics().density)); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java index 6134b4cb7a..5ae5661985 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java @@ -11,12 +11,9 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; - -import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -24,12 +21,11 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.Property; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.util.List; import java.util.Locale; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; /** @@ -82,13 +78,10 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa private void setupMapView(Bundle savedInstanceState) { mapView = (MapView) findViewById(R.id.mapView); - mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { - @Override - public void onMapChanged(int change) { - if (change == MapView.DID_FINISH_LOADING_STYLE && mapboxMap != null) { - Timber.v("New style loaded with JSON: %s", mapboxMap.getStyleJson()); - setupNavigationView(mapboxMap.getLayers()); - } + mapView.addOnMapChangedListener(change -> { + if (change == MapView.DID_FINISH_LOADING_STYLE && mapboxMap != null) { + Timber.v("New style loaded with JSON: %s", mapboxMap.getStyleJson()); + setupNavigationView(mapboxMap.getLayers()); } }); @@ -110,25 +103,17 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa private void setFpsView() { final TextView fpsView = (TextView) findViewById(R.id.fpsView); - mapboxMap.setOnFpsChangedListener(new MapboxMap.OnFpsChangedListener() { - @Override - public void onFpsChanged(double fps) { - fpsView.setText(String.format(Locale.US,"FPS: %4.2f", fps)); - } - }); + mapboxMap.setOnFpsChangedListener(fps -> fpsView.setText(String.format(Locale.US,"FPS: %4.2f", fps))); } private void setupNavigationView(List<Layer> layerList) { final LayerListAdapter adapter = new LayerListAdapter(this, layerList); ListView listView = (ListView) findViewById(R.id.listView); listView.setAdapter(adapter); - listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - Layer clickedLayer = adapter.getItem(position); - toggleLayerVisibility(clickedLayer); - closeNavigationView(); - } + listView.setOnItemClickListener((parent, view, position, id) -> { + Layer clickedLayer = adapter.getItem(position); + toggleLayerVisibility(clickedLayer); + closeNavigationView(); }); } @@ -148,44 +133,29 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa private void setupZoomView() { final TextView textView = (TextView) findViewById(R.id.textZoom); - mapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() { - @Override - public void onCameraChange(CameraPosition position) { - textView.setText(String.format(getString(R.string.debug_zoom), position.zoom)); - } - }); + mapboxMap.setOnCameraChangeListener(position -> + textView.setText(String.format(getString(R.string.debug_zoom), position.zoom))); } private void setupDebugChangeView() { FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug); - fabDebug.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - Timber.d("Debug FAB: isDebug Active? %s", mapboxMap.isDebugActive()); - mapboxMap.cycleDebugOptions(); - } + fabDebug.setOnClickListener(view -> { + if (mapboxMap != null) { + Timber.d("Debug FAB: isDebug Active? %s", mapboxMap.isDebugActive()); + mapboxMap.cycleDebugOptions(); } }); } private void setupStyleChangeView() { FloatingActionButton fabStyles = (FloatingActionButton) findViewById(R.id.fabStyles); - fabStyles.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - currentStyleIndex++; - if (currentStyleIndex == STYLES.length) { - currentStyleIndex = 0; - } - mapboxMap.setStyleUrl(STYLES[currentStyleIndex], new MapboxMap.OnStyleLoadedListener() { - @Override - public void onStyleLoaded(String style) { - Timber.d("Style loaded %s", style); - } - }); + fabStyles.setOnClickListener(view -> { + if (mapboxMap != null) { + currentStyleIndex++; + if (currentStyleIndex == STYLES.length) { + currentStyleIndex = 0; } + mapboxMap.setStyleUrl(STYLES[currentStyleIndex], style -> Timber.d("Style loaded %s", style)); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java index 462c0c8025..f2e4ae63c2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java @@ -3,21 +3,17 @@ package com.mapbox.mapboxsdk.testapp.activity.maplayout; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.constants.Style; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; @@ -90,47 +86,38 @@ public class DoubleMapActivity extends AppCompatActivity { // MapView large mapView = (MapView) view.findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - if (activity != null) { - activity.setMapboxMap(mapboxMap); - } + mapView.getMapAsync(mapboxMap -> { + if (activity != null) { + activity.setMapboxMap(mapboxMap); } }); // MapView mini mapViewMini = (MapView) view.findViewById(R.id.mini_map); mapViewMini.onCreate(savedInstanceState); - mapViewMini.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - mapboxMap.setStyleUrl(Style.LIGHT); - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(4)); - - UiSettings uiSettings = mapboxMap.getUiSettings(); - uiSettings.setAllGesturesEnabled(false); - uiSettings.setCompassEnabled(false); - uiSettings.setAttributionEnabled(false); - uiSettings.setLogoEnabled(false); - - try { - mapboxMap.setMyLocationEnabled(true); - TrackingSettings settings = mapboxMap.getTrackingSettings(); - settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW); - } catch (SecurityException securityException) { - // permission is handled in MainActivity - getActivity().finish(); - } - - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - // test if we can open 2 activities after each other - startActivity(new Intent(mapViewMini.getContext(), DoubleMapActivity.class)); - } - }); + mapViewMini.getMapAsync(mapboxMap -> { + mapboxMap.setStyleUrl(Style.LIGHT); + mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(4)); + + UiSettings uiSettings = mapboxMap.getUiSettings(); + uiSettings.setAllGesturesEnabled(false); + uiSettings.setCompassEnabled(false); + uiSettings.setAttributionEnabled(false); + uiSettings.setLogoEnabled(false); + + try { + mapboxMap.setMyLocationEnabled(true); + TrackingSettings settings = mapboxMap.getTrackingSettings(); + settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW); + } catch (SecurityException securityException) { + // permission is handled in MainActivity + getActivity().finish(); } + + mapboxMap.setOnMapClickListener(point -> { + // test if we can open 2 activities after each other + startActivity(new Intent(mapViewMini.getContext(), DoubleMapActivity.class)); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java index 24a167e260..f8c5fb581e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java @@ -6,7 +6,6 @@ import android.support.v7.app.AppCompatActivity; import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; - import com.mapbox.mapboxsdk.annotations.PolygonOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapChangeActivity.java index 32344248bc..ef2038f5a6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapChangeActivity.java @@ -3,14 +3,11 @@ package com.mapbox.mapboxsdk.testapp.activity.maplayout; import android.os.Bundle; import android.support.v4.util.LongSparseArray; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** @@ -28,21 +25,13 @@ public class MapChangeActivity extends AppCompatActivity { final LongSparseArray<String> mapChangeMap = buildMapChangeStringValueSparseArray(); mapView = (MapView) findViewById(R.id.mapView); - mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { - @Override - public void onMapChanged(int change) { - Timber.e("OnMapChange: %s, %s", change, mapChangeMap.get(change)); - } - }); + mapView.addOnMapChangedListener(change -> Timber.e("OnMapChange: %s, %s", change, mapChangeMap.get(change))); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom( - new LatLng(55.754020, 37.620948), 12), 9000); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom( + new LatLng(55.754020, 37.620948), 12), 9000); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java index f0827c65cc..d63b34e99f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java @@ -11,7 +11,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.testapp.R; @@ -29,13 +28,10 @@ public class MapInDialogActivity extends AppCompatActivity { setContentView(R.layout.activity_map_in_dialog); Button button = (Button) findViewById(R.id.button_open_dialog); - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - FragmentManager fm = getSupportFragmentManager(); - MapDialogFragment editNameDialogFragment = MapDialogFragment.newInstance("Map Dialog"); - editNameDialogFragment.show(fm, "fragment_dialog_map"); - } + button.setOnClickListener(view -> { + FragmentManager fm = getSupportFragmentManager(); + MapDialogFragment editNameDialogFragment = MapDialogFragment.newInstance("Map Dialog"); + editNameDialogFragment.show(fm, "fragment_dialog_map"); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java index 0cf0191cea..dcebc7517e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java @@ -1,11 +1,9 @@ package com.mapbox.mapboxsdk.testapp.activity.maplayout; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; - import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -13,7 +11,6 @@ import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.testapp.R; @@ -37,19 +34,16 @@ public class MapPaddingActivity extends AppCompatActivity { mapView.setTag(true); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - MapPaddingActivity.this.mapboxMap = mapboxMap; + mapView.getMapAsync(mapboxMap -> { + MapPaddingActivity.this.mapboxMap = mapboxMap; - int paddingLeft = (int) getResources().getDimension(R.dimen.map_padding_left); - int paddingBottom = (int) getResources().getDimension(R.dimen.map_padding_bottom); - int paddingRight = (int) getResources().getDimension(R.dimen.map_padding_right); - int paddingTop = (int) getResources().getDimension(R.dimen.map_padding_top); - mapboxMap.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); + int paddingLeft = (int) getResources().getDimension(R.dimen.map_padding_left); + int paddingBottom = (int) getResources().getDimension(R.dimen.map_padding_bottom); + int paddingRight = (int) getResources().getDimension(R.dimen.map_padding_right); + int paddingTop = (int) getResources().getDimension(R.dimen.map_padding_top); + mapboxMap.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); - moveToBangalore(); - } + moveToBangalore(); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java index 8f8a5af3cc..f4c2fb716d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.activity.maplayout; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.testapp.R; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java index 393abb7cd4..32c41026ae 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java @@ -4,12 +4,10 @@ import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; /** @@ -29,13 +27,10 @@ public class VisibilityChangeActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom( - new LatLng(55.754020, 37.620948), 12), 9000); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom( + new LatLng(55.754020, 37.620948), 12), 9000); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DeleteRegionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DeleteRegionActivity.java index 220f46f4e8..b6e15065f0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DeleteRegionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/DeleteRegionActivity.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.testapp.activity.offline; import android.content.Context; -import android.content.DialogInterface; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; @@ -13,7 +12,6 @@ import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; - import com.mapbox.mapboxsdk.offline.OfflineManager; import com.mapbox.mapboxsdk.offline.OfflineRegion; import com.mapbox.mapboxsdk.testapp.R; @@ -53,18 +51,8 @@ public class DeleteRegionActivity extends AppCompatActivity implements AdapterVi input.setText(metadata); builder.setView(input); - builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - delete(region); - } - }); - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); - } - }); + builder.setPositiveButton("OK", (dialog, which) -> delete(region)); + builder.setNegativeButton("Cancel", (dialog, which) -> dialog.cancel()); builder.show(); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java index 5bffd4d930..7c5dab830f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java @@ -1,14 +1,12 @@ package com.mapbox.mapboxsdk.testapp.activity.offline; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.Toast; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -17,7 +15,6 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.offline.OfflineManager; import com.mapbox.mapboxsdk.offline.OfflineRegion; import com.mapbox.mapboxsdk.offline.OfflineRegionError; @@ -27,11 +24,10 @@ import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.model.other.OfflineDownloadRegionDialog; import com.mapbox.mapboxsdk.testapp.model.other.OfflineListRegionsDialog; import com.mapbox.mapboxsdk.testapp.utils.OfflineUtils; +import timber.log.Timber; import java.util.ArrayList; -import timber.log.Timber; - /** * Test activity showcasing the Offline API. * <p> @@ -80,21 +76,18 @@ public class OfflineActivity extends AppCompatActivity mapView = (MapView) findViewById(R.id.mapView); mapView.setStyleUrl(STYLE_URL); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - Timber.d("Map is ready"); - OfflineActivity.this.mapboxMap = mapboxMap; - - // Set initial position to UNHQ in NYC - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .target(new LatLng(40.749851, -73.967966)) - .zoom(14) - .bearing(0) - .tilt(0) - .build())); - } + mapView.getMapAsync(mapboxMap -> { + Timber.d("Map is ready"); + OfflineActivity.this.mapboxMap = mapboxMap; + + // Set initial position to UNHQ in NYC + mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .target(new LatLng(40.749851, -73.967966)) + .zoom(14) + .bearing(0) + .tilt(0) + .build())); }); // The progress bar @@ -102,20 +95,10 @@ public class OfflineActivity extends AppCompatActivity // Set up button listeners downloadRegion = (Button) findViewById(R.id.button_download_region); - downloadRegion.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - handleDownloadRegion(); - } - }); + downloadRegion.setOnClickListener(view -> handleDownloadRegion()); listRegions = (Button) findViewById(R.id.button_list_regions); - listRegions.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - handleListRegions(); - } - }); + listRegions.setOnClickListener(view -> handleListRegions()); // Set up the OfflineManager offlineManager = OfflineManager.getInstance(this); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/UpdateMetadataActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/UpdateMetadataActivity.java index 285e896766..c176a79409 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/UpdateMetadataActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/UpdateMetadataActivity.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.testapp.activity.offline; import android.content.Context; -import android.content.DialogInterface; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; @@ -15,7 +14,6 @@ import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; - import com.mapbox.mapboxsdk.offline.OfflineManager; import com.mapbox.mapboxsdk.offline.OfflineRegion; import com.mapbox.mapboxsdk.testapp.R; @@ -57,18 +55,9 @@ public class UpdateMetadataActivity extends AppCompatActivity implements Adapter input.setSelection(metadata.length()); builder.setView(input); - builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - updateMetadata(region, OfflineUtils.convertRegionName(input.getText().toString())); - } - }); - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); - } - }); + builder.setPositiveButton("OK", (dialog, which) -> + updateMetadata(region, OfflineUtils.convertRegionName(input.getText().toString()))); + builder.setNegativeButton("Cancel", (dialog, which) -> dialog.cancel()); builder.show(); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterActivity.java index 245786e1d0..7eadeae95b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterActivity.java @@ -5,21 +5,18 @@ import android.support.v7.app.AppCompatActivity; import android.view.ViewTreeObserver; import android.widget.GridLayout; import android.widget.ImageView; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.snapshotter.MapSnapshot; import com.mapbox.mapboxsdk.snapshotter.MapSnapshotter; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.util.ArrayList; import java.util.List; import java.util.Random; -import timber.log.Timber; - /** * Test activity showing how to use a the {@link com.mapbox.mapboxsdk.snapshotter.MapSnapshotter} */ @@ -95,17 +92,14 @@ public class MapSnapshotterActivity extends AppCompatActivity { MapSnapshotter snapshotter = new MapSnapshotter(MapSnapshotterActivity.this, options); - snapshotter.start(new MapSnapshotter.SnapshotReadyCallback() { - @Override - public void onSnapshotReady(MapSnapshot snapshot) { - Timber.i("Got the snapshot"); - ImageView imageView = new ImageView(MapSnapshotterActivity.this); - imageView.setImageBitmap(snapshot.getBitmap()); - grid.addView( - imageView, - new GridLayout.LayoutParams(GridLayout.spec(row), GridLayout.spec(column)) - ); - } + snapshotter.start(snapshot -> { + Timber.i("Got the snapshot"); + ImageView imageView = new ImageView(MapSnapshotterActivity.this); + imageView.setImageBitmap(snapshot.getBitmap()); + grid.addView( + imageView, + new GridLayout.LayoutParams(GridLayout.spec(row), GridLayout.spec(column)) + ); }); snapshotters.add(snapshotter); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterMarkerActivity.java index 582d4a29c5..ca657d44d8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterMarkerActivity.java @@ -9,14 +9,12 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewTreeObserver; import android.widget.ImageView; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.snapshotter.MapSnapshot; import com.mapbox.mapboxsdk.snapshotter.MapSnapshotter; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterReuseActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterReuseActivity.java index 50f9be77fa..412b2e1307 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterReuseActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/snapshot/MapSnapshotterReuseActivity.java @@ -4,7 +4,6 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -31,24 +30,21 @@ public class MapSnapshotterReuseActivity extends AppCompatActivity implements Ma fab = findViewById(R.id.fab); fab.setVisibility(View.INVISIBLE); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - fab.setVisibility(View.INVISIBLE); - - mapSnapshotter.setStyleUrl(getRandomStyle()); - if (random.nextInt(2) == 0) { - mapSnapshotter.setCameraPosition(getRandomCameraPosition()); - } else { - mapSnapshotter.setRegion(getRandomBounds()); - } - if (random.nextInt(2) == 0) { - mapSnapshotter.setSize(512, 512); - } else { - mapSnapshotter.setSize(256, 256); - } - mapSnapshotter.start(MapSnapshotterReuseActivity.this); + fab.setOnClickListener(v -> { + fab.setVisibility(View.INVISIBLE); + + mapSnapshotter.setStyleUrl(getRandomStyle()); + if (random.nextInt(2) == 0) { + mapSnapshotter.setCameraPosition(getRandomCameraPosition()); + } else { + mapSnapshotter.setRegion(getRandomBounds()); + } + if (random.nextInt(2) == 0) { + mapSnapshotter.setSize(512, 512); + } else { + mapSnapshotter.setSize(256, 256); } + mapSnapshotter.start(MapSnapshotterReuseActivity.this); }); mapSnapshotter = new MapSnapshotter( diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java index 74b43e0257..b52bb0170a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java @@ -3,14 +3,11 @@ package com.mapbox.mapboxsdk.testapp.activity.storage; import android.app.Activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.storage.FileSource; import com.mapbox.mapboxsdk.storage.Resource; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** @@ -47,12 +44,9 @@ public class UrlTransformActivity extends AppCompatActivity { // Get a handle to the file source and set the resource transform FileSource.getInstance(UrlTransformActivity.this).setResourceTransform(new Transform()); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - Timber.i("Map loaded"); - mapboxMap = map; - } + mapView.getMapAsync(map -> { + Timber.i("Map loaded"); + mapboxMap = map; }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java index 1beba632b0..30bac3468f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java @@ -9,7 +9,6 @@ import android.os.Handler; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngQuad; @@ -18,7 +17,6 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.RasterLayer; import com.mapbox.mapboxsdk.style.sources.ImageSource; - import com.mapbox.mapboxsdk.testapp.R; /** diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/BuildingFillExtrusionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/BuildingFillExtrusionActivity.java index def7d1678a..7521c83085 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/BuildingFillExtrusionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/BuildingFillExtrusionActivity.java @@ -2,15 +2,11 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; -import android.view.View; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.functions.Function; import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops; import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; @@ -46,13 +42,10 @@ public class BuildingFillExtrusionActivity extends AppCompatActivity { setContentView(R.layout.activity_building_layer); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap map) { - mapboxMap = map; - setupBuildings(); - setupLight(); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + setupBuildings(); + setupLight(); }); } @@ -73,24 +66,18 @@ public class BuildingFillExtrusionActivity extends AppCompatActivity { private void setupLight() { light = mapboxMap.getLight(); - findViewById(R.id.fabLightPosition).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - isInitPosition = !isInitPosition; - if (isInitPosition) { - light.setPosition(new Position(1.5f, 90, 80)); - } else { - light.setPosition(new Position(1.15f, 210, 30)); - } + findViewById(R.id.fabLightPosition).setOnClickListener(v -> { + isInitPosition = !isInitPosition; + if (isInitPosition) { + light.setPosition(new Position(1.5f, 90, 80)); + } else { + light.setPosition(new Position(1.15f, 210, 30)); } }); - findViewById(R.id.fabLightColor).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - isRedColor = !isRedColor; - light.setColor(PropertyFactory.colorToRgbaString(isRedColor ? Color.RED : Color.BLUE)); - } + findViewById(R.id.fabLightColor).setOnClickListener(v -> { + isRedColor = !isRedColor; + light.setColor(PropertyFactory.colorToRgbaString(isRedColor ? Color.RED : Color.BLUE)); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java index f99a1fdb96..2bc39e6e9c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java @@ -2,29 +2,25 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.LineLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.net.MalformedURLException; import java.net.URL; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.Filter.in; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius; @@ -56,16 +52,12 @@ public class CircleLayerActivity extends AppCompatActivity implements View.OnCli mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull - final MapboxMap map) { - mapboxMap = map; - addBusStopSource(); - addBusStopCircleLayer(); - initFloatingActionButtons(); - isLoadingStyle = false; - } + mapView.getMapAsync(map -> { + mapboxMap = map; + addBusStopSource(); + addBusStopCircleLayer(); + initFloatingActionButtons(); + isLoadingStyle = false; }); } @@ -161,12 +153,9 @@ public class CircleLayerActivity extends AppCompatActivity implements View.OnCli } private void loadNewStyle() { - mapboxMap.setStyleUrl(getNextStyle(), new MapboxMap.OnStyleLoadedListener() { - @Override - public void onStyleLoaded(String style) { - addBusStop(); - isLoadingStyle = false; - } + mapboxMap.setStyleUrl(getNextStyle(), style -> { + addBusStop(); + isLoadingStyle = false; }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java index 3763b45e7a..6dd4d06d3c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java @@ -2,17 +2,14 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.BitmapFactory; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; @@ -21,7 +18,6 @@ import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; import com.mapbox.services.commons.geojson.Point; import com.mapbox.services.commons.models.Position; - import timber.log.Timber; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; @@ -45,56 +41,53 @@ public class CustomSpriteActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap map) { - mapboxMap = map; - final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); - fab.setColorFilter(ContextCompat.getColor(CustomSpriteActivity.this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - private Point point; - - @Override - public void onClick(View view) { - if (point == null) { - Timber.i("First click -> Car"); - // Add an icon to reference later - mapboxMap.addImage(CUSTOM_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_car_top)); - - // Add a source with a geojson point - point = Point.fromCoordinates(Position.fromCoordinates(13.400972d, 52.519003d)); - source = new GeoJsonSource( - "point", - FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)}) - ); - mapboxMap.addSource(source); - - // Add a symbol layer that references that point source - layer = new SymbolLayer("layer", "point"); - layer.setProperties( - // Set the id of the sprite to use - iconImage(CUSTOM_ICON) - ); - - // lets add a circle below labels! - mapboxMap.addLayerBelow(layer, "waterway-label"); - - fab.setImageResource(R.drawable.ic_directions_car_black); - } else { - // Update point - point = Point.fromCoordinates( - Position.fromCoordinates(point.getCoordinates().getLongitude() + 0.001, - point.getCoordinates().getLatitude() + 0.001) - ); - source.setGeoJson(FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)})); - - // Move the camera as well - mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng( - point.getCoordinates().getLatitude(), point.getCoordinates().getLongitude()))); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setColorFilter(ContextCompat.getColor(CustomSpriteActivity.this, R.color.primary)); + fab.setOnClickListener(new View.OnClickListener() { + private Point point; + + @Override + public void onClick(View view) { + if (point == null) { + Timber.i("First click -> Car"); + // Add an icon to reference later + mapboxMap.addImage(CUSTOM_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_car_top)); + + // Add a source with a geojson point + point = Point.fromCoordinates(Position.fromCoordinates(13.400972d, 52.519003d)); + source = new GeoJsonSource( + "point", + FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)}) + ); + mapboxMap.addSource(source); + + // Add a symbol layer that references that point source + layer = new SymbolLayer("layer", "point"); + layer.setProperties( + // Set the id of the sprite to use + iconImage(CUSTOM_ICON) + ); + + // lets add a circle below labels! + mapboxMap.addLayerBelow(layer, "waterway-label"); + + fab.setImageResource(R.drawable.ic_directions_car_black); + } else { + // Update point + point = Point.fromCoordinates( + Position.fromCoordinates(point.getCoordinates().getLongitude() + 0.001, + point.getCoordinates().getLatitude() + 0.001) + ); + source.setGeoJson(FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)})); + + // Move the camera as well + mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng( + point.getCoordinates().getLatitude(), point.getCoordinates().getLongitude()))); } - }); - } + } + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DataDrivenStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DataDrivenStyleActivity.java index 571b48daa6..36fd87e783 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DataDrivenStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/DataDrivenStyleActivity.java @@ -6,23 +6,20 @@ import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.functions.stops.Stops; import com.mapbox.mapboxsdk.style.layers.FillLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; +import timber.log.Timber; import java.io.IOException; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.functions.Function.composite; import static com.mapbox.mapboxsdk.style.functions.Function.property; import static com.mapbox.mapboxsdk.style.functions.Function.zoom; @@ -54,18 +51,15 @@ public class DataDrivenStyleActivity extends AppCompatActivity { mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - // Store for later - mapboxMap = map; + mapView.getMapAsync(map -> { + // Store for later + mapboxMap = map; - // Add a parks layer - addParksLayer(); + // Add a parks layer + addParksLayer(); - // Center and Zoom (Amsterdam, zoomed to streets) - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.379189, 4.899431), 14)); - } + // Center and Zoom (Amsterdam, zoomed to streets) + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.379189, 4.899431), 14)); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java index 52ba8d7c7b..a6be0c6f4f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java @@ -2,15 +2,12 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; @@ -35,58 +32,55 @@ public class FillExtrusionActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap map) { - mapboxMap = map; - Polygon domTower = Polygon.fromCoordinates(new double[][][] { - new double[][] { - new double[] { - 5.12112557888031, - 52.09071040847704 - }, - new double[] { - 5.121227502822875, - 52.09053901776669 - }, - new double[] { - 5.121484994888306, - 52.090601641371805 - }, - new double[] { - 5.1213884353637695, - 52.090766439912635 - }, - new double[] { - 5.12112557888031, - 52.09071040847704 - } + mapView.getMapAsync(map -> { + mapboxMap = map; + Polygon domTower = Polygon.fromCoordinates(new double[][][] { + new double[][] { + new double[] { + 5.12112557888031, + 52.09071040847704 + }, + new double[] { + 5.121227502822875, + 52.09053901776669 + }, + new double[] { + 5.121484994888306, + 52.090601641371805 + }, + new double[] { + 5.1213884353637695, + 52.090766439912635 + }, + new double[] { + 5.12112557888031, + 52.09071040847704 } - }); - - GeoJsonSource source = new GeoJsonSource("extrusion-source", domTower); - map.addSource(source); - - mapboxMap.addLayer( - new FillExtrusionLayer("extrusion-layer", source.getId()) - .withProperties( - fillExtrusionHeight(40f), - fillExtrusionOpacity(0.5f), - fillExtrusionColor(Color.RED) - ) - ); - - mapboxMap.animateCamera( - CameraUpdateFactory.newCameraPosition( - new CameraPosition.Builder() - .target(new LatLng(52.09071040847704, 5.12112557888031)) - .tilt(45.0) - .zoom(18) - .build() - ), - 10000 - ); - } + } + }); + + GeoJsonSource source = new GeoJsonSource("extrusion-source", domTower); + map.addSource(source); + + mapboxMap.addLayer( + new FillExtrusionLayer("extrusion-layer", source.getId()) + .withProperties( + fillExtrusionHeight(40f), + fillExtrusionOpacity(0.5f), + fillExtrusionColor(Color.RED) + ) + ); + + mapboxMap.animateCamera( + CameraUpdateFactory.newCameraPosition( + new CameraPosition.Builder() + .target(new LatLng(52.09071040847704, 5.12112557888031)) + .tilt(45.0) + .zoom(18) + .build() + ), + 10000 + ); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java index 24914fcbb2..1322c34fe9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java @@ -2,10 +2,8 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; /** @@ -24,12 +22,7 @@ public class FillExtrusionStyleTestActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap mapboxMap) { - FillExtrusionStyleTestActivity.this.mapboxMap = mapboxMap; - } - }); + mapView.getMapAsync(mapboxMap -> FillExtrusionStyleTestActivity.this.mapboxMap = mapboxMap); } public MapboxMap getMapboxMap() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java index a2111bc304..abe5cf62f1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java @@ -5,23 +5,20 @@ import android.os.Bundle; import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.net.MalformedURLException; import java.net.URL; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.Filter.all; import static com.mapbox.mapboxsdk.style.layers.Filter.gte; import static com.mapbox.mapboxsdk.style.layers.Filter.lt; @@ -50,15 +47,12 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { // noinspection ConstantConditions mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.7749, 122.4194), 0)); + mapView.getMapAsync(map -> { + mapboxMap = map; + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.7749, 122.4194), 0)); - // Add a clustered source with some layers - addClusteredGeoJsonSource(); - } + // Add a clustered source with some layers + addClusteredGeoJsonSource(); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java index b9f1dfe810..c3c26bb6b5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java @@ -4,19 +4,17 @@ import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.net.MalformedURLException; import java.net.URL; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; /** diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index adce889007..95624492aa 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -7,12 +7,10 @@ import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.functions.Function; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; import com.mapbox.mapboxsdk.style.functions.stops.Stop; @@ -34,14 +32,13 @@ import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; +import timber.log.Timber; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; @@ -85,18 +82,15 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - // Store for later - mapboxMap = map; + mapView.getMapAsync(map -> { + // Store for later + mapboxMap = map; - // Center and Zoom (Amsterdam, zoomed to streets) - mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.379189, 4.899431), 14)); + // Center and Zoom (Amsterdam, zoomed to streets) + mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.379189, 4.899431), 14)); - mapboxMap.setTransitionDuration(250); - mapboxMap.setTransitionDelay(50); - } + mapboxMap.setTransitionDuration(250); + mapboxMap.setTransitionDelay(50); }); } @@ -362,32 +356,29 @@ public class RuntimeStyleActivity extends AppCompatActivity { private void animateParksSource(final FeatureCollection parks, final int counter) { Handler handler = new Handler(getMainLooper()); - handler.postDelayed(new Runnable() { - @Override - public void run() { - if (mapboxMap == null) { - return; - } + handler.postDelayed(() -> { + if (mapboxMap == null) { + return; + } - Timber.d("Updating parks source"); - // change the source - int park = counter < parks.getFeatures().size() - 1 ? counter : 0; + Timber.d("Updating parks source"); + // change the source + int park = counter < parks.getFeatures().size() - 1 ? counter : 0; - GeoJsonSource source = mapboxMap.getSourceAs("dynamic-park-source"); + GeoJsonSource source = mapboxMap.getSourceAs("dynamic-park-source"); - if (source == null) { - Timber.e("Source not found"); - Toast.makeText(RuntimeStyleActivity.this, "Source not found", Toast.LENGTH_SHORT).show(); - return; - } + if (source == null) { + Timber.e("Source not found"); + Toast.makeText(RuntimeStyleActivity.this, "Source not found", Toast.LENGTH_SHORT).show(); + return; + } - List<Feature> features = new ArrayList<>(); - features.add(parks.getFeatures().get(park)); - source.setGeoJson(FeatureCollection.fromFeatures(features)); + List<Feature> features = new ArrayList<>(); + features.add(parks.getFeatures().get(park)); + source.setGeoJson(FeatureCollection.fromFeatures(features)); - // Re-post - animateParksSource(parks, park + 1); - } + // Re-post + animateParksSource(parks, park + 1); }, counter == 0 ? 100 : 1000); } @@ -498,28 +489,25 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(31, -100), 3)); Handler handler = new Handler(getMainLooper()); - handler.postDelayed(new Runnable() { - @Override - public void run() { - if (mapboxMap == null) { - return; - } + handler.postDelayed(() -> { + if (mapboxMap == null) { + return; + } - Timber.d("Styling filtered fill layer"); + Timber.d("Styling filtered fill layer"); - FillLayer states = (FillLayer) mapboxMap.getLayer("states"); + FillLayer states = (FillLayer) mapboxMap.getLayer("states"); - if (states != null) { - states.setFilter(eq("name", "Texas")); - states.setFillOpacityTransition(new TransitionOptions(2500, 0)); - states.setFillColorTransition(new TransitionOptions(2500, 0)); - states.setProperties( - fillColor(Color.RED), - fillOpacity(0.25f) - ); - } else { - Toast.makeText(RuntimeStyleActivity.this, "No states layer in this style", Toast.LENGTH_SHORT).show(); - } + if (states != null) { + states.setFilter(eq("name", "Texas")); + states.setFillOpacityTransition(new TransitionOptions(2500, 0)); + states.setFillColorTransition(new TransitionOptions(2500, 0)); + states.setProperties( + fillColor(Color.RED), + fillOpacity(0.25f) + ); + } else { + Toast.makeText(RuntimeStyleActivity.this, "No states layer in this style", Toast.LENGTH_SHORT).show(); } }, 2000); } @@ -529,28 +517,25 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40, -97), 5)); Handler handler = new Handler(getMainLooper()); - handler.postDelayed(new Runnable() { - @Override - public void run() { - if (mapboxMap == null) { - return; - } + handler.postDelayed(() -> { + if (mapboxMap == null) { + return; + } - Timber.d("Styling filtered line layer"); + Timber.d("Styling filtered line layer"); - LineLayer counties = (LineLayer) mapboxMap.getLayer("counties"); + LineLayer counties = (LineLayer) mapboxMap.getLayer("counties"); - if (counties != null) { - counties.setFilter(eq("NAME10", "Washington")); + if (counties != null) { + counties.setFilter(eq("NAME10", "Washington")); - counties.setProperties( - lineColor(Color.RED), - lineOpacity(0.75f), - lineWidth(5f) - ); - } else { - Toast.makeText(RuntimeStyleActivity.this, "No counties layer in this style", Toast.LENGTH_SHORT).show(); - } + counties.setProperties( + lineColor(Color.RED), + lineOpacity(0.75f), + lineWidth(5f) + ); + } else { + Toast.makeText(RuntimeStyleActivity.this, "No counties layer in this style", Toast.LENGTH_SHORT).show(); } }, 2000); } @@ -560,27 +545,24 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40, -97), 5)); Handler handler = new Handler(getMainLooper()); - handler.postDelayed(new Runnable() { - @Override - public void run() { - if (mapboxMap == null) { - return; - } + handler.postDelayed(() -> { + if (mapboxMap == null) { + return; + } - Timber.d("Styling numeric fill layer"); + Timber.d("Styling numeric fill layer"); - FillLayer regions = (FillLayer) mapboxMap.getLayer("regions"); + FillLayer regions = (FillLayer) mapboxMap.getLayer("regions"); - if (regions != null) { - regions.setFilter(all(gte("HRRNUM", 200), lt("HRRNUM", 300))); + if (regions != null) { + regions.setFilter(all(gte("HRRNUM", 200), lt("HRRNUM", 300))); - regions.setProperties( - fillColor(Color.BLUE), - fillOpacity(0.5f) - ); - } else { - Toast.makeText(RuntimeStyleActivity.this, "No regions layer in this style", Toast.LENGTH_SHORT).show(); - } + regions.setProperties( + fillColor(Color.BLUE), + fillOpacity(0.5f) + ); + } else { + Toast.makeText(RuntimeStyleActivity.this, "No regions layer in this style", Toast.LENGTH_SHORT).show(); } }, 2000); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java index 910233accf..eaab537643 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java @@ -2,10 +2,8 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; /** @@ -24,12 +22,7 @@ public class RuntimeStyleTestActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap mapboxMap) { - RuntimeStyleTestActivity.this.mapboxMap = mapboxMap; - } - }); + mapView.getMapAsync(mapboxMap -> RuntimeStyleTestActivity.this.mapboxMap = mapboxMap); } public MapboxMap getMapboxMap() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java index 5057578731..98f525a2f7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java @@ -3,10 +3,8 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.sources.VectorSource; import com.mapbox.mapboxsdk.testapp.R; @@ -32,23 +30,20 @@ public class RuntimeStyleTimingTestActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap mapboxMap) { - RuntimeStyleTimingTestActivity.this.mapboxMap = mapboxMap; - VectorSource museums = new VectorSource("museums_source", "mapbox://mapbox.2opop9hr"); - mapboxMap.addSource(museums); - - CircleLayer museumsLayer = new CircleLayer("museums", "museums_source"); - museumsLayer.setSourceLayer("museum-cusco"); - museumsLayer.setProperties( - visibility(VISIBLE), - circleRadius(8f), - circleColor(Color.argb(1, 55, 148, 179)) - ); - - mapboxMap.addLayer(museumsLayer); - } + mapView.getMapAsync(mapboxMap -> { + RuntimeStyleTimingTestActivity.this.mapboxMap = mapboxMap; + VectorSource museums = new VectorSource("museums_source", "mapbox://mapbox.2opop9hr"); + mapboxMap.addSource(museums); + + CircleLayer museumsLayer = new CircleLayer("museums", "museums_source"); + museumsLayer.setSourceLayer("museum-cusco"); + museumsLayer.setProperties( + visibility(VISIBLE), + circleRadius(8f), + circleColor(Color.argb(1, 55, 148, 179)) + ); + + mapboxMap.addLayer(museumsLayer); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java index 49015ec1e9..0c241bf6b9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java @@ -3,18 +3,15 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; -import android.view.View; import android.widget.Toast; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; +import timber.log.Timber; import java.io.BufferedWriter; import java.io.File; @@ -22,8 +19,6 @@ import java.io.FileWriter; import java.io.IOException; import java.lang.ref.WeakReference; -import timber.log.Timber; - /** * Test activity showcasing how to use a file:// resource for the style.json and how to use MapboxMap#setStyleJson. */ @@ -39,29 +34,16 @@ public class StyleFileActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap map) { - mapboxMap = map; - - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_file); - fab.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - new CreateStyleFileTask(view.getContext(), mapboxMap).execute(); - } - }); - - FloatingActionButton fabStyleJson = (FloatingActionButton) findViewById(R.id.fab_style_json); - fabStyleJson.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); - fabStyleJson.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - new LoadStyleFileTask(view.getContext(), mapboxMap).execute(); - } - }); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_file); + fab.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); + fab.setOnClickListener(view -> new CreateStyleFileTask(view.getContext(), mapboxMap).execute()); + + FloatingActionButton fabStyleJson = (FloatingActionButton) findViewById(R.id.fab_style_json); + fabStyleJson.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); + fabStyleJson.setOnClickListener(view -> new LoadStyleFileTask(view.getContext(), mapboxMap).execute()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java index 0eaccfef0c..f72fa79743 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java @@ -2,20 +2,17 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v7.app.AppCompatActivity; import android.graphics.Color; import android.graphics.PointF; import android.os.Bundle; import android.support.annotation.NonNull; - +import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; - import com.google.gson.GsonBuilder; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; @@ -30,13 +27,11 @@ import com.mapbox.services.commons.geojson.Geometry; import com.mapbox.services.commons.geojson.custom.GeometryDeserializer; import com.mapbox.services.commons.geojson.custom.PositionDeserializer; import com.mapbox.services.commons.models.Position; +import timber.log.Timber; import java.io.IOException; - import java.util.List; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; @@ -110,19 +105,16 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR } private void addSymbolClickListener() { - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - PointF screenPoint = mapboxMap.getProjection().toScreenLocation(point); - List<Feature> features = mapboxMap.queryRenderedFeatures(screenPoint, LAYER_ID); - if (!features.isEmpty()) { - Feature feature = features.get(0); - Timber.v("Feature was clicked with data: %s", feature.toJson()); - Toast.makeText( - SymbolGeneratorActivity.this, - "hello from: " + feature.getStringProperty(FEATURE_VALUE), - Toast.LENGTH_LONG).show(); - } + mapboxMap.setOnMapClickListener(point -> { + PointF screenPoint = mapboxMap.getProjection().toScreenLocation(point); + List<Feature> features = mapboxMap.queryRenderedFeatures(screenPoint, LAYER_ID); + if (!features.isEmpty()) { + Feature feature = features.get(0); + Timber.v("Feature was clicked with data: %s", feature.toJson()); + Toast.makeText( + SymbolGeneratorActivity.this, + "hello from: " + feature.getStringProperty(FEATURE_VALUE), + Toast.LENGTH_LONG).show(); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java index 82da905413..5b1737fb4f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java @@ -8,14 +8,12 @@ import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; - import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; @@ -51,43 +49,40 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap map) { - mapboxMap = map; - - // Add a image for the makers - mapboxMap.addImage( - "my-marker-image", - BitmapFactory.decodeResource(SymbolLayerActivity.this.getResources(), - R.drawable.mapbox_marker_icon_default) - ); - - // Add a source - FeatureCollection markers = FeatureCollection.fromFeatures(new Feature[] { - Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.35673}), featureProperties("Marker 1")), - Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.34673}), featureProperties("Marker 2")) - }); - mapboxMap.addSource(new GeoJsonSource(MARKER_SOURCE, markers)); - - // Add the symbol-layer - mapboxMap.addLayer( - new SymbolLayer(MARKER_LAYER, MARKER_SOURCE) - .withProperties( - iconImage("my-marker-image"), - iconAllowOverlap(true), - textField("{title}"), - textColor(Color.RED), - textSize(10f) - ) - ); - - // Show - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.35273, 4.91638), 14)); - - // Set a click-listener so we can manipulate the map - mapboxMap.setOnMapClickListener(SymbolLayerActivity.this); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + + // Add a image for the makers + mapboxMap.addImage( + "my-marker-image", + BitmapFactory.decodeResource(SymbolLayerActivity.this.getResources(), + R.drawable.mapbox_marker_icon_default) + ); + + // Add a source + FeatureCollection markers = FeatureCollection.fromFeatures(new Feature[] { + Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.35673}), featureProperties("Marker 1")), + Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.34673}), featureProperties("Marker 2")) + }); + mapboxMap.addSource(new GeoJsonSource(MARKER_SOURCE, markers)); + + // Add the symbol-layer + mapboxMap.addLayer( + new SymbolLayer(MARKER_LAYER, MARKER_SOURCE) + .withProperties( + iconImage("my-marker-image"), + iconAllowOverlap(true), + textField("{title}"), + textColor(Color.RED), + textSize(10f) + ) + ); + + // Show + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.35273, 4.91638), 14)); + + // Set a click-listener so we can manipulate the map + mapboxMap.setOnMapClickListener(SymbolLayerActivity.this); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java index 95c3929c1d..83595dd5fe 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java @@ -2,16 +2,12 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.graphics.PointF; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; - import com.google.gson.JsonObject; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; @@ -19,11 +15,10 @@ import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; import com.mapbox.services.commons.geojson.Point; import com.mapbox.services.commons.models.Position; +import timber.log.Timber; import java.util.List; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.functions.Function.property; import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; @@ -60,14 +55,11 @@ public class ZoomFunctionSymbolLayerActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(@NonNull final MapboxMap map) { - mapboxMap = map; - updateSource(); - addLayer(); - addMapClickListener(); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + updateSource(); + addLayer(); + addMapClickListener(); }); } @@ -120,19 +112,16 @@ public class ZoomFunctionSymbolLayerActivity extends AppCompatActivity { } private void addMapClickListener() { - mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { - @Override - public void onMapClick(@NonNull LatLng point) { - PointF screenPoint = mapboxMap.getProjection().toScreenLocation(point); - List<Feature> featureList = mapboxMap.queryRenderedFeatures(screenPoint, LAYER_ID); - if (!featureList.isEmpty()) { - Feature feature = featureList.get(0); - boolean selectedNow = feature.getBooleanProperty(KEY_PROPERTY_SELECTED); - isSelected = !selectedNow; - updateSource(); - } else { - Timber.e("No features found"); - } + mapboxMap.setOnMapClickListener(point -> { + PointF screenPoint = mapboxMap.getProjection().toScreenLocation(point); + List<Feature> featureList = mapboxMap.queryRenderedFeatures(screenPoint, LAYER_ID); + if (!featureList.isEmpty()) { + Feature feature = featureList.get(0); + boolean selectedNow = feature.getBooleanProperty(KEY_PROPERTY_SELECTED); + isSelected = !selectedNow; + updateSource(); + } else { + Timber.e("No features found"); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewAnimationActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewAnimationActivity.java index dc95373663..c9ac8c5070 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewAnimationActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewAnimationActivity.java @@ -6,12 +6,10 @@ import android.os.Handler; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import java.util.Locale; @@ -56,22 +54,19 @@ public class TextureViewAnimationActivity extends AppCompatActivity { private void setupMapView(Bundle savedInstanceState) { mapView = (MapView) findViewById(R.id.mapView); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap mapboxMap) { - TextureViewAnimationActivity.this.mapboxMap = mapboxMap; - - setFpsView(mapboxMap); - - // Animate the map view - ObjectAnimator animation = ObjectAnimator.ofFloat(mapView, "rotationY", 0.0f, 360f); - animation.setDuration(3600); - animation.setRepeatCount(ObjectAnimator.INFINITE); - animation.start(); - - // Start an animation on the map as well - flyTo(mapboxMap, 0, 14); - } + mapView.getMapAsync(mapboxMap -> { + TextureViewAnimationActivity.this.mapboxMap = mapboxMap; + + setFpsView(mapboxMap); + + // Animate the map view + ObjectAnimator animation = ObjectAnimator.ofFloat(mapView, "rotationY", 0.0f, 360f); + animation.setDuration(3600); + animation.setRepeatCount(ObjectAnimator.INFINITE); + animation.start(); + + // Start an animation on the map as well + flyTo(mapboxMap, 0, 14); }); } @@ -82,12 +77,9 @@ public class TextureViewAnimationActivity extends AppCompatActivity { new MapboxMap.CancelableCallback() { @Override public void onCancel() { - delayed = new Runnable() { - @Override - public void run() { - delayed = null; - flyTo(mapboxMap, place, zoom); - } + delayed = () -> { + delayed = null; + flyTo(mapboxMap, place, zoom); }; handler.postDelayed(delayed, 2000); } @@ -101,12 +93,7 @@ public class TextureViewAnimationActivity extends AppCompatActivity { private void setFpsView(MapboxMap mapboxMap) { final TextView fpsView = (TextView) findViewById(R.id.fpsView); - mapboxMap.setOnFpsChangedListener(new MapboxMap.OnFpsChangedListener() { - @Override - public void onFpsChanged(double fps) { - fpsView.setText(String.format(Locale.US, "FPS: %4.2f", fps)); - } - }); + mapboxMap.setOnFpsChangedListener(fps -> fpsView.setText(String.format(Locale.US, "FPS: %4.2f", fps))); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewDebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewDebugModeActivity.java index 87f78cf2c8..5483914c38 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewDebugModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewDebugModeActivity.java @@ -11,12 +11,9 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; - -import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -24,12 +21,11 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.Property; import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.util.List; import java.util.Locale; -import timber.log.Timber; - import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; /** @@ -82,13 +78,10 @@ public class TextureViewDebugModeActivity extends AppCompatActivity implements O private void setupMapView(Bundle savedInstanceState) { mapView = (MapView) findViewById(R.id.mapView); - mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { - @Override - public void onMapChanged(int change) { - if (change == MapView.DID_FINISH_LOADING_STYLE && mapboxMap != null) { - Timber.v("New style loaded with JSON: %s", mapboxMap.getStyleJson()); - setupNavigationView(mapboxMap.getLayers()); - } + mapView.addOnMapChangedListener(change -> { + if (change == MapView.DID_FINISH_LOADING_STYLE && mapboxMap != null) { + Timber.v("New style loaded with JSON: %s", mapboxMap.getStyleJson()); + setupNavigationView(mapboxMap.getLayers()); } }); @@ -110,25 +103,17 @@ public class TextureViewDebugModeActivity extends AppCompatActivity implements O private void setFpsView() { final TextView fpsView = (TextView) findViewById(R.id.fpsView); - mapboxMap.setOnFpsChangedListener(new MapboxMap.OnFpsChangedListener() { - @Override - public void onFpsChanged(double fps) { - fpsView.setText(String.format(Locale.US,"FPS: %4.2f", fps)); - } - }); + mapboxMap.setOnFpsChangedListener(fps -> fpsView.setText(String.format(Locale.US,"FPS: %4.2f", fps))); } private void setupNavigationView(List<Layer> layerList) { final LayerListAdapter adapter = new LayerListAdapter(this, layerList); ListView listView = (ListView) findViewById(R.id.listView); listView.setAdapter(adapter); - listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - Layer clickedLayer = adapter.getItem(position); - toggleLayerVisibility(clickedLayer); - closeNavigationView(); - } + listView.setOnItemClickListener((parent, view, position, id) -> { + Layer clickedLayer = adapter.getItem(position); + toggleLayerVisibility(clickedLayer); + closeNavigationView(); }); } @@ -148,44 +133,30 @@ public class TextureViewDebugModeActivity extends AppCompatActivity implements O private void setupZoomView() { final TextView textView = (TextView) findViewById(R.id.textZoom); - mapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() { - @Override - public void onCameraChange(CameraPosition position) { - textView.setText(String.format(getString(R.string.debug_zoom), position.zoom)); - } - }); + mapboxMap.setOnCameraChangeListener(position -> + textView.setText(String.format(getString(R.string.debug_zoom), position.zoom))); } private void setupDebugChangeView() { FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug); - fabDebug.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - Timber.d("Debug FAB: isDebug Active? %s", mapboxMap.isDebugActive()); - mapboxMap.cycleDebugOptions(); - } + fabDebug.setOnClickListener(view -> { + if (mapboxMap != null) { + Timber.d("Debug FAB: isDebug Active? %s", mapboxMap.isDebugActive()); + mapboxMap.cycleDebugOptions(); } }); } private void setupStyleChangeView() { FloatingActionButton fabStyles = (FloatingActionButton) findViewById(R.id.fabStyles); - fabStyles.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - currentStyleIndex++; - if (currentStyleIndex == STYLES.length) { - currentStyleIndex = 0; - } - mapboxMap.setStyleUrl(STYLES[currentStyleIndex], new MapboxMap.OnStyleLoadedListener() { - @Override - public void onStyleLoaded(String style) { - Timber.d("Style loaded %s", style); - } - }); + fabStyles.setOnClickListener(view -> { + if (mapboxMap != null) { + currentStyleIndex++; + if (currentStyleIndex == STYLES.length) { + currentStyleIndex = 0; } + mapboxMap.setStyleUrl(STYLES[currentStyleIndex], style + -> Timber.d("Style loaded %s", style)); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewResizeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewResizeActivity.java index 388774e6c8..4db1386eae 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewResizeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewResizeActivity.java @@ -6,10 +6,8 @@ import android.support.design.widget.FloatingActionButton; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; /** @@ -39,25 +37,17 @@ public class TextureViewResizeActivity extends AppCompatActivity { private void setupMapView(Bundle savedInstanceState) { mapView = (MapView) findViewById(R.id.mapView); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap mapboxMap) { - TextureViewResizeActivity.this.mapboxMap = mapboxMap; - } - }); + mapView.getMapAsync(mapboxMap -> TextureViewResizeActivity.this.mapboxMap = mapboxMap); } private void setupFab() { FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabResize); - fabDebug.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapView != null) { - View parent = findViewById(R.id.coordinator_layout); - int width = parent.getWidth() == mapView.getWidth() ? parent.getWidth() / 2 : parent.getWidth(); - int height = parent.getHeight() == mapView.getHeight() ? parent.getHeight() / 2 : parent.getHeight(); - mapView.setLayoutParams(new CoordinatorLayout.LayoutParams(width, height)); - } + fabDebug.setOnClickListener(view -> { + if (mapView != null) { + View parent = findViewById(R.id.coordinator_layout); + int width = parent.getWidth() == mapView.getWidth() ? parent.getWidth() / 2 : parent.getWidth(); + int height = parent.getHeight() == mapView.getHeight() ? parent.getHeight() / 2 : parent.getHeight(); + mapView.setLayoutParams(new CoordinatorLayout.LayoutParams(width, height)); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java index 71b8115d2e..1031c5b6a0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java @@ -8,7 +8,6 @@ import android.support.annotation.UiThread; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; - import com.mapbox.services.android.telemetry.permissions.PermissionsListener; import com.mapbox.services.android.telemetry.permissions.PermissionsManager; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/CustomLocationEngineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/CustomLocationEngineActivity.java index 626f7c372d..a97da02472 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/CustomLocationEngineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/CustomLocationEngineActivity.java @@ -4,12 +4,9 @@ import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.view.Menu; import android.view.MenuItem; -import android.view.View; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; /** @@ -28,21 +25,15 @@ public class CustomLocationEngineActivity extends BaseLocationActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - mapboxMap.setLocationSource(MockLocationEngine.getInstance()); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + mapboxMap.setLocationSource(MockLocationEngine.getInstance()); }); locationToggleFab = (FloatingActionButton) findViewById(R.id.fabLocationToggle); - locationToggleFab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - enableLocation(!mapboxMap.isMyLocationEnabled()); - } + locationToggleFab.setOnClickListener(view -> { + if (mapboxMap != null) { + enableLocation(!mapboxMap.isMyLocationEnabled()); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java index bfc04dc1e6..18f332362d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java @@ -4,10 +4,8 @@ import android.animation.AnimatorListenerAdapter; import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.location.Location; - import com.mapbox.services.android.core.location.LocationEngine; import com.mapbox.services.android.core.location.LocationEngineListener; - import timber.log.Timber; /** @@ -21,12 +19,9 @@ public class MockLocationEngine extends LocationEngine { private static int counter; MockLocationEngine(Location start, Location end) { - locationAnimator = new LocationAnimator(start, end, new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - for (LocationEngineListener listener : locationListeners) { - listener.onLocationChanged((Location) animation.getAnimatedValue()); - } + locationAnimator = new LocationAnimator(start, end, animation -> { + for (LocationEngineListener listener : locationListeners) { + listener.onLocationChanged((Location) animation.getAnimatedValue()); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java index 2b681f6983..f2640e88a8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java @@ -7,14 +7,12 @@ import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.services.android.core.location.LocationEngineListener; @@ -50,12 +48,9 @@ public class MyLocationDrawableActivity extends BaseLocationActivity implements parent.addView(mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - toggleGps(true); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + toggleGps(true); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java index 44ee030885..94f09cbe46 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java @@ -9,13 +9,11 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.view.View; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.testapp.R; @@ -37,80 +35,65 @@ public class MyLocationTintActivity extends BaseLocationActivity implements Loca mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - - // enable location updates - toggleGps(!mapboxMap.isMyLocationEnabled()); - - // add some padding - final MyLocationViewSettings myLocationViewSettings = mapboxMap.getMyLocationViewSettings(); - myLocationViewSettings.setPadding(0, 500, 0, 0); - - // enable tracking - TrackingSettings settings = mapboxMap.getTrackingSettings(); - settings.setDismissLocationTrackingOnGesture(false); - settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW); - - // handle default button clicks - ViewUtils.attachClickListener( - MyLocationTintActivity.this, - R.id.default_user_dot_coloring_button, - new View.OnClickListener() { - @Override - public void onClick(View view) { - myLocationViewSettings.setAccuracyTintColor(ContextCompat.getColor( - MyLocationTintActivity.this, R.color.mapbox_blue)); - myLocationViewSettings.setForegroundTintColor(ContextCompat.getColor( - MyLocationTintActivity.this, R.color.mapbox_blue)); - myLocationViewSettings.setBackgroundTintColor(Color.WHITE); - } - }); - - // handle tint user dot button clicks - ViewUtils.attachClickListener( - MyLocationTintActivity.this, - R.id.tint_user_dot_button, - new View.OnClickListener() { - @Override - public void onClick(View view) { - myLocationViewSettings.setAccuracyTintColor( - ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapboxGreen)); - myLocationViewSettings.setForegroundTintColor( - ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapboxGreen)); - myLocationViewSettings.setBackgroundTintColor(Color.WHITE); - } - }); - - // handle tint accuracy ring button clicks - ViewUtils.attachClickListener( - MyLocationTintActivity.this, - R.id.user_accuracy_ring_tint_button, - new View.OnClickListener() { - @Override - public void onClick(View view) { - myLocationViewSettings.setAccuracyTintColor( - ContextCompat.getColor(MyLocationTintActivity.this, R.color.accent)); - myLocationViewSettings.setForegroundTintColor( - ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_blue)); - myLocationViewSettings.setBackgroundTintColor(Color.WHITE); - } - }); - - ViewUtils.attachClickListener( - MyLocationTintActivity.this, - R.id.user_dot_transparent_button, - new View.OnClickListener() { - @Override - public void onClick(View view) { - myLocationViewSettings.setForegroundTintColor(Color.TRANSPARENT); - myLocationViewSettings.setBackgroundTintColor(Color.TRANSPARENT); - } - } - ); - } + mapView.getMapAsync(map -> { + mapboxMap = map; + + // enable location updates + toggleGps(!mapboxMap.isMyLocationEnabled()); + + // add some padding + final MyLocationViewSettings myLocationViewSettings = mapboxMap.getMyLocationViewSettings(); + myLocationViewSettings.setPadding(0, 500, 0, 0); + + // enable tracking + TrackingSettings settings = mapboxMap.getTrackingSettings(); + settings.setDismissLocationTrackingOnGesture(false); + settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW); + + // handle default button clicks + ViewUtils.attachClickListener( + MyLocationTintActivity.this, + R.id.default_user_dot_coloring_button, + view -> { + myLocationViewSettings.setAccuracyTintColor(ContextCompat.getColor( + MyLocationTintActivity.this, R.color.mapbox_blue)); + myLocationViewSettings.setForegroundTintColor(ContextCompat.getColor( + MyLocationTintActivity.this, R.color.mapbox_blue)); + myLocationViewSettings.setBackgroundTintColor(Color.WHITE); + }); + + // handle tint user dot button clicks + ViewUtils.attachClickListener( + MyLocationTintActivity.this, + R.id.tint_user_dot_button, + view -> { + myLocationViewSettings.setAccuracyTintColor( + ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapboxGreen)); + myLocationViewSettings.setForegroundTintColor( + ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapboxGreen)); + myLocationViewSettings.setBackgroundTintColor(Color.WHITE); + }); + + // handle tint accuracy ring button clicks + ViewUtils.attachClickListener( + MyLocationTintActivity.this, + R.id.user_accuracy_ring_tint_button, + view -> { + myLocationViewSettings.setAccuracyTintColor( + ContextCompat.getColor(MyLocationTintActivity.this, R.color.accent)); + myLocationViewSettings.setForegroundTintColor( + ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_blue)); + myLocationViewSettings.setBackgroundTintColor(Color.WHITE); + }); + + ViewUtils.attachClickListener( + MyLocationTintActivity.this, + R.id.user_dot_transparent_button, + view -> { + myLocationViewSettings.setForegroundTintColor(Color.TRANSPARENT); + myLocationViewSettings.setBackgroundTintColor(Color.TRANSPARENT); + } + ); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java index 718c10c7cb..dbee3f25f7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java @@ -2,13 +2,9 @@ package com.mapbox.mapboxsdk.testapp.activity.userlocation; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; -import android.view.View; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; - import timber.log.Timber; /** @@ -27,20 +23,12 @@ public class MyLocationToggleActivity extends BaseLocationActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(new OnMapReadyCallback() { - @Override - public void onMapReady(MapboxMap map) { - mapboxMap = map; - } - }); + mapView.getMapAsync(map -> mapboxMap = map); locationToggleFab = (FloatingActionButton) findViewById(R.id.fabLocationToggle); - locationToggleFab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mapboxMap != null) { - toggleGps(!mapboxMap.isMyLocationEnabled()); - } + locationToggleFab.setOnClickListener(view -> { + if (mapboxMap != null) { + toggleGps(!mapboxMap.isMyLocationEnabled()); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java index 726d13a516..31e9e59bf8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java @@ -13,7 +13,6 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast; - import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.MyBearingTracking; @@ -26,7 +25,6 @@ import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.services.android.core.location.LocationEngineListener; - import timber.log.Timber; /** @@ -125,41 +123,35 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements bearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this); setCheckBoxes(); - mapboxMap.setOnMyLocationTrackingModeChangeListener(new MapboxMap.OnMyLocationTrackingModeChangeListener() { - @Override - public void onMyLocationTrackingModeChange(@MyLocationTracking.Mode int myLocationTrackingMode) { - locationSpinner.setOnItemSelectedListener(null); - switch (myLocationTrackingMode) { - case MyLocationTracking.TRACKING_NONE: - locationSpinner.setSelection(TRACKING_NONE_INDEX); - break; - case MyLocationTracking.TRACKING_FOLLOW: - locationSpinner.setSelection(TRACKING_FOLLOW_INDEX); - break; - } - locationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this); + mapboxMap.setOnMyLocationTrackingModeChangeListener(myLocationTrackingMode -> { + locationSpinner.setOnItemSelectedListener(null); + switch (myLocationTrackingMode) { + case MyLocationTracking.TRACKING_NONE: + locationSpinner.setSelection(TRACKING_NONE_INDEX); + break; + case MyLocationTracking.TRACKING_FOLLOW: + locationSpinner.setSelection(TRACKING_FOLLOW_INDEX); + break; } + locationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this); }); - mapboxMap.setOnMyBearingTrackingModeChangeListener(new MapboxMap.OnMyBearingTrackingModeChangeListener() { - @Override - public void onMyBearingTrackingModeChange(@MyBearingTracking.Mode int myBearingTrackingMode) { - bearingSpinner.setOnItemSelectedListener(null); - switch (myBearingTrackingMode) { - case MyBearingTracking.NONE: - bearingSpinner.setSelection(BEARING_NONE_INDEX); - break; - - case MyBearingTracking.GPS: - bearingSpinner.setSelection(BEARING_GPS_INDEX); - break; - - case MyBearingTracking.COMPASS: - bearingSpinner.setSelection(BEARING_COMPASS_INDEX); - break; - } - bearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this); + mapboxMap.setOnMyBearingTrackingModeChangeListener(myBearingTrackingMode -> { + bearingSpinner.setOnItemSelectedListener(null); + switch (myBearingTrackingMode) { + case MyBearingTracking.NONE: + bearingSpinner.setSelection(BEARING_NONE_INDEX); + break; + + case MyBearingTracking.GPS: + bearingSpinner.setSelection(BEARING_GPS_INDEX); + break; + + case MyBearingTracking.COMPASS: + bearingSpinner.setSelection(BEARING_COMPASS_INDEX); + break; } + bearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java index 7ac3401a0d..488e4354c2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java @@ -6,7 +6,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; - import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.model.activity.Feature; import com.mapbox.mapboxsdk.testapp.utils.FontCache; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java index 1d89f89f08..3ceffa360c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java @@ -10,11 +10,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; - import com.mapbox.mapboxsdk.testapp.utils.FontCache; import java.util.Arrays; -import java.util.Comparator; public class FeatureSectionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @@ -126,14 +124,9 @@ public class FeatureSectionAdapter extends RecyclerView.Adapter<RecyclerView.Vie public void setSections(Section[] sections) { this.sections.clear(); - Arrays.sort(sections, new Comparator<Section>() { - @Override - public int compare(Section section, Section section1) { - return (section.firstPosition == section1.firstPosition) - ? 0 - : ((section.firstPosition < section1.firstPosition) ? -1 : 1); - } - }); + Arrays.sort(sections, (section, section1) -> (section.firstPosition == section1.firstPosition) + ? 0 + : ((section.firstPosition < section1.firstPosition) ? -1 : 1)); int offset = 0; for (Section section : sections) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java index 874c644af7..43032cb8bf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.model.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerOptions.java index 0a64359979..8b66134e07 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.model.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java index 6602054f47..d42a509a93 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.model.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java index d752e5d0ef..fe901aecd2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.model.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java index df7c575f74..8f7028b6f9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.model.annotations; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; - import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java index c4aa934139..410a86eac6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java @@ -2,17 +2,13 @@ package com.mapbox.mapboxsdk.testapp.model.other; import android.app.Activity; import android.app.Dialog; -import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; - -import timber.log.Timber; - import android.widget.EditText; - import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; public class OfflineDownloadRegionDialog extends DialogFragment { @@ -39,18 +35,10 @@ public class OfflineDownloadRegionDialog extends DialogFragment { builder.setTitle("Choose a name for the region") .setIcon(R.drawable.ic_airplanemode_active_black) .setView(regionNameEdit) - .setPositiveButton("Start", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - String regionName = regionNameEdit.getText().toString(); - listener.onDownloadRegionDialogPositiveClick(regionName); - } - }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Timber.d("Download cancelled."); - } - }); + .setPositiveButton("Start", (dialog, which) -> { + String regionName = regionNameEdit.getText().toString(); + listener.onDownloadRegionDialogPositiveClick(regionName); + }).setNegativeButton("Cancel", (dialog, which) -> Timber.d("Download cancelled.")); return builder.create(); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java index 76f07ba526..ff45dd2bf3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java @@ -1,15 +1,12 @@ package com.mapbox.mapboxsdk.testapp.model.other; import android.app.Dialog; -import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; - -import timber.log.Timber; - import com.mapbox.mapboxsdk.testapp.R; +import timber.log.Timber; import java.util.ArrayList; @@ -29,18 +26,8 @@ public class OfflineListRegionsDialog extends DialogFragment { builder.setTitle("List of offline regions") .setIcon(R.drawable.ic_airplanemode_active_black) - .setItems(items, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Timber.d("Selected item: %s", which); - } - }) - .setPositiveButton("Accept", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Timber.d("Dialog dismissed"); - } - }); + .setItems(items, (dialog, which) -> Timber.d("Selected item: %s", which)) + .setPositiveButton("Accept", (dialog, which) -> Timber.d("Dialog dismissed")); return builder.create(); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java index 10ecf43bd3..a361213bdc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.content.Context; import android.graphics.Typeface; - import timber.log.Timber; import java.util.Hashtable; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java index 0d21fd2c71..a377cd9173 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java @@ -2,9 +2,7 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.content.Context; import android.text.TextUtils; - import com.mapbox.mapboxsdk.geometry.LatLng; - import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/IconUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/IconUtils.java index b6768a91a3..0bf0a78db1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/IconUtils.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/IconUtils.java @@ -9,7 +9,6 @@ import android.support.annotation.DrawableRes; import android.support.annotation.NonNull; import android.support.v4.content.res.ResourcesCompat; import android.support.v4.graphics.drawable.DrawableCompat; - import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java index 0939181ef4..9b68ad71fc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.support.v7.widget.RecyclerView; import android.view.View; - import com.mapbox.mapboxsdk.testapp.R; public class ItemClickSupport { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java index 6220dc7e69..7b97093da8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java @@ -1,10 +1,8 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.support.annotation.NonNull; - -import timber.log.Timber; - import org.json.JSONObject; +import timber.log.Timber; import static com.mapbox.mapboxsdk.testapp.activity.offline.OfflineActivity.JSON_CHARSET; import static com.mapbox.mapboxsdk.testapp.activity.offline.OfflineActivity.JSON_FIELD_REGION_NAME; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java index 235fd8233b..2486c408c6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java @@ -16,11 +16,10 @@ package com.mapbox.mapboxsdk.testapp.utils; */ import android.os.SystemClock; +import timber.log.Timber; import java.util.ArrayList; -import timber.log.Timber; - /** * A utility class to help log timings splits throughout a method call. * Typical usage is: diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TokenUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TokenUtils.java index e08fdb9154..4f8a972b1a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TokenUtils.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TokenUtils.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.content.Context; import android.support.annotation.NonNull; - import com.mapbox.mapboxsdk.Mapbox; public class TokenUtils { diff --git a/platform/android/build.gradle b/platform/android/build.gradle index 3b22eae3ab..1c75042ea2 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -1,6 +1,7 @@ buildscript { repositories { jcenter() + google() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' @@ -12,7 +13,7 @@ buildscript { allprojects { repositories { jcenter() - maven { url 'https://maven.google.com' } + google() maven { url "http://oss.sonatype.org/content/repositories/snapshots/" } } } |