diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt index c44d544e40..f8f53f9ffd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt @@ -16,6 +16,7 @@ import android.widget.TextView import com.mapbox.mapboxsdk.camera.CameraPosition import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.maps.MapboxMapOptions +import com.mapbox.mapboxsdk.maps.OnMapReadyCallback import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.maps.SupportMapFragment import com.mapbox.mapboxsdk.testapp.R @@ -113,26 +114,27 @@ class NestedViewPagerActivity : AppCompatActivity() { options.zoomGesturesEnabled(false) when (position) { 0 -> { - options.styleUrl(Style.MAPBOX_STREETS) options.camera(CameraPosition.Builder().target(LatLng(34.920526, 102.634774)).zoom(3.0).build()) - return SupportMapFragment.newInstance(options) + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } + return fragment } 1 -> { return EmptyFragment.newInstance() } 2 -> { - options.styleUrl(Style.DARK) options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build()) - return SupportMapFragment.newInstance(options) - } + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.DARK) } + return fragment } 3 -> { return EmptyFragment.newInstance() } 4 -> { - options.styleUrl(Style.SATELLITE) options.camera(CameraPosition.Builder().target(LatLng(-25.007786, 133.623852)).zoom(3.0).build()) - return SupportMapFragment.newInstance(options) - } + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) } + return fragment } 5 -> { return EmptyFragment.newInstance() } |