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

Commit

Permalink
adding directions profile toggle example
Browse files Browse the repository at this point in the history
  • Loading branch information
Langston Smith authored and langsmith committed Feb 27, 2020
1 parent 311d9bc commit e8ff1ee
Show file tree
Hide file tree
Showing 9 changed files with 477 additions and 5 deletions.
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

0 comments on commit e8ff1ee

Please sign in to comment.