Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Adding Directions API profile toggle example #1303

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.mapbox.mapboxandroiddemo.examples.dds.CircleToIconTransitionActivity;
import com.mapbox.mapboxandroiddemo.examples.dds.PropertyIconDeterminationActivity;
import com.mapbox.mapboxandroiddemo.examples.camera.ZoomToShowClusterLeavesActivity;
import com.mapbox.mapboxandroiddemo.examples.javaservices.DirectionsProfileToggleActivity;
import com.mapbox.mapboxandroiddemo.examples.javaservices.KotlinBorderedCircleActivity;
import com.mapbox.mapboxandroiddemo.examples.dds.CreateHotspotsActivity;
import com.mapbox.mapboxandroiddemo.examples.dds.DrawGeojsonLineActivity;
Expand Down Expand Up @@ -1147,6 +1148,14 @@ private void initializeModels() {
null,
R.string.activity_java_services_static_image_notification_url, true, BuildConfig.MIN_SDK_VERSION));

exampleItemModels.add(new ExampleItemModel(
R.id.nav_java_services,
R.string.activity_java_services_directions_profile_toggle_title,
R.string.activity_java_services_directions_profile_toggle_description,
new Intent(MainActivity.this, DirectionsProfileToggleActivity.class),
null,
R.string.activity_java_services_directions_profile_toggle_url, true, BuildConfig.MIN_SDK_VERSION));

exampleItemModels.add(new ExampleItemModel(
R.id.nav_snapshot_image_generator,
R.string.activity_image_generator_snapshot_notification_title,
Expand Down
8 changes: 8 additions & 0 deletions MapboxAndroidDemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,14 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.mapbox.mapboxandroiddemo.MainActivity" />
</activity>
<activity
android:name=".examples.javaservices.DirectionsProfileToggleActivity"
android:label="@string/activity_java_services_directions_profile_toggle_title"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.mapbox.mapboxandroiddemo.MainActivity" />
</activity>
<activity
android:name=".examples.labs.ValueAnimatorIconAnimationActivity"
android:label="@string/activity_lab_animated_interpolator_icon_drop_title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ public void onStyleLoaded(@NonNull Style style) {
* Add the route and marker sources to the map
*/
private void initSource(@NonNull Style loadedMapStyle) {
loadedMapStyle.addSource(new GeoJsonSource(ROUTE_SOURCE_ID,
FeatureCollection.fromFeatures(new Feature[] {})));
loadedMapStyle.addSource(new GeoJsonSource(ROUTE_SOURCE_ID));

GeoJsonSource iconGeoJsonSource = new GeoJsonSource(ICON_SOURCE_ID, FeatureCollection.fromFeatures(new Feature[] {
Feature.fromGeometry(Point.fromLngLat(origin.longitude(), origin.latitude())),
Expand Down Expand Up @@ -184,9 +183,7 @@ public void onStyleLoaded(@NonNull Style style) {
// Create a LineString with the directions route's geometry and
// reset the GeoJSON source for the route LineLayer source
if (source != null) {
Timber.d("onResponse: source != null");
source.setGeoJson(FeatureCollection.fromFeature(
Feature.fromGeometry(LineString.fromPolyline(currentRoute.geometry(), PRECISION_6))));
source.setGeoJson(LineString.fromPolyline(currentRoute.geometry(), PRECISION_6));
}
}
});
Expand Down
Loading