Merge branch 'release-boba' into master
# Conflicts: # circle.yml # include/mbgl/style/expression/let.hpp # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java # platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java # platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml # platform/android/gradle/dependencies.gradle # platform/android/src/example_custom_layer.cpp # platform/android/src/geojson/point.cpp # platform/darwin/src/NSPredicate+MGLAdditions.mm # platform/darwin/test/MGLExpressionTests.mm # platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec # platform/ios/Mapbox-iOS-SDK-symbols.podspec # platform/ios/Mapbox-iOS-SDK.podspec # platform/ios/app/MBXViewController.m # src/mbgl/renderer/layers/render_custom_layer.cpp # src/mbgl/style/conversion/filter.cpp # src/mbgl/style/expression/interpolate.cpp # src/mbgl/style/expression/value.cpp # test/style/filter.test.cpp
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mapbox.mapboxsdk.testapp">
|
||||
package="com.mapbox.mapboxsdk.testapp">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:name=".MapboxApplication"
|
||||
@@ -19,8 +18,9 @@
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
@@ -29,10 +29,10 @@
|
||||
android:label="@string/activity_info_window">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_infowindow"/>
|
||||
android:value="@string/category_infowindow" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.infowindow.InfoWindowAdapterActivity"
|
||||
@@ -40,10 +40,10 @@
|
||||
android:label="@string/activity_infowindow_adapter">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_infowindow"/>
|
||||
android:value="@string/category_infowindow" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.infowindow.DynamicInfoWindowAdapterActivity"
|
||||
@@ -51,10 +51,10 @@
|
||||
android:label="@string/activity_dynamic_infowindow_adapter">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_infowindow"/>
|
||||
android:value="@string/category_infowindow" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.BulkMarkerActivity"
|
||||
@@ -63,10 +63,10 @@
|
||||
android:label="@string/activity_add_bulk_markers">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.AnimatedSymbolLayerActivity"
|
||||
@@ -74,10 +74,10 @@
|
||||
android:label="@string/activity_animated_symbollayer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.DynamicMarkerChangeActivity"
|
||||
@@ -85,10 +85,10 @@
|
||||
android:label="@string/activity_dynamic_marker">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.PressForMarkerActivity"
|
||||
@@ -96,10 +96,10 @@
|
||||
android:label="@string/activity_press_for_marker">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.CameraAnimationTypeActivity"
|
||||
@@ -107,10 +107,10 @@
|
||||
android:label="@string/activity_camera_animation_types">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.CameraAnimatorActivity"
|
||||
@@ -118,10 +118,10 @@
|
||||
android:label="@string/activity_camera_animator">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.CameraPositionActivity"
|
||||
@@ -129,10 +129,10 @@
|
||||
android:label="@string/activity_camera_position">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.LatLngBoundsActivity"
|
||||
@@ -141,10 +141,10 @@
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.fragment.MapFragmentActivity"
|
||||
@@ -152,10 +152,10 @@
|
||||
android:label="@string/activity_map_fragment">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_fragment"/>
|
||||
android:value="@string/category_fragment" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.fragment.SupportMapFragmentActivity"
|
||||
@@ -163,10 +163,10 @@
|
||||
android:label="@string/activity_map_fragment_suport">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_fragment"/>
|
||||
android:value="@string/category_fragment" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.fragment.MultiMapActivity"
|
||||
@@ -174,10 +174,10 @@
|
||||
android:label="@string/activity_multimap">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_fragment"/>
|
||||
android:value="@string/category_fragment" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.ManualZoomActivity"
|
||||
@@ -185,10 +185,10 @@
|
||||
android:label="@string/activity_camera_zoom">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.MaxMinZoomActivity"
|
||||
@@ -196,10 +196,10 @@
|
||||
android:label="@string/activity_minmax_zoom">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.customlayer.CustomLayerActivity"
|
||||
@@ -207,66 +207,10 @@
|
||||
android:label="@string/activity_custom_layer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_custom_layer"/>
|
||||
android:value="@string/category_custom_layer" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.userlocation.MyLocationTrackingModeActivity"
|
||||
android:description="@string/description_user_location_tracking"
|
||||
android:label="@string/activity_user_tracking_mode"
|
||||
android:theme="@style/NoActionBar">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_userlocation"/>
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.userlocation.MyLocationDrawableActivity"
|
||||
android:description="@string/description_user_location_customization"
|
||||
android:label="@string/activity_user_tracking_customization">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_userlocation"/>
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.userlocation.MyLocationTintActivity"
|
||||
android:description="@string/description_user_location_dot_color"
|
||||
android:label="@string/activity_user_dot_color">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_userlocation"/>
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.userlocation.MyLocationToggleActivity"
|
||||
android:description="@string/description_user_location_toggle"
|
||||
android:label="@string/activity_user_location_toggle">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_userlocation"/>
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.userlocation.CustomLocationEngineActivity"
|
||||
android:description="@string/description_custom_location_engine"
|
||||
android:label="@string/activity_custom_location_engine">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_userlocation"/>
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.PolygonActivity"
|
||||
@@ -274,10 +218,10 @@
|
||||
android:label="@string/activity_polygon">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.PolylineActivity"
|
||||
@@ -285,10 +229,10 @@
|
||||
android:label="@string/activity_polyline">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.ScrollByActivity"
|
||||
@@ -297,10 +241,10 @@
|
||||
android:theme="@style/NoActionBar">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera"/>
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.MapPaddingActivity"
|
||||
@@ -309,10 +253,10 @@
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.DebugModeActivity"
|
||||
@@ -321,7 +265,7 @@
|
||||
android:label="@string/activity_debug_mode">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_basic"/>
|
||||
android:value="@string/category_basic" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.offline.OfflineActivity"
|
||||
@@ -329,10 +273,10 @@
|
||||
android:label="@string/activity_offline">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_offline"/>
|
||||
android:value="@string/category_offline" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.offline.UpdateMetadataActivity"
|
||||
@@ -340,10 +284,10 @@
|
||||
android:label="@string/activity_update_metadata">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_offline"/>
|
||||
android:value="@string/category_offline" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.offline.DeleteRegionActivity"
|
||||
@@ -351,10 +295,10 @@
|
||||
android:label="@string/activity_offline_region_delete">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_offline"/>
|
||||
android:value="@string/category_offline" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.imagegenerator.SnapshotActivity"
|
||||
@@ -362,10 +306,10 @@
|
||||
android:label="@string/activity_snapshot">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_imagegenerator"/>
|
||||
android:value="@string/category_imagegenerator" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.snapshot.MapSnapshotterActivity"
|
||||
@@ -373,10 +317,10 @@
|
||||
android:label="@string/activity_map_snapshotter">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_imagegenerator"/>
|
||||
android:value="@string/category_imagegenerator" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.snapshot.MapSnapshotterReuseActivity"
|
||||
@@ -384,10 +328,10 @@
|
||||
android:label="@string/activity_map_snapshotter_reuse">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_imagegenerator"/>
|
||||
android:value="@string/category_imagegenerator" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.snapshot.MapSnapshotterMarkerActivity"
|
||||
@@ -395,10 +339,10 @@
|
||||
android:label="@string/activity_map_snapshotter_marker">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_imagegenerator"/>
|
||||
android:value="@string/category_imagegenerator" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.DoubleMapActivity"
|
||||
@@ -406,10 +350,10 @@
|
||||
android:label="@string/activity_double_map">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.MarkerViewActivity"
|
||||
@@ -417,10 +361,10 @@
|
||||
android:label="@string/activity_view_marker">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.fragment.ViewPagerActivity"
|
||||
@@ -428,10 +372,10 @@
|
||||
android:label="@string/activity_viewpager">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_fragment"/>
|
||||
android:value="@string/category_fragment" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.SimpleMapActivity"
|
||||
@@ -439,10 +383,10 @@
|
||||
android:label="@string/activity_simple_map">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_basic"/>
|
||||
android:value="@string/category_basic" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.MapChangeActivity"
|
||||
@@ -450,10 +394,10 @@
|
||||
android:label="@string/activity_map_change">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.VisibilityChangeActivity"
|
||||
@@ -461,10 +405,10 @@
|
||||
android:label="@string/activity_map_visibility">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.RuntimeStyleActivity"
|
||||
@@ -472,10 +416,10 @@
|
||||
android:label="@string/activity_runtime_style">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.DataDrivenStyleActivity"
|
||||
@@ -483,10 +427,10 @@
|
||||
android:label="@string/activity_data_driven_style">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.CircleLayerActivity"
|
||||
@@ -494,10 +438,10 @@
|
||||
android:label="@string/activity_circle_layer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.FillExtrusionActivity"
|
||||
@@ -505,10 +449,10 @@
|
||||
android:label="@string/activity_fill_extrusion_layer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.BuildingFillExtrusionActivity"
|
||||
@@ -516,10 +460,10 @@
|
||||
android:label="@string/activity_building_fill_extrusion_layer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.SymbolLayerActivity"
|
||||
@@ -527,10 +471,10 @@
|
||||
android:label="@string/activity_symbol_layer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.GeoJsonClusteringActivity"
|
||||
@@ -538,10 +482,10 @@
|
||||
android:label="@string/activity_geojson_clustering">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.RealTimeGeoJsonActivity"
|
||||
@@ -549,10 +493,10 @@
|
||||
android:label="@string/activity_geojson_realtime">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.StyleFileActivity"
|
||||
@@ -560,10 +504,10 @@
|
||||
android:label="@string/activity_style_file">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.CustomSpriteActivity"
|
||||
@@ -571,10 +515,10 @@
|
||||
android:label="@string/activity_add_sprite">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.imagegenerator.PrintActivity"
|
||||
@@ -582,10 +526,10 @@
|
||||
android:label="@string/activity_print">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_imagegenerator"/>
|
||||
android:value="@string/category_imagegenerator" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.AnimatedImageSourceActivity"
|
||||
@@ -593,10 +537,10 @@
|
||||
android:label="@string/activity_animated_image_source">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.GridSourceActivity"
|
||||
@@ -604,10 +548,10 @@
|
||||
android:label="@string/activity_grid_source">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<!-- Features -->
|
||||
<activity
|
||||
@@ -616,10 +560,10 @@
|
||||
android:label="@string/activity_query_rendered_feature_properties">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_features"/>
|
||||
android:value="@string/category_features" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.feature.QueryRenderedFeaturesBoxCountActivity"
|
||||
@@ -627,10 +571,10 @@
|
||||
android:label="@string/activity_query_rendered_features_box_count">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_features"/>
|
||||
android:value="@string/category_features" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.feature.QueryRenderedFeaturesBoxSymbolCountActivity"
|
||||
@@ -638,10 +582,10 @@
|
||||
android:label="@string/activity_query_rendered_features_box_symbol_count">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_features"/>
|
||||
android:value="@string/category_features" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.feature.QueryRenderedFeaturesBoxHighlightActivity"
|
||||
@@ -649,10 +593,10 @@
|
||||
android:label="@string/activity_query_rendered_features_box_highlight">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_features"/>
|
||||
android:value="@string/category_features" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.feature.QuerySourceFeaturesActivity"
|
||||
@@ -660,10 +604,10 @@
|
||||
android:label="@string/activity_query_source_features">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_features"/>
|
||||
android:value="@string/category_features" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.SymbolGeneratorActivity"
|
||||
@@ -671,10 +615,10 @@
|
||||
android:label="@string/activity_symbol_generator">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.ZoomFunctionSymbolLayerActivity"
|
||||
@@ -682,10 +626,10 @@
|
||||
android:label="@string/activity_add_remove_markers">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.MapInDialogActivity"
|
||||
@@ -693,10 +637,10 @@
|
||||
android:label="@string/activity_map_in_dialog">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.annotation.MarkerViewsInRectangleActivity"
|
||||
@@ -704,10 +648,10 @@
|
||||
android:label="@string/activity_marker_view_rectangle">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_annotation"/>
|
||||
android:value="@string/category_annotation" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.LatLngBoundsForCameraActivity"
|
||||
@@ -715,10 +659,10 @@
|
||||
android:label="@string/activity_restricted_bounds">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
|
||||
<!-- Storage -->
|
||||
@@ -728,10 +672,10 @@
|
||||
android:label="@string/activity_url_transform">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_storage"/>
|
||||
android:value="@string/category_storage" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.BottomSheetActivity"
|
||||
@@ -739,7 +683,7 @@
|
||||
android:label="@string/activity_bottom_sheet">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
</activity>
|
||||
|
||||
<!-- TextureView -->
|
||||
@@ -749,7 +693,7 @@
|
||||
android:label="@string/activity_textureview_debug">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview"/>
|
||||
android:value="@string/category_textureview" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.textureview.TextureViewResizeActivity"
|
||||
@@ -757,7 +701,18 @@
|
||||
android:label="@string/activity_textureview_resize">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview"/>
|
||||
android:value="@string/category_textureview" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.textureview.TextureViewTransparentBackgroundActivity"
|
||||
android:description="@string/description_textureview_transparent"
|
||||
android:label="@string/activity_textureview_transparent">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.textureview.TextureViewAnimationActivity"
|
||||
@@ -765,7 +720,7 @@
|
||||
android:label="@string/activity_textureview_animate">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_textureview"/>
|
||||
android:value="@string/category_textureview" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.maplayout.LocalGlyphActivity"
|
||||
@@ -773,10 +728,10 @@
|
||||
android:label="@string/activity_local_glyph">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_maplayout"/>
|
||||
android:value="@string/category_maplayout" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.HillshadeLayerActivity"
|
||||
@@ -784,10 +739,10 @@
|
||||
android:label="@string/activity_hillshade">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.HeatmapLayerActivity"
|
||||
@@ -795,32 +750,43 @@
|
||||
android:label="@string/activity_heatmaplayer">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
android:value="@string/category_style" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
android:value=".activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.camera.GestureDetectorActivity"
|
||||
android:label="@string/activity_gesture_detector"
|
||||
android:description="@string/description_gesture_detector">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_camera" />
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity" />
|
||||
</activity>
|
||||
|
||||
<!-- For Instrumentation tests -->
|
||||
<activity
|
||||
android:name=".activity.style.RuntimeStyleTestActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.style.RuntimeStyleTimingTestActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.espresso.EspressoTestActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.style.FillExtrusionStyleTestActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
<!-- Configuration Settings -->
|
||||
<meta-data
|
||||
android:name="com.mapbox.TestEventsServer"
|
||||
android:value="api-events-staging.tilestream.net"/>
|
||||
android:value="api-events-staging.tilestream.net" />
|
||||
<meta-data
|
||||
android:name="com.mapbox.TestEventsAccessToken"
|
||||
android:value="pk.eyJ1IjoiYmxzdGFnaW5nIiwiYSI6ImNpdDF3OHpoaTAwMDcyeXA5Y3Z0Nmk2dzEifQ.0IfB7v5Qbm2MGVYt8Kb8fg"/>
|
||||
android:value="pk.eyJ1IjoiYmxzdGFnaW5nIiwiYSI6ImNpdDF3OHpoaTAwMDcyeXA5Y3Z0Nmk2dzEifQ.0IfB7v5Qbm2MGVYt8Kb8fg" />
|
||||
|
||||
<!-- Comment out this setting to switch to external storage (and disable internal) in your app -->
|
||||
<!-- <meta-data -->
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.StrictMode;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mapbox.mapboxsdk.Mapbox;
|
||||
import com.mapbox.mapboxsdk.maps.Telemetry;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.TokenUtils;
|
||||
import com.squareup.leakcanary.LeakCanary;
|
||||
|
||||
@@ -57,6 +58,8 @@ public class MapboxApplication extends Application {
|
||||
}
|
||||
|
||||
Mapbox.getInstance(getApplicationContext(), mapboxAccessToken);
|
||||
|
||||
Telemetry.updateDebugLoggingEnabled(true);
|
||||
}
|
||||
|
||||
private void initializeLogger() {
|
||||
|
||||
@@ -7,23 +7,17 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.mapboxsdk.testapp.adapter.FeatureAdapter;
|
||||
import com.mapbox.mapboxsdk.testapp.adapter.FeatureSectionAdapter;
|
||||
import com.mapbox.mapboxsdk.testapp.model.activity.Feature;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.ItemClickSupport;
|
||||
import com.mapbox.android.core.permissions.PermissionsListener;
|
||||
import com.mapbox.android.core.permissions.PermissionsManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -39,23 +33,19 @@ import timber.log.Timber;
|
||||
* It uses tags as category and description to order the different entries.
|
||||
* </p>
|
||||
*/
|
||||
public class FeatureOverviewActivity extends AppCompatActivity implements PermissionsListener {
|
||||
public class FeatureOverviewActivity extends AppCompatActivity {
|
||||
|
||||
private static final String KEY_STATE_FEATURES = "featureList";
|
||||
|
||||
private PermissionsManager permissionsManager;
|
||||
private RecyclerView recyclerView;
|
||||
private FeatureSectionAdapter sectionAdapter;
|
||||
private List<Feature> features;
|
||||
private int locationActivityInList;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_feature_overview);
|
||||
|
||||
permissionsManager = new PermissionsManager(this);
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
recyclerView.addOnItemTouchListener(new RecyclerView.SimpleOnItemTouchListener());
|
||||
@@ -65,11 +55,6 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis
|
||||
if (!sectionAdapter.isSectionHeaderPosition(position)) {
|
||||
int itemPosition = sectionAdapter.getConvertedPosition(position);
|
||||
Feature feature = features.get(itemPosition);
|
||||
if (feature.isRequiresLocationPermission()) {
|
||||
if (requestLocationPermission(itemPosition)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
startFeature(feature);
|
||||
}
|
||||
});
|
||||
@@ -118,45 +103,6 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private boolean requestLocationPermission(final int positionInList) {
|
||||
if (isRuntimePermissionsRequired()) {
|
||||
locationActivityInList = positionInList;
|
||||
permissionsManager.requestLocationPermissions(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExplanationNeeded(List<String> list) {
|
||||
Snackbar.make(
|
||||
findViewById(android.R.id.content),
|
||||
TextUtils.join("", list.toArray()),
|
||||
Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionResult(boolean isPermissionGranted) {
|
||||
if (isPermissionGranted) {
|
||||
startFeature(features.get(locationActivityInList));
|
||||
} else {
|
||||
Snackbar.make(
|
||||
findViewById(android.R.id.content),
|
||||
"Can't open without accepting the location permission.",
|
||||
Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
private boolean isRuntimePermissionsRequired() {
|
||||
return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
@@ -178,8 +124,7 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis
|
||||
String label = getString(info.labelRes);
|
||||
String description = resolveString(info.descriptionRes);
|
||||
String category = resolveMetaData(info.metaData, metaDataKey);
|
||||
boolean requiresLocationPermission = requiresLocationPermission(label, category);
|
||||
features.add(new Feature(info.name, label, description, category, requiresLocationPermission));
|
||||
features.add(new Feature(info.name, label, description, category));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,24 +158,6 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis
|
||||
}
|
||||
}
|
||||
|
||||
private boolean requiresLocationPermission(String name, String category) {
|
||||
final Resources resources = getResources();
|
||||
|
||||
List<String> requiresPermissionCategories = new ArrayList<String>() {
|
||||
{
|
||||
add(resources.getString(R.string.category_userlocation));
|
||||
}
|
||||
};
|
||||
|
||||
List<String> requiresPermissionActivities = new ArrayList<String>() {
|
||||
{
|
||||
add(resources.getString(R.string.activity_double_map));
|
||||
}
|
||||
};
|
||||
|
||||
return requiresPermissionCategories.contains(category) || requiresPermissionActivities.contains(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Feature> features) {
|
||||
super.onPostExecute(features);
|
||||
|
||||
@@ -1,449 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.annotation;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mapbox.geojson.Feature;
|
||||
import com.mapbox.geojson.FeatureCollection;
|
||||
import com.mapbox.geojson.Point;
|
||||
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.style.functions.stops.Stops;
|
||||
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
|
||||
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.turf.TurfMeasurement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.functions.Function.property;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap;
|
||||
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.iconRotate;
|
||||
|
||||
/**
|
||||
* Test activity showcasing animating MarkerViews.
|
||||
*/
|
||||
public class AnimatedSymbolLayerActivity extends AppCompatActivity {
|
||||
|
||||
private static final String PASSENGER = "passenger";
|
||||
private static final String PASSENGER_LAYER = "passenger-layer";
|
||||
private static final String PASSENGER_SOURCE = "passenger-source";
|
||||
private static final String TAXI = "taxi";
|
||||
private static final String TAXI_LAYER = "taxi-layer";
|
||||
private static final String TAXI_SOURCE = "taxi-source";
|
||||
private static final String RANDOM_CAR_LAYER = "random-car-layer";
|
||||
private static final String RANDOM_CAR_SOURCE = "random-car-source";
|
||||
private static final String RANDOM_CAR_IMAGE_ID = "random-car";
|
||||
private static final String PROPERTY_BEARING = "bearing";
|
||||
private static final String WATERWAY_LAYER_ID = "waterway-label";
|
||||
private static final int DURATION_RANDOM_MAX = 1500;
|
||||
private static final int DURATION_BASE = 3000;
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
|
||||
private List<Car> randomCars = new ArrayList<>();
|
||||
private GeoJsonSource randomCarSource;
|
||||
private Car taxi;
|
||||
private GeoJsonSource taxiSource;
|
||||
private LatLng passenger;
|
||||
|
||||
private List<Animator> animators = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_animated_marker);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(mapboxMap -> {
|
||||
AnimatedSymbolLayerActivity.this.mapboxMap = mapboxMap;
|
||||
setupCars();
|
||||
animateRandomRoutes();
|
||||
animateTaxi();
|
||||
});
|
||||
}
|
||||
|
||||
private void setupCars() {
|
||||
addRandomCars();
|
||||
addPassenger();
|
||||
addMainCar();
|
||||
}
|
||||
|
||||
private void animateRandomRoutes() {
|
||||
final Car longestDrive = getLongestDrive();
|
||||
final Random random = new Random();
|
||||
for (final Car car : randomCars) {
|
||||
final boolean isLongestDrive = longestDrive.equals(car);
|
||||
ValueAnimator valueAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), car.current, car.next);
|
||||
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
|
||||
private LatLng latLng;
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
latLng = (LatLng) animation.getAnimatedValue();
|
||||
car.current = latLng;
|
||||
if (isLongestDrive) {
|
||||
updateRandomCarSource();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (isLongestDrive) {
|
||||
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
updateRandomDestinations();
|
||||
animateRandomRoutes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
super.onAnimationStart(animation);
|
||||
car.feature.properties().addProperty("bearing", Car.getBearing(car.current, car.next));
|
||||
}
|
||||
});
|
||||
|
||||
int offset = random.nextInt(2) == 0 ? 0 : random.nextInt(1000) + 250;
|
||||
valueAnimator.setStartDelay(offset);
|
||||
valueAnimator.setDuration(car.duration - offset);
|
||||
valueAnimator.setInterpolator(new LinearInterpolator());
|
||||
valueAnimator.start();
|
||||
|
||||
animators.add(valueAnimator);
|
||||
}
|
||||
}
|
||||
|
||||
private void animateTaxi() {
|
||||
ValueAnimator valueAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), taxi.current, taxi.next);
|
||||
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
|
||||
private LatLng latLng;
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
latLng = (LatLng) animation.getAnimatedValue();
|
||||
taxi.current = latLng;
|
||||
updateTaxiSource();
|
||||
}
|
||||
});
|
||||
|
||||
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
updatePassenger();
|
||||
animateTaxi();
|
||||
}
|
||||
});
|
||||
|
||||
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
super.onAnimationStart(animation);
|
||||
taxi.feature.properties().addProperty("bearing", Car.getBearing(taxi.current, taxi.next));
|
||||
}
|
||||
});
|
||||
|
||||
valueAnimator.setDuration((long) (7 * taxi.current.distanceTo(taxi.next)));
|
||||
valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
valueAnimator.start();
|
||||
|
||||
animators.add(valueAnimator);
|
||||
}
|
||||
|
||||
private void updatePassenger() {
|
||||
passenger = getLatLngInBounds();
|
||||
updatePassengerSource();
|
||||
taxi.setNext(passenger);
|
||||
}
|
||||
|
||||
private void updatePassengerSource() {
|
||||
GeoJsonSource source = mapboxMap.getSourceAs(PASSENGER_SOURCE);
|
||||
FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {
|
||||
Feature.fromGeometry(
|
||||
Point.fromLngLat(
|
||||
passenger.getLongitude(),
|
||||
passenger.getLatitude()
|
||||
)
|
||||
)
|
||||
});
|
||||
source.setGeoJson(featureCollection);
|
||||
}
|
||||
|
||||
private void updateTaxiSource() {
|
||||
taxi.updateFeature();
|
||||
taxiSource.setGeoJson(taxi.feature);
|
||||
}
|
||||
|
||||
private void updateRandomDestinations() {
|
||||
for (Car randomCar : randomCars) {
|
||||
randomCar.setNext(getLatLngInBounds());
|
||||
}
|
||||
}
|
||||
|
||||
private Car getLongestDrive() {
|
||||
Car longestDrive = null;
|
||||
for (Car randomCar : randomCars) {
|
||||
if (longestDrive == null) {
|
||||
longestDrive = randomCar;
|
||||
} else if (longestDrive.duration < randomCar.duration) {
|
||||
longestDrive = randomCar;
|
||||
}
|
||||
}
|
||||
return longestDrive;
|
||||
}
|
||||
|
||||
private void updateRandomCarSource() {
|
||||
for (Car randomCarsRoute : randomCars) {
|
||||
randomCarsRoute.updateFeature();
|
||||
}
|
||||
randomCarSource.setGeoJson(featuresFromRoutes());
|
||||
}
|
||||
|
||||
private FeatureCollection featuresFromRoutes() {
|
||||
List<Feature> features = new ArrayList<>();
|
||||
for (Car randomCarsRoute : randomCars) {
|
||||
features.add(randomCarsRoute.feature);
|
||||
}
|
||||
return FeatureCollection.fromFeatures(features);
|
||||
}
|
||||
|
||||
private long getDuration() {
|
||||
return random.nextInt(DURATION_RANDOM_MAX) + DURATION_BASE;
|
||||
}
|
||||
|
||||
private void addRandomCars() {
|
||||
LatLng latLng;
|
||||
LatLng next;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
latLng = getLatLngInBounds();
|
||||
next = getLatLngInBounds();
|
||||
|
||||
JsonObject properties = new JsonObject();
|
||||
properties.addProperty(PROPERTY_BEARING, Car.getBearing(latLng, next));
|
||||
|
||||
Feature feature = Feature.fromGeometry(
|
||||
Point.fromLngLat(
|
||||
latLng.getLongitude(),
|
||||
latLng.getLatitude()
|
||||
), properties);
|
||||
|
||||
randomCars.add(
|
||||
new Car(feature, next, getDuration())
|
||||
);
|
||||
}
|
||||
|
||||
randomCarSource = new GeoJsonSource(RANDOM_CAR_SOURCE, featuresFromRoutes());
|
||||
mapboxMap.addSource(randomCarSource);
|
||||
mapboxMap.addImage(RANDOM_CAR_IMAGE_ID,
|
||||
((BitmapDrawable) getResources().getDrawable(R.drawable.ic_car_top)).getBitmap());
|
||||
|
||||
SymbolLayer symbolLayer = new SymbolLayer(RANDOM_CAR_LAYER, RANDOM_CAR_SOURCE);
|
||||
symbolLayer.withProperties(
|
||||
iconImage(RANDOM_CAR_IMAGE_ID),
|
||||
iconAllowOverlap(true),
|
||||
iconRotate(
|
||||
property(
|
||||
PROPERTY_BEARING,
|
||||
Stops.<Float>identity()
|
||||
)
|
||||
),
|
||||
iconIgnorePlacement(true)
|
||||
);
|
||||
|
||||
mapboxMap.addLayerBelow(symbolLayer, WATERWAY_LAYER_ID);
|
||||
}
|
||||
|
||||
private void addPassenger() {
|
||||
passenger = getLatLngInBounds();
|
||||
FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {
|
||||
Feature.fromGeometry(
|
||||
Point.fromLngLat(
|
||||
passenger.getLongitude(),
|
||||
passenger.getLatitude()
|
||||
)
|
||||
)
|
||||
});
|
||||
|
||||
mapboxMap.addImage(PASSENGER,
|
||||
((BitmapDrawable) getResources().getDrawable(R.drawable.icon_burned)).getBitmap());
|
||||
|
||||
GeoJsonSource geoJsonSource = new GeoJsonSource(PASSENGER_SOURCE, featureCollection);
|
||||
mapboxMap.addSource(geoJsonSource);
|
||||
|
||||
SymbolLayer symbolLayer = new SymbolLayer(PASSENGER_LAYER, PASSENGER_SOURCE);
|
||||
symbolLayer.withProperties(
|
||||
iconImage(PASSENGER),
|
||||
iconIgnorePlacement(true),
|
||||
iconAllowOverlap(true)
|
||||
);
|
||||
mapboxMap.addLayerBelow(symbolLayer, RANDOM_CAR_LAYER);
|
||||
}
|
||||
|
||||
private void addMainCar() {
|
||||
LatLng latLng = getLatLngInBounds();
|
||||
JsonObject properties = new JsonObject();
|
||||
properties.addProperty(PROPERTY_BEARING, Car.getBearing(latLng, passenger));
|
||||
Feature feature = Feature.fromGeometry(
|
||||
Point.fromLngLat(
|
||||
latLng.getLongitude(),
|
||||
latLng.getLatitude()), properties);
|
||||
FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {feature});
|
||||
|
||||
taxi = new Car(feature, passenger, getDuration());
|
||||
mapboxMap.addImage(TAXI,
|
||||
((BitmapDrawable) getResources().getDrawable(R.drawable.ic_taxi_top)).getBitmap());
|
||||
taxiSource = new GeoJsonSource(TAXI_SOURCE, featureCollection);
|
||||
mapboxMap.addSource(taxiSource);
|
||||
|
||||
SymbolLayer symbolLayer = new SymbolLayer(TAXI_LAYER, TAXI_SOURCE);
|
||||
symbolLayer.withProperties(
|
||||
iconImage(TAXI),
|
||||
iconRotate(
|
||||
property(
|
||||
PROPERTY_BEARING,
|
||||
Stops.<Float>identity()
|
||||
)
|
||||
),
|
||||
iconAllowOverlap(true),
|
||||
iconIgnorePlacement(true)
|
||||
|
||||
);
|
||||
mapboxMap.addLayer(symbolLayer);
|
||||
}
|
||||
|
||||
private LatLng getLatLngInBounds() {
|
||||
LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
|
||||
Random generator = new Random();
|
||||
double randomLat = bounds.getLatSouth() + generator.nextDouble()
|
||||
* (bounds.getLatNorth() - bounds.getLatSouth());
|
||||
double randomLon = bounds.getLonWest() + generator.nextDouble()
|
||||
* (bounds.getLonEast() - bounds.getLonWest());
|
||||
return new LatLng(randomLat, randomLon);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
for (Animator animator : animators) {
|
||||
if (animator != null) {
|
||||
animator.removeAllListeners();
|
||||
animator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluator for LatLng pairs
|
||||
*/
|
||||
private static class LatLngEvaluator implements TypeEvaluator<LatLng> {
|
||||
|
||||
private LatLng latLng = new LatLng();
|
||||
|
||||
@Override
|
||||
public LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) {
|
||||
latLng.setLatitude(startValue.getLatitude()
|
||||
+ ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
|
||||
latLng.setLongitude(startValue.getLongitude()
|
||||
+ ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
|
||||
return latLng;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Car {
|
||||
private Feature feature;
|
||||
private LatLng next;
|
||||
private LatLng current;
|
||||
private long duration;
|
||||
|
||||
Car(Feature feature, LatLng next, long duration) {
|
||||
this.feature = feature;
|
||||
Point point = ((Point) feature.geometry());
|
||||
this.current = new LatLng(point.latitude(), point.longitude());
|
||||
this.duration = duration;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
void setNext(LatLng next) {
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
void updateFeature() {
|
||||
feature = Feature.fromGeometry(Point.fromLngLat(
|
||||
current.getLongitude(),
|
||||
current.getLatitude())
|
||||
);
|
||||
feature.properties().addProperty("bearing", getBearing(current, next));
|
||||
}
|
||||
|
||||
private static float getBearing(LatLng from, LatLng to) {
|
||||
return (float) TurfMeasurement.bearing(
|
||||
Point.fromLngLat(from.getLongitude(), from.getLatitude()),
|
||||
Point.fromLngLat(to.getLongitude(), to.getLatitude())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe
|
||||
ValueAnimator latLngAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), currentPosition, targetPosition);
|
||||
latLngAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR));
|
||||
latLngAnimator.setInterpolator(new FastOutSlowInInterpolator());
|
||||
latLngAnimator.addUpdateListener(animation -> mapboxMap.setLatLng((LatLng) animation.getAnimatedValue()));
|
||||
latLngAnimator.addUpdateListener(animation -> mapboxMap.moveCamera(
|
||||
CameraUpdateFactory.newLatLng((LatLng) animation.getAnimatedValue()))
|
||||
);
|
||||
return latLngAnimator;
|
||||
}
|
||||
|
||||
@@ -124,7 +126,9 @@ 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(animation -> mapboxMap.setZoom((Float) animation.getAnimatedValue()));
|
||||
zoomAnimator.addUpdateListener(animation -> mapboxMap.moveCamera(
|
||||
CameraUpdateFactory.zoomTo((Float) animation.getAnimatedValue()))
|
||||
);
|
||||
return zoomAnimator;
|
||||
}
|
||||
|
||||
@@ -133,7 +137,9 @@ 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(animation -> mapboxMap.setBearing((Float) animation.getAnimatedValue()));
|
||||
bearingAnimator.addUpdateListener(animation -> mapboxMap.moveCamera(
|
||||
CameraUpdateFactory.bearingTo((Float) animation.getAnimatedValue()))
|
||||
);
|
||||
return bearingAnimator;
|
||||
}
|
||||
|
||||
@@ -141,7 +147,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe
|
||||
ValueAnimator tiltAnimator = ValueAnimator.ofFloat((float) currentTilt, (float) targetTilt);
|
||||
tiltAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR));
|
||||
tiltAnimator.setStartDelay((long) (1500 * ANIMATION_DELAY_FACTOR));
|
||||
tiltAnimator.addUpdateListener(animation -> mapboxMap.setTilt((Float) animation.getAnimatedValue()));
|
||||
tiltAnimator.addUpdateListener(animation -> mapboxMap.moveCamera(
|
||||
CameraUpdateFactory.tiltTo((Float) animation.getAnimatedValue()))
|
||||
);
|
||||
return tiltAnimator;
|
||||
}
|
||||
|
||||
@@ -195,7 +203,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe
|
||||
ValueAnimator zoomAnimator = ValueAnimator.ofFloat(11.0f, 16.0f);
|
||||
zoomAnimator.setDuration((long) (duration * ANIMATION_DELAY_FACTOR));
|
||||
zoomAnimator.setInterpolator(interpolator);
|
||||
zoomAnimator.addUpdateListener(animation -> mapboxMap.setZoom((Float) animation.getAnimatedValue()));
|
||||
zoomAnimator.addUpdateListener(animation -> mapboxMap.moveCamera(
|
||||
CameraUpdateFactory.zoomTo((Float) animation.getAnimatedValue()))
|
||||
);
|
||||
return zoomAnimator;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.camera;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mapbox.android.gestures.AndroidGesturesManager;
|
||||
import com.mapbox.android.gestures.MoveGestureDetector;
|
||||
import com.mapbox.android.gestures.RotateGestureDetector;
|
||||
import com.mapbox.android.gestures.ShoveGestureDetector;
|
||||
import com.mapbox.android.gestures.StandardScaleGestureDetector;
|
||||
import com.mapbox.mapboxsdk.annotations.Marker;
|
||||
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
||||
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 com.mapbox.mapboxsdk.testapp.utils.FontCache;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
/**
|
||||
* Test activity showcasing APIs around gestures implementation.
|
||||
*/
|
||||
public class GestureDetectorActivity extends AppCompatActivity {
|
||||
|
||||
private static final int MAX_NUMBER_OF_ALERTS = 30;
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private RecyclerView recyclerView;
|
||||
private GestureAlertsAdapter gestureAlertsAdapter;
|
||||
|
||||
private AndroidGesturesManager gesturesManager;
|
||||
|
||||
@Nullable
|
||||
private Marker marker;
|
||||
@Nullable
|
||||
private LatLng focalPointLatLng;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_gesture_detector);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(new OnMapReadyCallback() {
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
GestureDetectorActivity.this.mapboxMap = mapboxMap;
|
||||
initializeMap();
|
||||
}
|
||||
});
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.alerts_recycler);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
gestureAlertsAdapter = new GestureAlertsAdapter();
|
||||
recyclerView.setAdapter(gestureAlertsAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
gestureAlertsAdapter.cancelUpdates();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private void initializeMap() {
|
||||
gesturesManager = mapboxMap.getGesturesManager();
|
||||
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) recyclerView.getLayoutParams();
|
||||
layoutParams.height = (int) (mapView.getHeight() / 1.75);
|
||||
layoutParams.width = (mapView.getWidth() / 3);
|
||||
recyclerView.setLayoutParams(layoutParams);
|
||||
|
||||
attachListeners();
|
||||
}
|
||||
|
||||
public void attachListeners() {
|
||||
mapboxMap.addOnMoveListener(new MapboxMap.OnMoveListener() {
|
||||
@Override
|
||||
public void onMoveBegin(MoveGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_START, "MOVE START"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMove(MoveGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_PROGRESS, "MOVE PROGRESS"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoveEnd(MoveGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_END, "MOVE END"));
|
||||
}
|
||||
});
|
||||
|
||||
mapboxMap.addOnRotateListener(new MapboxMap.OnRotateListener() {
|
||||
@Override
|
||||
public void onRotateBegin(RotateGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_START, "ROTATE START"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRotate(RotateGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_PROGRESS, "ROTATE PROGRESS"));
|
||||
recalculateFocalPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRotateEnd(RotateGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_END, "ROTATE END"));
|
||||
}
|
||||
});
|
||||
|
||||
mapboxMap.addOnScaleListener(new MapboxMap.OnScaleListener() {
|
||||
@Override
|
||||
public void onScaleBegin(StandardScaleGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_START, "SCALE START"));
|
||||
if (focalPointLatLng != null) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_OTHER, "INCREASING MOVE THRESHOLD"));
|
||||
gesturesManager.getMoveGestureDetector().setMoveThreshold(
|
||||
ResourceUtils.convertDpToPx(GestureDetectorActivity.this, 175));
|
||||
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_OTHER, "MANUALLY INTERRUPTING MOVE"));
|
||||
gesturesManager.getMoveGestureDetector().interrupt();
|
||||
}
|
||||
recalculateFocalPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScale(StandardScaleGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_PROGRESS, "SCALE PROGRESS"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScaleEnd(StandardScaleGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_END, "SCALE END"));
|
||||
|
||||
if (focalPointLatLng != null) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_OTHER, "REVERTING MOVE THRESHOLD"));
|
||||
gesturesManager.getMoveGestureDetector().setMoveThreshold(0f);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mapboxMap.addOnShoveListener(new MapboxMap.OnShoveListener() {
|
||||
@Override
|
||||
public void onShoveBegin(ShoveGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_START, "SHOVE START"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShove(ShoveGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_PROGRESS, "SHOVE PROGRESS"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShoveEnd(ShoveGestureDetector detector) {
|
||||
gestureAlertsAdapter.addAlert(new GestureAlert(GestureAlert.TYPE_END, "SHOVE END"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_gestures, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
resetModes();
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_gesture_none:
|
||||
return true;
|
||||
case R.id.menu_gesture_focus_point:
|
||||
focalPointLatLng = new LatLng(51.50325, -0.12968);
|
||||
marker = mapboxMap.addMarker(new MarkerOptions().position(focalPointLatLng));
|
||||
mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(focalPointLatLng, 16));
|
||||
mapboxMap.getUiSettings().setFocalPoint(mapboxMap.getProjection().toScreenLocation(focalPointLatLng));
|
||||
return true;
|
||||
case R.id.menu_gesture_animation:
|
||||
mapboxMap.getUiSettings().setAllVelocityAnimationsEnabled(false);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void resetModes() {
|
||||
focalPointLatLng = null;
|
||||
mapboxMap.getUiSettings().setFocalPoint(null);
|
||||
gesturesManager.getMoveGestureDetector().setMoveThreshold(0f);
|
||||
mapboxMap.getUiSettings().setAllVelocityAnimationsEnabled(true);
|
||||
|
||||
if (marker != null) {
|
||||
mapboxMap.removeMarker(marker);
|
||||
marker = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void recalculateFocalPoint() {
|
||||
if (focalPointLatLng != null) {
|
||||
mapboxMap.getUiSettings().setFocalPoint(
|
||||
mapboxMap.getProjection().toScreenLocation(focalPointLatLng)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GestureAlertsAdapter extends RecyclerView.Adapter<GestureAlertsAdapter.ViewHolder> {
|
||||
|
||||
private boolean isUpdating;
|
||||
private final Handler updateHandler = new Handler();
|
||||
private final List<GestureAlert> alerts = new ArrayList<>();
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView alertMessageTv;
|
||||
|
||||
@ColorInt
|
||||
public int textColor;
|
||||
|
||||
ViewHolder(View view) {
|
||||
super(view);
|
||||
Typeface typeface = FontCache.get("Roboto-Regular.ttf", view.getContext());
|
||||
alertMessageTv = (TextView) view.findViewById(R.id.alert_message);
|
||||
alertMessageTv.setTypeface(typeface);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_gesture_alert, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
GestureAlert alert = alerts.get(position);
|
||||
holder.alertMessageTv.setText(alert.getMessage());
|
||||
holder.alertMessageTv.setTextColor(
|
||||
ContextCompat.getColor(holder.alertMessageTv.getContext(), alert.getColor()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return alerts.size();
|
||||
}
|
||||
|
||||
void addAlert(GestureAlert alert) {
|
||||
for (GestureAlert gestureAlert : alerts) {
|
||||
if (gestureAlert.getAlertType() != GestureAlert.TYPE_PROGRESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (alert.getAlertType() == GestureAlert.TYPE_PROGRESS && gestureAlert.equals(alert)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (getItemCount() >= MAX_NUMBER_OF_ALERTS) {
|
||||
alerts.remove(getItemCount() - 1);
|
||||
}
|
||||
|
||||
alerts.add(0, alert);
|
||||
if (!isUpdating) {
|
||||
isUpdating = true;
|
||||
updateHandler.postDelayed(updateRunnable, 250);
|
||||
}
|
||||
}
|
||||
|
||||
private Runnable updateRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
notifyDataSetChanged();
|
||||
isUpdating = false;
|
||||
}
|
||||
};
|
||||
|
||||
void cancelUpdates() {
|
||||
updateHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GestureAlert {
|
||||
@Retention(SOURCE)
|
||||
@IntDef( {TYPE_NONE, TYPE_START, TYPE_PROGRESS, TYPE_END, TYPE_OTHER})
|
||||
@interface Type {
|
||||
}
|
||||
|
||||
static final int TYPE_NONE = 0;
|
||||
static final int TYPE_START = 1;
|
||||
static final int TYPE_END = 2;
|
||||
static final int TYPE_PROGRESS = 3;
|
||||
static final int TYPE_OTHER = 4;
|
||||
|
||||
@Type
|
||||
private int alertType;
|
||||
|
||||
private String message;
|
||||
|
||||
@ColorInt
|
||||
private int color;
|
||||
|
||||
GestureAlert(@Type int alertType, String message) {
|
||||
this.alertType = alertType;
|
||||
this.message = message;
|
||||
|
||||
switch (alertType) {
|
||||
case TYPE_NONE:
|
||||
color = android.R.color.black;
|
||||
break;
|
||||
case TYPE_END:
|
||||
color = android.R.color.holo_red_dark;
|
||||
break;
|
||||
case TYPE_OTHER:
|
||||
color = android.R.color.holo_purple;
|
||||
break;
|
||||
case TYPE_PROGRESS:
|
||||
color = android.R.color.holo_orange_dark;
|
||||
break;
|
||||
case TYPE_START:
|
||||
color = android.R.color.holo_green_dark;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int getAlertType() {
|
||||
return alertType;
|
||||
}
|
||||
|
||||
String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GestureAlert that = (GestureAlert) o;
|
||||
|
||||
if (alertType != that.alertType) {
|
||||
return false;
|
||||
}
|
||||
return message != null ? message.equals(that.message) : that.message == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = alertType;
|
||||
result = 31 * result + (message != null ? message.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,11 +58,7 @@ public class CustomLayerActivity extends AppCompatActivity {
|
||||
fab.setImageResource(R.drawable.ic_layers);
|
||||
} else {
|
||||
customLayer = new CustomLayer("custom",
|
||||
ExampleCustomLayer.createContext(),
|
||||
ExampleCustomLayer.InitializeFunction,
|
||||
ExampleCustomLayer.RenderFunction,
|
||||
ExampleCustomLayer.ContextLostFunction, // Optional
|
||||
ExampleCustomLayer.DeinitializeFunction);
|
||||
ExampleCustomLayer.createContext());
|
||||
mapboxMap.addLayerBelow(customLayer, "building");
|
||||
fab.setImageResource(R.drawable.ic_layers_clear);
|
||||
}
|
||||
|
||||
@@ -11,16 +11,19 @@ import com.mapbox.geojson.Feature;
|
||||
import com.mapbox.geojson.FeatureCollection;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
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 java.util.List;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.lt;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.toNumber;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillColor;
|
||||
|
||||
/**
|
||||
@@ -58,7 +61,9 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity
|
||||
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");
|
||||
|
||||
Expression filter = lt(toNumber(get("height")), literal(10));
|
||||
List<Feature> features = mapboxMap.queryRenderedFeatures(box, filter, "building");
|
||||
|
||||
// Show count
|
||||
Toast.makeText(
|
||||
|
||||
@@ -11,13 +11,16 @@ import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.Filter;
|
||||
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.neq;
|
||||
|
||||
/**
|
||||
* Test activity showcasing using the query source features API to query feature counts
|
||||
*/
|
||||
@@ -31,8 +34,6 @@ public class QuerySourceFeaturesActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_query_source_features);
|
||||
|
||||
final float density = getResources().getDisplayMetrics().density;
|
||||
|
||||
// Initialize map as normal
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
@@ -47,12 +48,12 @@ public class QuerySourceFeaturesActivity extends AppCompatActivity {
|
||||
}));
|
||||
mapboxMap.addSource(source);
|
||||
|
||||
mapboxMap.addLayer(new CircleLayer("test-layer", source.getId()).withFilter(Filter.neq("key1", "value1")));
|
||||
mapboxMap.addLayer(new CircleLayer("test-layer", source.getId()).withFilter(neq(get("key1"), literal("value1"))));
|
||||
|
||||
// Add a click listener
|
||||
mapboxMap.setOnMapClickListener(point -> {
|
||||
// Query
|
||||
List<Feature> features = source.querySourceFeatures(Filter.eq("key1", "value1"));
|
||||
List<Feature> features = source.querySourceFeatures(eq(get("key1"), literal("value1")));
|
||||
Toast.makeText(QuerySourceFeaturesActivity.this, String.format("Found %s features",
|
||||
features.size()), Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -16,6 +17,8 @@ import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
* Test activity showcasing the Snapshot API to create and display a bitmap of the current shown Map.
|
||||
*/
|
||||
@@ -75,6 +78,12 @@ public class SnapshotActivity extends AppCompatActivity implements OnMapReadyCal
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapboxMap.snapshot(new MapboxMap.SnapshotReadyCallback() {
|
||||
@Override
|
||||
public void onSnapshotReady(Bitmap snapshot) {
|
||||
Timber.e("Regression test for https://github.com/mapbox/mapbox-gl-native/pull/11358");
|
||||
}
|
||||
});
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.maplayout;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@@ -151,10 +150,7 @@ public class BottomSheetActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
Location location = mapboxMap.getMyLocation();
|
||||
if (location != null) {
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location), 15));
|
||||
}
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.760545, -122.436055), 15));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -207,7 +203,6 @@ public class BottomSheetActivity extends AppCompatActivity {
|
||||
public static BottomSheetFragment newInstance() {
|
||||
BottomSheetFragment mapFragment = new BottomSheetFragment();
|
||||
MapboxMapOptions mapboxMapOptions = new MapboxMapOptions();
|
||||
mapboxMapOptions.locationEnabled(true);
|
||||
mapboxMapOptions.renderSurfaceOnTop(true);
|
||||
mapboxMapOptions.styleUrl(Style.LIGHT);
|
||||
mapFragment.setArguments(MapFragmentUtils.createFragmentArgs(mapboxMapOptions));
|
||||
@@ -230,10 +225,7 @@ public class BottomSheetActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
Location location = mapboxMap.getMyLocation();
|
||||
if (location != null) {
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location), 15));
|
||||
}
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.760545, -122.436055), 15));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,11 +11,9 @@ 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.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.TrackingSettings;
|
||||
import com.mapbox.mapboxsdk.maps.UiSettings;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
@@ -50,14 +48,6 @@ public class DoubleMapActivity extends AppCompatActivity {
|
||||
mapboxMap = map;
|
||||
mapboxMap.setStyleUrl(Style.DARK);
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(18));
|
||||
try {
|
||||
mapboxMap.setMyLocationEnabled(true);
|
||||
TrackingSettings settings = mapboxMap.getTrackingSettings();
|
||||
settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
|
||||
} catch (SecurityException securityException) {
|
||||
// permission is handled in MainActivity
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,15 +96,6 @@ public class DoubleMapActivity extends AppCompatActivity {
|
||||
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));
|
||||
|
||||
@@ -8,18 +8,13 @@ import android.view.MenuItem;
|
||||
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
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.TrackingSettings;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
/**
|
||||
* Test activity showcasing using the map padding API.
|
||||
* <p>
|
||||
* This activity tests for correct padding around a marker (Bangalore) and correct padding around MyLocationView.
|
||||
* </p>
|
||||
*/
|
||||
public class MapPaddingActivity extends AppCompatActivity {
|
||||
|
||||
@@ -96,24 +91,7 @@ public class MapPaddingActivity extends AppCompatActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void toggleGps(boolean enable) {
|
||||
try {
|
||||
// Enable user location
|
||||
mapboxMap.setMyLocationEnabled(enable);
|
||||
|
||||
TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
|
||||
trackingSettings.setDismissLocationTrackingOnGesture(false);
|
||||
trackingSettings.setMyLocationTrackingMode(
|
||||
enable ? MyLocationTracking.TRACKING_FOLLOW : MyLocationTracking.TRACKING_NONE);
|
||||
} catch (SecurityException securityException) {
|
||||
// permission not granted is handled in FeatureOverviewActivity
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void moveToBangalore() {
|
||||
toggleGps(false);
|
||||
|
||||
LatLng bangalore = new LatLng(12.9810816, 77.6368034);
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder()
|
||||
.zoom(16)
|
||||
@@ -129,11 +107,6 @@ public class MapPaddingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_user_tracking:
|
||||
if (mapboxMap != null) {
|
||||
toggleGps(true);
|
||||
}
|
||||
return true;
|
||||
|
||||
case R.id.action_bangalore:
|
||||
if (mapboxMap != null) {
|
||||
|
||||
@@ -8,8 +8,7 @@ import android.view.MenuItem;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.functions.Function;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.Property;
|
||||
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
|
||||
@@ -17,7 +16,9 @@ import com.mapbox.mapboxsdk.style.light.Light;
|
||||
import com.mapbox.mapboxsdk.style.light.Position;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.layers.Filter.eq;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
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;
|
||||
@@ -53,12 +54,12 @@ public class BuildingFillExtrusionActivity extends AppCompatActivity {
|
||||
private void setupBuildings() {
|
||||
FillExtrusionLayer fillExtrusionLayer = new FillExtrusionLayer("3d-buildings", "composite");
|
||||
fillExtrusionLayer.setSourceLayer("building");
|
||||
fillExtrusionLayer.setFilter(eq("extrude", "true"));
|
||||
fillExtrusionLayer.setFilter(eq(get("extrude"), literal("true")));
|
||||
fillExtrusionLayer.setMinZoom(15);
|
||||
fillExtrusionLayer.setProperties(
|
||||
fillExtrusionColor(Color.LTGRAY),
|
||||
fillExtrusionHeight(Function.property("height", new IdentityStops<Float>())),
|
||||
fillExtrusionBase(Function.property("min_height", new IdentityStops<Float>())),
|
||||
fillExtrusionHeight(Expression.get("height")),
|
||||
fillExtrusionBase(Expression.get("min_height")),
|
||||
fillExtrusionOpacity(0.9f)
|
||||
);
|
||||
mapboxMap.addLayer(fillExtrusionLayer);
|
||||
|
||||
@@ -13,6 +13,7 @@ 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.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.LineLayer;
|
||||
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
|
||||
@@ -23,7 +24,10 @@ import java.net.URL;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.layers.Filter.in;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.array;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.has;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius;
|
||||
|
||||
@@ -117,7 +121,7 @@ public class CircleLayerActivity extends AppCompatActivity implements View.OnCli
|
||||
}
|
||||
|
||||
private void applyBusRouteFilterToBusStopSource() {
|
||||
layer.setFilter(in("number", (Object[]) Data.STOPS_FOR_ROUTE));
|
||||
layer.setFilter(has(Expression.toString(get("number")), array(literal(Data.STOPS_FOR_ROUTE))));
|
||||
}
|
||||
|
||||
private void addBusRouteSource() {
|
||||
|
||||
@@ -23,16 +23,18 @@ import java.io.IOException;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.color;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.exponential;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.linear;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.match;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.rgb;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.rgba;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.step;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.color;
|
||||
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;
|
||||
@@ -165,7 +167,6 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addExponentialZoomFunction() {
|
||||
Timber.i("Add exponential zoom function");
|
||||
FillLayer layer = mapboxMap.getLayerAs("water");
|
||||
@@ -191,10 +192,10 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
layer.setProperties(
|
||||
fillColor(
|
||||
step(zoom(),
|
||||
color(Color.CYAN),
|
||||
stop(1, color(Color.RED)),
|
||||
stop(5, color(Color.BLUE)),
|
||||
stop(10, color(Color.GREEN))
|
||||
rgba(0.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1, rgba(255.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(5, rgba(0.0f, 0.0f, 255.0f, 1.0f)),
|
||||
stop(10, rgba(0.0f, 255.0f, 0.0f, 1.0f))
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -211,9 +212,9 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
interpolate(
|
||||
exponential(0.5f),
|
||||
get("stroke-width"),
|
||||
stop(1f, color(Color.RED)),
|
||||
stop(5f, color(Color.BLUE)),
|
||||
stop(10f, color(Color.GREEN))
|
||||
stop(1f, rgba(255.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(5f, rgba(0.0f, 0.0f, 255.0f, 1.0f)),
|
||||
stop(10f, rgba(0.0f, 255.0f, 0.0f, 1.0f))
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -229,10 +230,10 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
fillColor(
|
||||
match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
literal("Jordaan"), color(Color.BLUE),
|
||||
literal("Prinseneiland"), color(Color.GREEN),
|
||||
color(Color.CYAN)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
literal("Jordaan"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
literal("Prinseneiland"), rgba(0.0f, 255.0f, 0.0f, 1.0f),
|
||||
rgba(0.0f, 255.0f, 255.0f, 1.0f)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -261,10 +262,10 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
fillColor(
|
||||
step(
|
||||
get("stroke-width"),
|
||||
color(Color.CYAN),
|
||||
stop(1f, color(Color.RED)),
|
||||
stop(2f, color(Color.BLUE)),
|
||||
stop(3f, color(Color.GREEN))
|
||||
rgba(0.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(255.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(0.0f, 0.0f, 255.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 255.0f, 0.0f, 1.0f))
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -283,24 +284,24 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
zoom(),
|
||||
stop(12, step(
|
||||
get("stroke-width"),
|
||||
color(Color.BLACK),
|
||||
stop(1f, color(Color.RED)),
|
||||
stop(2f, color(Color.WHITE)),
|
||||
stop(3f, color(Color.BLUE))
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(255.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(0.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 0.0f, 255.0f, 1.0f))
|
||||
)),
|
||||
stop(15, step(
|
||||
get("stroke-width"),
|
||||
color(Color.BLACK),
|
||||
stop(1f, color(Color.YELLOW)),
|
||||
stop(2f, color(Color.LTGRAY)),
|
||||
stop(3f, color(Color.CYAN))
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(255.0f, 255.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(211.0f, 211.0f, 211.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 255.0f, 255.0f, 1.0f))
|
||||
)),
|
||||
stop(18, step(
|
||||
get("stroke-width"),
|
||||
color(Color.BLACK),
|
||||
stop(1f, color(Color.WHITE)),
|
||||
stop(2f, color(Color.GRAY)),
|
||||
stop(3f, color(Color.GREEN)))
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(0.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(128.0f, 128.0f, 128.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 255.0f, 0.0f, 1.0f)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -320,24 +321,24 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
zoom(),
|
||||
stop(12, step(
|
||||
get("stroke-width"),
|
||||
color(Color.BLACK),
|
||||
stop(1f, color(Color.RED)),
|
||||
stop(2f, color(Color.WHITE)),
|
||||
stop(3f, color(Color.BLUE))
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(255.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(0.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 0.0f, 255.0f, 1.0f))
|
||||
)),
|
||||
stop(15, step(
|
||||
get("stroke-width"),
|
||||
color(Color.BLACK),
|
||||
stop(1f, color(Color.YELLOW)),
|
||||
stop(2f, color(Color.LTGRAY)),
|
||||
stop(3f, color(Color.CYAN))
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(255.0f, 255.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(211.0f, 211.0f, 211.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 255.0f, 255.0f, 1.0f))
|
||||
)),
|
||||
stop(18, step(
|
||||
get("stroke-width"),
|
||||
color(Color.BLACK),
|
||||
stop(1f, color(Color.WHITE)),
|
||||
stop(2f, color(Color.GRAY)),
|
||||
stop(3f, color(Color.GREEN))
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(1f, rgba(0.0f, 0.0f, 0.0f, 1.0f)),
|
||||
stop(2f, rgba(128.0f, 128.0f, 128.0f, 1.0f)),
|
||||
stop(3f, rgba(0.0f, 255.0f, 0.0f, 1.0f))
|
||||
))
|
||||
)
|
||||
)
|
||||
@@ -353,89 +354,89 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
layer.setProperties(
|
||||
fillColor(
|
||||
step(zoom(),
|
||||
color(Color.BLACK),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
stop(7f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(8f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(9f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(10f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(11f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(12f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(13f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(14f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
literal("Jordaan"), color(Color.GREEN),
|
||||
literal("PrinsenEiland"), color(Color.WHITE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
literal("Jordaan"), rgba(0.0f, 255.0f, 0.0f, 1.0f),
|
||||
literal("PrinsenEiland"), rgba(0.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(15f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(16f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(17f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(18f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
literal("Jordaan"), color(Color.CYAN),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
literal("Jordaan"), rgba(0.0f, 255.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(19f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(20f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(21f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.RED),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(255.0f, 0.0f, 0.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
)),
|
||||
stop(22f, match(
|
||||
get("name"),
|
||||
literal("Westerpark"), color(Color.BLUE),
|
||||
color(Color.BLACK)
|
||||
literal("Westerpark"), rgba(0.0f, 0.0f, 255.0f, 1.0f),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f)
|
||||
))
|
||||
)
|
||||
)
|
||||
@@ -461,8 +462,8 @@ public class DataDrivenStyleActivity extends AppCompatActivity {
|
||||
// Add a fill layer
|
||||
mapboxMap.addLayer(new FillLayer(AMSTERDAM_PARKS_LAYER, source.getId())
|
||||
.withProperties(
|
||||
fillColor(Color.BLACK),
|
||||
fillOutlineColor(Color.BLUE),
|
||||
fillColor(color(Color.GREEN)),
|
||||
fillOutlineColor(rgb(0, 0, 255)),
|
||||
fillAntialias(true)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
@@ -14,6 +15,9 @@ import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.geojson.Polygon;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
@@ -35,30 +39,17 @@ public class FillExtrusionActivity extends AppCompatActivity {
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
mapboxMap = map;
|
||||
Polygon domTower = Polygon.fromLngLats(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
|
||||
}
|
||||
}
|
||||
});
|
||||
List<List<Point>> lngLats = Arrays.asList(
|
||||
Arrays.asList(
|
||||
Point.fromLngLat(5.12112557888031, 52.09071040847704),
|
||||
Point.fromLngLat(5.121227502822875, 52.09053901776669),
|
||||
Point.fromLngLat(5.121484994888306, 52.090601641371805),
|
||||
Point.fromLngLat(5.1213884353637695, 52.090766439912635),
|
||||
Point.fromLngLat(5.12112557888031, 52.09071040847704)
|
||||
)
|
||||
);
|
||||
|
||||
Polygon domTower = Polygon.fromLngLats(lngLats);
|
||||
|
||||
GeoJsonSource source = new GeoJsonSource("extrusion-source", domTower);
|
||||
map.addSource(source);
|
||||
|
||||
@@ -10,6 +10,7 @@ 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.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
|
||||
import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions;
|
||||
@@ -21,9 +22,12 @@ 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;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.all;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.gte;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.lt;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.toNumber;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage;
|
||||
@@ -124,7 +128,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity {
|
||||
)
|
||||
);
|
||||
} catch (MalformedURLException malformedUrlException) {
|
||||
Timber.e(malformedUrlException,"That's not an url... ");
|
||||
Timber.e(malformedUrlException, "That's not an url... ");
|
||||
}
|
||||
|
||||
// Add unclustered layer
|
||||
@@ -145,10 +149,15 @@ public class GeoJsonClusteringActivity extends AppCompatActivity {
|
||||
circleColor(layers[i][1]),
|
||||
circleRadius(18f)
|
||||
);
|
||||
|
||||
Expression pointCount = toNumber(get("point_count"));
|
||||
circles.setFilter(
|
||||
i == 0
|
||||
? gte("point_count", layers[i][0]) :
|
||||
all(gte("point_count", layers[i][0]), lt("point_count", layers[i - 1][0]))
|
||||
? gte(pointCount, literal(layers[i][0])) :
|
||||
all(
|
||||
gte(pointCount, literal(layers[i][0])),
|
||||
lt(pointCount, literal(layers[i - 1][0]))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(circles);
|
||||
}
|
||||
@@ -156,7 +165,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity {
|
||||
// Add the count labels
|
||||
SymbolLayer count = new SymbolLayer("count", "earthquakes");
|
||||
count.setProperties(
|
||||
textField("{point_count}"),
|
||||
textField(get("point_count")),
|
||||
textSize(12f),
|
||||
textColor(Color.WHITE)
|
||||
);
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.net.URL;
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.heatmapDensity;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.linear;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
@@ -28,6 +29,7 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleOpacity;
|
||||
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.circleStrokeWidth;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.heatmapColor;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.heatmapIntensity;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.heatmapOpacity;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.heatmapRadius;
|
||||
@@ -51,7 +53,6 @@ public class HeatmapLayerActivity extends AppCompatActivity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_heatmaplayer);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
@@ -76,11 +77,20 @@ public class HeatmapLayerActivity extends AppCompatActivity {
|
||||
layer.setSourceLayer(HEATMAP_LAYER_SOURCE);
|
||||
layer.setProperties(
|
||||
|
||||
// TODO add heatmap color https://github.com/mapbox/mapbox-gl-native/issues/11172
|
||||
// Color ramp for heatmap. Domain is 0 (low) to 1 (high).
|
||||
// Begin color ramp at 0-stop with a 0-transparancy color
|
||||
// to create a blur-like effect.
|
||||
//heatmapColor(),
|
||||
heatmapColor(
|
||||
interpolate(
|
||||
linear(), heatmapDensity(),
|
||||
literal(0), rgba(33, 102, 172, 0),
|
||||
literal(0.2), rgb(103, 169, 207),
|
||||
literal(0.4), rgb(209, 229, 240),
|
||||
literal(0.6), rgb(253, 219, 199),
|
||||
literal(0.8), rgb(239, 138, 98),
|
||||
literal(1), rgb(178, 24, 43)
|
||||
)
|
||||
),
|
||||
|
||||
// Increase the heatmap weight based on frequency and property magnitude
|
||||
heatmapWeight(
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.mapbox.mapboxsdk.style.sources.VectorSource;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -39,15 +38,18 @@ import java.util.List;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.all;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.color;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.exponential;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.gte;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.lt;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.toNumber;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Filter.all;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Filter.eq;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Filter.gte;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Filter.lt;
|
||||
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.SYMBOL_PLACEMENT_POINT;
|
||||
@@ -295,7 +297,7 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
);
|
||||
|
||||
// Only show me parks (except westerpark with stroke-width == 3)
|
||||
layer.setFilter(all(eq("type", "park"), eq("stroke-width", 2)));
|
||||
layer.setFilter(all(eq(get("type"), literal("park")), eq(get("stroke-width"), literal(3))));
|
||||
|
||||
mapboxMap.addLayerBelow(layer, "building");
|
||||
// layer.setPaintProperty(fillColor(Color.RED)); // XXX But not after the object is attached
|
||||
@@ -345,7 +347,7 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
);
|
||||
|
||||
// Only show me parks
|
||||
layer.setFilter(all(eq("type", "park")));
|
||||
layer.setFilter(all(eq(get("type"), literal("park"))));
|
||||
|
||||
mapboxMap.addLayer(layer);
|
||||
|
||||
@@ -499,7 +501,7 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
FillLayer states = (FillLayer) mapboxMap.getLayer("states");
|
||||
|
||||
if (states != null) {
|
||||
states.setFilter(eq("name", "Texas"));
|
||||
states.setFilter(eq(get("name"), literal("Texas")));
|
||||
states.setFillOpacityTransition(new TransitionOptions(2500, 0));
|
||||
states.setFillColorTransition(new TransitionOptions(2500, 0));
|
||||
states.setProperties(
|
||||
@@ -527,7 +529,7 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
LineLayer counties = (LineLayer) mapboxMap.getLayer("counties");
|
||||
|
||||
if (counties != null) {
|
||||
counties.setFilter(eq("NAME10", "Washington"));
|
||||
counties.setFilter(eq(get("NAME10"), "Washington"));
|
||||
|
||||
counties.setProperties(
|
||||
lineColor(Color.RED),
|
||||
@@ -555,7 +557,10 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
FillLayer regions = (FillLayer) mapboxMap.getLayer("regions");
|
||||
|
||||
if (regions != null) {
|
||||
regions.setFilter(all(gte("HRRNUM", 200), lt("HRRNUM", 300)));
|
||||
regions.setFilter(all(
|
||||
gte(toNumber(get("HRRNUM")), literal(200)),
|
||||
lt(toNumber(get("HRRNUM")), literal(300)))
|
||||
);
|
||||
|
||||
regions.setProperties(
|
||||
fillColor(Color.BLUE),
|
||||
|
||||
@@ -20,15 +20,15 @@ import com.mapbox.geojson.FeatureCollection;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.style.layers.Filter;
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
|
||||
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 java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,11 +37,19 @@ import timber.log.Timber;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.concat;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.division;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.downcase;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.match;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.number;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.pi;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.product;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.rgba;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.step;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.string;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.upcase;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_BOTTOM;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_TOP;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap;
|
||||
@@ -50,6 +58,7 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOffset;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize;
|
||||
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.textSize;
|
||||
|
||||
@@ -115,8 +124,8 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_action_filter) {
|
||||
SymbolLayer layer = mapboxMap.getLayerAs(LAYER_ID);
|
||||
layer.setFilter(Filter.eq(FEATURE_RANK, 1));
|
||||
//layer.setFilter(eq(get(FEATURE_RANK), 1));
|
||||
layer.setFilter(eq(get(FEATURE_RANK), literal(1)));
|
||||
Timber.e("Filter that was set: %s", layer.getFilter());
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -196,27 +205,32 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
|
||||
|
||||
private static class LoadDataTask extends AsyncTask<Void, Void, FeatureCollection> {
|
||||
|
||||
private SymbolGeneratorActivity activity;
|
||||
private WeakReference<SymbolGeneratorActivity> activity;
|
||||
|
||||
LoadDataTask(SymbolGeneratorActivity activity) {
|
||||
this.activity = activity;
|
||||
this.activity = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FeatureCollection doInBackground(Void... params) {
|
||||
try {
|
||||
// read local geojson from raw folder
|
||||
String tinyCountriesJson = ResourceUtils.readRawResource(activity, R.raw.tiny_countries);
|
||||
return FeatureCollection.fromJson(tinyCountriesJson);
|
||||
Context context = activity.get();
|
||||
if (context != null) {
|
||||
try {
|
||||
// read local geojson from raw folder
|
||||
String tinyCountriesJson = ResourceUtils.readRawResource(context, R.raw.tiny_countries);
|
||||
return FeatureCollection.fromJson(tinyCountriesJson);
|
||||
|
||||
} catch (IOException exception) {
|
||||
return null;
|
||||
} catch (IOException exception) {
|
||||
Timber.e(exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(FeatureCollection featureCollection) {
|
||||
super.onPostExecute(featureCollection);
|
||||
SymbolGeneratorActivity activity = this.activity.get();
|
||||
if (featureCollection == null || activity == null) {
|
||||
return;
|
||||
}
|
||||
@@ -226,37 +240,74 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
|
||||
}
|
||||
|
||||
public void onDataLoaded(@NonNull FeatureCollection featureCollection) {
|
||||
// add a geojson to the map
|
||||
// create expressions
|
||||
Expression iconImageExpression = string(get(literal(FEATURE_ID)));
|
||||
Expression iconSizeExpression = division(number(get(literal(FEATURE_RANK))), literal(2.0f));
|
||||
Expression textSizeExpression = product(get(literal(FEATURE_RANK)), pi());
|
||||
Expression textFieldExpression = concat(upcase(literal("a ")), upcase(string(get(literal(FEATURE_TYPE)))),
|
||||
downcase(literal(" IN ")), string(get(literal(FEATURE_REGION)))
|
||||
);
|
||||
Expression textColorExpression = match(get(literal(FEATURE_RANK)),
|
||||
literal(1), rgba(255, 0, 0, 1.0f),
|
||||
literal(2), rgba(0, 0, 255.0f, 1.0f),
|
||||
rgba(0.0f, 255.0f, 0.0f, 1.0f)
|
||||
);
|
||||
|
||||
rgba(
|
||||
division(literal(255), get(FEATURE_RANK)),
|
||||
literal(0.0f),
|
||||
literal(0.0f),
|
||||
literal(1.0f)
|
||||
);
|
||||
|
||||
// create symbol layer
|
||||
SymbolLayer symbolLayer = new SymbolLayer(LAYER_ID, SOURCE_ID)
|
||||
.withProperties(
|
||||
// icon configuration
|
||||
iconImage(iconImageExpression),
|
||||
iconAllowOverlap(false),
|
||||
iconSize(iconSizeExpression),
|
||||
iconAnchor(ICON_ANCHOR_BOTTOM),
|
||||
iconOffset(step(zoom(), literal(new float[] {0f, 0f}),
|
||||
stop(1, new Float[] {0f, 0f}),
|
||||
stop(10, new Float[] {0f, -35f})
|
||||
)),
|
||||
|
||||
// text field configuration
|
||||
textField(textFieldExpression),
|
||||
textSize(textSizeExpression),
|
||||
textAnchor(TEXT_ANCHOR_TOP),
|
||||
textColor(textColorExpression)
|
||||
);
|
||||
|
||||
// add a geojson source to the map
|
||||
Source source = new GeoJsonSource(SOURCE_ID, featureCollection);
|
||||
mapboxMap.addSource(source);
|
||||
|
||||
// create layer use
|
||||
mapboxMap.addLayer(new SymbolLayer(LAYER_ID, SOURCE_ID)
|
||||
.withProperties(
|
||||
// add symbol layer
|
||||
mapboxMap.addLayer(symbolLayer);
|
||||
|
||||
// icon configuration
|
||||
iconImage(get(literal(FEATURE_ID))),
|
||||
iconAllowOverlap(false),
|
||||
iconSize(
|
||||
division(get(literal(FEATURE_RANK)), literal(2))
|
||||
),
|
||||
iconAnchor(ICON_ANCHOR_BOTTOM),
|
||||
iconOffset(new Float[] {0.0f, -5.0f}),
|
||||
// get expressions
|
||||
Expression iconImageExpressionResult = symbolLayer.getIconImage().getExpression();
|
||||
Expression iconSizeExpressionResult = symbolLayer.getIconSize().getExpression();
|
||||
Expression textSizeExpressionResult = symbolLayer.getTextSize().getExpression();
|
||||
Expression textFieldExpressionResult = symbolLayer.getTextField().getExpression();
|
||||
Expression textColorExpressionResult = symbolLayer.getTextColor().getExpression();
|
||||
|
||||
// text field configuration
|
||||
textField(
|
||||
concat(
|
||||
upcase(literal("a ")),
|
||||
get(literal(FEATURE_TYPE)),
|
||||
downcase(literal(" IN ")),
|
||||
get(literal(FEATURE_REGION))
|
||||
)
|
||||
),
|
||||
textSize(
|
||||
product(get(literal(FEATURE_RANK)), pi())
|
||||
),
|
||||
textAnchor(TEXT_ANCHOR_TOP)
|
||||
)
|
||||
// log expressions
|
||||
Timber.e(iconImageExpressionResult.toString());
|
||||
Timber.e(iconSizeExpressionResult.toString());
|
||||
Timber.e(textSizeExpressionResult.toString());
|
||||
Timber.e(textFieldExpressionResult.toString());
|
||||
Timber.e(textColorExpressionResult.toString());
|
||||
|
||||
// reset expressions
|
||||
symbolLayer.setProperties(
|
||||
iconImage(iconImageExpressionResult),
|
||||
iconSize(iconSizeExpressionResult),
|
||||
textSize(textSizeExpressionResult),
|
||||
textField(textFieldExpressionResult),
|
||||
textColor(textColorExpressionResult)
|
||||
);
|
||||
|
||||
new GenerateSymbolTask(mapboxMap, this).execute(featureCollection);
|
||||
@@ -265,27 +316,29 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
|
||||
private static class GenerateSymbolTask extends AsyncTask<FeatureCollection, Void, HashMap<String, Bitmap>> {
|
||||
|
||||
private MapboxMap mapboxMap;
|
||||
private Context context;
|
||||
private WeakReference<Context> context;
|
||||
|
||||
GenerateSymbolTask(MapboxMap mapboxMap, Context context) {
|
||||
this.mapboxMap = mapboxMap;
|
||||
this.context = context;
|
||||
this.context = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("WrongThread")
|
||||
@Override
|
||||
protected HashMap<String, Bitmap> doInBackground(FeatureCollection... params) {
|
||||
FeatureCollection featureCollection = params[0];
|
||||
|
||||
HashMap<String, Bitmap> imagesMap = new HashMap<>();
|
||||
for (Feature feature : featureCollection.features()) {
|
||||
String countryName = feature.getStringProperty(FEATURE_ID);
|
||||
TextView textView = new TextView(context);
|
||||
textView.setBackgroundColor(context.getResources().getColor(R.color.blueAccent));
|
||||
textView.setPadding(10, 5, 10, 5);
|
||||
textView.setTextColor(Color.WHITE);
|
||||
textView.setText(countryName);
|
||||
imagesMap.put(countryName, SymbolGenerator.generate(textView));
|
||||
Context context = this.context.get();
|
||||
List<Feature> features = params[0].features();
|
||||
if (context != null && features != null) {
|
||||
for (Feature feature : features) {
|
||||
String countryName = feature.getStringProperty(FEATURE_ID);
|
||||
TextView textView = new TextView(context);
|
||||
textView.setBackgroundColor(context.getResources().getColor(R.color.blueAccent));
|
||||
textView.setPadding(10, 5, 10, 5);
|
||||
textView.setTextColor(Color.WHITE);
|
||||
textView.setText(countryName);
|
||||
imagesMap.put(countryName, SymbolGenerator.generate(textView));
|
||||
}
|
||||
}
|
||||
return imagesMap;
|
||||
}
|
||||
|
||||
@@ -22,11 +22,13 @@ 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;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.linear;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.literal;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.switchCase;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize;
|
||||
@@ -101,20 +103,16 @@ public class ZoomFunctionSymbolLayerActivity extends AppCompatActivity {
|
||||
layer = new SymbolLayer(LAYER_ID, SOURCE_ID);
|
||||
layer.setProperties(
|
||||
iconImage(
|
||||
zoom(
|
||||
interval(
|
||||
stop(ZOOM_STOP_MIN_VALUE, iconImage(BUS_MAKI_ICON_ID)),
|
||||
stop(ZOOM_STOP_MAX_VALUE, iconImage(CAFE_MAKI_ICON_ID))
|
||||
)
|
||||
)
|
||||
interpolate(
|
||||
linear(), zoom(),
|
||||
stop(ZOOM_STOP_MIN_VALUE, BUS_MAKI_ICON_ID),
|
||||
stop(ZOOM_STOP_MAX_VALUE, CAFE_MAKI_ICON_ID)
|
||||
)
|
||||
),
|
||||
iconSize(
|
||||
property(
|
||||
KEY_PROPERTY_SELECTED,
|
||||
categorical(
|
||||
stop(true, iconSize(3.0f)),
|
||||
stop(false, iconSize(1.0f))
|
||||
)
|
||||
switchCase(
|
||||
get(KEY_PROPERTY_SELECTED), literal(3.0f),
|
||||
literal(1.0f)
|
||||
)
|
||||
),
|
||||
iconAllowOverlap(true)
|
||||
|
||||
@@ -95,4 +95,4 @@ public class TextureViewResizeActivity extends AppCompatActivity {
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,52 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
package com.mapbox.mapboxsdk.testapp.activity.textureview;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
* Test activity showcasing toggling the user location on the map.
|
||||
* Example showcasing how to create a TextureView with a transparent background.
|
||||
*/
|
||||
public class MyLocationToggleActivity extends BaseLocationActivity {
|
||||
public class TextureViewTransparentBackgroundActivity extends AppCompatActivity {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private FloatingActionButton locationToggleFab;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_location_toggle);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> mapboxMap = map);
|
||||
|
||||
locationToggleFab = (FloatingActionButton) findViewById(R.id.fabLocationToggle);
|
||||
locationToggleFab.setOnClickListener(view -> {
|
||||
if (mapboxMap != null) {
|
||||
toggleGps(!mapboxMap.isMyLocationEnabled());
|
||||
}
|
||||
});
|
||||
setContentView(R.layout.activity_textureview_transparent);
|
||||
setupBackground();
|
||||
setupMapView(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enableLocation(boolean enabled) {
|
||||
Timber.e("Enabling location: %s", enabled);
|
||||
mapboxMap.setMyLocationEnabled(enabled);
|
||||
if (enabled) {
|
||||
locationToggleFab.setImageResource(R.drawable.ic_location_disabled);
|
||||
} else {
|
||||
locationToggleFab.setImageResource(R.drawable.ic_my_location);
|
||||
}
|
||||
private void setupBackground() {
|
||||
ImageView imageView = (ImageView) findViewById(R.id.imageView);
|
||||
imageView.setImageResource(R.drawable.water);
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
}
|
||||
|
||||
private void setupMapView(Bundle savedInstanceState) {
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
mapboxMap = map;
|
||||
|
||||
try {
|
||||
map.setStyleJson(ResourceUtils.readRawResource(getApplicationContext(), R.raw.no_bg_style));
|
||||
} catch (IOException exception) {
|
||||
Timber.e(exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,4 +91,4 @@ public class MyLocationToggleActivity extends BaseLocationActivity {
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mapbox.android.core.permissions.PermissionsListener;
|
||||
import com.mapbox.android.core.permissions.PermissionsManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Base class for location aware activities.
|
||||
*/
|
||||
public abstract class BaseLocationActivity extends AppCompatActivity implements PermissionsListener {
|
||||
|
||||
private PermissionsManager permissionsManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
permissionsManager = new PermissionsManager(this);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
protected final void toggleGps(boolean enableGps) {
|
||||
if (enableGps) {
|
||||
if (!isRuntimePermissionsRequired()) {
|
||||
permissionsManager.requestLocationPermissions(this);
|
||||
} else {
|
||||
enableLocation(true);
|
||||
}
|
||||
} else {
|
||||
enableLocation(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExplanationNeeded(List<String> list) {
|
||||
Snackbar.make(
|
||||
findViewById(android.R.id.content),
|
||||
TextUtils.join("", list.toArray()),
|
||||
Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionResult(boolean isPermissionAccepted) {
|
||||
enableLocation(isPermissionAccepted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
private boolean isRuntimePermissionsRequired() {
|
||||
return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
|
||||
}
|
||||
|
||||
protected abstract void enableLocation(boolean enabled);
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.mapbox.mapboxsdk.Mapbox;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
/**
|
||||
* Test activity showcasing using a custom location engine.
|
||||
*/
|
||||
public class CustomLocationEngineActivity extends BaseLocationActivity {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private FloatingActionButton locationToggleFab;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_custom_location_engine);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
mapboxMap = map;
|
||||
mapboxMap.setLocationSource(MockLocationEngine.getInstance());
|
||||
});
|
||||
|
||||
locationToggleFab = (FloatingActionButton) findViewById(R.id.fabLocationToggle);
|
||||
locationToggleFab.setOnClickListener(view -> {
|
||||
if (mapboxMap != null) {
|
||||
enableLocation(!mapboxMap.isMyLocationEnabled());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enableLocation(boolean enabled) {
|
||||
mapboxMap.setMyLocationEnabled(enabled);
|
||||
if (enabled) {
|
||||
locationToggleFab.setImageResource(R.drawable.ic_location_disabled);
|
||||
} else {
|
||||
locationToggleFab.setImageResource(R.drawable.ic_my_location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_location_engine, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (mapboxMap != null) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_id_location_source_lost) {
|
||||
mapboxMap.setLocationSource(Mapbox.getLocationEngine());
|
||||
return true;
|
||||
} else if (itemId == R.id.action_id_location_source_mock) {
|
||||
mapboxMap.setLocationSource(MockLocationEngine.getInstance());
|
||||
return true;
|
||||
} else if (itemId == R.id.action_id_location_source_null) {
|
||||
mapboxMap.setLocationSource(null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mapbox.android.core.location.LocationEngine;
|
||||
import com.mapbox.android.core.location.LocationEngineListener;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
* Sample LocationEngine that provides mocked LOCATIONS simulating GPS updates
|
||||
*/
|
||||
public class MockLocationEngine extends LocationEngine {
|
||||
private static MockLocationEngine INSTANCE;
|
||||
|
||||
private final LocationAnimator locationAnimator;
|
||||
private boolean running;
|
||||
private static int counter;
|
||||
|
||||
MockLocationEngine(Location start, Location end) {
|
||||
locationAnimator = new LocationAnimator(start, end, animation -> {
|
||||
for (LocationEngineListener listener : locationListeners) {
|
||||
listener.onLocationChanged((Location) animation.getAnimatedValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static synchronized MockLocationEngine getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new MockLocationEngine(
|
||||
MockLocationEngine.createLocation(40.416913, -3.703861),
|
||||
MockLocationEngine.createLocation(39.461643, -0.368041)
|
||||
);
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static Location createLocation(double latitude, double longitude) {
|
||||
Location location = new Location(MockLocationEngine.class.getSimpleName());
|
||||
location.setLatitude(latitude);
|
||||
location.setLongitude(longitude);
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate() {
|
||||
// "Connection" is immediate here
|
||||
for (LocationEngineListener listener : locationListeners) {
|
||||
listener.onConnected();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return true; // Always connected
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLastLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLocationUpdates() {
|
||||
if (!running) {
|
||||
locationAnimator.start();
|
||||
running = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationUpdates() {
|
||||
if (running) {
|
||||
locationAnimator.stop();
|
||||
running = false;
|
||||
Timber.e("LOC %s", counter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type obtainType() {
|
||||
return Type.MOCK;
|
||||
}
|
||||
|
||||
private static class LocationAnimator extends AnimatorListenerAdapter {
|
||||
|
||||
private static final long DURATION_ANIMATION = 10000;
|
||||
private final ValueAnimator locationAnimator;
|
||||
private long animationTime;
|
||||
|
||||
LocationAnimator(Location start, Location end, ValueAnimator.AnimatorUpdateListener listener) {
|
||||
locationAnimator = ValueAnimator.ofObject(new LocationEvaluator(), start, end);
|
||||
locationAnimator.setDuration(DURATION_ANIMATION);
|
||||
locationAnimator.addUpdateListener(listener);
|
||||
locationAnimator.addListener(this);
|
||||
}
|
||||
|
||||
void start() {
|
||||
locationAnimator.start();
|
||||
locationAnimator.setCurrentPlayTime(animationTime);
|
||||
}
|
||||
|
||||
void stop() {
|
||||
animationTime = locationAnimator.getCurrentPlayTime();
|
||||
locationAnimator.cancel();
|
||||
}
|
||||
|
||||
private static class LocationEvaluator implements TypeEvaluator<Location> {
|
||||
|
||||
private Location location = new Location(MockLocationEngine.class.getSimpleName());
|
||||
|
||||
@Override
|
||||
public Location evaluate(float fraction, Location startValue, Location endValue) {
|
||||
counter++;
|
||||
location.setLatitude(startValue.getLatitude()
|
||||
+ ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
|
||||
location.setLongitude(startValue.getLongitude()
|
||||
+ ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
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.testapp.R;
|
||||
import com.mapbox.android.core.location.LocationEngineListener;
|
||||
|
||||
/**
|
||||
* Test activity showcasing how to change the MyLocationView drawable.
|
||||
*/
|
||||
public class MyLocationDrawableActivity extends BaseLocationActivity implements LocationEngineListener {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_location_customization);
|
||||
findViewById(R.id.progress).setVisibility(View.GONE);
|
||||
|
||||
MapboxMapOptions mapboxMapOptions = new MapboxMapOptions();
|
||||
mapboxMapOptions.styleUrl(Style.MAPBOX_STREETS);
|
||||
mapboxMapOptions.myLocationForegroundDrawable(ContextCompat.getDrawable(this, R.drawable.ic_android));
|
||||
mapboxMapOptions.myLocationBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.ic_android));
|
||||
mapboxMapOptions.myLocationForegroundTintColor(Color.GREEN);
|
||||
mapboxMapOptions.myLocationBackgroundTintColor(Color.YELLOW);
|
||||
mapboxMapOptions.myLocationBackgroundPadding(new int[] {0, 0,
|
||||
(int) getResources().getDimension(R.dimen.locationview_background_drawable_padding),
|
||||
(int) getResources().getDimension(R.dimen.locationview_background_drawable_padding)});
|
||||
mapboxMapOptions.myLocationAccuracyTint(Color.RED);
|
||||
mapboxMapOptions.myLocationAccuracyAlpha(155);
|
||||
|
||||
mapView = new MapView(this, mapboxMapOptions);
|
||||
mapView.setId(R.id.mapView);
|
||||
ViewGroup parent = (ViewGroup) findViewById(android.R.id.content);
|
||||
parent.addView(mapView);
|
||||
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
mapboxMap = map;
|
||||
toggleGps(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enableLocation(boolean enabled) {
|
||||
mapboxMap.setMyLocationEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location), 14));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.IdRes;
|
||||
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.TrackingSettings;
|
||||
import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.android.core.location.LocationEngineListener;
|
||||
|
||||
/**
|
||||
* Test activity showcasing how to tint the MyLocationView.
|
||||
*/
|
||||
public class MyLocationTintActivity extends BaseLocationActivity implements LocationEngineListener {
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private boolean firstRun;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_location_dot_color);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
mapboxMap = map;
|
||||
|
||||
// enable location updates
|
||||
toggleGps(true);
|
||||
|
||||
// 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);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
if (mapboxMap != null && firstRun) {
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location), 15));
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enableLocation(boolean enabled) {
|
||||
if (enabled) {
|
||||
mapboxMap.setMyLocationEnabled(true);
|
||||
if (mapboxMap.getMyLocation() != null) {
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
|
||||
new LatLng(mapboxMap.getMyLocation().getLatitude(),
|
||||
mapboxMap.getMyLocation().getLongitude()), 15));
|
||||
}
|
||||
} else {
|
||||
mapboxMap.setMyLocationEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ViewUtils {
|
||||
|
||||
public static void attachClickListener(
|
||||
@NonNull Activity activity, @IdRes int buttonId, @Nullable View.OnClickListener clickListener) {
|
||||
View view = activity.findViewById(buttonId);
|
||||
if (view != null) {
|
||||
view.setOnClickListener(clickListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,296 +0,0 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
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;
|
||||
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.UiSettings;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.android.core.location.LocationEngineListener;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
* Test activity showcasing the different tracking modes the SDK exposes.
|
||||
* <p>
|
||||
* This includes MyLocationTracking/MyLocationBearingTracking and how the components can be configured to be dismissed
|
||||
* using gesture configurations.
|
||||
* </p>
|
||||
*/
|
||||
public class MyLocationTrackingModeActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener,
|
||||
OnMapReadyCallback, LocationEngineListener {
|
||||
|
||||
public static final int TRACKING_NONE_INDEX = 0;
|
||||
public static final int TRACKING_FOLLOW_INDEX = 1;
|
||||
public static final int BEARING_NONE_INDEX = 0;
|
||||
public static final int BEARING_GPS_INDEX = 1;
|
||||
public static final int BEARING_COMPASS_INDEX = 2;
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private Spinner locationSpinner;
|
||||
private Spinner bearingSpinner;
|
||||
private boolean firstRun = true;
|
||||
|
||||
private MenuItem dismissLocationTrackingOnGestureItem;
|
||||
private MenuItem dismissBearingTrackingOnGestureItem;
|
||||
private MenuItem enableRotateGesturesItem;
|
||||
private MenuItem enableScrollGesturesItem;
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_location_tracking);
|
||||
setupToolbar();
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
MyLocationTrackingModeActivity.this.mapboxMap = mapboxMap;
|
||||
|
||||
mapboxMap.setMyLocationEnabled(true);
|
||||
Mapbox.getLocationEngine().addLocationEngineListener(this);
|
||||
Mapbox.getLocationEngine().requestLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
Timber.e("Location changed %s", location);
|
||||
if (firstRun) {
|
||||
setInitialLocation(location, 16);
|
||||
}
|
||||
}
|
||||
|
||||
private void setInitialLocation(Location location, double zoom) {
|
||||
mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location), zoom));
|
||||
mapboxMap.setMyLocationEnabled(true);
|
||||
setupSpinners(mapboxMap);
|
||||
firstRun = false;
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
|
||||
locationSpinner = (Spinner) findViewById(R.id.spinner_location);
|
||||
ArrayAdapter<CharSequence> locationTrackingAdapter = ArrayAdapter.createFromResource(
|
||||
actionBar.getThemedContext(), R.array.user_tracking_mode, android.R.layout.simple_spinner_item);
|
||||
locationTrackingAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
locationSpinner.setAdapter(locationTrackingAdapter);
|
||||
|
||||
bearingSpinner = (Spinner) findViewById(R.id.spinner_bearing);
|
||||
ArrayAdapter<CharSequence> bearingTrackingAdapter = ArrayAdapter.createFromResource(
|
||||
actionBar.getThemedContext(), R.array.user_bearing_mode, android.R.layout.simple_spinner_item);
|
||||
bearingTrackingAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
bearingSpinner.setAdapter(bearingTrackingAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSpinners(@NonNull MapboxMap mapboxMap) {
|
||||
locationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
|
||||
bearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
|
||||
setCheckBoxes();
|
||||
|
||||
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(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);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) throws SecurityException {
|
||||
TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
|
||||
if (parent.getId() == R.id.spinner_location) {
|
||||
switch (position) {
|
||||
case TRACKING_NONE_INDEX:
|
||||
trackingSettings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
|
||||
break;
|
||||
|
||||
case TRACKING_FOLLOW_INDEX:
|
||||
trackingSettings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
|
||||
break;
|
||||
}
|
||||
} else if (parent.getId() == R.id.spinner_bearing) {
|
||||
switch (position) {
|
||||
case BEARING_NONE_INDEX:
|
||||
trackingSettings.setMyBearingTrackingMode(MyBearingTracking.NONE);
|
||||
break;
|
||||
|
||||
case BEARING_GPS_INDEX:
|
||||
trackingSettings.setMyBearingTrackingMode(MyBearingTracking.GPS);
|
||||
break;
|
||||
|
||||
case BEARING_COMPASS_INDEX:
|
||||
trackingSettings.setMyBearingTrackingMode(MyBearingTracking.COMPASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
Mapbox.getLocationEngine().removeLocationEngineListener(this);
|
||||
Mapbox.getLocationEngine().removeLocationUpdates();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_tracking, menu);
|
||||
dismissLocationTrackingOnGestureItem = menu.findItem(R.id.action_toggle_dismissible_location);
|
||||
dismissBearingTrackingOnGestureItem = menu.findItem(R.id.action_toggle_dismissible_bearing);
|
||||
enableRotateGesturesItem = menu.findItem(R.id.action_toggle_rotate_gesture_enabled);
|
||||
enableScrollGesturesItem = menu.findItem(R.id.action_toggle_scroll_gesture_enabled);
|
||||
setCheckBoxes();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setCheckBoxes() {
|
||||
if (mapboxMap != null && dismissBearingTrackingOnGestureItem != null) {
|
||||
TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
|
||||
UiSettings uiSettings = mapboxMap.getUiSettings();
|
||||
dismissBearingTrackingOnGestureItem.setChecked(trackingSettings.isDismissBearingTrackingOnGesture());
|
||||
dismissLocationTrackingOnGestureItem.setChecked(trackingSettings.isDismissLocationTrackingOnGesture());
|
||||
enableRotateGesturesItem.setChecked(uiSettings.isRotateGesturesEnabled());
|
||||
enableScrollGesturesItem.setChecked(uiSettings.isScrollGesturesEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
boolean state;
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
case R.id.action_toggle_dismissible_location:
|
||||
state = !item.isChecked();
|
||||
mapboxMap.getTrackingSettings().setDismissLocationTrackingOnGesture(state);
|
||||
Toast.makeText(this, "Dismiss tracking mode on gesture = " + state, Toast.LENGTH_SHORT).show();
|
||||
item.setChecked(state);
|
||||
return true;
|
||||
case R.id.action_toggle_dismissible_bearing:
|
||||
state = !item.isChecked();
|
||||
mapboxMap.getTrackingSettings().setDismissBearingTrackingOnGesture(state);
|
||||
Toast.makeText(this, "Dismiss bearing mode on gesture = " + state, Toast.LENGTH_SHORT).show();
|
||||
item.setChecked(state);
|
||||
return true;
|
||||
case R.id.action_toggle_rotate_gesture_enabled:
|
||||
state = !item.isChecked();
|
||||
mapboxMap.getUiSettings().setRotateGesturesEnabled(state);
|
||||
Toast.makeText(this, "Rotate gesture enabled = " + state, Toast.LENGTH_SHORT).show();
|
||||
item.setChecked(state);
|
||||
return true;
|
||||
case R.id.action_toggle_scroll_gesture_enabled:
|
||||
state = !item.isChecked();
|
||||
mapboxMap.getUiSettings().setScrollGesturesEnabled(state);
|
||||
Toast.makeText(this, "Scroll gesture enabled = " + state, Toast.LENGTH_SHORT).show();
|
||||
item.setChecked(state);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,12 @@ public class Feature implements Parcelable {
|
||||
private String label;
|
||||
private String description;
|
||||
private String category;
|
||||
private boolean requiresLocationPermission;
|
||||
|
||||
public Feature(String name, String label, String description, String category, boolean requiresLocationPermission) {
|
||||
public Feature(String name, String label, String description, String category) {
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.description = description;
|
||||
this.category = category;
|
||||
this.requiresLocationPermission = requiresLocationPermission;
|
||||
}
|
||||
|
||||
private Feature(Parcel in) {
|
||||
@@ -24,7 +22,6 @@ public class Feature implements Parcelable {
|
||||
label = in.readString();
|
||||
description = in.readString();
|
||||
category = in.readString();
|
||||
requiresLocationPermission = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -48,10 +45,6 @@ public class Feature implements Parcelable {
|
||||
return category;
|
||||
}
|
||||
|
||||
public boolean isRequiresLocationPermission() {
|
||||
return requiresLocationPermission;
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
@@ -61,7 +54,6 @@ public class Feature implements Parcelable {
|
||||
out.writeString(label);
|
||||
out.writeString(description);
|
||||
out.writeString(category);
|
||||
out.writeByte((byte) (requiresLocationPermission ? 1 : 0));
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<Feature> CREATOR
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.testapp.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.RawRes;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -16,21 +17,23 @@ public class ResourceUtils {
|
||||
public static String readRawResource(Context context, @RawRes int rawResource) throws IOException {
|
||||
String json = "";
|
||||
if (context != null) {
|
||||
InputStream is = context.getResources().openRawResource(rawResource);
|
||||
Writer writer = new StringWriter();
|
||||
char[] buffer = new char[1024];
|
||||
try {
|
||||
try (InputStream is = context.getResources().openRawResource(rawResource)) {
|
||||
Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
int numRead;
|
||||
while ((numRead = reader.read(buffer)) != -1) {
|
||||
writer.write(buffer, 0, numRead);
|
||||
}
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
json = writer.toString();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public static float convertDpToPx(Context context, float dp) {
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94L13,1h-2v2.06c-1.13,0.12 -2.19,0.46 -3.16,0.97l1.5,1.5C10.16,5.19 11.06,5 12,5c3.87,0 7,3.13 7,7 0,0.94 -0.19,1.84 -0.52,2.65l1.5,1.5c0.5,-0.96 0.84,-2.02 0.97,-3.15L23,13v-2h-2.06zM3,4.27l2.04,2.04C3.97,7.62 3.25,9.23 3.06,11L1,11v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94L11,23h2v-2.06c1.77,-0.2 3.38,-0.91 4.69,-1.98L19.73,21 21,19.73 4.27,3 3,4.27zM16.27,17.54C15.09,18.45 13.61,19 12,19c-3.87,0 -7,-3.13 -7,-7 0,-1.61 0.55,-3.09 1.46,-4.27l9.81,9.81z"/>
|
||||
</vector>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_cameraTargetLat="40.416872"
|
||||
app:mapbox_cameraTargetLng="-3.703807"
|
||||
app:mapbox_cameraZoom="4"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabLocationToggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_my_location"
|
||||
tools:backgroundTint="@color/primary"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.mapbox.mapboxsdk.testapp.activity.camera.GestureDetectorActivity">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_cameraTargetLat="51.50325"
|
||||
app:mapbox_cameraTargetLng="-0.11968"
|
||||
app:mapbox_cameraZoom="15" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/alerts_recycler"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#97cdcfd3" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<android.support.v4.widget.ContentLoadingProgressBar
|
||||
android:id="@id/progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
</merge>
|
||||
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:mapbox="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
mapbox:mapbox_uiAttribution="false"
|
||||
mapbox:mapbox_uiLogo="false"/>
|
||||
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/accent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="4">
|
||||
|
||||
<Button
|
||||
android:id="@+id/default_user_dot_coloring_button"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_user_dot_default"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/tint_user_dot_button"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_user_dot_tint"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/user_accuracy_ring_tint_button"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_user_accuracy_ring_tint"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/user_dot_transparent_button"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_user_transparent_tint"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabLocationToggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_my_location"
|
||||
tools:backgroundTint="@color/primary"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
@@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/primary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:weightSum="2">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_location"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_bearing"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_myLocationTintColor="@color/primary"
|
||||
app:mapbox_myLocationAccuracyTintColor="@color/primary"
|
||||
app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"
|
||||
app:mapbox_cameraZoom="8" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -7,7 +7,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null"/>
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_cameraTargetLat="48.507879"
|
||||
app:mapbox_cameraTargetLng="8.363795"
|
||||
app:mapbox_cameraZoom="2"
|
||||
app:mapbox_renderTextureMode="true"
|
||||
app:mapbox_renderTextureTranslucentSurface="true"
|
||||
app:mapbox_styleUrl="mapbox://styles/agerace-globant/cja02de7193b02suvy4gpbt2c"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alert_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingTop="2dp"
|
||||
android:textSize="9sp" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/menu_gesture_none"
|
||||
android:title="None" />
|
||||
<item
|
||||
android:id="@+id/menu_gesture_focus_point"
|
||||
android:title="Focus on a point" />
|
||||
<item
|
||||
android:id="@+id/menu_gesture_animation"
|
||||
android:title="Turn off velocity animations" />
|
||||
</menu>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:mapbox="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_id_location_source_lost"
|
||||
android:title="@string/menuitem_title_change_location_source_lost"
|
||||
mapbox:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_id_location_source_mock"
|
||||
android:title="@string/menuitem_title_change_location_source_mock"
|
||||
mapbox:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_id_location_source_null"
|
||||
android:title="@string/menuitem_title_change_location_source_null"
|
||||
mapbox:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:mapbox="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_user_tracking"
|
||||
android:title="@string/my_location_tracking"
|
||||
mapbox:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_bangalore"
|
||||
android:title="@string/bangalore"
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<group android:checkableBehavior="all">
|
||||
<item
|
||||
android:id="@+id/action_toggle_dismissible_location"
|
||||
android:checkable="true"
|
||||
android:checked="false"
|
||||
android:title="@string/menuitem_title_tracking_mode_dismiss_on_gesture"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_toggle_dismissible_bearing"
|
||||
android:checkable="true"
|
||||
android:checked="false"
|
||||
android:title="@string/menuitem_title_bearing_mode_dismiss_on_gesture"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_toggle_rotate_gesture_enabled"
|
||||
android:checkable="true"
|
||||
android:checked="false"
|
||||
android:title="@string/menuitem_title_rotate_gesture_enabled"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_toggle_scroll_gesture_enabled"
|
||||
android:checkable="true"
|
||||
android:checked="false"
|
||||
android:title="@string/menuitem_title_scroll_gesture_enabled"
|
||||
app:showAsAction="never" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"version": 8,
|
||||
"name": "Land",
|
||||
"metadata": {
|
||||
"mapbox:autocomposite": true,
|
||||
},
|
||||
"sources": {
|
||||
"composite": {
|
||||
"url": "mapbox://mapbox.mapbox-terrain-v2",
|
||||
"type": "vector"
|
||||
}
|
||||
},
|
||||
"sprite": "mapbox://sprites/mapbox/mapbox-terrain-v2",
|
||||
"glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
|
||||
"layers": [
|
||||
{
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"type": "fill",
|
||||
"source": "composite",
|
||||
"id": "admin",
|
||||
"paint": {
|
||||
"fill-color": "hsl(359, 100%, 50%)",
|
||||
"fill-opacity": 1
|
||||
},
|
||||
"source-layer": "landcover"
|
||||
},
|
||||
{
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"type": "fill",
|
||||
"source": "composite",
|
||||
"id": "layer-0",
|
||||
"paint": {
|
||||
"fill-opacity": 1,
|
||||
"fill-color": "hsl(359, 100%, 50%)"
|
||||
},
|
||||
"source-layer": "Layer_0"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,14 +2,7 @@
|
||||
<resources>
|
||||
<string name="menuitem_title_concurrent_infowindow">Concurrent Open InfoWindows</string>
|
||||
<string name="menuitem_title_deselect_markers_on_tap">Deselect Markers On Tap</string>
|
||||
<string name="menuitem_title_tracking_mode_dismiss_on_gesture">Dismiss location tracking on gesture</string>
|
||||
<string name="menuitem_title_bearing_mode_dismiss_on_gesture">Dismiss bearing tracking on gesture</string>
|
||||
<string name="menuitem_title_reset">Reset</string>
|
||||
<string name="menuitem_title_rotate_gesture_enabled">Enable rotate gestures</string>
|
||||
<string name="menuitem_title_scroll_gesture_enabled">Enable scroll gestures</string>
|
||||
<string name="menuitem_title_change_location_source_lost">Change to LOST location source</string>
|
||||
<string name="menuitem_title_change_location_source_mock">Change to mock location source</string>
|
||||
<string name="menuitem_title_change_location_source_null">Reset location source to null</string>
|
||||
<string name="menuitem_change_icon_overlap">Toggle icon overlap</string>
|
||||
<string name="menuitem_filter">Filter layer</string>
|
||||
<string name="menuitem_change_location">Change location</string>
|
||||
@@ -21,10 +14,6 @@
|
||||
<string name="button_camera_move">Move</string>
|
||||
<string name="button_camera_ease">Ease</string>
|
||||
<string name="button_camera_animate">Animate</string>
|
||||
<string name="button_user_dot_default">Default</string>
|
||||
<string name="button_user_dot_tint">Tint dot</string>
|
||||
<string name="button_user_accuracy_ring_tint">Tint ring</string>
|
||||
<string name="button_user_transparent_tint">tran</string>
|
||||
<string name="button_open_dialog">Open dialog</string>
|
||||
<string name="button_download_region">Download region</string>
|
||||
<string name="button_list_regions">List regions</string>
|
||||
@@ -73,7 +62,6 @@
|
||||
<string name="add_a_composite_categorical_function">Add a composite, categorical function</string>
|
||||
<string name="add_a_composite_exponential_function">Add a composite, exponential function</string>
|
||||
<string name="add_a_composite_interval_function">Add a composite, interval function</string>
|
||||
<string name="my_location_tracking">My Location Tracking</string>
|
||||
<string name="bangalore">Bangalore</string>
|
||||
<string name="list_all_layers_in_the_style">List all layers in the style</string>
|
||||
<string name="list_all_sources_in_the_style">List all sources in the style</string>
|
||||
|
||||
@@ -7,16 +7,4 @@
|
||||
<item>1000</item>
|
||||
<item>10000</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="user_tracking_mode">
|
||||
<item>Disabled</item>
|
||||
<item>Follow tracking</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="user_bearing_mode">
|
||||
<item>Disabled</item>
|
||||
<item>GPS bearing</item>
|
||||
<item>Compass bearing</item>
|
||||
<!--<item>Combined mode</item>-->
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -10,7 +10,6 @@
|
||||
<string name="category_infowindow">Info Window</string>
|
||||
<string name="category_maplayout">Map Layout</string>
|
||||
<string name="category_offline">Offline</string>
|
||||
<string name="category_userlocation">User Location</string>
|
||||
<string name="category_style">Styling</string>
|
||||
<string name="category_features">Features</string>
|
||||
<string name="category_storage">Storage</string>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="description_user_location_tracking">Tracks the location of the user</string>
|
||||
<string name="description_user_location_customization">Customize the location of the user</string>
|
||||
<string name="description_user_location_dot_color">Customize the user location color</string>
|
||||
<string name="description_user_location_toggle">Toggle location of the user on and off</string>
|
||||
<string name="description_custom_location_engine">Customize location engine</string>
|
||||
<string name="description_custom_layer">Overlay a custom native layer on the map</string>
|
||||
<string name="description_info_window_adapter">Learn how to create a custom InfoWindow</string>
|
||||
<string name="description_cameraposition">CameraPosition capabilities</string>
|
||||
@@ -67,8 +62,10 @@
|
||||
<string name="description_textureview_debug">Use TextureView to render the map</string>
|
||||
<string name="description_textureview_resize">Resize a map rendered on a TextureView</string>
|
||||
<string name="description_textureview_animate">Animate a map rendered on a TextureView</string>
|
||||
<string name="description_textureview_transparent">Enable a transparent surface on TextureView</string>
|
||||
<string name="description_grid_source">Example Custom Geometry Source</string>
|
||||
<string name="description_local_glyph">Suzhou using Droid Sans for Chinese glyphs</string>
|
||||
<string name="description_hillshade">Example raster-dem source and hillshade layer</string>
|
||||
<string name="description_heatmaplayer">Use HeatmapLayer to visualise earthquakes</string>
|
||||
<string name="description_gesture_detector">Manipulate gestures detector\'s settings</string>
|
||||
</resources>
|
||||
|
||||
@@ -6,6 +6,5 @@
|
||||
<dimen name="map_padding_bottom">256dp</dimen>
|
||||
<dimen name="map_padding_right">32dp</dimen>
|
||||
<dimen name="map_padding_top">0dp</dimen>
|
||||
<dimen name="locationview_background_drawable_padding">2dp</dimen>
|
||||
<dimen name="navigation_drawer_width">240dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -21,11 +21,6 @@
|
||||
<string name="activity_scroll_by">Scroll By Method</string>
|
||||
<string name="activity_double_map">Double Map Activity</string>
|
||||
<string name="activity_snapshot">Snapshot Activity</string>
|
||||
<string name="activity_user_tracking_mode">User tracking mode</string>
|
||||
<string name="activity_user_tracking_customization">User location drawable</string>
|
||||
<string name="activity_user_dot_color">User location tint color</string>
|
||||
<string name="activity_user_location_toggle">User location toggle</string>
|
||||
<string name="activity_custom_location_engine">Custom location engine</string>
|
||||
<string name="activity_custom_layer">Custom Layer</string>
|
||||
<string name="activity_map_padding">Map Padding</string>
|
||||
<string name="activity_debug_mode">Debug Mode</string>
|
||||
@@ -67,8 +62,10 @@
|
||||
<string name="activity_textureview_debug">TextureView debug</string>
|
||||
<string name="activity_textureview_resize">TextureView resize</string>
|
||||
<string name="activity_textureview_animate">TextureView animation</string>
|
||||
<string name="activity_textureview_transparent">TextureView transparent background</string>
|
||||
<string name="activity_grid_source">Grid Source</string>
|
||||
<string name="activity_local_glyph">Local CJK glyph generation</string>
|
||||
<string name="activity_hillshade">Hillshade</string>
|
||||
<string name="activity_heatmaplayer">Heatmap layer</string>
|
||||
<string name="activity_gesture_detector">Gestures detector</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user