From ef56040d09694e05ae7377e68e7c75fefec9e7de Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 5 Dec 2023 00:29:56 +0100 Subject: [PATCH] remove sources -> we use the lib (jar) --- libandroid-navigation-ui/.gitignore | 1 - libandroid-navigation-ui/build.gradle | 88 - libandroid-navigation-ui/gradle.properties | 4 - libandroid-navigation-ui/javadoc.gradle | 18 - .../proguard-consumer.pro | 13 - .../src/main/AndroidManifest.xml | 9 - .../ui/v5/CancelBtnClickListener.java | 17 - .../ui/v5/ConnectivityStatusProvider.java | 63 - .../ui/v5/DamerauLevenshteinAlgorithm.java | 127 - .../ui/v5/LocationEngineConductor.java | 41 - .../ui/v5/MapConnectivityController.java | 10 - .../ui/v5/MapboxNavigationActivity.java | 140 - .../ui/v5/MobileNetworkChecker.java | 45 - .../ui/v5/MultiOnClickListener.java | 33 - .../navigation/ui/v5/NavigationButton.java | 30 - .../navigation/ui/v5/NavigationContract.java | 43 - .../v5/NavigationInstructionListListener.java | 19 - .../navigation/ui/v5/NavigationLauncher.java | 106 - .../ui/v5/NavigationLauncherOptions.java | 38 - ...gationOnCameraTrackingChangedListener.java | 34 - .../navigation/ui/v5/NavigationPresenter.java | 85 - .../navigation/ui/v5/NavigationUiOptions.java | 20 - .../navigation/ui/v5/NavigationView.java | 715 -- .../ui/v5/NavigationViewEventDispatcher.java | 188 - .../ui/v5/NavigationViewInstanceState.java | 85 - .../navigation/ui/v5/NavigationViewModel.java | 464 -- ...gationViewModelProgressChangeListener.java | 21 - .../ui/v5/NavigationViewOptions.java | 106 - .../v5/NavigationViewRouteEngineListener.java | 31 - .../ui/v5/NavigationViewRouter.java | 139 - .../ui/v5/NavigationViewSubscriber.java | 65 - .../ui/v5/NavigationViewWayNameListener.java | 19 - .../ui/v5/OnNavigationReadyCallback.java | 14 - .../ui/v5/RecenterBtnClickListener.java | 17 - .../navigation/ui/v5/RecenterButton.java | 132 - .../navigation/ui/v5/RouteCallStatus.java | 29 - .../navigation/ui/v5/RouteComparator.java | 73 - .../ui/v5/RouteOverviewBtnClickListener.java | 17 - .../android/navigation/ui/v5/SoundButton.java | 219 - .../ui/v5/SummaryBottomSheetCallback.java | 27 - .../navigation/ui/v5/ThemeSwitcher.java | 142 - .../navigation/ui/v5/ViewRouteListener.java | 13 - .../navigation/ui/v5/WifiNetworkChecker.java | 33 - .../navigation/ui/v5/alert/AlertView.java | 161 - .../v5/alert/AlertViewAnimatorListener.java | 38 - .../ui/v5/camera/CameraAnimationDelegate.java | 30 - .../CameraOverviewCancelableCallback.java | 27 - .../ui/v5/camera/CameraUpdateMode.java | 24 - .../ui/v5/camera/DynamicCamera.java | 239 - .../ui/v5/camera/NavigationCamera.java | 562 -- ...vigationCameraTrackingChangedListener.java | 25 - .../NavigationCameraTransitionListener.java | 23 - .../ui/v5/camera/NavigationCameraUpdate.java | 48 - .../camera/OnTrackingModeChangedListener.java | 15 - .../OnTrackingModeTransitionListener.java | 18 - .../ui/v5/camera/ResetCancelableCallback.java | 22 - .../v5/instruction/AbbreviationCreator.java | 178 - .../v5/instruction/AbbreviationVerifier.java | 15 - .../v5/instruction/BannerComponentNode.java | 25 - .../v5/instruction/BannerComponentTree.java | 73 - .../instruction/BannerInstructionModel.java | 48 - .../ui/v5/instruction/BannerShield.java | 40 - .../ui/v5/instruction/ExitSignCreator.java | 70 - .../ui/v5/instruction/ExitSignVerifier.java | 11 - .../ui/v5/instruction/ImageCreator.java | 215 - .../ui/v5/instruction/ImageVerifier.java | 17 - .../InstructionListTransitionListener.java | 38 - .../ui/v5/instruction/InstructionLoader.java | 51 - .../ui/v5/instruction/InstructionModel.java | 32 - .../ui/v5/instruction/InstructionTarget.java | 98 - .../ui/v5/instruction/InstructionView.java | 782 --- .../v5/instruction/NavigationAlertView.java | 92 - .../ui/v5/instruction/NodeCreator.java | 39 - .../ui/v5/instruction/NodeVerifier.java | 7 - .../ui/v5/instruction/TextCreator.java | 22 - .../ui/v5/instruction/TextVerifier.java | 10 - .../ui/v5/instruction/TextViewUtils.java | 66 - .../ui/v5/instruction/UrlDensityMap.java | 58 - .../v5/instruction/maneuver/ManeuverView.java | 313 - .../instruction/maneuver/ManeuverViewMap.java | 179 - .../maneuver/ManeuverViewUpdate.java | 8 - .../maneuver/ManeuversStyleKit.java | 1685 ----- .../instruction/turnlane/TurnLaneAdapter.java | 47 - .../turnlane/TurnLaneDrawableMap.java | 24 - .../v5/instruction/turnlane/TurnLaneView.java | 91 - .../turnlane/TurnLaneViewData.java | 94 - .../turnlane/TurnLaneViewHolder.java | 16 - .../listeners/BannerInstructionsListener.java | 26 - .../v5/listeners/InstructionListListener.java | 14 - .../ui/v5/listeners/NavigationListener.java | 33 - .../ui/v5/listeners/RouteListener.java | 64 - .../listeners/SpeechAnnouncementListener.java | 29 - .../ui/v5/map/FeatureFilterTask.java | 32 - .../FpsDelegateProgressChangeListener.java | 20 - .../ui/v5/map/LocationFpsDelegate.java | 89 - .../ui/v5/map/MapBatteryMonitor.java | 33 - .../navigation/ui/v5/map/MapFpsDelegate.java | 128 - .../ui/v5/map/MapLayerInteractor.java | 88 - .../ui/v5/map/MapPaddingAdjustor.java | 75 - .../navigation/ui/v5/map/MapWayName.java | 143 - .../ui/v5/map/MapWayNameChangedListener.java | 21 - .../map/MapWaynameProgressChangeListener.java | 20 - .../ui/v5/map/NavigationMapSettings.java | 117 - .../ui/v5/map/NavigationMapboxMap.java | 774 --- .../map/NavigationMapboxMapInstanceState.java | 44 - .../ui/v5/map/NavigationSymbolManager.java | 55 - .../ui/v5/map/OnFeatureFilteredCallback.java | 9 - .../ui/v5/map/OnWayNameChangedListener.java | 23 - .../v5/map/SymbolOnStyleLoadedListener.java | 24 - .../navigation/ui/v5/map/WayNameView.java | 64 - .../ui/v5/map/WaynameFeatureFilter.java | 161 - .../ui/v5/map/WaynameFeatureFinder.java | 21 - .../navigation/ui/v5/package-info.java | 6 - .../ui/v5/route/FeatureProcessingTask.java | 113 - .../navigation/ui/v5/route/MapRouteArrow.java | 351 - .../ui/v5/route/MapRouteClickListener.java | 96 - .../ui/v5/route/MapRouteDrawableProvider.java | 20 - .../ui/v5/route/MapRouteLayerProvider.java | 194 - .../navigation/ui/v5/route/MapRouteLine.java | 493 -- .../route/MapRouteProgressChangeListener.java | 50 - .../ui/v5/route/MapRouteSourceProvider.java | 12 - .../ui/v5/route/MapboxRouteFetcher.java | 203 - .../ui/v5/route/NavigationMapRoute.java | 409 -- .../ui/v5/route/NavigationRoute.java | 572 -- .../route/OnPrimaryRouteUpdatedCallback.java | 9 - .../OnRouteFeaturesProcessedCallback.java | 13 - .../route/OnRouteSelectionChangeListener.java | 20 - .../ui/v5/route/PrimaryRouteUpdateTask.java | 97 - .../ui/v5/route/RouteConstants.java | 49 - .../ui/v5/summary/SummaryBottomSheet.java | 229 - .../ui/v5/summary/SummaryModel.java | 43 - .../summary/list/InstructionListAdapter.java | 56 - .../list/InstructionListPresenter.java | 159 - .../v5/summary/list/InstructionListView.java | 24 - .../summary/list/InstructionViewHolder.java | 83 - .../navigation/ui/v5/utils/MapImageUtils.java | 22 - .../navigation/ui/v5/utils/MapUtils.java | 62 - .../navigation/ui/v5/utils/ViewUtils.java | 47 - .../ui/v5/voice/AndroidSpeechPlayer.java | 147 - .../ui/v5/voice/Api14UtteranceListener.java | 16 - .../ui/v5/voice/Api26AudioFocusDelegate.java | 30 - .../ui/v5/voice/AudioFocusDelegate.java | 8 - .../v5/voice/AudioFocusDelegateProvider.java | 24 - .../ui/v5/voice/NavigationSpeechListener.java | 31 - .../ui/v5/voice/NavigationSpeechPlayer.java | 88 - .../ui/v5/voice/SpeechAnnouncement.java | 116 - .../ui/v5/voice/SpeechAnnouncementMap.java | 27 - .../ui/v5/voice/SpeechAnnouncementUpdate.java | 8 - .../ui/v5/voice/SpeechAudioFocusDelegate.java | 23 - .../ui/v5/voice/SpeechAudioFocusManager.java | 18 - .../ui/v5/voice/SpeechListener.java | 10 - .../navigation/ui/v5/voice/SpeechPlayer.java | 51 - .../ui/v5/voice/SpeechPlayerProvider.java | 100 - .../ui/v5/voice/UtteranceListener.java | 29 - .../src/main/res/anim/slide_down_top.xml | 9 - .../src/main/res/anim/slide_in_right.xml | 9 - .../src/main/res/anim/slide_out_right.xml | 9 - .../src/main/res/anim/slide_up_top.xml | 9 - .../res/drawable-hdpi/ic_bad_route_filled.png | Bin 4325 -> 0 bytes .../drawable-hdpi/ic_bad_route_unfilled.png | Bin 4318 -> 0 bytes .../ic_confusing_directions_filled.png | Bin 4548 -> 0 bytes .../ic_confusing_directions_unfilled.png | Bin 4456 -> 0 bytes .../drawable-hdpi/ic_not_allowed_filled.png | Bin 3610 -> 0 bytes .../drawable-hdpi/ic_not_allowed_unfilled.png | Bin 3466 -> 0 bytes .../drawable-hdpi/ic_road_closed_filled.png | Bin 2728 -> 0 bytes .../drawable-hdpi/ic_road_closed_unfilled.png | Bin 2437 -> 0 bytes .../res/drawable-hdpi/map_marker_dark.png | Bin 3723 -> 0 bytes .../res/drawable-hdpi/map_marker_light.png | Bin 4806 -> 0 bytes .../drawable-land/turn_lane_background.xml | 9 - .../res/drawable-mdpi/ic_bad_route_filled.png | Bin 2544 -> 0 bytes .../drawable-mdpi/ic_bad_route_unfilled.png | Bin 2542 -> 0 bytes .../ic_confusing_directions_filled.png | Bin 2695 -> 0 bytes .../ic_confusing_directions_unfilled.png | Bin 2731 -> 0 bytes .../drawable-mdpi/ic_not_allowed_filled.png | Bin 2251 -> 0 bytes .../drawable-mdpi/ic_not_allowed_unfilled.png | Bin 2239 -> 0 bytes .../drawable-mdpi/ic_road_closed_filled.png | Bin 1559 -> 0 bytes .../drawable-mdpi/ic_road_closed_unfilled.png | Bin 1442 -> 0 bytes .../res/drawable-mdpi/map_marker_dark.png | Bin 2176 -> 0 bytes .../res/drawable-mdpi/map_marker_light.png | Bin 2711 -> 0 bytes .../drawable-v21/alert_progress_drawable.xml | 16 - .../feedback_bottomsheet_background.xml | 12 - .../feedback_progress_drawable.xml | 16 - .../drawable-v21/instruction_background.xml | 9 - .../drawable-v21/sound_chip_background.xml | 10 - .../drawable-v21/sub_banner_background.xml | 11 - .../drawable-v21/wayname_text_background.xml | 21 - .../drawable-xhdpi/ic_bad_route_filled.png | Bin 5834 -> 0 bytes .../drawable-xhdpi/ic_bad_route_unfilled.png | Bin 5865 -> 0 bytes .../ic_confusing_directions_filled.png | Bin 6296 -> 0 bytes .../ic_confusing_directions_unfilled.png | Bin 6262 -> 0 bytes .../drawable-xhdpi/ic_not_allowed_filled.png | Bin 5001 -> 0 bytes .../ic_not_allowed_unfilled.png | Bin 4968 -> 0 bytes .../drawable-xhdpi/ic_road_closed_filled.png | Bin 3811 -> 0 bytes .../ic_road_closed_unfilled.png | Bin 3563 -> 0 bytes .../res/drawable-xhdpi/map_marker_dark.png | Bin 5257 -> 0 bytes .../res/drawable-xhdpi/map_marker_light.png | Bin 7047 -> 0 bytes .../drawable-xxhdpi/ic_bad_route_filled.png | Bin 9303 -> 0 bytes .../drawable-xxhdpi/ic_bad_route_unfilled.png | Bin 9127 -> 0 bytes .../ic_confusing_directions_filled.png | Bin 9942 -> 0 bytes .../ic_confusing_directions_unfilled.png | Bin 9723 -> 0 bytes .../drawable-xxhdpi/ic_not_allowed_filled.png | Bin 8163 -> 0 bytes .../ic_not_allowed_unfilled.png | Bin 7839 -> 0 bytes .../drawable-xxhdpi/ic_road_closed_filled.png | Bin 6242 -> 0 bytes .../ic_road_closed_unfilled.png | Bin 5682 -> 0 bytes .../res/drawable-xxhdpi/map_marker_dark.png | Bin 8944 -> 0 bytes .../res/drawable-xxhdpi/map_marker_light.png | Bin 12612 -> 0 bytes .../drawable-xxxhdpi/ic_bad_route_filled.png | Bin 12926 -> 0 bytes .../ic_bad_route_unfilled.png | Bin 12291 -> 0 bytes .../ic_confusing_directions_filled.png | Bin 13553 -> 0 bytes .../ic_confusing_directions_unfilled.png | Bin 13063 -> 0 bytes .../ic_not_allowed_filled.png | Bin 11345 -> 0 bytes .../ic_not_allowed_unfilled.png | Bin 10749 -> 0 bytes .../ic_road_closed_filled.png | Bin 8806 -> 0 bytes .../ic_road_closed_unfilled.png | Bin 7770 -> 0 bytes .../res/drawable-xxxhdpi/map_marker_dark.png | Bin 13389 -> 0 bytes .../res/drawable-xxxhdpi/map_marker_light.png | Bin 19096 -> 0 bytes .../res/drawable/alert_progress_drawable.xml | 12 - .../feedback_bottomsheet_background.xml | 10 - .../drawable/feedback_progress_drawable.xml | 14 - .../res/drawable/gradient_shadow_down.xml | 6 - .../main/res/drawable/gradient_shadow_up.xml | 6 - .../src/main/res/drawable/ic_arrow_head.xml | 9 - .../res/drawable/ic_arrow_head_casing.xml | 9 - .../src/main/res/drawable/ic_arrow_up.xml | 9 - .../src/main/res/drawable/ic_bad_route.xml | 5 - .../src/main/res/drawable/ic_circle.xml | 9 - .../src/main/res/drawable/ic_clear.xml | 9 - .../res/drawable/ic_confusing_directions.xml | 5 - .../main/res/drawable/ic_exit_arrow_left.xml | 11 - .../main/res/drawable/ic_exit_arrow_right.xml | 11 - .../src/main/res/drawable/ic_lane_right.xml | 22 - .../main/res/drawable/ic_lane_right_only.xml | 31 - .../res/drawable/ic_lane_slight_right.xml | 30 - .../main/res/drawable/ic_lane_straight.xml | 19 - .../res/drawable/ic_lane_straight_only.xml | 31 - .../src/main/res/drawable/ic_lane_uturn.xml | 22 - .../src/main/res/drawable/ic_message.xml | 9 - .../src/main/res/drawable/ic_navigation.xml | 9 - .../src/main/res/drawable/ic_not_allowed.xml | 5 - .../src/main/res/drawable/ic_road_closed.xml | 5 - .../res/drawable/ic_route_destination.xml | 18 - .../src/main/res/drawable/ic_route_origin.xml | 18 - .../main/res/drawable/ic_route_preview.xml | 13 - .../res/drawable/ic_route_preview_dark.xml | 13 - .../src/main/res/drawable/ic_sound_off.xml | 9 - .../src/main/res/drawable/ic_sound_on.xml | 9 - .../res/drawable/instruction_background.xml | 7 - .../src/main/res/drawable/rounded_corners.xml | 16 - .../res/drawable/sound_chip_background.xml | 8 - .../res/drawable/sub_banner_background.xml | 9 - .../res/drawable/wayname_text_background.xml | 20 - .../instruction_content_layout.xml | 94 - .../res/layout-land/instruction_layout.xml | 187 - .../layout-land/instruction_layout_alt.xml | 146 - .../layout-land/instruction_view_layout.xml | 15 - .../instruction_viewholder_layout.xml | 41 - .../layout-land/navigation_view_layout.xml | 53 - .../layout-land/sub_instruction_layout.xml | 49 - .../layout-land/summary_content_layout.xml | 27 - .../summary_peek_content_layout.xml | 63 - .../res/layout-land/summary_peek_layout.xml | 69 - .../main/res/layout-land/turn_lane_layout.xml | 22 - .../main/res/layout/activity_navigation.xml | 19 - .../src/main/res/layout/alert_view_layout.xml | 39 - .../main/res/layout/exit_sign_view_left.xml | 18 - .../main/res/layout/exit_sign_view_right.xml | 18 - .../res/layout/instruction_content_layout.xml | 98 - .../main/res/layout/instruction_layout.xml | 49 - .../res/layout/instruction_list_layout.xml | 18 - .../res/layout/instruction_view_layout.xml | 70 - .../layout/instruction_viewholder_layout.xml | 37 - .../res/layout/navigation_view_layout.xml | 53 - .../main/res/layout/recenter_btn_layout.xml | 32 - .../src/main/res/layout/sound_layout.xml | 47 - .../res/layout/sub_instruction_layout.xml | 48 - .../res/layout/summary_bottomsheet_layout.xml | 14 - .../res/layout/summary_content_layout.xml | 27 - .../layout/summary_peek_content_layout.xml | 58 - .../main/res/layout/summary_peek_layout.xml | 82 - .../src/main/res/layout/turn_lane_layout.xml | 18 - .../res/layout/turn_lane_listitem_layout.xml | 14 - .../main/res/layout/wayname_view_layout.xml | 24 - .../src/main/res/values-ar/strings.xml | 24 - .../src/main/res/values-bg/strings.xml | 27 - .../src/main/res/values-bn/strings.xml | 24 - .../src/main/res/values-ca/strings.xml | 12 - .../src/main/res/values-cs/strings.xml | 27 - .../src/main/res/values-da/strings.xml | 27 - .../src/main/res/values-de/strings.xml | 27 - .../src/main/res/values-es/strings.xml | 24 - .../src/main/res/values-fa/strings.xml | 27 - .../src/main/res/values-fr/strings.xml | 24 - .../src/main/res/values-gl/strings.xml | 27 - .../src/main/res/values-hdpi/dimens.xml | 4 - .../src/main/res/values-he/strings.xml | 27 - .../src/main/res/values-hu/strings.xml | 27 - .../src/main/res/values-id/strings.xml | 12 - .../src/main/res/values-it/strings.xml | 15 - .../src/main/res/values-ja/strings.xml | 27 - .../src/main/res/values-ko/strings.xml | 24 - .../src/main/res/values-land/dimens.xml | 9 - .../src/main/res/values-mdpi/dimens.xml | 4 - .../src/main/res/values-my/strings.xml | 24 - .../src/main/res/values-port/dimens.xml | 9 - .../src/main/res/values-pt-rBR/strings.xml | 18 - .../src/main/res/values-pt-rPT/strings.xml | 27 - .../src/main/res/values-ru/strings.xml | 27 - .../src/main/res/values-sv/strings.xml | 24 - .../src/main/res/values-uk/strings.xml | 27 - .../src/main/res/values-vi/strings.xml | 27 - .../src/main/res/values-xhdpi/dimens.xml | 4 - .../src/main/res/values-xxhdpi/dimens.xml | 4 - .../src/main/res/values-xxxhdpi/dimens.xml | 4 - .../src/main/res/values-yo/strings.xml | 27 - .../src/main/res/values/attrs.xml | 78 - .../src/main/res/values/colors.xml | 65 - .../src/main/res/values/dimens.xml | 7 - .../src/main/res/values/strings.xml | 35 - .../src/main/res/values/styles.xml | 84 - .../android/navigation/ui/v5/BaseTest.java | 39 - .../ui/v5/ConnectivityStatusProviderTest.java | 119 - .../ui/v5/LocationEngineConductorTest.java | 61 - ...onOnCameraTrackingChangedListenerTest.java | 41 - .../ui/v5/NavigationPresenterTest.java | 159 - .../v5/NavigationViewEventDispatcherTest.java | 407 -- ...onViewModelProgressChangeListenerTest.java | 40 - .../ui/v5/NavigationViewModelTest.java | 136 - ...NavigationViewRouteEngineListenerTest.java | 69 - .../ui/v5/NavigationViewRouterTest.java | 213 - .../ui/v5/NavigationViewSubscriberTest.java | 78 - .../v5/NavigationViewWayNameListenerTest.java | 23 - .../navigation/ui/v5/RouteCallStatusTest.java | 49 - .../navigation/ui/v5/TestRouteBuilder.java | 70 - .../ui/v5/TestRouteProgressBuilder.java | 74 - .../alert/AlertViewAnimatorListenerTest.java | 21 - .../ui/v5/camera/DynamicCameraTest.java | 251 - .../ui/v5/camera/NavigationCameraTest.java | 212 - ...tionCameraTrackingChangedListenerTest.java | 34 - ...avigationCameraTransitionListenerTest.java | 45 - .../camera/ResetCancelableCallbackTest.java | 30 - .../instruction/AbbreviationCreatorTest.java | 68 - .../instruction/BannerComponentTreeTest.java | 81 - .../v5/instruction/BannerComponentsFaker.java | 22 - .../v5/instruction/InstructionLoaderTest.java | 22 - .../ui/v5/instruction/UrlDensityMapTest.java | 199 - .../turnlane/TurnLaneViewDataTest.java | 44 - .../ui/v5/map/LocationFpsDelegateTest.java | 117 - .../ui/v5/map/MapFpsDelegateTest.java | 132 - .../ui/v5/map/MapLayerInteractorTest.java | 124 - .../ui/v5/map/MapPaddingAdjustorTest.java | 97 - .../v5/map/MapWayNameChangedListenerTest.java | 26 - .../navigation/ui/v5/map/MapWayNameTest.java | 111 - .../ui/v5/map/NavigationMapboxMapTest.java | 336 - .../v5/map/NavigationSymbolManagerTest.java | 56 - .../map/SymbolOnStyleLoadedListenerTest.java | 30 - .../ui/v5/map/WaynameFeatureFilterTest.java | 53 - .../ui/v5/map/WaynameFeatureFinderTest.java | 25 - .../v5/route/MapRouteClickListenerTest.java | 91 - .../ui/v5/route/MapRouteLineTest.java | 393 -- .../MapRouteProgressChangeListenerTest.java | 59 - .../ui/v5/route/NavigationMapRouteTest.java | 366 - .../ui/v5/route/NavigationRouteTest.java | 155 - .../v5/route/PrimaryRouteUpdateTaskTest.java | 43 - .../list/InstructionListPresenterTest.java | 223 - .../voice/NavigationSpeechListenerTest.java | 60 - .../v5/voice/NavigationSpeechPlayerTest.java | 57 - .../ui/v5/voice/SpeechAnnouncementTest.java | 40 - .../ui/v5/voice/SpeechPlayerProviderTest.java | 49 - .../resources/directions_v5_precision_6.json | 1 - .../src/test/resources/feature_one.json | 1 - .../src/test/resources/feature_two.json | 1 - .../org.mockito.plugins.MockMaker | 1 - libandroid-navigation/.gitignore | 1 - libandroid-navigation/build.gradle | 80 - libandroid-navigation/gradle.properties | 4 - libandroid-navigation/javadoc.gradle | 19 - libandroid-navigation/proguard-consumer.pro | 17 - .../src/main/AndroidManifest.xml | 14 - .../services/android/core/FileUtils.java | 149 - .../connectivity/ConnectivityListener.java | 10 - .../connectivity/ConnectivityReceiver.java | 150 - .../core/crashreporter/CrashReport.java | 87 - .../crashreporter/CrashReportBuilder.java | 129 - .../MapboxUncaughtExceptionHanlder.java | 184 - .../v5/exception/NavigationException.java | 21 - .../navigation/v5/exception/package-info.java | 5 - .../v5/instruction/Instruction.java | 19 - .../v5/instruction/package-info.java | 4 - .../v5/location/LocationValidator.java | 36 - .../v5/location/MetricsLocation.java | 23 - .../engine/GoogleLocationEngineImpl.java | 152 - .../engine/LocationEngineProvider.java | 66 - .../navigation/v5/location/engine/Utils.java | 107 - .../v5/location/replay/GpxParser.java | 100 - .../v5/location/replay/ParseGpxTask.java | 69 - .../location/replay/ReplayJsonRouteDto.java | 28 - .../replay/ReplayJsonRouteLocationMapper.java | 55 - .../replay/ReplayLocationDispatcher.java | 117 - .../v5/location/replay/ReplayLocationDto.java | 90 - .../replay/ReplayLocationListener.java | 9 - .../replay/ReplayRouteLocationConverter.java | 152 - .../replay/ReplayRouteLocationEngine.java | 217 - .../v5/location/replay/TimestampAdapter.java | 45 - .../milestone/BannerInstructionMilestone.java | 89 - .../navigation/v5/milestone/Milestone.java | 132 - .../v5/milestone/MilestoneEventListener.java | 9 - .../navigation/v5/milestone/Operation.java | 80 - .../v5/milestone/RouteMilestone.java | 62 - .../v5/milestone/StepMilestone.java | 73 - .../navigation/v5/milestone/Trigger.java | 344 - .../v5/milestone/TriggerProperty.java | 108 - .../milestone/VoiceInstructionMilestone.java | 141 - .../navigation/v5/milestone/package-info.java | 5 - .../android/navigation/v5/models/Admin.java | 102 - .../v5/models/BannerComponents.java | 452 -- .../v5/models/BannerInstructions.java | 189 - .../navigation/v5/models/BannerText.java | 210 - .../navigation/v5/models/BannerView.java | 167 - .../android/navigation/v5/models/Closure.java | 99 - .../navigation/v5/models/Congestion.java | 78 - .../v5/models/DirectionsAdapterFactory.java | 24 - .../v5/models/DirectionsCriteria.java | 364 - .../navigation/v5/models/DirectionsError.java | 124 - .../v5/models/DirectionsJsonObject.java | 30 - .../v5/models/DirectionsResponse.java | 216 - .../navigation/v5/models/DirectionsRoute.java | 280 - .../v5/models/DirectionsWaypoint.java | 135 - .../navigation/v5/models/Incident.java | 416 -- .../v5/models/IntersectionLanes.java | 177 - .../navigation/v5/models/LegAnnotation.java | 186 - .../android/navigation/v5/models/LegStep.java | 507 -- .../v5/models/ManeuverModifier.java | 89 - .../navigation/v5/models/MapboxStreetsV8.java | 94 - .../navigation/v5/models/MaxSpeed.java | 154 - .../navigation/v5/models/RestStop.java | 88 - .../navigation/v5/models/RouteLeg.java | 252 - .../navigation/v5/models/RouteOptions.java | 1106 --- .../navigation/v5/models/SpeedLimit.java | 32 - .../v5/models/StepIntersection.java | 422 -- .../navigation/v5/models/StepManeuver.java | 420 -- .../navigation/v5/models/TollCollection.java | 90 - .../v5/models/VoiceInstructions.java | 148 - .../navigation/v5/models/WalkingOptions.java | 168 - .../models/WalkingOptionsAdapterFactory.java | 25 - .../navigation/v5/models/package-info.java | 4 - .../v5/models/utils/FormatUtils.java | 257 - .../v5/models/utils/ParseUtils.java | 205 - .../v5/navigation/MapboxNavigation.java | 734 -- .../MapboxNavigationNotification.java | 250 - .../navigation/MapboxNavigationOptions.java | 164 - .../v5/navigation/NavigationConstants.java | 328 - .../navigation/NavigationEngineFactory.java | 73 - .../navigation/NavigationEventDispatcher.java | 162 - .../navigation/NavigationEventListener.java | 5 - .../NavigationFasterRouteListener.java | 35 - .../v5/navigation/NavigationHelper.java | 557 -- .../v5/navigation/NavigationIndices.java | 15 - .../NavigationLifecycleMonitor.java | 120 - .../NavigationLocationEngineListener.java | 51 - .../NavigationLocationEngineUpdater.java | 77 - .../navigation/NavigationLocationUpdate.java | 17 - .../v5/navigation/NavigationMapRoute.java | 1148 ---- .../NavigationNotificationProvider.java | 41 - .../navigation/NavigationRouteProcessor.java | 283 - .../v5/navigation/NavigationService.java | 138 - .../v5/navigation/NavigationTimeFormat.java | 18 - .../RouteProcessorBackgroundThread.java | 55 - .../RouteProcessorHandlerCallback.java | 93 - .../RouteProcessorThreadListener.java | 55 - .../v5/navigation/SdkVersionChecker.java | 18 - .../v5/navigation/camera/Camera.java | 42 - .../navigation/camera/RouteInformation.java | 52 - .../v5/navigation/camera/SimpleCamera.java | 102 - .../notification/NavigationNotification.java | 55 - .../v5/navigation/package-info.java | 5 - .../navigation/v5/offroute/OffRoute.java | 12 - .../v5/offroute/OffRouteCallback.java | 23 - .../v5/offroute/OffRouteDetector.java | 258 - .../v5/offroute/OffRouteListener.java | 7 - .../navigation/v5/offroute/package-info.java | 6 - .../navigation/v5/route/FasterRoute.java | 51 - .../v5/route/FasterRouteDetector.java | 137 - .../v5/route/FasterRouteListener.java | 18 - .../route/MapRouteProgressChangeListener.java | 41 - .../route/OnRouteSelectionChangeListener.java | 20 - .../navigation/v5/route/RouteFetcher.java | 46 - .../navigation/v5/route/RouteListener.java | 16 - .../routeprogress/CurrentLegAnnotation.java | 175 - .../routeprogress/MetricsRouteProgress.java | 193 - .../routeprogress/ProgressChangeListener.java | 7 - .../v5/routeprogress/RouteLegProgress.java | 281 - .../v5/routeprogress/RouteProgress.java | 256 - .../v5/routeprogress/RouteStepProgress.java | 181 - .../v5/routeprogress/package-info.java | 5 - .../android/navigation/v5/snap/Snap.java | 27 - .../navigation/v5/snap/SnapToRoute.java | 184 - .../navigation/v5/snap/package-info.java | 4 - .../navigation/v5/utils/Constants.java | 41 - .../v5/utils/DistanceFormatter.java | 172 - .../navigation/v5/utils/LocaleUtils.java | 95 - .../navigation/v5/utils/ManeuverMap.java | 188 - .../navigation/v5/utils/ManeuverUtils.java | 23 - .../navigation/v5/utils/MapImageUtils.java | 22 - .../android/navigation/v5/utils/MapUtils.java | 75 - .../navigation/v5/utils/MathUtils.java | 80 - .../navigation/v5/utils/MeasurementUtils.java | 63 - .../navigation/v5/utils/RingBuffer.java | 53 - .../navigation/v5/utils/RouteUtils.java | 338 - .../navigation/v5/utils/TextUtils.java | 212 - .../navigation/v5/utils/ToleranceUtils.java | 52 - .../navigation/v5/utils/ValidationUtils.java | 49 - .../utils/abbreviation/AbbreviationArray.java | 86 - .../utils/abbreviation/StringAbbreviator.java | 34 - .../navigation/v5/utils/package-info.java | 4 - .../navigation/v5/utils/span/SpanItem.java | 6 - .../navigation/v5/utils/span/SpanUtils.java | 28 - .../v5/utils/span/TextSpanItem.java | 21 - .../utils/time/NoneSpecifiedTimeFormat.java | 29 - .../v5/utils/time/TimeFormatResolver.java | 10 - .../v5/utils/time/TimeFormatter.java | 92 - .../v5/utils/time/TimeFormattingChain.java | 15 - .../v5/utils/time/TwelveHoursTimeFormat.java | 25 - .../utils/time/TwentyFourHoursTimeFormat.java | 25 - .../drawable-hdpi/ic_confusing_directions.png | Bin 11151 -> 0 bytes .../main/res/drawable-hdpi/ic_map_error.png | Bin 11411 -> 0 bytes .../res/drawable-hdpi/ic_no_turn_allowed.png | Bin 12605 -> 0 bytes .../main/res/drawable-hdpi/ic_road_closed.png | Bin 9318 -> 0 bytes .../src/main/res/drawable-hdpi/ic_traffic.png | Bin 11650 -> 0 bytes .../res/drawable-hdpi/ic_wrong_directions.png | Bin 12788 -> 0 bytes .../res/drawable-hdpi/map_marker_dark.png | Bin 3723 -> 0 bytes .../res/drawable-hdpi/map_marker_light.png | Bin 4806 -> 0 bytes .../drawable-land/turn_lane_background.xml | 9 - .../drawable-mdpi/ic_confusing_directions.png | Bin 8097 -> 0 bytes .../main/res/drawable-mdpi/ic_map_error.png | Bin 8271 -> 0 bytes .../res/drawable-mdpi/ic_no_turn_allowed.png | Bin 9072 -> 0 bytes .../main/res/drawable-mdpi/ic_road_closed.png | Bin 7198 -> 0 bytes .../src/main/res/drawable-mdpi/ic_traffic.png | Bin 8479 -> 0 bytes .../res/drawable-mdpi/ic_wrong_directions.png | Bin 9070 -> 0 bytes .../res/drawable-mdpi/map_marker_dark.png | Bin 2176 -> 0 bytes .../res/drawable-mdpi/map_marker_light.png | Bin 2711 -> 0 bytes .../drawable-v21/alert_progress_drawable.xml | 16 - .../feedback_bottomsheet_background.xml | 12 - .../feedback_progress_drawable.xml | 16 - .../drawable-v21/instruction_background.xml | 9 - .../drawable-v21/sound_chip_background.xml | 10 - .../drawable-v21/sub_banner_background.xml | 11 - .../drawable-v21/wayname_text_background.xml | 21 - .../ic_confusing_directions.png | Bin 3361 -> 0 bytes .../main/res/drawable-xhdpi/ic_map_error.png | Bin 3942 -> 0 bytes .../res/drawable-xhdpi/ic_no_turn_allowed.png | Bin 4126 -> 0 bytes .../res/drawable-xhdpi/ic_road_closed.png | Bin 2727 -> 0 bytes .../main/res/drawable-xhdpi/ic_traffic.png | Bin 3784 -> 0 bytes .../drawable-xhdpi/ic_wrong_directions.png | Bin 4015 -> 0 bytes .../res/drawable-xhdpi/map_marker_dark.png | Bin 5257 -> 0 bytes .../res/drawable-xhdpi/map_marker_light.png | Bin 7047 -> 0 bytes .../ic_confusing_directions.png | Bin 26822 -> 0 bytes .../main/res/drawable-xxhdpi/ic_map_error.png | Bin 27275 -> 0 bytes .../drawable-xxhdpi/ic_no_turn_allowed.png | Bin 28979 -> 0 bytes .../res/drawable-xxhdpi/ic_road_closed.png | Bin 20927 -> 0 bytes .../main/res/drawable-xxhdpi/ic_traffic.png | Bin 26652 -> 0 bytes .../drawable-xxhdpi/ic_wrong_directions.png | Bin 31786 -> 0 bytes .../res/drawable-xxhdpi/map_marker_dark.png | Bin 8944 -> 0 bytes .../ic_confusing_directions.png | Bin 40071 -> 0 bytes .../res/drawable-xxxhdpi/ic_map_error.png | Bin 41084 -> 0 bytes .../drawable-xxxhdpi/ic_no_turn_allowed.png | Bin 43890 -> 0 bytes .../res/drawable-xxxhdpi/ic_road_closed.png | Bin 31793 -> 0 bytes .../main/res/drawable-xxxhdpi/ic_traffic.png | Bin 40219 -> 0 bytes .../drawable-xxxhdpi/ic_wrong_directions.png | Bin 49494 -> 0 bytes .../res/drawable-xxxhdpi/map_marker_dark.png | Bin 13389 -> 0 bytes .../res/drawable-xxxhdpi/map_marker_light.png | Bin 19096 -> 0 bytes .../res/drawable/alert_progress_drawable.xml | 12 - .../main/res/drawable/direction_arrive.xml | 1 - .../res/drawable/direction_arrive_left.xml | 1 - .../res/drawable/direction_arrive_right.xml | 1 - .../drawable/direction_continue_straight.xml | 9 - .../main/res/drawable/direction_depart.xml | 9 - .../res/drawable/direction_depart_left.xml | 1 - .../res/drawable/direction_depart_right.xml | 1 - .../drawable/direction_end_of_road_left.xml | 1 - .../drawable/direction_end_of_road_right.xml | 1 - .../src/main/res/drawable/direction_fork.xml | 1 - .../main/res/drawable/direction_fork_left.xml | 1 - .../res/drawable/direction_fork_right.xml | 1 - .../drawable/direction_fork_slight_left.xml | 1 - .../drawable/direction_fork_slight_right.xml | 1 - .../res/drawable/direction_fork_straight.xml | 1 - .../res/drawable/direction_merge_left.xml | 1 - .../res/drawable/direction_merge_right.xml | 1 - .../drawable/direction_merge_slight_left.xml | 1 - .../drawable/direction_merge_slight_right.xml | 1 - .../res/drawable/direction_merge_straight.xml | 1 - .../drawable/direction_notification_left.xml | 1 - .../drawable/direction_notification_right.xml | 1 - .../direction_notification_sharp_left.xml | 1 - .../direction_notification_sharp_right.xml | 1 - .../direction_notification_slight_left.xml | 1 - .../direction_notification_slight_right.xml | 1 - .../direction_notification_straight.xml | 1 - .../res/drawable/direction_off_ramp_left.xml | 1 - .../res/drawable/direction_off_ramp_right.xml | 1 - .../direction_off_ramp_slight_left.xml | 1 - .../direction_off_ramp_slight_right.xml | 1 - .../res/drawable/direction_on_ramp_left.xml | 1 - .../res/drawable/direction_on_ramp_right.xml | 1 - .../drawable/direction_on_ramp_sharp_left.xml | 1 - .../direction_on_ramp_sharp_right.xml | 1 - .../direction_on_ramp_slight_left.xml | 1 - .../direction_on_ramp_slight_right.xml | 1 - .../res/drawable/direction_roundabout.xml | 1 - .../drawable/direction_roundabout_left.xml | 1 - .../drawable/direction_roundabout_right.xml | 1 - .../direction_roundabout_sharp_left.xml | 1 - .../direction_roundabout_sharp_right.xml | 1 - .../direction_roundabout_slight_left.xml | 1 - .../direction_roundabout_slight_right.xml | 1 - .../direction_roundabout_straight.xml | 1 - .../main/res/drawable/direction_turn_left.xml | 1 - .../res/drawable/direction_turn_right.xml | 1 - .../drawable/direction_turn_sharp_left.xml | 1 - .../drawable/direction_turn_sharp_right.xml | 1 - .../drawable/direction_turn_slight_left.xml | 1 - .../drawable/direction_turn_slight_right.xml | 1 - .../src/main/res/drawable/direction_uturn.xml | 1 - .../feedback_bottomsheet_background.xml | 10 - .../drawable/feedback_progress_drawable.xml | 14 - .../res/drawable/gradient_shadow_down.xml | 6 - .../main/res/drawable/gradient_shadow_up.xml | 6 - .../src/main/res/drawable/ic_arrow_head.xml | 9 - .../res/drawable/ic_arrow_head_casting.xml | 9 - .../src/main/res/drawable/ic_arrow_up.xml | 9 - .../src/main/res/drawable/ic_circle.xml | 9 - .../src/main/res/drawable/ic_clear.xml | 9 - .../src/main/res/drawable/ic_close.xml | 9 - .../src/main/res/drawable/ic_list.xml | 9 - .../main/res/drawable/ic_maneuver_arrive.xml | 33 - .../res/drawable/ic_maneuver_arrive_left.xml | 31 - .../res/drawable/ic_maneuver_arrive_right.xml | 31 - .../main/res/drawable/ic_maneuver_depart.xml | 31 - .../res/drawable/ic_maneuver_depart_left.xml | 31 - .../res/drawable/ic_maneuver_depart_right.xml | 31 - .../drawable/ic_maneuver_end_of_road_left.xml | 9 - .../ic_maneuver_end_of_road_right.xml | 1 - .../main/res/drawable/ic_maneuver_fork.xml | 1 - .../res/drawable/ic_maneuver_fork_left.xml | 10 - .../res/drawable/ic_maneuver_fork_right.xml | 1 - .../drawable/ic_maneuver_fork_slight_left.xml | 1 - .../ic_maneuver_fork_slight_right.xml | 1 - .../drawable/ic_maneuver_fork_straight.xml | 1 - .../res/drawable/ic_maneuver_merge_left.xml | 34 - .../res/drawable/ic_maneuver_merge_right.xml | 34 - .../drawable/ic_maneuver_off_ramp_left.xml | 10 - .../drawable/ic_maneuver_off_ramp_right.xml | 10 - .../ic_maneuver_off_ramp_slight_left.xml | 10 - .../ic_maneuver_off_ramp_slight_right.xml | 10 - .../res/drawable/ic_maneuver_roundabout.xml | 1 - .../drawable/ic_maneuver_roundabout_left.xml | 1 - .../drawable/ic_maneuver_roundabout_right.xml | 1 - .../ic_maneuver_roundabout_sharp_left.xml | 1 - .../ic_maneuver_roundabout_sharp_right.xml | 1 - .../ic_maneuver_roundabout_slight_left.xml | 1 - .../ic_maneuver_roundabout_slight_right.xml | 1 - .../ic_maneuver_roundabout_straight.xml | 9 - .../main/res/drawable/ic_maneuver_turn_0.xml | 19 - .../res/drawable/ic_maneuver_turn_180.xml | 23 - .../main/res/drawable/ic_maneuver_turn_30.xml | 18 - .../res/drawable/ic_maneuver_turn_30_left.xml | 19 - .../main/res/drawable/ic_maneuver_turn_45.xml | 19 - .../res/drawable/ic_maneuver_turn_45_left.xml | 19 - .../main/res/drawable/ic_maneuver_turn_75.xml | 23 - .../res/drawable/ic_maneuver_turn_75_left.xml | 24 - .../src/main/res/drawable/ic_message.xml | 9 - .../src/main/res/drawable/ic_navigation.xml | 11 - .../res/drawable/ic_route_destination.xml | 18 - .../src/main/res/drawable/ic_route_origin.xml | 18 - .../main/res/drawable/ic_route_preview.xml | 13 - .../res/drawable/ic_route_preview_dark.xml | 13 - .../src/main/res/drawable/ic_sound_off.xml | 9 - .../src/main/res/drawable/ic_sound_on.xml | 9 - .../res/drawable/instruction_background.xml | 7 - .../src/main/res/drawable/lane_right.xml | 15 - .../src/main/res/drawable/lane_right_only.xml | 23 - .../src/main/res/drawable/lane_straight.xml | 14 - .../res/drawable/lane_straight_only_right.xml | 23 - .../src/main/res/drawable/lane_uturn.xml | 16 - .../main/res/drawable/map_marker_light.png | Bin 12612 -> 0 bytes .../res/drawable/sound_chip_background.xml | 8 - .../res/drawable/sub_banner_background.xml | 9 - .../res/drawable/wayname_text_background.xml | 20 - ...llapsed_navigation_notification_layout.xml | 74 - ...xpanded_navigation_notification_layout.xml | 39 - .../src/main/res/values-bg/strings.xml | 4 - .../src/main/res/values-bn/strings.xml | 6 - .../src/main/res/values-ca/strings.xml | 4 - .../src/main/res/values-cs/strings.xml | 23 - .../src/main/res/values-da/strings.xml | 6 - .../src/main/res/values-de/strings.xml | 21 - .../src/main/res/values-es/strings.xml | 19 - .../src/main/res/values-fr/strings.xml | 14 - .../src/main/res/values-he/strings.xml | 6 - .../src/main/res/values-hu/strings.xml | 6 - .../src/main/res/values-id/strings.xml | 4 - .../src/main/res/values-it/strings.xml | 4 - .../src/main/res/values-ko/strings.xml | 10 - .../src/main/res/values-my/strings.xml | 10 - .../src/main/res/values-pt-rBR/strings.xml | 4 - .../src/main/res/values-pt-rPT/strings.xml | 19 - .../src/main/res/values-ru/strings.xml | 23 - .../src/main/res/values-sv/strings.xml | 12 - .../src/main/res/values-uk/strings.xml | 10 - .../src/main/res/values-v21/styles.xml | 6 - .../src/main/res/values-vi/strings.xml | 20 - .../src/main/res/values/attrs.xml | 71 - .../src/main/res/values/colors.xml | 65 - .../src/main/res/values/strings.xml | 69 - .../src/main/res/values/styles.xml | 193 - .../src/main/resources/translations/de.json | 397 -- .../src/main/resources/translations/en.json | 402 -- .../src/main/resources/translations/fr.json | 402 -- .../src/main/resources/translations/nl.json | 402 -- .../src/main/resources/translations/ru.json | 402 -- .../src/main/resources/translations/sv.json | 402 -- .../src/main/resources/translations/vi.json | 402 -- .../main/resources/translations/zh-Hans.json | 287 - .../android/navigation/v5/BaseTest.java | 80 - .../navigation/v5/MockLocationBuilder.java | 54 - .../navigation/v5/TestRouteBuilder.java | 69 - .../v5/TestRouteProgressBuilder.java | 97 - .../v5/location/LocationValidatorTest.java | 58 - .../v5/location/replay/GpxParserTest.java | 114 - .../ReplayJsonRouteLocationMapperTest.java | 178 - .../replay/ReplayLocationDispatcherTest.java | 163 - .../ReplayRouteLocationConverterTest.java | 28 - .../replay/ReplayRouteParserTest.java | 120 - .../BannerInstructionMilestoneTest.java | 110 - .../v5/milestone/StepMilestoneTest.java | 59 - .../v5/milestone/TriggerPropertyTest.java | 134 - .../navigation/v5/milestone/TriggerTest.java | 368 - .../VoiceInstructionMilestoneTest.java | 136 - .../navigation/FasterRouteDetectorTest.java | 143 - .../MapboxNavigationNotificationTest.java | 64 - .../v5/navigation/MapboxNavigationTest.java | 300 - .../NavigationEngineFactoryTest.java | 72 - .../NavigationEventDispatcherTest.java | 323 - .../NavigationFasterRouteListenerTest.java | 64 - .../v5/navigation/NavigationHelperTest.java | 489 -- .../NavigationNotificationProviderTest.java | 66 - .../NavigationRouteProcessorTest.java | 227 - .../RouteProcessorThreadListenerTest.java | 117 - .../v5/offroute/OffRouteDetectorTest.java | 417 -- .../routeprogress/RouteLegProgressTest.java | 226 - .../v5/routeprogress/RouteProgressTest.java | 292 - .../routeprogress/RouteStepProgressTest.java | 366 - .../navigation/v5/snap/SnapToRouteTest.java | 191 - .../v5/utils/DistanceFormatterTest.java | 132 - .../v5/utils/MeasurementUtilsTest.java | 70 - .../navigation/v5/utils/RingBufferTest.java | 55 - .../navigation/v5/utils/RouteUtilsTest.java | 497 -- .../v5/utils/ToleranceUtilsTest.java | 61 - .../v5/utils/ValidationUtilsTest.java | 102 - .../v5/utils/time/TimeFormatterTest.java | 90 - .../test/resources/dcmapbox_chipoltle.json | 660 -- ...ctions_distance_congestion_annotation.json | 1 - .../resources/directions_two_leg_route.json | 6103 ----------------- ...rections_two_leg_route_with_distances.json | 1 - .../src/test/resources/directions_v5.json | 1 - .../resources/directions_v5_no_voice.json | 1 - .../resources/directions_v5_precision_6.json | 1 - .../src/test/resources/long_step.json | 72 - .../resources/mobile-event-schemas.jsonl.gz | Bin 11925 -> 0 bytes .../src/test/resources/navigation.json | 1 - .../src/test/resources/reroute.json | 355 - .../test/resources/single_intersection.json | 1 - .../src/test/resources/test.gpx | 28 - .../src/test/resources/test_invalid.gpx | 4919 ------------- 774 files changed, 65899 deletions(-) delete mode 100644 libandroid-navigation-ui/.gitignore delete mode 100644 libandroid-navigation-ui/build.gradle delete mode 100644 libandroid-navigation-ui/gradle.properties delete mode 100644 libandroid-navigation-ui/javadoc.gradle delete mode 100644 libandroid-navigation-ui/proguard-consumer.pro delete mode 100644 libandroid-navigation-ui/src/main/AndroidManifest.xml delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/CancelBtnClickListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProvider.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/DamerauLevenshteinAlgorithm.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductor.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapConnectivityController.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapboxNavigationActivity.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MobileNetworkChecker.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MultiOnClickListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationButton.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationContract.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationInstructionListListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncherOptions.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenter.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationUiOptions.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcher.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewInstanceState.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModel.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewOptions.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouter.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriber.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/OnNavigationReadyCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterBtnClickListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterButton.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatus.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteComparator.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteOverviewBtnClickListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SoundButton.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SummaryBottomSheetCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ViewRouteListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/WifiNetworkChecker.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraAnimationDelegate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraOverviewCancelableCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraUpdateMode.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCamera.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraUpdate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeChangedListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeTransitionListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationVerifier.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentNode.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTree.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerInstructionModel.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerShield.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignVerifier.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageVerifier.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionListTransitionListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoader.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionModel.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionTarget.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeCreator.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeVerifier.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextCreator.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextVerifier.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextViewUtils.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMap.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewMap.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewUpdate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuversStyleKit.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneAdapter.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneDrawableMap.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewData.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewHolder.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/BannerInstructionsListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/InstructionListListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/NavigationListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/RouteListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/SpeechAnnouncementListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FeatureFilterTask.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FpsDelegateProgressChangeListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapBatteryMonitor.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractor.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustor.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayName.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWaynameProgressChangeListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapSettings.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapInstanceState.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManager.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnFeatureFilteredCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnWayNameChangedListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WayNameView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilter.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinder.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/package-info.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/FeatureProcessingTask.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteArrow.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteDrawableProvider.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLayerProvider.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLine.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteSourceProvider.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapboxRouteFetcher.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRoute.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationRoute.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/OnPrimaryRouteUpdatedCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/OnRouteFeaturesProcessedCallback.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/OnRouteSelectionChangeListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/PrimaryRouteUpdateTask.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/RouteConstants.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/summary/SummaryBottomSheet.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/summary/SummaryModel.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListAdapter.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListPresenter.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListView.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionViewHolder.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/utils/MapImageUtils.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/utils/MapUtils.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/utils/ViewUtils.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/AndroidSpeechPlayer.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/Api14UtteranceListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/Api26AudioFocusDelegate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/AudioFocusDelegate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/AudioFocusDelegateProvider.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechPlayer.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncement.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncementMap.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncementUpdate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAudioFocusDelegate.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAudioFocusManager.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechListener.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechPlayer.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechPlayerProvider.java delete mode 100644 libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/UtteranceListener.java delete mode 100644 libandroid-navigation-ui/src/main/res/anim/slide_down_top.xml delete mode 100644 libandroid-navigation-ui/src/main/res/anim/slide_in_right.xml delete mode 100644 libandroid-navigation-ui/src/main/res/anim/slide_out_right.xml delete mode 100644 libandroid-navigation-ui/src/main/res/anim/slide_up_top.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_bad_route_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_bad_route_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_confusing_directions_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_confusing_directions_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_not_allowed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_not_allowed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_road_closed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/ic_road_closed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/map_marker_dark.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-hdpi/map_marker_light.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-land/turn_lane_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_bad_route_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_bad_route_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_confusing_directions_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_confusing_directions_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_not_allowed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_not_allowed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_road_closed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/ic_road_closed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/map_marker_dark.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-mdpi/map_marker_light.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/alert_progress_drawable.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/feedback_bottomsheet_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/feedback_progress_drawable.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/instruction_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/sound_chip_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/sub_banner_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-v21/wayname_text_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_bad_route_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_bad_route_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_confusing_directions_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_confusing_directions_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_not_allowed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_not_allowed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_road_closed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/ic_road_closed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/map_marker_dark.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xhdpi/map_marker_light.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_bad_route_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_bad_route_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_confusing_directions_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_confusing_directions_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_not_allowed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_not_allowed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_road_closed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/ic_road_closed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/map_marker_dark.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxhdpi/map_marker_light.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_bad_route_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_bad_route_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_confusing_directions_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_confusing_directions_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_not_allowed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_not_allowed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_road_closed_filled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/ic_road_closed_unfilled.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/map_marker_dark.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable-xxxhdpi/map_marker_light.png delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/alert_progress_drawable.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/feedback_bottomsheet_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/feedback_progress_drawable.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/gradient_shadow_down.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/gradient_shadow_up.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_arrow_head.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_arrow_head_casing.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_arrow_up.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_bad_route.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_circle.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_clear.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_confusing_directions.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_exit_arrow_left.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_exit_arrow_right.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_lane_right.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_lane_right_only.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_lane_slight_right.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_lane_straight.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_lane_straight_only.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_lane_uturn.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_message.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_navigation.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_not_allowed.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_road_closed.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_route_destination.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_route_origin.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_route_preview.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_route_preview_dark.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_sound_off.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/ic_sound_on.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/instruction_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/rounded_corners.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/sound_chip_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/sub_banner_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/drawable/wayname_text_background.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/instruction_content_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/instruction_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/instruction_layout_alt.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/instruction_view_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/instruction_viewholder_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/navigation_view_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/sub_instruction_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/summary_content_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/summary_peek_content_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/summary_peek_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout-land/turn_lane_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/activity_navigation.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/alert_view_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/exit_sign_view_left.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/exit_sign_view_right.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/instruction_content_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/instruction_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/instruction_list_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/instruction_view_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/instruction_viewholder_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/navigation_view_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/recenter_btn_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/sound_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/sub_instruction_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/summary_bottomsheet_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/summary_content_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/summary_peek_content_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/summary_peek_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/turn_lane_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/turn_lane_listitem_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/layout/wayname_view_layout.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-ar/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-bg/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-bn/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-ca/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-cs/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-da/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-de/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-es/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-fa/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-fr/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-gl/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-hdpi/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-he/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-hu/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-id/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-it/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-ja/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-ko/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-land/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-mdpi/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-my/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-port/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-pt-rBR/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-pt-rPT/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-ru/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-sv/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-uk/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-vi/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-xhdpi/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-xxhdpi/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-xxxhdpi/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values-yo/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values/attrs.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values/colors.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values/dimens.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values/strings.xml delete mode 100644 libandroid-navigation-ui/src/main/res/values/styles.xml delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/BaseTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProviderTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductorTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenterTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcherTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouterTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriberTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatusTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteBuilder.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteProgressBuilder.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCameraTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallbackTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreatorTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTreeTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentsFaker.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoaderTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMapTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewDataTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegateTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegateTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractorTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustorTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManagerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilterTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinderTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLineTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRouteTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationRouteTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/PrimaryRouteUpdateTaskTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListPresenterTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechListenerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechPlayerTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncementTest.java delete mode 100644 libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechPlayerProviderTest.java delete mode 100644 libandroid-navigation-ui/src/test/resources/directions_v5_precision_6.json delete mode 100644 libandroid-navigation-ui/src/test/resources/feature_one.json delete mode 100644 libandroid-navigation-ui/src/test/resources/feature_two.json delete mode 100644 libandroid-navigation-ui/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker delete mode 100644 libandroid-navigation/.gitignore delete mode 100644 libandroid-navigation/build.gradle delete mode 100644 libandroid-navigation/gradle.properties delete mode 100644 libandroid-navigation/javadoc.gradle delete mode 100644 libandroid-navigation/proguard-consumer.pro delete mode 100644 libandroid-navigation/src/main/AndroidManifest.xml delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/core/FileUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityReceiver.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReport.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReportBuilder.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/MapboxUncaughtExceptionHanlder.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/NavigationException.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/Instruction.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/LocationValidator.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/MetricsLocation.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/GoogleLocationEngineImpl.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/LocationEngineProvider.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/Utils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParser.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ParseGpxTask.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteDto.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapper.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcher.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDto.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverter.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationEngine.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/TimestampAdapter.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestone.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Milestone.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/MilestoneEventListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Operation.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/RouteMilestone.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestone.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Trigger.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/TriggerProperty.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestone.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Admin.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerComponents.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerInstructions.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerText.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerView.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Closure.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Congestion.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsAdapterFactory.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsCriteria.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsError.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsJsonObject.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsResponse.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsRoute.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsWaypoint.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Incident.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/IntersectionLanes.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegAnnotation.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegStep.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/ManeuverModifier.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MapboxStreetsV8.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MaxSpeed.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RestStop.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteLeg.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteOptions.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/SpeedLimit.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepIntersection.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepManeuver.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/TollCollection.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/VoiceInstructions.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptions.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptionsAdapterFactory.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/FormatUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/ParseUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotification.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationOptions.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactory.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcher.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationIndices.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLifecycleMonitor.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineUpdater.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationUpdate.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationMapRoute.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationNotificationProvider.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationRouteProcessor.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationService.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationTimeFormat.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorBackgroundThread.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorHandlerCallback.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/SdkVersionChecker.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/camera/Camera.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/camera/RouteInformation.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/camera/SimpleCamera.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/notification/NavigationNotification.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/offroute/OffRoute.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteCallback.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteDetector.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/offroute/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/FasterRoute.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/FasterRouteDetector.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/FasterRouteListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/MapRouteProgressChangeListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/OnRouteSelectionChangeListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/CurrentLegAnnotation.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/MetricsRouteProgress.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/ProgressChangeListener.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgress.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteProgress.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteStepProgress.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/snap/Snap.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/snap/SnapToRoute.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/snap/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/Constants.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/ManeuverMap.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/ManeuverUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MapImageUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MapUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MathUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MeasurementUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/RingBuffer.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/RouteUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/TextUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/ValidationUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/abbreviation/AbbreviationArray.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/abbreviation/StringAbbreviator.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/package-info.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/span/SpanItem.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/span/SpanUtils.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/span/TextSpanItem.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/time/NoneSpecifiedTimeFormat.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormatResolver.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormatter.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormattingChain.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/time/TwelveHoursTimeFormat.java delete mode 100644 libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/time/TwentyFourHoursTimeFormat.java delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/ic_confusing_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/ic_map_error.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/ic_no_turn_allowed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/ic_road_closed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/ic_traffic.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/ic_wrong_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/map_marker_dark.png delete mode 100644 libandroid-navigation/src/main/res/drawable-hdpi/map_marker_light.png delete mode 100644 libandroid-navigation/src/main/res/drawable-land/turn_lane_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/ic_confusing_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/ic_map_error.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/ic_no_turn_allowed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/ic_road_closed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/ic_traffic.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/ic_wrong_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/map_marker_dark.png delete mode 100644 libandroid-navigation/src/main/res/drawable-mdpi/map_marker_light.png delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/alert_progress_drawable.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/feedback_bottomsheet_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/feedback_progress_drawable.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/instruction_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/sound_chip_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/sub_banner_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-v21/wayname_text_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/ic_confusing_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/ic_map_error.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/ic_no_turn_allowed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/ic_road_closed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/ic_traffic.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/ic_wrong_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/map_marker_dark.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xhdpi/map_marker_light.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/ic_confusing_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/ic_map_error.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/ic_no_turn_allowed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/ic_road_closed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/ic_traffic.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/ic_wrong_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxhdpi/map_marker_dark.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/ic_confusing_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/ic_map_error.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/ic_no_turn_allowed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/ic_road_closed.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/ic_traffic.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/ic_wrong_directions.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/map_marker_dark.png delete mode 100644 libandroid-navigation/src/main/res/drawable-xxxhdpi/map_marker_light.png delete mode 100644 libandroid-navigation/src/main/res/drawable/alert_progress_drawable.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_arrive.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_arrive_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_arrive_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_continue_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_depart.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_depart_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_depart_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_end_of_road_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_end_of_road_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_fork.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_fork_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_fork_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_fork_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_fork_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_fork_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_merge_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_merge_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_merge_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_merge_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_merge_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_sharp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_sharp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_notification_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_off_ramp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_off_ramp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_off_ramp_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_off_ramp_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_on_ramp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_on_ramp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_on_ramp_sharp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_on_ramp_sharp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_on_ramp_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_on_ramp_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_sharp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_sharp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_roundabout_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_turn_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_turn_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_turn_sharp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_turn_sharp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_turn_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_turn_slight_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/direction_uturn.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/feedback_bottomsheet_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/feedback_progress_drawable.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/gradient_shadow_down.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/gradient_shadow_up.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_arrow_head.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_arrow_head_casting.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_arrow_up.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_circle.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_clear.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_close.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_list.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_arrive.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_arrive_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_arrive_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_depart.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_depart_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_depart_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_end_of_road_left.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_end_of_road_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_fork.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_fork_left.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_fork_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_fork_slight_left.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_fork_slight_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_fork_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_merge_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_merge_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_off_ramp_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_off_ramp_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_off_ramp_slight_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_off_ramp_slight_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_left.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_sharp_left.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_sharp_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_slight_left.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_slight_right.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_roundabout_straight.xml delete mode 100755 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_0.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_180.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_30.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_30_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_45.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_45_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_75.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_maneuver_turn_75_left.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_message.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_navigation.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_route_destination.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_route_origin.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_route_preview.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_route_preview_dark.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_sound_off.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/ic_sound_on.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/instruction_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/lane_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/lane_right_only.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/lane_straight.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/lane_straight_only_right.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/lane_uturn.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/map_marker_light.png delete mode 100644 libandroid-navigation/src/main/res/drawable/sound_chip_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/sub_banner_background.xml delete mode 100644 libandroid-navigation/src/main/res/drawable/wayname_text_background.xml delete mode 100644 libandroid-navigation/src/main/res/layout/collapsed_navigation_notification_layout.xml delete mode 100644 libandroid-navigation/src/main/res/layout/expanded_navigation_notification_layout.xml delete mode 100644 libandroid-navigation/src/main/res/values-bg/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-bn/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-ca/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-cs/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-da/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-de/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-es/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-fr/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-he/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-hu/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-id/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-it/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-ko/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-my/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-pt-rBR/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-pt-rPT/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-ru/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-sv/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-uk/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values-v21/styles.xml delete mode 100644 libandroid-navigation/src/main/res/values-vi/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values/attrs.xml delete mode 100644 libandroid-navigation/src/main/res/values/colors.xml delete mode 100644 libandroid-navigation/src/main/res/values/strings.xml delete mode 100644 libandroid-navigation/src/main/res/values/styles.xml delete mode 100644 libandroid-navigation/src/main/resources/translations/de.json delete mode 100644 libandroid-navigation/src/main/resources/translations/en.json delete mode 100644 libandroid-navigation/src/main/resources/translations/fr.json delete mode 100644 libandroid-navigation/src/main/resources/translations/nl.json delete mode 100644 libandroid-navigation/src/main/resources/translations/ru.json delete mode 100644 libandroid-navigation/src/main/resources/translations/sv.json delete mode 100644 libandroid-navigation/src/main/resources/translations/vi.json delete mode 100644 libandroid-navigation/src/main/resources/translations/zh-Hans.json delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/BaseTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/MockLocationBuilder.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteBuilder.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteProgressBuilder.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/LocationValidatorTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParserTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapperTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcherTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverterTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteParserTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestoneTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestoneTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerPropertyTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestoneTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/FasterRouteDetectorTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotificationTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactoryTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcherTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListenerTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelperTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationNotificationProviderTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationRouteProcessorTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListenerTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteDetectorTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgressTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteProgressTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteStepProgressTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/snap/SnapToRouteTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatterTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/MeasurementUtilsTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RingBufferTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RouteUtilsTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtilsTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ValidationUtilsTest.java delete mode 100644 libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormatterTest.java delete mode 100644 libandroid-navigation/src/test/resources/dcmapbox_chipoltle.json delete mode 100644 libandroid-navigation/src/test/resources/directions_distance_congestion_annotation.json delete mode 100644 libandroid-navigation/src/test/resources/directions_two_leg_route.json delete mode 100644 libandroid-navigation/src/test/resources/directions_two_leg_route_with_distances.json delete mode 100644 libandroid-navigation/src/test/resources/directions_v5.json delete mode 100644 libandroid-navigation/src/test/resources/directions_v5_no_voice.json delete mode 100644 libandroid-navigation/src/test/resources/directions_v5_precision_6.json delete mode 100644 libandroid-navigation/src/test/resources/long_step.json delete mode 100644 libandroid-navigation/src/test/resources/mobile-event-schemas.jsonl.gz delete mode 100644 libandroid-navigation/src/test/resources/navigation.json delete mode 100644 libandroid-navigation/src/test/resources/reroute.json delete mode 100644 libandroid-navigation/src/test/resources/single_intersection.json delete mode 100644 libandroid-navigation/src/test/resources/test.gpx delete mode 100644 libandroid-navigation/src/test/resources/test_invalid.gpx diff --git a/libandroid-navigation-ui/.gitignore b/libandroid-navigation-ui/.gitignore deleted file mode 100644 index eab6a9e6..00000000 --- a/libandroid-navigation-ui/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dependency-graph-mapbox-libraries.png \ No newline at end of file diff --git a/libandroid-navigation-ui/build.gradle b/libandroid-navigation-ui/build.gradle deleted file mode 100644 index 16c9b7be..00000000 --- a/libandroid-navigation-ui/build.gradle +++ /dev/null @@ -1,88 +0,0 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion androidVersions.compileSdkVersion - buildToolsVersion androidVersions.buildToolsVersion - - defaultConfig { - minSdkVersion androidVersions.minSdkVersion - targetSdkVersion androidVersions.targetSdkVersion - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - vectorDrawables.useSupportLibrary = true - - buildConfigField('String', - "MAPBOX_NAVIGATION_SDK_IDENTIFIER", String.format("\"%s\"", "mapbox-navigation-ui-android") - ) - buildConfigField 'String', - "MAPBOX_NAVIGATION_EVENTS_USER_AGENT", String.format("\"mapbox-navigation-ui-android/%s\"", - project.VERSION_NAME - ) - consumerProguardFiles 'proguard-consumer.pro' - } - - configurations { - javadocDeps - } - - buildTypes { - debug { - testCoverageEnabled = true - } - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true - unitTests.all { - jacoco { - includeNoLocationClasses = true - excludes = ['jdk.internal.*'] - } - } - } -} - -dependencies { - // Navigation SDK - api project(':libandroid-navigation') - - // Maplibre Maps SDK - api dependenciesList.mapLibreServices - api dependenciesList.mapLibreTurf - api dependenciesList.mapLibreAnnotations - implementation(dependenciesList.mapLibre){ - exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-sdk-geojson' - exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-sdk-turf' - } - - // Support libraries - implementation dependenciesList.materialDesign - implementation dependenciesList.androidxRecyclerView - implementation dependenciesList.androidxConstraintLayout - implementation dependenciesList.androidxCardView - - // AutoValues - annotationProcessor dependenciesList.autoValue - implementation dependenciesList.autoValueAnnotations - - // AutoValues - annotationProcessor dependenciesList.autoValue - compileOnly dependenciesList.autoValue - - // Picasso - implementation dependenciesList.picasso - - // Timber - implementation dependenciesList.timber - - // Unit testing - testImplementation dependenciesList.junit - testImplementation dependenciesList.mockito - testImplementation dependenciesList.robolectric - testImplementation dependenciesList.json -} - -apply from: 'javadoc.gradle' -apply from: "${rootDir}/gradle/checkstyle.gradle" -apply from: "${rootDir}/gradle/dependencies-graph.gradle" -apply from: "${rootDir}/gradle/dependency-updates.gradle" \ No newline at end of file diff --git a/libandroid-navigation-ui/gradle.properties b/libandroid-navigation-ui/gradle.properties deleted file mode 100644 index 4f4c7fc0..00000000 --- a/libandroid-navigation-ui/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -POM_ARTIFACT_ID=mapbox-android-navigation-ui -POM_NAME=Mapbox Android Navigation UI SDK -POM_DESCRIPTION=Mapbox Android Navigation UI SDK -POM_PACKAGING=aar \ No newline at end of file diff --git a/libandroid-navigation-ui/javadoc.gradle b/libandroid-navigation-ui/javadoc.gradle deleted file mode 100644 index e36e3165..00000000 --- a/libandroid-navigation-ui/javadoc.gradle +++ /dev/null @@ -1,18 +0,0 @@ -android.libraryVariants.all { variant -> - def name = variant.name - task "javadoc$name"(type: Javadoc) { - description = "Generates javadoc for build $name" - failOnError = false - destinationDir = new File(destinationDir, variant.baseName) - source = variant.sourceSets.collect { it.java.sourceFiles }.inject { m, i -> m + i } - classpath += variant.javaCompile.classpath - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - options.windowTitle("Mapbox Android Navigation UI SDK $VERSION_NAME Reference") - options.docTitle("Mapbox Android Navigation UI SDK $VERSION_NAME") - options.header("Mapbox Android Navigation UI SDK $VERSION_NAME Reference") - options.bottom("© 2019 Mapbox. All rights reserved.") - options.links("http://docs.oracle.com/javase/7/docs/api/") - options.linksOffline("http://d.android.com/reference/", "${android.sdkDirectory}/docs/reference") - exclude '**/R.java', '**/BuildConfig.java' - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/proguard-consumer.pro b/libandroid-navigation-ui/proguard-consumer.pro deleted file mode 100644 index f946dc73..00000000 --- a/libandroid-navigation-ui/proguard-consumer.pro +++ /dev/null @@ -1,13 +0,0 @@ -# Consumer proguard rules for libandroid-navigation-ui - -# --- Picasso --- --dontwarn com.squareup.okhttp.** - -# --- com.mapbox.api.directions.v5.MapboxDirections --- --dontwarn com.sun.xml.internal.ws.spi.db.BindingContextFactory - -# --- com.amazonaws.util.json.JacksonFactory --- --dontwarn com.fasterxml.jackson.core.** - -# --- Mapbox --- --dontwarn com.mapbox.services.android.navigation.ui.v5.** \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/AndroidManifest.xml b/libandroid-navigation-ui/src/main/AndroidManifest.xml deleted file mode 100644 index 6ca71ee1..00000000 --- a/libandroid-navigation-ui/src/main/AndroidManifest.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/CancelBtnClickListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/CancelBtnClickListener.java deleted file mode 100644 index 5dcd5f2b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/CancelBtnClickListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.view.View; - -class CancelBtnClickListener implements View.OnClickListener { - - private NavigationViewEventDispatcher dispatcher; - - CancelBtnClickListener(NavigationViewEventDispatcher dispatcher) { - this.dispatcher = dispatcher; - } - - @Override - public void onClick(View view) { - dispatcher.onCancelNavigation(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProvider.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProvider.java deleted file mode 100644 index 22b72665..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.net.wifi.WifiInfo; -import android.net.wifi.WifiManager; - -import java.util.HashMap; - -/** - * TODO internal package - */ -public class ConnectivityStatusProvider { - - private final Context context; - private final WifiNetworkChecker wifiNetworkChecker; - private final MobileNetworkChecker mobileNetworkChecker; - - public ConnectivityStatusProvider(Context applicationContext) { - this.context = applicationContext; - this.wifiNetworkChecker = new WifiNetworkChecker(new HashMap()); - this.mobileNetworkChecker = new MobileNetworkChecker(new HashMap()); - } - - public boolean isConnectedFast() { - NetworkInfo info = getNetworkInfo(context); - int wifiLevel = getWifiLevel(context); - return (info != null - && info.isConnected() - && isConnectionFast(info.getType(), info.getSubtype(), wifiLevel)); - } - - public boolean isConnected() { - NetworkInfo info = getNetworkInfo(context); - return (info != null && info.isConnected()); - } - - @SuppressLint("MissingPermission") - private NetworkInfo getNetworkInfo(Context context) { - ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - return cm.getActiveNetworkInfo(); - } - - @SuppressLint({"MissingPermission", "WifiManagerPotentialLeak"}) - private int getWifiLevel(Context context) { - WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); - int numberOfLevels = 5; - WifiInfo wifiInfo = wifiManager.getConnectionInfo(); - return WifiManager.calculateSignalLevel(wifiInfo.getRssi(), numberOfLevels); - } - - private boolean isConnectionFast(int type, int networkType, int wifiLevel) { - if (type == ConnectivityManager.TYPE_WIFI) { - return wifiNetworkChecker.isFast(wifiLevel); - } else if (type == ConnectivityManager.TYPE_MOBILE) { - return mobileNetworkChecker.isFast(networkType); - } else { - return false; - } - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/DamerauLevenshteinAlgorithm.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/DamerauLevenshteinAlgorithm.java deleted file mode 100644 index 92af480c..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/DamerauLevenshteinAlgorithm.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import java.util.HashMap; -import java.util.Map; - -/* Copyright (c) 2012 Kevin L. Stern - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * The Damerau-Levenshtein Algorithm is an extension to the Levenshtein - * Algorithm which solves the edit distance problem between a source string and - * a target string with the following operations: - *

- *

    - *
  • Character Insertion
  • - *
  • Character Deletion
  • - *
  • Character Replacement
  • - *
  • Adjacent Character Swap
  • - *
- *

- * Note that the adjacent character swap operation is an edit that may be - * applied when two adjacent characters in the source string match two adjacent - * characters in the target string, but in reverse order, rather than a general - * allowance for adjacent character swaps. - *

- *

- * This implementation allows the client to specify the costs of the various - * edit operations with the restriction that the cost of two swap operations - * must not be less than the cost of a delete operation followed by an insert - * operation. This restriction is required to preclude two swaps involving the - * same character being required for optimality which, in turn, enables a fast - * dynamic programming solution. - *

- *

- * The running time of the Damerau-Levenshtein algorithm is O(n*m) where n is - * the length of the source string and m is the length of the target string. - * This implementation consumes O(n*m) space. - * - * @author Kevin L. Stern - */ -class DamerauLevenshteinAlgorithm { - private static final int DELETE_COST = 1; - private static final int INSERT_COST = 1; - private static final int REPLACE_COST = 1; - private static final int SWAP_COST = 1; - - /** - * Compute the Damerau-Levenshtein distance between the specified source - * string and the specified target string. - */ - static int execute(String source, String target) { - if (source.length() == 0) { - return target.length() * INSERT_COST; - } - if (target.length() == 0) { - return source.length() * DELETE_COST; - } - int[][] table = new int[source.length()][target.length()]; - Map sourceIndexByCharacter = new HashMap<>(); - if (source.charAt(0) != target.charAt(0)) { - table[0][0] = Math.min(REPLACE_COST, DELETE_COST + INSERT_COST); - } - sourceIndexByCharacter.put(source.charAt(0), 0); - for (int i = 1; i < source.length(); i++) { - int deleteDistance = table[i - 1][0] + DELETE_COST; - int insertDistance = (i + 1) * DELETE_COST + INSERT_COST; - int matchDistance = i * DELETE_COST + (source.charAt(i) == target.charAt(0) ? 0 : REPLACE_COST); - table[i][0] = Math.min(Math.min(deleteDistance, insertDistance), matchDistance); - } - for (int j = 1; j < target.length(); j++) { - int deleteDistance = (j + 1) * INSERT_COST + DELETE_COST; - int insertDistance = table[0][j - 1] + INSERT_COST; - int matchDistance = j * INSERT_COST + (source.charAt(0) == target.charAt(j) ? 0 : REPLACE_COST); - table[0][j] = Math.min(Math.min(deleteDistance, insertDistance), matchDistance); - } - for (int i = 1; i < source.length(); i++) { - int maxSourceLetterMatchIndex = source.charAt(i) == target.charAt(0) ? 0 : -1; - for (int j = 1; j < target.length(); j++) { - Integer candidateSwapIndex = sourceIndexByCharacter.get(target.charAt(j)); - int indexJSwap = maxSourceLetterMatchIndex; - int deleteDistance = table[i - 1][j] + DELETE_COST; - int insertDistance = table[i][j - 1] + INSERT_COST; - int matchDistance = table[i - 1][j - 1]; - if (source.charAt(i) != target.charAt(j)) { - matchDistance += REPLACE_COST; - } else { - maxSourceLetterMatchIndex = j; - } - int swapDistance; - if (candidateSwapIndex != null && indexJSwap != -1) { - int indexISwap = candidateSwapIndex; - int preSwapCost; - if (indexISwap == 0 && indexJSwap == 0) { - preSwapCost = 0; - } else { - preSwapCost = table[Math.max(0, indexISwap - 1)][Math.max(0, indexJSwap - 1)]; - } - swapDistance = preSwapCost + (i - indexISwap - 1) * DELETE_COST + (j - indexJSwap - 1) * INSERT_COST - + SWAP_COST; - } else { - swapDistance = Integer.MAX_VALUE; - } - table[i][j] = Math.min(Math.min(Math.min(deleteDistance, insertDistance), matchDistance), swapDistance); - } - sourceIndexByCharacter.put(source.charAt(i), i); - } - return table[source.length() - 1][target.length() - 1]; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductor.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductor.java deleted file mode 100644 index 85f1f273..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductor.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.content.Context; - - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.location.engine.LocationEngineProvider; -import com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine; - -class LocationEngineConductor { - - private LocationEngine locationEngine; - - void initializeLocationEngine(Context context, LocationEngine locationEngine, boolean shouldReplayRoute) { - initialize(context, locationEngine, shouldReplayRoute); - } - - boolean updateSimulatedRoute(DirectionsRoute route) { - if (locationEngine instanceof ReplayRouteLocationEngine) { - ((ReplayRouteLocationEngine) locationEngine).assign(route); - return true; - } - return false; - } - - LocationEngine obtainLocationEngine() { - return locationEngine; - } - - @SuppressWarnings("MissingPermission") - private void initialize(Context context, LocationEngine locationEngine, boolean simulateRoute) { - if (locationEngine != null) { - this.locationEngine = locationEngine; - } else if (simulateRoute) { - this.locationEngine = new ReplayRouteLocationEngine(); - } else { - this.locationEngine = LocationEngineProvider.getBestLocationEngine(context); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapConnectivityController.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapConnectivityController.java deleted file mode 100644 index 04b8beb7..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapConnectivityController.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.mapboxsdk.Mapbox; - -class MapConnectivityController { - - void assign(Boolean state) { - Mapbox.setConnected(state); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapboxNavigationActivity.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapboxNavigationActivity.java deleted file mode 100644 index dcdad8ed..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapboxNavigationActivity.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.content.SharedPreferences; -import android.os.Bundle; -import android.os.Parcelable; -import android.preference.PreferenceManager; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.services.android.navigation.ui.v5.listeners.NavigationListener; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; - -/** - * Serves as a launching point for the custom drop-in UI, {@link NavigationView}. - *

- * Demonstrates the proper setup and usage of the view, including all lifecycle methods. - */ -public class MapboxNavigationActivity extends AppCompatActivity implements OnNavigationReadyCallback, - NavigationListener { - - private NavigationView navigationView; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - setTheme(R.style.Theme_AppCompat_NoActionBar); - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_navigation); - navigationView = findViewById(R.id.navigationView); - navigationView.onCreate(savedInstanceState); - initialize(); - } - - @Override - public void onStart() { - super.onStart(); - navigationView.onStart(); - } - - @Override - public void onResume() { - super.onResume(); - navigationView.onResume(); - } - - @Override - public void onLowMemory() { - super.onLowMemory(); - navigationView.onLowMemory(); - } - - @Override - public void onBackPressed() { - // If the navigation view didn't need to do anything, call super - if (!navigationView.onBackPressed()) { - super.onBackPressed(); - } - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - navigationView.onSaveInstanceState(outState); - super.onSaveInstanceState(outState); - } - - @Override - protected void onRestoreInstanceState(Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - navigationView.onRestoreInstanceState(savedInstanceState); - } - - @Override - public void onPause() { - super.onPause(); - navigationView.onPause(); - } - - @Override - public void onStop() { - super.onStop(); - navigationView.onStop(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - navigationView.onDestroy(); - } - - @Override - public void onNavigationReady(boolean isRunning) { - NavigationViewOptions.Builder options = NavigationViewOptions.builder(); - options.navigationListener(this); - extractRoute(options); - extractConfiguration(options); - options.navigationOptions(MapboxNavigationOptions.builder().build()); - navigationView.startNavigation(options.build()); - } - - @Override - public void onCancelNavigation() { - finishNavigation(); - } - - @Override - public void onNavigationFinished() { - finishNavigation(); - } - - @Override - public void onNavigationRunning() { - // Intentionally empty - } - - private void initialize() { - Parcelable position = getIntent().getParcelableExtra(NavigationConstants.NAVIGATION_VIEW_INITIAL_MAP_POSITION); - if (position != null) { - navigationView.initialize(this, (CameraPosition) position); - } else { - navigationView.initialize(this); - } - } - - private void extractRoute(NavigationViewOptions.Builder options) { - DirectionsRoute route = NavigationLauncher.extractRoute(this); - options.directionsRoute(route); - } - - private void extractConfiguration(NavigationViewOptions.Builder options) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); - options.shouldSimulateRoute(preferences.getBoolean(NavigationConstants.NAVIGATION_VIEW_SIMULATE_ROUTE, false)); - } - - private void finishNavigation() { - NavigationLauncher.cleanUpPreferences(this); - finish(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MobileNetworkChecker.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MobileNetworkChecker.java deleted file mode 100644 index e9030539..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MobileNetworkChecker.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.NonNull; -import android.telephony.TelephonyManager; - -import java.util.HashMap; - -class MobileNetworkChecker { - - private final HashMap statusMap; - - MobileNetworkChecker(HashMap statusMap) { - this.statusMap = statusMap; - initialize(statusMap); - } - - @NonNull - Boolean isFast(Integer networkType) { - Boolean isConnectionFast = statusMap.get(networkType); - if (isConnectionFast == null) { - isConnectionFast = false; - } - return isConnectionFast; - } - - private void initialize(HashMap statusMap) { - statusMap.put(TelephonyManager.NETWORK_TYPE_1xRTT, false); - statusMap.put(TelephonyManager.NETWORK_TYPE_GPRS, false); - statusMap.put(TelephonyManager.NETWORK_TYPE_CDMA, false); - statusMap.put(TelephonyManager.NETWORK_TYPE_EDGE, false); - statusMap.put(TelephonyManager.NETWORK_TYPE_IDEN, false); - statusMap.put(TelephonyManager.NETWORK_TYPE_UNKNOWN, false); - - statusMap.put(TelephonyManager.NETWORK_TYPE_EVDO_0, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_EVDO_A, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_HSDPA, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_HSPA, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_HSUPA, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_UMTS, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_EHRPD, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_EVDO_B, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_HSPAP, true); - statusMap.put(TelephonyManager.NETWORK_TYPE_LTE, true); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MultiOnClickListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MultiOnClickListener.java deleted file mode 100644 index 28699343..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MultiOnClickListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.view.View; - -import java.util.HashSet; -import java.util.Set; - -class MultiOnClickListener implements View.OnClickListener { - private Set onClickListeners; - - MultiOnClickListener() { - this.onClickListeners = new HashSet<>(); - } - - void addListener(View.OnClickListener onClickListener) { - onClickListeners.add(onClickListener); - } - - void removeListener(View.OnClickListener onClickListener) { - onClickListeners.remove(onClickListener); - } - - void clearListeners() { - onClickListeners.clear(); - } - - @Override - public void onClick(View view) { - for (View.OnClickListener onClickListener : onClickListeners) { - onClickListener.onClick(view); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationButton.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationButton.java deleted file mode 100644 index b45b0530..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationButton.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.view.View; - -public interface NavigationButton { - - /** - * Adds an onClickListener to the button - * - * @param onClickListener to add - */ - void addOnClickListener(View.OnClickListener onClickListener); - - /** - * Removes an onClickListener from the button - * - * @param onClickListener to remove - */ - void removeOnClickListener(View.OnClickListener onClickListener); - - /** - * Hides the button - */ - void hide(); - - /** - * Shows the button - */ - void show(); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationContract.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationContract.java deleted file mode 100644 index be0945b3..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationContract.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.location.Location; -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; - -public interface NavigationContract { - - interface View { - - void setSummaryBehaviorState(int state); - - void setSummaryBehaviorHideable(boolean isHideable); - - boolean isSummaryBottomSheetHidden(); - - void updateWayNameVisibility(boolean isVisible); - - void updateWayNameView(@NonNull String wayName); - - void resetCameraPosition(); - - void showRecenterBtn(); - - void hideRecenterBtn(); - - void drawRoute(DirectionsRoute directionsRoute); - - void addMarker(Point point); - - void startCamera(DirectionsRoute directionsRoute); - - void resumeCamera(Location location); - - void updateNavigationMap(Location location); - - boolean isRecenterButtonVisible(); - - void updateCameraRouteOverview(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationInstructionListListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationInstructionListListener.java deleted file mode 100644 index c4b9a486..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationInstructionListListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.services.android.navigation.ui.v5.listeners.InstructionListListener; - -class NavigationInstructionListListener implements InstructionListListener { - - private NavigationPresenter presenter; - private NavigationViewEventDispatcher dispatcher; - - NavigationInstructionListListener(NavigationPresenter presenter, NavigationViewEventDispatcher dispatcher) { - this.presenter = presenter; - this.dispatcher = dispatcher; - } - - @Override - public void onInstructionListVisibilityChanged(boolean visible) { - dispatcher.onInstructionListVisibilityChanged(visible); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java deleted file mode 100644 index a599883f..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; - -import com.google.gson.Gson; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; - -/** - * Use this class to launch the navigation UI - *

- * You can launch the UI a route you have already retrieved from - * {@link com.mapbox.services.android.navigation.v5.navigation.NavigationRoute}. - *

- * For testing, you can launch with simulation, in which our - * {@link com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine} will begin - * following the given {@link DirectionsRoute} once the UI is initialized. - *

- */ -public class NavigationLauncher { - - /** - * Starts the UI with a {@link DirectionsRoute} already retrieved from - * {@link com.mapbox.services.android.navigation.v5.navigation.NavigationRoute} - * - * @param activity must be launched from another {@link Activity} - * @param options with fields to customize the navigation view - */ - public static void startNavigation(Activity activity, NavigationLauncherOptions options) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); - SharedPreferences.Editor editor = preferences.edit(); - - storeDirectionsRouteValue(options, editor); - storeConfiguration(options, editor); - - storeThemePreferences(options, editor); - - editor.apply(); - - Intent navigationActivity = new Intent(activity, MapboxNavigationActivity.class); - storeInitialMapPosition(options, navigationActivity); - activity.startActivity(navigationActivity); - } - - /** - * Used to extract the route used to launch the drop-in UI. - *

- * Extracts the route {@link String} from {@link SharedPreferences} and converts - * it back to a {@link DirectionsRoute} object with {@link Gson}. - * - * @param context to retrieve {@link SharedPreferences} - * @return {@link DirectionsRoute} stored when launching - */ - static DirectionsRoute extractRoute(Context context) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - String directionsRouteJson = preferences.getString(NavigationConstants.NAVIGATION_VIEW_ROUTE_KEY, ""); - return DirectionsRoute.fromJson(directionsRouteJson); - } - - static void cleanUpPreferences(Context context) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - SharedPreferences.Editor editor = preferences.edit(); - editor - .remove(NavigationConstants.NAVIGATION_VIEW_ROUTE_KEY) - .remove(NavigationConstants.NAVIGATION_VIEW_SIMULATE_ROUTE) - .remove(NavigationConstants.NAVIGATION_VIEW_PREFERENCE_SET_THEME) - .remove(NavigationConstants.NAVIGATION_VIEW_PREFERENCE_SET_THEME) - .remove(NavigationConstants.NAVIGATION_VIEW_LIGHT_THEME) - .remove(NavigationConstants.NAVIGATION_VIEW_DARK_THEME) - .apply(); - } - - private static void storeDirectionsRouteValue(NavigationLauncherOptions options, SharedPreferences.Editor editor) { - editor.putString(NavigationConstants.NAVIGATION_VIEW_ROUTE_KEY, options.directionsRoute().toJson()); - } - - private static void storeConfiguration(NavigationLauncherOptions options, SharedPreferences.Editor editor) { - editor.putBoolean(NavigationConstants.NAVIGATION_VIEW_SIMULATE_ROUTE, options.shouldSimulateRoute()); - } - - private static void storeThemePreferences(NavigationLauncherOptions options, SharedPreferences.Editor editor) { - boolean preferenceThemeSet = options.lightThemeResId() != null || options.darkThemeResId() != null; - editor.putBoolean(NavigationConstants.NAVIGATION_VIEW_PREFERENCE_SET_THEME, preferenceThemeSet); - - if (preferenceThemeSet) { - if (options.lightThemeResId() != null) { - editor.putInt(NavigationConstants.NAVIGATION_VIEW_LIGHT_THEME, options.lightThemeResId()); - } - if (options.darkThemeResId() != null) { - editor.putInt(NavigationConstants.NAVIGATION_VIEW_DARK_THEME, options.darkThemeResId()); - } - } - } - - private static void storeInitialMapPosition(NavigationLauncherOptions options, Intent navigationActivity) { - if (options.initialMapCameraPosition() != null) { - navigationActivity.putExtra( - NavigationConstants.NAVIGATION_VIEW_INITIAL_MAP_POSITION, options.initialMapCameraPosition() - ); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncherOptions.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncherOptions.java deleted file mode 100644 index 6ff8ffe5..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncherOptions.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.camera.CameraPosition; - -@AutoValue -public abstract class NavigationLauncherOptions extends NavigationUiOptions { - - @Nullable - public abstract CameraPosition initialMapCameraPosition(); - - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder directionsRoute(DirectionsRoute directionsRoute); - - public abstract Builder lightThemeResId(Integer lightThemeResId); - - public abstract Builder darkThemeResId(Integer darkThemeResId); - - public abstract Builder shouldSimulateRoute(boolean shouldSimulateRoute); - - public abstract Builder waynameChipEnabled(boolean waynameChipEnabled); - - public abstract Builder initialMapCameraPosition(@Nullable CameraPosition initialMapCameraPosition); - - public abstract NavigationLauncherOptions build(); - } - - public static NavigationLauncherOptions.Builder builder() { - return new AutoValue_NavigationLauncherOptions.Builder() - .shouldSimulateRoute(false) - .waynameChipEnabled(true); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListener.java deleted file mode 100644 index 348042c0..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListener.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.google.android.material.bottomsheet.BottomSheetBehavior; - -import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener; - -/** - * Listener used to detect user interaction with the map while driving. - *

- * If the camera tracking is dismissed, we notify the presenter to adjust UI accordingly. - */ -class NavigationOnCameraTrackingChangedListener implements OnCameraTrackingChangedListener { - - private final NavigationPresenter navigationPresenter; - private final BottomSheetBehavior summaryBehavior; - - NavigationOnCameraTrackingChangedListener(NavigationPresenter navigationPresenter, - BottomSheetBehavior summaryBehavior) { - this.navigationPresenter = navigationPresenter; - this.summaryBehavior = summaryBehavior; - } - - @Override - public void onCameraTrackingDismissed() { - if (summaryBehavior.getState() != BottomSheetBehavior.STATE_HIDDEN) { - navigationPresenter.onCameraTrackingDismissed(); - } - } - - @Override - public void onCameraTrackingChanged(int currentMode) { - // Intentionally empty - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenter.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenter.java deleted file mode 100644 index 3df46896..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenter.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.location.Location; -import androidx.annotation.NonNull; -import com.google.android.material.bottomsheet.BottomSheetBehavior; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.core.utils.TextUtils; -import com.mapbox.geojson.Point; - -class NavigationPresenter { - - private NavigationContract.View view; - private boolean resumeState; - - NavigationPresenter(NavigationContract.View view) { - this.view = view; - } - - void updateResumeState(boolean resumeState) { - this.resumeState = resumeState; - } - - void onRecenterClick() { - view.setSummaryBehaviorHideable(false); - view.setSummaryBehaviorState(BottomSheetBehavior.STATE_EXPANDED); - view.updateWayNameVisibility(true); - view.resetCameraPosition(); - view.hideRecenterBtn(); - } - - void onCameraTrackingDismissed() { - if (!view.isSummaryBottomSheetHidden()) { - view.setSummaryBehaviorHideable(true); - view.setSummaryBehaviorState(BottomSheetBehavior.STATE_HIDDEN); - view.updateWayNameVisibility(false); - } - } - - void onSummaryBottomSheetHidden() { - if (view.isSummaryBottomSheetHidden()) { - view.showRecenterBtn(); - } - } - - void onRouteUpdate(DirectionsRoute directionsRoute) { - view.drawRoute(directionsRoute); - if (resumeState && view.isRecenterButtonVisible()) { - view.updateCameraRouteOverview(); - } else { - view.startCamera(directionsRoute); - } - } - - void onDestinationUpdate(Point point) { - view.addMarker(point); - } - - void onNavigationLocationUpdate(Location location) { - if (resumeState && !view.isRecenterButtonVisible()) { - view.resumeCamera(location); - resumeState = false; - } - view.updateNavigationMap(location); - } - - void onWayNameChanged(@NonNull String wayName) { - if (TextUtils.isEmpty(wayName) || view.isSummaryBottomSheetHidden()) { - view.updateWayNameVisibility(false); - return; - } - view.updateWayNameView(wayName); - view.updateWayNameVisibility(true); - } - - void onNavigationStopped() { - view.updateWayNameVisibility(false); - } - - void onRouteOverviewClick() { - view.updateWayNameVisibility(false); - view.updateCameraRouteOverview(); - view.showRecenterBtn(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationUiOptions.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationUiOptions.java deleted file mode 100644 index 814bc493..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationUiOptions.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; - -public abstract class NavigationUiOptions { - - public abstract DirectionsRoute directionsRoute(); - - @Nullable - public abstract Integer lightThemeResId(); - - @Nullable - public abstract Integer darkThemeResId(); - - public abstract boolean shouldSimulateRoute(); - - public abstract boolean waynameChipEnabled(); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationView.java deleted file mode 100644 index 56824d7b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationView.java +++ /dev/null @@ -1,715 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.app.Activity; -import android.content.Context; -import android.content.res.Resources; -import android.location.Location; -import android.os.Bundle; -import android.util.AttributeSet; -import android.view.View; -import android.widget.ImageButton; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.core.view.ViewCompat; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleOwner; -import androidx.lifecycle.LifecycleRegistry; -import androidx.lifecycle.ViewModelProvider; - -import com.google.android.material.bottomsheet.BottomSheetBehavior; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.core.utils.TextUtils; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.location.modes.RenderMode; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera; -import com.mapbox.services.android.navigation.ui.v5.instruction.ImageCreator; -import com.mapbox.services.android.navigation.ui.v5.instruction.InstructionView; -import com.mapbox.services.android.navigation.ui.v5.instruction.NavigationAlertView; -import com.mapbox.services.android.navigation.ui.v5.map.NavigationMapboxMap; -import com.mapbox.services.android.navigation.ui.v5.map.NavigationMapboxMapInstanceState; -import com.mapbox.services.android.navigation.ui.v5.map.WayNameView; -import com.mapbox.services.android.navigation.ui.v5.summary.SummaryBottomSheet; -import com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions; -import com.mapbox.services.android.navigation.v5.navigation.NavigationTimeFormat; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; -import com.mapbox.services.android.navigation.v5.utils.LocaleUtils; - -/** - * View that creates the drop-in UI. - *

- * Once started, this view will check if the {@link Activity} that inflated - * it was launched with a {@link DirectionsRoute}. - *

- * Or, if not found, this view will look for a set of {@link Point} coordinates. - * In the latter case, a new {@link DirectionsRoute} will be retrieved from {@link NavigationRoute}. - *

- * Once valid data is obtained, this activity will immediately begin navigation - * with {@link MapboxNavigation}. - *

- * If launched with the simulation boolean set to true, a {@link ReplayRouteLocationEngine} - * will be initialized and begin pushing updates. - *

- * This activity requires user permissions ACCESS_FINE_LOCATION - * and ACCESS_COARSE_LOCATION have already been granted. - *

- * A Mapbox access token must also be set by the developer (to initialize navigation). - * - * @since 0.7.0 - */ -public class NavigationView extends CoordinatorLayout implements LifecycleOwner, OnMapReadyCallback, - NavigationContract.View { - - private static final String MAP_INSTANCE_STATE_KEY = "navgation_mapbox_map_instance_state"; - private static final int INVALID_STATE = 0; - private MapView mapView; - private InstructionView instructionView; - private SummaryBottomSheet summaryBottomSheet; - private BottomSheetBehavior summaryBehavior; - private ImageButton cancelBtn; - private RecenterButton recenterBtn; - private WayNameView wayNameView; - private ImageButton routeOverviewBtn; - - private NavigationPresenter navigationPresenter; - private NavigationViewEventDispatcher navigationViewEventDispatcher; - private NavigationViewModel navigationViewModel; - private NavigationMapboxMap navigationMap; - private OnNavigationReadyCallback onNavigationReadyCallback; - private NavigationOnCameraTrackingChangedListener onTrackingChangedListener; - private NavigationMapboxMapInstanceState mapInstanceState; - private CameraPosition initialMapCameraPosition; - private boolean isMapInitialized; - private boolean isSubscribed; - private LifecycleRegistry lifecycleRegistry; - - public NavigationView(Context context) { - this(context, null); - } - - public NavigationView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, -1); - } - - public NavigationView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - ThemeSwitcher.setTheme(context, attrs); - initializeView(); - } - - /** - * Uses savedInstanceState as a cue to restore state (if not null). - * - * @param savedInstanceState to restore state if not null - */ - public void onCreate(@Nullable Bundle savedInstanceState) { - mapView.onCreate(savedInstanceState); - updatePresenterState(savedInstanceState); - lifecycleRegistry = new LifecycleRegistry(this); - lifecycleRegistry.markState(Lifecycle.State.CREATED); - } - - /** - * Low memory must be reported so the {@link MapView} - * can react appropriately. - */ - public void onLowMemory() { - mapView.onLowMemory(); - } - - /** - * If the instruction list is showing and onBackPressed is called, - * hide the instruction list and do not hide the activity or fragment. - * - * @return true if back press handled, false if not - */ - public boolean onBackPressed() { - return instructionView.handleBackPressed(); - } - - /** - * Used to store the bottomsheet state and re-center - * button visibility. As well as anything the {@link MapView} - * needs to store in the bundle. - * - * @param outState to store state variables - */ - public void onSaveInstanceState(Bundle outState) { - int bottomSheetBehaviorState = summaryBehavior == null ? INVALID_STATE : summaryBehavior.getState(); - boolean isWayNameVisible = wayNameView.getVisibility() == VISIBLE; - NavigationViewInstanceState navigationViewInstanceState = new NavigationViewInstanceState( - bottomSheetBehaviorState, recenterBtn.getVisibility(), instructionView.isShowingInstructionList(), - isWayNameVisible, wayNameView.retrieveWayNameText(), navigationViewModel.isMuted()); - String instanceKey = getContext().getString(R.string.navigation_view_instance_state); - outState.putParcelable(instanceKey, navigationViewInstanceState); - outState.putBoolean(getContext().getString(R.string.navigation_running), navigationViewModel.isRunning()); - mapView.onSaveInstanceState(outState); - saveNavigationMapInstanceState(outState); - } - - /** - * Used to restore the bottomsheet state and re-center - * button visibility. As well as the {@link MapView} - * position prior to rotation. - * - * @param savedInstanceState to extract state variables - */ - public void onRestoreInstanceState(Bundle savedInstanceState) { - String instanceKey = getContext().getString(R.string.navigation_view_instance_state); - NavigationViewInstanceState navigationViewInstanceState = savedInstanceState.getParcelable(instanceKey); - recenterBtn.setVisibility(navigationViewInstanceState.getRecenterButtonVisibility()); - wayNameView.setVisibility(navigationViewInstanceState.isWayNameVisible() ? VISIBLE : INVISIBLE); - wayNameView.updateWayNameText(navigationViewInstanceState.getWayNameText()); - resetBottomSheetState(navigationViewInstanceState.getBottomSheetBehaviorState()); - updateInstructionListState(navigationViewInstanceState.isInstructionViewVisible()); - updateInstructionMutedState(navigationViewInstanceState.isMuted()); - mapInstanceState = savedInstanceState.getParcelable(MAP_INSTANCE_STATE_KEY); - } - - /** - * Called to ensure the {@link MapView} is destroyed - * properly. - *

- * In an {@link Activity} this should be in {@link Activity#onDestroy()}. - *

- * In a {@link Fragment}, this should - * be in {@link Fragment#onDestroyView()}. - */ - public void onDestroy() { - shutdown(); - lifecycleRegistry.markState(Lifecycle.State.DESTROYED); - } - - public void onStart() { - mapView.onStart(); - if (navigationMap != null) { - navigationMap.onStart(); - } - lifecycleRegistry.markState(Lifecycle.State.STARTED); - } - - public void onResume() { - mapView.onResume(); - lifecycleRegistry.markState(Lifecycle.State.RESUMED); - } - - public void onPause() { - mapView.onPause(); - } - - public void onStop() { - mapView.onStop(); - if (navigationMap != null) { - navigationMap.onStop(); - } - } - - @NonNull - @Override - public Lifecycle getLifecycle() { - return lifecycleRegistry; - } - - /** - * Fired after the map is ready, this is our cue to finish - * setting up the rest of the plugins / location engine. - *

- * Also, we check for launch data (coordinates or route). - * - * @param mapboxMap used for route, camera, and location UI - * @since 0.6.0 - */ - @Override - public void onMapReady(final MapboxMap mapboxMap) { - mapboxMap.setStyle(ThemeSwitcher.retrieveMapStyle(getContext()), new Style.OnStyleLoaded() { - @Override - public void onStyleLoaded(@NonNull Style style) { - initializeNavigationMap(mapView, mapboxMap); - initializeWayNameListener(); - onNavigationReadyCallback.onNavigationReady(navigationViewModel.isRunning()); - isMapInitialized = true; - } - }); - } - - @Override - public void setSummaryBehaviorState(int state) { - summaryBehavior.setState(state); - } - - @Override - public void setSummaryBehaviorHideable(boolean isHideable) { - summaryBehavior.setHideable(isHideable); - } - - @Override - public boolean isSummaryBottomSheetHidden() { - return summaryBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN; - } - - @Override - public void resetCameraPosition() { - if (navigationMap != null) { - navigationMap.resetPadding(); - navigationMap.resetCameraPositionWith(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS); - } - } - - @Override - public void showRecenterBtn() { - recenterBtn.show(); - } - - @Override - public void hideRecenterBtn() { - recenterBtn.hide(); - } - - @Override - public boolean isRecenterButtonVisible() { - return recenterBtn.getVisibility() == View.VISIBLE; - } - - @Override - public void drawRoute(DirectionsRoute directionsRoute) { - if (navigationMap != null) { - navigationMap.drawRoute(directionsRoute); - } - } - - @Override - public void addMarker(Point position) { - if (navigationMap != null) { - navigationMap.addDestinationMarker(position); - } - } - - /** - * Provides the current visibility of the way name view. - * - * @return true if visible, false if not visible - */ - public boolean isWayNameVisible() { - return wayNameView.getVisibility() == VISIBLE; - } - - /** - * Updates the text of the way name view below the - * navigation icon. - *

- * If you'd like to use this method without being overridden by the default way names - * values we provide, please disabled auto-query with - * {@link NavigationMapboxMap#updateWaynameQueryMap(boolean)}. - * - * @param wayName to update the view - */ - @Override - public void updateWayNameView(@NonNull String wayName) { - wayNameView.updateWayNameText(wayName); - } - - /** - * Updates the visibility of the way name view that is show below - * the navigation icon. - *

- * If you'd like to use this method without being overridden by the default visibility values - * values we provide, please disabled auto-query with - * {@link NavigationMapboxMap#updateWaynameQueryMap(boolean)}. - * - * @param isVisible true to show, false to hide - */ - @Override - public void updateWayNameVisibility(boolean isVisible) { - if (TextUtils.isEmpty(wayNameView.retrieveWayNameText())) { - isVisible = false; - } - wayNameView.updateVisibility(isVisible); - if (navigationMap != null) { - navigationMap.updateWaynameQueryMap(isVisible); - } - } - - /** - * Used when starting this {@link android.app.Activity} - * for the first time. - *

- * Zooms to the beginning of the {@link DirectionsRoute}. - * - * @param directionsRoute where camera should move to - */ - @Override - public void startCamera(DirectionsRoute directionsRoute) { - if (navigationMap != null) { - navigationMap.startCamera(directionsRoute); - } - } - - /** - * Used after configuration changes to resume the camera - * to the last location update from the Navigation SDK. - * - * @param location where the camera should move to - */ - @Override - public void resumeCamera(Location location) { - if (navigationMap != null) { - navigationMap.resumeCamera(location); - } - } - - @Override - public void updateNavigationMap(Location location) { - if (navigationMap != null) { - navigationMap.updateLocation(location); - } - } - - @Override - public void updateCameraRouteOverview() { - if (navigationMap != null) { - int[] padding = buildRouteOverviewPadding(getContext()); - navigationMap.showRouteOverview(padding); - } - } - - /** - * Should be called when this view is completely initialized. - * - * @param options with containing route / coordinate data - */ - public void startNavigation(NavigationViewOptions options) { - initializeNavigation(options); - } - - /** - * Call this when the navigation session needs to end navigation without finishing the whole view - * - * @since 0.16.0 - */ - public void stopNavigation() { - navigationPresenter.onNavigationStopped(); - navigationViewModel.stopNavigation(); - } - - /** - * Should be called after {@link NavigationView#onCreate(Bundle)}. - *

- * This method adds the {@link OnNavigationReadyCallback}, - * which will fire the ready events for this view. - * - * @param onNavigationReadyCallback to be set to this view - */ - public void initialize(OnNavigationReadyCallback onNavigationReadyCallback) { - this.onNavigationReadyCallback = onNavigationReadyCallback; - if (!isMapInitialized) { - mapView.getMapAsync(this); - } else { - onNavigationReadyCallback.onNavigationReady(navigationViewModel.isRunning()); - } - } - - /** - * Should be called after {@link NavigationView#onCreate(Bundle)}. - *

- * This method adds the {@link OnNavigationReadyCallback}, - * which will fire the ready events for this view. - *

- * This method also accepts a {@link CameraPosition} that will be set as soon as the map is - * ready. Note, this position is ignored during rotation in favor of the last known map position. - * - * @param onNavigationReadyCallback to be set to this view - * @param initialMapCameraPosition to be shown once the map is ready - */ - public void initialize(OnNavigationReadyCallback onNavigationReadyCallback, - @NonNull CameraPosition initialMapCameraPosition) { - this.onNavigationReadyCallback = onNavigationReadyCallback; - this.initialMapCameraPosition = initialMapCameraPosition; - if (!isMapInitialized) { - mapView.getMapAsync(this); - } else { - onNavigationReadyCallback.onNavigationReady(navigationViewModel.isRunning()); - } - } - - /** - * Gives the ability to manipulate the map directly for anything that might not currently be - * supported. This returns null until the view is initialized. - *

- * The {@link NavigationMapboxMap} gives direct access to the map UI (location marker, route, etc.). - * - * @return navigation mapbox map object, or null if view has not been initialized - */ - @Nullable - public NavigationMapboxMap retrieveNavigationMapboxMap() { - return navigationMap; - } - - /** - * Returns the instance of {@link MapboxNavigation} powering the {@link NavigationView} - * once navigation has started. Will return null if navigation has not been started with - * {@link NavigationView#startNavigation(NavigationViewOptions)}. - * - * @return mapbox navigation, or null if navigation has not started - */ - @Nullable - public MapboxNavigation retrieveMapboxNavigation() { - return navigationViewModel.retrieveNavigation(); - } - - /** - * Returns the sound button used for muting instructions - * - * @return sound button - */ - public NavigationButton retrieveSoundButton() { - return instructionView.retrieveSoundButton(); - } - - - /** - * Returns the re-center button for recentering on current location - * - * @return recenter button - */ - public NavigationButton retrieveRecenterButton() { - return recenterBtn; - } - - /** - * Returns the {@link NavigationAlertView} that is shown during off-route events with - * "Report a Problem" text. - * - * @return alert view that is used in the instruction view - */ - public NavigationAlertView retrieveAlertView() { - return instructionView.retrieveAlertView(); - } - - private void initializeView() { - inflate(getContext(), R.layout.navigation_view_layout, this); - bind(); - initializeNavigationViewModel(); - initializeNavigationEventDispatcher(); - initializeNavigationPresenter(); - initializeInstructionListListener(); - initializeSummaryBottomSheet(); - } - - private void bind() { - mapView = findViewById(R.id.navigationMapView); - instructionView = findViewById(R.id.instructionView); - ViewCompat.setElevation(instructionView, 10); - summaryBottomSheet = findViewById(R.id.summaryBottomSheet); - cancelBtn = findViewById(R.id.cancelBtn); - recenterBtn = findViewById(R.id.recenterBtn); - wayNameView = findViewById(R.id.wayNameView); - routeOverviewBtn = findViewById(R.id.routeOverviewBtn); - } - - private void initializeNavigationViewModel() { - try { - navigationViewModel = new ViewModelProvider((FragmentActivity) getContext()).get(NavigationViewModel.class); - } catch (ClassCastException exception) { - throw new ClassCastException("Please ensure that the provided Context is a valid FragmentActivity"); - } - } - - private void initializeSummaryBottomSheet() { - summaryBehavior = BottomSheetBehavior.from(summaryBottomSheet); - summaryBehavior.setHideable(false); - summaryBehavior.setBottomSheetCallback(new SummaryBottomSheetCallback(navigationPresenter, - navigationViewEventDispatcher)); - } - - private void initializeNavigationEventDispatcher() { - navigationViewEventDispatcher = new NavigationViewEventDispatcher(); - navigationViewModel.initializeEventDispatcher(navigationViewEventDispatcher); - } - - private void initializeInstructionListListener() { - instructionView.setInstructionListListener(new NavigationInstructionListListener(navigationPresenter, - navigationViewEventDispatcher)); - } - - private void initializeNavigationMap(MapView mapView, MapboxMap map) { - if (initialMapCameraPosition != null) { - map.setCameraPosition(initialMapCameraPosition); - } - navigationMap = new NavigationMapboxMap(mapView, map); - navigationMap.updateLocationLayerRenderMode(RenderMode.GPS); - if (mapInstanceState != null) { - navigationMap.restoreFrom(mapInstanceState); - return; - } - } - - private void initializeWayNameListener() { - NavigationViewWayNameListener wayNameListener = new NavigationViewWayNameListener(navigationPresenter); - navigationMap.addOnWayNameChangedListener(wayNameListener); - } - - private void saveNavigationMapInstanceState(Bundle outState) { - if (navigationMap != null) { - navigationMap.saveStateWith(MAP_INSTANCE_STATE_KEY, outState); - } - } - - private void resetBottomSheetState(int bottomSheetState) { - if (bottomSheetState > INVALID_STATE) { - boolean isShowing = bottomSheetState == BottomSheetBehavior.STATE_EXPANDED; - summaryBehavior.setHideable(!isShowing); - summaryBehavior.setState(bottomSheetState); - } - } - - private void updateInstructionListState(boolean visible) { - if (visible) { - instructionView.showInstructionList(); - } else { - instructionView.hideInstructionList(); - } - } - - private void updateInstructionMutedState(boolean isMuted) { - if (isMuted) { - ((SoundButton) instructionView.retrieveSoundButton()).soundFabOff(); - } - } - - private int[] buildRouteOverviewPadding(Context context) { - Resources resources = context.getResources(); - int leftRightPadding = (int) resources.getDimension(R.dimen.route_overview_left_right_padding); - int paddingBuffer = (int) resources.getDimension(R.dimen.route_overview_buffer_padding); - int instructionHeight = (int) (resources.getDimension(R.dimen.instruction_layout_height) + paddingBuffer); - int summaryHeight = (int) resources.getDimension(R.dimen.summary_bottomsheet_height); - return new int[] {leftRightPadding, instructionHeight, leftRightPadding, summaryHeight}; - } - - private boolean isChangingConfigurations() { - try { - return ((FragmentActivity) getContext()).isChangingConfigurations(); - } catch (ClassCastException exception) { - throw new ClassCastException("Please ensure that the provided Context is a valid FragmentActivity"); - } - } - - private void initializeNavigationPresenter() { - navigationPresenter = new NavigationPresenter(this); - } - - private void updatePresenterState(@Nullable Bundle savedInstanceState) { - if (savedInstanceState != null) { - String navigationRunningKey = getContext().getString(R.string.navigation_running); - boolean resumeState = savedInstanceState.getBoolean(navigationRunningKey); - navigationPresenter.updateResumeState(resumeState); - } - } - - private void initializeNavigation(NavigationViewOptions options) { - establish(options); - navigationViewModel.initialize(options); - initializeNavigationListeners(options, navigationViewModel); - setupNavigationMapboxMap(options); - - if (!isSubscribed) { - initializeClickListeners(); - initializeOnCameraTrackingChangedListener(); - subscribeViewModels(); - } - } - - private void initializeClickListeners() { - cancelBtn.setOnClickListener(new CancelBtnClickListener(navigationViewEventDispatcher)); - recenterBtn.addOnClickListener(new RecenterBtnClickListener(navigationPresenter)); - routeOverviewBtn.setOnClickListener(new RouteOverviewBtnClickListener(navigationPresenter)); - } - - private void initializeOnCameraTrackingChangedListener() { - onTrackingChangedListener = new NavigationOnCameraTrackingChangedListener(navigationPresenter, summaryBehavior); - navigationMap.addOnCameraTrackingChangedListener(onTrackingChangedListener); - } - - private void establish(NavigationViewOptions options) { - LocaleUtils localeUtils = new LocaleUtils(); - establishDistanceFormatter(localeUtils, options); - establishTimeFormat(options); - } - - private void establishDistanceFormatter(LocaleUtils localeUtils, NavigationViewOptions options) { - String unitType = establishUnitType(localeUtils, options); - String language = establishLanguage(localeUtils, options); - int roundingIncrement = establishRoundingIncrement(options); - DistanceFormatter distanceFormatter = new DistanceFormatter(getContext(), language, unitType, roundingIncrement); - - instructionView.setDistanceFormatter(distanceFormatter); - summaryBottomSheet.setDistanceFormatter(distanceFormatter); - } - - private int establishRoundingIncrement(NavigationViewOptions navigationViewOptions) { - MapboxNavigationOptions mapboxNavigationOptions = navigationViewOptions.navigationOptions(); - return mapboxNavigationOptions.roundingIncrement(); - } - - private String establishLanguage(LocaleUtils localeUtils, NavigationViewOptions options) { - return localeUtils.getNonEmptyLanguage(getContext(), options.directionsRoute().voiceLanguage()); - } - - private String establishUnitType(LocaleUtils localeUtils, NavigationViewOptions options) { - RouteOptions routeOptions = options.directionsRoute().routeOptions(); - String voiceUnits = routeOptions == null ? null : routeOptions.voiceUnits(); - return localeUtils.retrieveNonNullUnitType(getContext(), voiceUnits); - } - - private void establishTimeFormat(NavigationViewOptions options) { - @NavigationTimeFormat.Type - int timeFormatType = options.navigationOptions().timeFormatType(); - summaryBottomSheet.setTimeFormat(timeFormatType); - } - - private void initializeNavigationListeners(NavigationViewOptions options, NavigationViewModel navigationViewModel) { - navigationMap.addProgressChangeListener(navigationViewModel.retrieveNavigation()); - navigationViewEventDispatcher.initializeListeners(options, navigationViewModel); - } - - private void setupNavigationMapboxMap(NavigationViewOptions options) { - navigationMap.updateWaynameQueryMap(options.waynameChipEnabled()); - } - - /** - * Subscribes the {@link InstructionView} and {@link SummaryBottomSheet} to the {@link NavigationViewModel}. - *

- * Then, creates an instance of {@link NavigationViewSubscriber}, which takes a presenter. - *

- * The subscriber then subscribes to the view models, setting up the appropriate presenter / listener - * method calls based on the {@link androidx.lifecycle.LiveData} updates. - */ - private void subscribeViewModels() { - instructionView.subscribe(this, navigationViewModel); - summaryBottomSheet.subscribe(this, navigationViewModel); - - new NavigationViewSubscriber(this, navigationViewModel, navigationPresenter).subscribe(); - isSubscribed = true; - } - - private void shutdown() { - if (navigationMap != null) { - navigationMap.removeOnCameraTrackingChangedListener(onTrackingChangedListener); - } - navigationViewEventDispatcher.onDestroy(navigationViewModel.retrieveNavigation()); - mapView.onDestroy(); - navigationViewModel.onDestroy(isChangingConfigurations()); - ImageCreator.getInstance().shutdown(); - navigationMap = null; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcher.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcher.java deleted file mode 100644 index fc3460a7..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcher.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - - -import android.view.View; - -import androidx.annotation.Nullable; - -import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCallback; -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.ui.v5.listeners.BannerInstructionsListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.InstructionListListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.NavigationListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.RouteListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.SpeechAnnouncementListener; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechAnnouncement; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; - -/** - * In charge of holding any {@link NavigationView} related listeners {@link NavigationListener}, - * {@link RouteListener} and firing listener events when - * triggered by the {@link NavigationView}. - */ -class NavigationViewEventDispatcher { - - private ProgressChangeListener progressChangeListener; - private MilestoneEventListener milestoneEventListener; - private NavigationListener navigationListener; - private RouteListener routeListener; - private BottomSheetCallback bottomSheetCallback; - private InstructionListListener instructionListListener; - private SpeechAnnouncementListener speechAnnouncementListener; - private BannerInstructionsListener bannerInstructionsListener; - - /** - * Initializes the listeners in the dispatcher, as well as the listeners in the {@link MapboxNavigation} - * - * @param navigationViewOptions that contains all listeners to attach - */ - void initializeListeners(NavigationViewOptions navigationViewOptions, NavigationViewModel navigationViewModel) { - assignNavigationListener(navigationViewOptions.navigationListener(), navigationViewModel); - assignRouteListener(navigationViewOptions.routeListener()); - assignBottomSheetCallback(navigationViewOptions.bottomSheetCallback()); - MapboxNavigation navigation = navigationViewModel.retrieveNavigation(); - assignProgressChangeListener(navigationViewOptions, navigation); - assignMilestoneEventListener(navigationViewOptions, navigation); - assignInstructionListListener(navigationViewOptions.instructionListListener()); - assignSpeechAnnouncementListener(navigationViewOptions.speechAnnouncementListener()); - assignBannerInstructionsListener(navigationViewOptions.bannerInstructionsListener()); - } - - void onDestroy(@Nullable MapboxNavigation navigation) { - if (navigation != null) { - removeProgressChangeListener(navigation); - removeMilestoneEventListener(navigation); - } - } - - void assignNavigationListener(@Nullable NavigationListener navigationListener, - NavigationViewModel navigationViewModel) { - this.navigationListener = navigationListener; - if (navigationListener != null && navigationViewModel.isRunning()) { - navigationListener.onNavigationRunning(); - } - } - - void assignRouteListener(@Nullable RouteListener routeListener) { - this.routeListener = routeListener; - } - - void assignBottomSheetCallback(@Nullable BottomSheetCallback bottomSheetCallback) { - this.bottomSheetCallback = bottomSheetCallback; - } - - void assignInstructionListListener(@Nullable InstructionListListener instructionListListener) { - this.instructionListListener = instructionListListener; - } - - void assignSpeechAnnouncementListener(@Nullable SpeechAnnouncementListener speechAnnouncementListener) { - this.speechAnnouncementListener = speechAnnouncementListener; - } - - void assignBannerInstructionsListener(@Nullable BannerInstructionsListener bannerInstructionsListener) { - this.bannerInstructionsListener = bannerInstructionsListener; - } - - - void onNavigationFinished() { - if (navigationListener != null) { - navigationListener.onNavigationFinished(); - } - } - - void onCancelNavigation() { - if (navigationListener != null) { - navigationListener.onCancelNavigation(); - } - } - - void onNavigationRunning() { - if (navigationListener != null) { - navigationListener.onNavigationRunning(); - } - } - - boolean allowRerouteFrom(Point point) { - return routeListener == null || routeListener.allowRerouteFrom(point); - } - - void onOffRoute(Point point) { - if (routeListener != null) { - routeListener.onOffRoute(point); - } - } - - void onRerouteAlong(DirectionsRoute directionsRoute) { - if (routeListener != null) { - routeListener.onRerouteAlong(directionsRoute); - } - } - - void onFailedReroute(String errorMessage) { - if (routeListener != null) { - routeListener.onFailedReroute(errorMessage); - } - } - - void onArrival() { - if (routeListener != null) { - routeListener.onArrival(); - } - } - - void onBottomSheetStateChanged(View bottomSheet, int newState) { - if (bottomSheetCallback != null) { - bottomSheetCallback.onStateChanged(bottomSheet, newState); - } - } - - void onInstructionListVisibilityChanged(boolean shown) { - if (instructionListListener != null) { - instructionListListener.onInstructionListVisibilityChanged(shown); - } - } - - SpeechAnnouncement onAnnouncement(SpeechAnnouncement announcement) { - if (speechAnnouncementListener != null) { - return speechAnnouncementListener.willVoice(announcement); - } - return announcement; - } - - BannerInstructions onBannerDisplay(BannerInstructions instructions) { - if (bannerInstructionsListener != null) { - return bannerInstructionsListener.willDisplay(instructions); - } - return instructions; - } - - private void assignProgressChangeListener(NavigationViewOptions navigationViewOptions, MapboxNavigation navigation) { - this.progressChangeListener = navigationViewOptions.progressChangeListener(); - if (progressChangeListener != null) { - navigation.addProgressChangeListener(progressChangeListener); - } - } - - private void assignMilestoneEventListener(NavigationViewOptions navigationViewOptions, MapboxNavigation navigation) { - this.milestoneEventListener = navigationViewOptions.milestoneEventListener(); - if (milestoneEventListener != null) { - navigation.addMilestoneEventListener(milestoneEventListener); - } - } - - private void removeMilestoneEventListener(MapboxNavigation navigation) { - if (milestoneEventListener != null) { - navigation.removeMilestoneEventListener(milestoneEventListener); - } - } - - private void removeProgressChangeListener(MapboxNavigation navigation) { - if (progressChangeListener != null) { - navigation.removeProgressChangeListener(progressChangeListener); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewInstanceState.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewInstanceState.java deleted file mode 100644 index 5332cbf5..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewInstanceState.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.os.Parcel; -import android.os.Parcelable; - -class NavigationViewInstanceState implements Parcelable { - - private int bottomSheetBehaviorState; - private int recenterButtonVisibility; - private boolean instructionViewVisible; - private boolean isWayNameVisible; - private boolean isMuted; - private String wayNameText; - - NavigationViewInstanceState(int bottomSheetBehaviorState, int recenterButtonVisibility, - boolean instructionViewVisible, boolean isWayNameVisible, String wayNameText, - boolean isMuted) { - this.bottomSheetBehaviorState = bottomSheetBehaviorState; - this.recenterButtonVisibility = recenterButtonVisibility; - this.instructionViewVisible = instructionViewVisible; - this.isWayNameVisible = isWayNameVisible; - this.wayNameText = wayNameText; - this.isMuted = isMuted; - } - - int getBottomSheetBehaviorState() { - return bottomSheetBehaviorState; - } - - int getRecenterButtonVisibility() { - return recenterButtonVisibility; - } - - boolean isInstructionViewVisible() { - return instructionViewVisible; - } - - boolean isWayNameVisible() { - return isWayNameVisible; - } - - String getWayNameText() { - return wayNameText; - } - - boolean isMuted() { - return isMuted; - } - - private NavigationViewInstanceState(Parcel in) { - bottomSheetBehaviorState = in.readInt(); - recenterButtonVisibility = in.readInt(); - instructionViewVisible = in.readByte() != 0; - isWayNameVisible = in.readByte() != 0; - isMuted = in.readByte() != 0; - wayNameText = in.readString(); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(bottomSheetBehaviorState); - dest.writeInt(recenterButtonVisibility); - dest.writeByte((byte) (instructionViewVisible ? 1 : 0)); - dest.writeByte((byte) (isWayNameVisible ? 1 : 0)); - dest.writeByte((byte) (isMuted ? 1 : 0)); - dest.writeString(wayNameText); - } - - @Override - public int describeContents() { - return 0; - } - - public static final Creator CREATOR = new Creator() { - @Override - public NavigationViewInstanceState createFromParcel(Parcel in) { - return new NavigationViewInstanceState(in); - } - - @Override - public NavigationViewInstanceState[] newArray(int size) { - return new NavigationViewInstanceState[size]; - } - }; -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModel.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModel.java deleted file mode 100644 index 230cfa07..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModel.java +++ /dev/null @@ -1,464 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.app.Application; -import android.content.Context; -import android.location.Location; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.lifecycle.AndroidViewModel; -import androidx.lifecycle.MutableLiveData; - -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.ui.v5.camera.DynamicCamera; -import com.mapbox.services.android.navigation.ui.v5.instruction.BannerInstructionModel; -import com.mapbox.services.android.navigation.ui.v5.instruction.InstructionModel; -import com.mapbox.services.android.navigation.ui.v5.route.MapboxRouteFetcher; -import com.mapbox.services.android.navigation.ui.v5.summary.SummaryModel; -import com.mapbox.services.android.navigation.ui.v5.voice.NavigationSpeechPlayer; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechAnnouncement; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayer; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayerProvider; -import com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.milestone.VoiceInstructionMilestone; -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions; -import com.mapbox.services.android.navigation.v5.navigation.NavigationEventListener; -import com.mapbox.services.android.navigation.v5.navigation.NavigationTimeFormat; -import com.mapbox.services.android.navigation.v5.navigation.camera.Camera; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener; -import com.mapbox.services.android.navigation.v5.route.FasterRouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; -import com.mapbox.services.android.navigation.v5.utils.LocaleUtils; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -import org.jetbrains.annotations.TestOnly; - -import java.util.List; - -public class NavigationViewModel extends AndroidViewModel { - - private static final String EMPTY_STRING = ""; - private static final String OKHTTP_INSTRUCTION_CACHE = "okhttp-instruction-cache"; - private static final long TEN_MEGABYTE_CACHE_SIZE = 10 * 1024 * 1024; - - public final MutableLiveData instructionModel = new MutableLiveData<>(); - public final MutableLiveData bannerInstructionModel = new MutableLiveData<>(); - public final MutableLiveData summaryModel = new MutableLiveData<>(); - public final MutableLiveData isOffRoute = new MutableLiveData<>(); - private final MutableLiveData navigationLocation = new MutableLiveData<>(); - private final MutableLiveData route = new MutableLiveData<>(); - private final MutableLiveData shouldRecordScreenshot = new MutableLiveData<>(); - private final MutableLiveData destination = new MutableLiveData<>(); - - private MapboxNavigation navigation; - private NavigationViewRouter router; - private LocationEngineConductor locationEngineConductor; - private NavigationViewEventDispatcher navigationViewEventDispatcher; - private SpeechPlayer speechPlayer; - private int voiceInstructionsToAnnounce = 0; - private RouteProgress routeProgress; - - Milestone milestone; - private String language; - private RouteUtils routeUtils; - private LocaleUtils localeUtils; - private DistanceFormatter distanceFormatter; - @NavigationTimeFormat.Type - private int timeFormatType; - private boolean isRunning; - private boolean isChangingConfigurations; - private MapConnectivityController connectivityController; - - public NavigationViewModel(Application application) { - super(application); - initializeLocationEngine(); - initializeRouter(); - this.routeUtils = new RouteUtils(); - this.localeUtils = new LocaleUtils(); - this.connectivityController = new MapConnectivityController(); - } - - @TestOnly - // Package private (no modifier) for testing purposes - NavigationViewModel(Application application, MapboxNavigation navigation, - MapConnectivityController connectivityController, - NavigationViewRouter router) { - super(application); - this.navigation = navigation; - this.router = router; - this.connectivityController = connectivityController; - } - - @TestOnly - // Package private (no modifier) for testing purposes - NavigationViewModel(Application application, MapboxNavigation navigation, - LocationEngineConductor conductor, NavigationViewEventDispatcher dispatcher, SpeechPlayer speechPlayer) { - super(application); - this.navigation = navigation; - this.locationEngineConductor = conductor; - this.navigationViewEventDispatcher = dispatcher; - this.speechPlayer = speechPlayer; - } - - @Override - protected void onCleared() { - super.onCleared(); - destroyRouter(); - } - - public void onDestroy(boolean isChangingConfigurations) { - this.isChangingConfigurations = isChangingConfigurations; - if (!isChangingConfigurations) { - endNavigation(); - deactivateInstructionPlayer(); - isRunning = false; - } - clearDynamicCameraMap(); - navigationViewEventDispatcher = null; - } - - public void setMuted(boolean isMuted) { - speechPlayer.setMuted(isMuted); - } - - - /** - * Returns the current instance of {@link MapboxNavigation}. - *

- * Will be null if navigation has not been initialized. - */ - @Nullable - public MapboxNavigation retrieveNavigation() { - return navigation; - } - - void initializeEventDispatcher(NavigationViewEventDispatcher navigationViewEventDispatcher) { - this.navigationViewEventDispatcher = navigationViewEventDispatcher; - } - - /** - * This method will pass {@link MapboxNavigationOptions} from the {@link NavigationViewOptions} - * to this view model to be used to initialize {@link MapboxNavigation}. - * - * @param options to init MapboxNavigation - */ - void initialize(NavigationViewOptions options) { - MapboxNavigationOptions navigationOptions = options.navigationOptions(); - navigationOptions = navigationOptions.toBuilder().isFromNavigationUi(true).build(); - initializeLanguage(options); - initializeTimeFormat(navigationOptions); - initializeDistanceFormatter(options); - if (!isRunning()) { - LocationEngine locationEngine = initializeLocationEngineFrom(options); - initializeNavigation(getApplication(), navigationOptions, locationEngine); - addMilestones(options); - initializeNavigationSpeechPlayer(options); - } - router.extractRouteOptions(options); - } - - boolean isRunning() { - return isRunning; - } - - boolean isMuted() { - if (speechPlayer == null) { - return false; - } - return speechPlayer.isMuted(); - } - - void stopNavigation() { - navigation.removeProgressChangeListener(null); - navigation.removeMilestoneEventListener(null); - navigation.stopNavigation(); - } - - boolean isOffRoute() { - try { - return isOffRoute.getValue(); - } catch (NullPointerException exception) { - return false; - } - } - - void updateRoute(DirectionsRoute route) { - this.route.setValue(route); - if (!isChangingConfigurations) { - startNavigation(route); - updateReplayEngine(route); - sendEventOnRerouteAlong(route); - isOffRoute.setValue(false); - } - resetConfigurationFlag(); - } - - void updateRouteProgress(RouteProgress routeProgress) { - this.routeProgress = routeProgress; - sendEventArrival(routeProgress, milestone); - instructionModel.setValue(new InstructionModel(distanceFormatter, routeProgress)); - summaryModel.setValue(new SummaryModel(getApplication(), distanceFormatter, routeProgress, timeFormatType)); - } - - void updateLocation(Location location) { - router.updateLocation(location); - navigationLocation.setValue(location); - } - - void sendEventFailedReroute(String errorMessage) { - if (navigationViewEventDispatcher != null) { - navigationViewEventDispatcher.onFailedReroute(errorMessage); - } - } - - MutableLiveData retrieveNavigationLocation() { - return navigationLocation; - } - - MutableLiveData retrieveRoute() { - return route; - } - - MutableLiveData retrieveDestination() { - return destination; - } - - MutableLiveData retrieveShouldRecordScreenshot() { - return shouldRecordScreenshot; - } - - private void initializeRouter() { - MapboxRouteFetcher onlineRouter = new MapboxRouteFetcher(getApplication()); - Context applicationContext = getApplication().getApplicationContext(); - ConnectivityStatusProvider connectivityStatus = new ConnectivityStatusProvider(applicationContext); - router = new NavigationViewRouter(onlineRouter, connectivityStatus, routeEngineListener); - } - - private void initializeLocationEngine() { - locationEngineConductor = new LocationEngineConductor(); - } - - private void initializeLanguage(NavigationUiOptions options) { - RouteOptions routeOptions = options.directionsRoute().routeOptions(); - language = localeUtils.inferDeviceLanguage(getApplication()); - if (routeOptions != null) { - language = routeOptions.language(); - } - } - - private String initializeUnitType(NavigationUiOptions options) { - RouteOptions routeOptions = options.directionsRoute().routeOptions(); - String unitType = localeUtils.getUnitTypeForDeviceLocale(getApplication()); - if (routeOptions != null) { - unitType = routeOptions.voiceUnits(); - } - return unitType; - } - - private void initializeTimeFormat(MapboxNavigationOptions options) { - timeFormatType = options.timeFormatType(); - } - - private int initializeRoundingIncrement(NavigationViewOptions options) { - MapboxNavigationOptions navigationOptions = options.navigationOptions(); - return navigationOptions.roundingIncrement(); - } - - private void initializeDistanceFormatter(NavigationViewOptions options) { - String unitType = initializeUnitType(options); - int roundingIncrement = initializeRoundingIncrement(options); - distanceFormatter = new DistanceFormatter(getApplication(), language, unitType, roundingIncrement); - } - - private void initializeNavigationSpeechPlayer(NavigationViewOptions options) { - SpeechPlayer speechPlayer = options.speechPlayer(); - if (speechPlayer != null) { - this.speechPlayer = speechPlayer; - return; - } - boolean isVoiceLanguageSupported = options.directionsRoute().voiceLanguage() != null; - SpeechPlayerProvider speechPlayerProvider = initializeSpeechPlayerProvider(isVoiceLanguageSupported); - this.speechPlayer = new NavigationSpeechPlayer(speechPlayerProvider); - } - - @NonNull - private SpeechPlayerProvider initializeSpeechPlayerProvider(boolean voiceLanguageSupported) { - return new SpeechPlayerProvider(getApplication(), language, voiceLanguageSupported); - } - - private LocationEngine initializeLocationEngineFrom(NavigationViewOptions options) { - LocationEngine locationEngine = options.locationEngine(); - boolean shouldReplayRoute = options.shouldSimulateRoute(); - locationEngineConductor.initializeLocationEngine(getApplication(), locationEngine, shouldReplayRoute); - return locationEngineConductor.obtainLocationEngine(); - } - - private void initializeNavigation(Context context, MapboxNavigationOptions options, LocationEngine locationEngine) { - navigation = new MapboxNavigation(context, options, locationEngine); - addNavigationListeners(); - } - - private void addNavigationListeners() { - navigation.addProgressChangeListener(new NavigationViewModelProgressChangeListener(this)); - navigation.addOffRouteListener(offRouteListener); - navigation.addMilestoneEventListener(milestoneEventListener); - navigation.addNavigationEventListener(navigationEventListener); - navigation.addFasterRouteListener(fasterRouteListener); - } - - private void addMilestones(NavigationViewOptions options) { - List milestones = options.milestones(); - if (milestones != null && !milestones.isEmpty()) { - navigation.addMilestones(milestones); - } - } - - private OffRouteListener offRouteListener = new OffRouteListener() { - @Override - public void userOffRoute(Location location) { - speechPlayer.onOffRoute(); - Point newOrigin = Point.fromLngLat(location.getLongitude(), location.getLatitude()); - handleOffRouteEvent(newOrigin); - } - }; - - private MilestoneEventListener milestoneEventListener = (routeProgress, instruction, milestone) -> { - NavigationViewModel.this.milestone = milestone; - playVoiceAnnouncement(milestone); - updateBannerInstruction(routeProgress, milestone); - sendEventArrival(routeProgress, milestone); - }; - - private NavigationEventListener navigationEventListener = isRunning -> { - NavigationViewModel.this.isRunning = isRunning; - sendNavigationStatusEvent(isRunning); - }; - - private FasterRouteListener fasterRouteListener = directionsRoute -> updateRoute(directionsRoute); - - private ViewRouteListener routeEngineListener = new NavigationViewRouteEngineListener(this); - - private void startNavigation(DirectionsRoute route) { - if (route != null) { - navigation.startNavigation(route); - voiceInstructionsToAnnounce = 0; - } - } - - private void updateReplayEngine(DirectionsRoute route) { - if (locationEngineConductor.updateSimulatedRoute(route)) { - LocationEngine replayEngine = locationEngineConductor.obtainLocationEngine(); - navigation.setLocationEngine(replayEngine); - } - } - - private void destroyRouter() { - if (router != null) { - router.onDestroy(); - } - } - - private void endNavigation() { - if (navigation != null) { - navigation.onDestroy(); - } - } - - private void clearDynamicCameraMap() { - if (navigation != null) { - Camera cameraEngine = navigation.getCameraEngine(); - boolean isDynamicCamera = cameraEngine instanceof DynamicCamera; - if (isDynamicCamera) { - ((DynamicCamera) cameraEngine).clearMap(); - } - } - } - - private void deactivateInstructionPlayer() { - if (speechPlayer != null) { - speechPlayer.onDestroy(); - } - } - - private void playVoiceAnnouncement(Milestone milestone) { - if (milestone instanceof VoiceInstructionMilestone) { - voiceInstructionsToAnnounce++; - SpeechAnnouncement announcement = SpeechAnnouncement.builder() - .voiceInstructionMilestone((VoiceInstructionMilestone) milestone).build(); - announcement = retrieveAnnouncementFromSpeechEvent(announcement); - speechPlayer.play(announcement); - } - } - - private void updateBannerInstruction(RouteProgress routeProgress, Milestone milestone) { - if (milestone instanceof BannerInstructionMilestone) { - BannerInstructions instructions = ((BannerInstructionMilestone) milestone).getBannerInstructions(); - instructions = retrieveInstructionsFromBannerEvent(instructions); - if (instructions != null) { - BannerInstructionModel model = new BannerInstructionModel(distanceFormatter, routeProgress, instructions); - bannerInstructionModel.setValue(model); - } - } - } - - private void sendEventArrival(RouteProgress routeProgress, Milestone milestone) { - if (milestone == null || routeProgress == null) { - return; - } - if (navigationViewEventDispatcher != null && routeUtils.isArrivalEvent(routeProgress, milestone)) { - navigationViewEventDispatcher.onArrival(); - } - } - - private void handleOffRouteEvent(Point newOrigin) { - if (navigationViewEventDispatcher != null && navigationViewEventDispatcher.allowRerouteFrom(newOrigin)) { - navigationViewEventDispatcher.onOffRoute(newOrigin); - router.findRouteFrom(routeProgress); - isOffRoute.setValue(true); - } - } - - private void sendNavigationStatusEvent(boolean isRunning) { - if (navigationViewEventDispatcher != null) { - if (isRunning) { - navigationViewEventDispatcher.onNavigationRunning(); - } else { - navigationViewEventDispatcher.onNavigationFinished(); - } - } - } - - private void sendEventOnRerouteAlong(DirectionsRoute route) { - if (navigationViewEventDispatcher != null && isOffRoute()) { - navigationViewEventDispatcher.onRerouteAlong(route); - } - } - - private void resetConfigurationFlag() { - if (isChangingConfigurations) { - isChangingConfigurations = false; - } - } - - private SpeechAnnouncement retrieveAnnouncementFromSpeechEvent(SpeechAnnouncement announcement) { - if (navigationViewEventDispatcher != null) { - announcement = navigationViewEventDispatcher.onAnnouncement(announcement); - } - return announcement; - } - - private BannerInstructions retrieveInstructionsFromBannerEvent(BannerInstructions instructions) { - if (navigationViewEventDispatcher != null) { - instructions = navigationViewEventDispatcher.onBannerDisplay(instructions); - } - return instructions; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListener.java deleted file mode 100644 index 51b769f3..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListener.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -class NavigationViewModelProgressChangeListener implements ProgressChangeListener { - - private final NavigationViewModel viewModel; - - NavigationViewModelProgressChangeListener(NavigationViewModel viewModel) { - this.viewModel = viewModel; - } - - @Override - public void onProgressChange(Location location, RouteProgress routeProgress) { - viewModel.updateRouteProgress(routeProgress); - viewModel.updateLocation(location); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewOptions.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewOptions.java deleted file mode 100644 index bf06a53f..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewOptions.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.Nullable; - -import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCallback; -import com.google.auto.value.AutoValue; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.ui.v5.listeners.BannerInstructionsListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.InstructionListListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.NavigationListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.RouteListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.SpeechAnnouncementListener; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayer; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; - -import java.util.List; - -@AutoValue -public abstract class NavigationViewOptions extends NavigationUiOptions { - - public abstract MapboxNavigationOptions navigationOptions(); - - @Nullable - public abstract RouteListener routeListener(); - - @Nullable - public abstract NavigationListener navigationListener(); - - @Nullable - public abstract ProgressChangeListener progressChangeListener(); - - @Nullable - public abstract MilestoneEventListener milestoneEventListener(); - - @Nullable - public abstract List milestones(); - - @Nullable - public abstract BottomSheetCallback bottomSheetCallback(); - - @Nullable - public abstract InstructionListListener instructionListListener(); - - @Nullable - public abstract SpeechAnnouncementListener speechAnnouncementListener(); - - @Nullable - public abstract BannerInstructionsListener bannerInstructionsListener(); - - @Nullable - public abstract SpeechPlayer speechPlayer(); - - @Nullable - public abstract LocationEngine locationEngine(); - - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder directionsRoute(DirectionsRoute directionsRoute); - - public abstract Builder lightThemeResId(Integer lightThemeResId); - - public abstract Builder darkThemeResId(Integer darkThemeResId); - - public abstract Builder shouldSimulateRoute(boolean shouldSimulateRoute); - - public abstract Builder waynameChipEnabled(boolean waynameChipEnabled); - - public abstract Builder navigationOptions(MapboxNavigationOptions navigationOptions); - - public abstract Builder routeListener(RouteListener routeListener); - - public abstract Builder navigationListener(NavigationListener navigationListener); - - public abstract Builder progressChangeListener(ProgressChangeListener progressChangeListener); - - public abstract Builder milestoneEventListener(MilestoneEventListener milestoneEventListener); - - public abstract Builder milestones(List milestones); - - public abstract Builder bottomSheetCallback(BottomSheetCallback bottomSheetCallback); - - public abstract Builder instructionListListener(InstructionListListener instructionListListener); - - public abstract Builder speechAnnouncementListener(SpeechAnnouncementListener speechAnnouncementListener); - - public abstract Builder bannerInstructionsListener(BannerInstructionsListener bannerInstructionsListener); - - public abstract Builder speechPlayer(SpeechPlayer speechPlayer); - - public abstract Builder locationEngine(LocationEngine locationEngine); - - public abstract NavigationViewOptions build(); - } - - public static Builder builder() { - return new AutoValue_NavigationViewOptions.Builder() - .navigationOptions(MapboxNavigationOptions.builder().build()) - .shouldSimulateRoute(false) - .waynameChipEnabled(true); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListener.java deleted file mode 100644 index d5c193ce..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListener.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; - - -class NavigationViewRouteEngineListener implements ViewRouteListener { - - private final NavigationViewModel navigationViewModel; - - NavigationViewRouteEngineListener(NavigationViewModel navigationViewModel) { - this.navigationViewModel = navigationViewModel; - } - - @Override - public void onRouteUpdate(DirectionsRoute directionsRoute) { - navigationViewModel.updateRoute(directionsRoute); - } - - @Override - public void onRouteRequestError(String errorMessage) { - if (navigationViewModel.isOffRoute()) { - navigationViewModel.sendEventFailedReroute(errorMessage); - } - } - - @Override - public void onDestinationSet(Point destination) { - navigationViewModel.retrieveDestination().setValue(destination); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouter.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouter.java deleted file mode 100644 index e715e140..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouter.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.location.Location; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.ui.v5.route.MapboxRouteFetcher; -import com.mapbox.services.android.navigation.ui.v5.route.NavigationRoute; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.route.RouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.util.Date; -import java.util.List; - -class NavigationViewRouter implements RouteListener { - - private final MapboxRouteFetcher onlineRouter; - private final ConnectivityStatusProvider connectivityStatus; - private final RouteComparator routeComparator; - private final ViewRouteListener listener; - - private RouteOptions routeOptions; - private DirectionsRoute currentRoute; - private Location location; - private RouteCallStatus callStatus; - - NavigationViewRouter(MapboxRouteFetcher onlineRouter, ConnectivityStatusProvider connectivityStatus, - ViewRouteListener listener) { - this.onlineRouter = onlineRouter; - this.connectivityStatus = connectivityStatus; - this.listener = listener; - this.routeComparator = new RouteComparator(this); - onlineRouter.addRouteListener(this); - } - - // Extra fields for testing purposes - NavigationViewRouter(MapboxRouteFetcher onlineRouter, - ConnectivityStatusProvider connectivityStatus, RouteComparator routeComparator, - ViewRouteListener listener, RouteCallStatus callStatus) { - this.onlineRouter = onlineRouter; - this.connectivityStatus = connectivityStatus; - this.routeComparator = routeComparator; - this.listener = listener; - this.callStatus = callStatus; - onlineRouter.addRouteListener(this); - } - - @Override - public void onResponseReceived(DirectionsResponse response, @Nullable RouteProgress routeProgress) { - if (validRouteResponse(response)) { - routeComparator.compare(response, currentRoute); - } - updateCallStatusReceived(); - } - - @Override - public void onErrorReceived(Throwable throwable) { - onRequestError(throwable.getMessage()); - updateCallStatusReceived(); - } - - void extractRouteOptions(NavigationViewOptions options) { - extractRouteFrom(options); - } - - void findRouteFrom(@Nullable RouteProgress routeProgress) { - if (isRouting()) { - return; - } - NavigationRoute.Builder builder = onlineRouter.buildRequest(location, routeProgress); - findOnlineRouteWith(builder); - } - - void updateLocation(@NonNull Location location) { - this.location = location; - } - - void updateCurrentRoute(DirectionsRoute currentRoute) { - this.currentRoute = currentRoute; - listener.onRouteUpdate(currentRoute); - } - - void updateCallStatusReceived() { - if (callStatus != null) { - callStatus.setResponseReceived(); - } - } - - void onRequestError(String errorMessage) { - listener.onRouteRequestError(errorMessage); - } - - void onDestroy() { - onlineRouter.cancelRouteCall(); - onlineRouter.clearListeners(); - } - - private boolean validRouteResponse(DirectionsResponse response) { - return response != null && !response.routes().isEmpty(); - } - - private void extractRouteFrom(NavigationViewOptions options) { - DirectionsRoute route = options.directionsRoute(); - cacheRouteOptions(route.routeOptions()); - updateCurrentRoute(route); - } - - private void cacheRouteOptions(RouteOptions routeOptions) { - this.routeOptions = routeOptions; - cacheRouteDestination(); - } - - private void cacheRouteDestination() { - boolean hasValidCoordinates = routeOptions != null && !routeOptions.coordinates().isEmpty(); - if (hasValidCoordinates) { - List coordinates = routeOptions.coordinates(); - int destinationCoordinate = coordinates.size() - 1; - Point destinationPoint = coordinates.get(destinationCoordinate); - listener.onDestinationSet(destinationPoint); - } - } - - private void findOnlineRouteWith(NavigationRoute.Builder builder) { - onlineRouter.cancelRouteCall(); - onlineRouter.findRouteWith(builder); - callStatus = new RouteCallStatus(new Date()); - } - - private boolean isRouting() { - if (callStatus == null) { - return false; - } - return callStatus.isRouting(new Date()); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriber.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriber.java deleted file mode 100644 index 5958ea12..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriber.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.location.Location; - -import androidx.annotation.Nullable; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleObserver; -import androidx.lifecycle.LifecycleOwner; -import androidx.lifecycle.Observer; -import androidx.lifecycle.OnLifecycleEvent; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; - -class NavigationViewSubscriber implements LifecycleObserver { - - private final LifecycleOwner lifecycleOwner; - private final NavigationViewModel navigationViewModel; - private final NavigationPresenter navigationPresenter; - - NavigationViewSubscriber(final LifecycleOwner owner, final NavigationViewModel navigationViewModel, - final NavigationPresenter navigationPresenter) { - lifecycleOwner = owner; - lifecycleOwner.getLifecycle().addObserver(this); - this.navigationViewModel = navigationViewModel; - this.navigationPresenter = navigationPresenter; - } - - void subscribe() { - navigationViewModel.retrieveRoute().observe(lifecycleOwner, new Observer() { - @Override - public void onChanged(@Nullable DirectionsRoute directionsRoute) { - if (directionsRoute != null) { - navigationPresenter.onRouteUpdate(directionsRoute); - } - } - }); - - navigationViewModel.retrieveDestination().observe(lifecycleOwner, new Observer() { - @Override - public void onChanged(@Nullable Point point) { - if (point != null) { - navigationPresenter.onDestinationUpdate(point); - } - } - }); - - navigationViewModel.retrieveNavigationLocation().observe(lifecycleOwner, new Observer() { - @Override - public void onChanged(@Nullable Location location) { - if (location != null) { - navigationPresenter.onNavigationLocationUpdate(location); - } - } - }); - } - - @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) - void unsubscribe() { - navigationViewModel.retrieveRoute().removeObservers(lifecycleOwner); - navigationViewModel.retrieveDestination().removeObservers(lifecycleOwner); - navigationViewModel.retrieveNavigationLocation().removeObservers(lifecycleOwner); - navigationViewModel.retrieveShouldRecordScreenshot().removeObservers(lifecycleOwner); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListener.java deleted file mode 100644 index e91d757b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.ui.v5.map.OnWayNameChangedListener; - -class NavigationViewWayNameListener implements OnWayNameChangedListener { - - private final NavigationPresenter presenter; - - NavigationViewWayNameListener(NavigationPresenter presenter) { - this.presenter = presenter; - } - - @Override - public void onWayNameChanged(@NonNull String wayName) { - presenter.onWayNameChanged(wayName); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/OnNavigationReadyCallback.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/OnNavigationReadyCallback.java deleted file mode 100644 index 5a4a1ce8..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/OnNavigationReadyCallback.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -public interface OnNavigationReadyCallback { - - /** - * Fired after the navigation is ready. - * - * @param isRunning true after {@link NavigationView} has been initialized once and began navigation, - * else false. - * Indicates that {@link NavigationViewModel} is currently running and hasn't been destroyed from - * a configuration change. - */ - void onNavigationReady(boolean isRunning); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterBtnClickListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterBtnClickListener.java deleted file mode 100644 index 5f53df67..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterBtnClickListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.view.View; - -class RecenterBtnClickListener implements View.OnClickListener { - - private NavigationPresenter presenter; - - RecenterBtnClickListener(NavigationPresenter presenter) { - this.presenter = presenter; - } - - @Override - public void onClick(View view) { - presenter.onRecenterClick(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterButton.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterButton.java deleted file mode 100644 index 18cd8cad..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RecenterButton.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.content.Context; -import androidx.annotation.Nullable; -import androidx.cardview.widget.CardView; -import android.util.AttributeSet; -import android.view.animation.Animation; -import android.view.animation.OvershootInterpolator; -import android.view.animation.TranslateAnimation; - -/** - * Button used to re-activate following user location during navigation. - *

- * If a user scrolls the map while navigating, the - * {@link com.mapbox.services.android.navigation.ui.v5.summary.SummaryBottomSheet} - * is set to hidden and this button is shown. - *

- * This button uses a custom {@link TranslateAnimation} with {@link OvershootInterpolator} - * to be shown. - * - * @since 0.6.0 - */ -public class RecenterButton extends CardView implements NavigationButton { - private MultiOnClickListener multiOnClickListener = new MultiOnClickListener(); - private Animation slideUpBottom; - - public RecenterButton(Context context) { - this(context, null); - } - - public RecenterButton(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, -1); - } - - public RecenterButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - /** - * Sets visibility to VISIBLE and starts custom animation. - * - * @since 0.6.0 - */ - @Override - public void show() { - if (getVisibility() == INVISIBLE) { - setVisibility(VISIBLE); - startAnimation(slideUpBottom); - } - } - - /** - * Adds an onClickListener to the button - * - * @param onClickListener to add - */ - @Override - public void addOnClickListener(OnClickListener onClickListener) { - multiOnClickListener.addListener(onClickListener); - } - - /** - * Removes an onClickListener from the button - * - * @param onClickListener to remove - */ - @Override - public void removeOnClickListener(OnClickListener onClickListener) { - multiOnClickListener.removeListener(onClickListener); - } - - /** - * Sets visibility to INVISIBLE. - * - * @since 0.6.0 - */ - @Override - public void hide() { - if (getVisibility() == VISIBLE) { - setVisibility(INVISIBLE); - } - } - - /** - * Once inflation of the view has finished, - * create the custom animation. - */ - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - initAnimation(); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - setupOnClickListeners(); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - clearListeners(); - } - - private void setupOnClickListeners() { - setOnClickListener(multiOnClickListener); - } - - private void clearListeners() { - multiOnClickListener.clearListeners(); - multiOnClickListener = null; - setOnClickListener(null); - } - - /** - * Inflates the layout. - */ - private void init() { - inflate(getContext(), R.layout.recenter_btn_layout, this); - } - - /** - * Creates the custom animation used to show this button. - */ - private void initAnimation() { - slideUpBottom = new TranslateAnimation(0f, 0f, 125f, 0f); - slideUpBottom.setDuration(300); - slideUpBottom.setInterpolator(new OvershootInterpolator(2.0f)); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatus.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatus.java deleted file mode 100644 index 513e7097..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatus.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import java.util.Date; - -class RouteCallStatus { - - private static final int FIVE_SECONDS_IN_MILLISECONDS = 5000; - private boolean responseReceived; - private final Date callDate; - - RouteCallStatus(Date callDate) { - this.callDate = callDate; - } - - void setResponseReceived() { - this.responseReceived = true; - } - - boolean isRouting(Date currentDate) { - if (responseReceived) { - return false; - } - return diffInMilliseconds(callDate, currentDate) < FIVE_SECONDS_IN_MILLISECONDS; - } - - private long diffInMilliseconds(Date callDate, Date currentDate) { - return currentDate.getTime() - callDate.getTime(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteComparator.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteComparator.java deleted file mode 100644 index f7d5d1b6..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteComparator.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; - -import java.util.List; - -class RouteComparator { - - private static final int FIRST_ROUTE = 0; - private static final int ONE_ROUTE = 1; - private final NavigationViewRouter navigationViewRouter; - - RouteComparator(NavigationViewRouter navigationViewRouter) { - this.navigationViewRouter = navigationViewRouter; - } - - void compare(@NonNull DirectionsResponse response, @Nullable DirectionsRoute chosenRoute) { - if (isValidRoute(response)) { - List routes = response.routes(); - DirectionsRoute bestRoute = routes.get(FIRST_ROUTE); - if (isNavigationRunning(chosenRoute)) { - bestRoute = findMostSimilarRoute(routes, bestRoute, chosenRoute); - } - navigationViewRouter.updateCurrentRoute(bestRoute); - } - } - - private DirectionsRoute findMostSimilarRoute(List routes, DirectionsRoute currentBestRoute, - DirectionsRoute chosenRoute) { - DirectionsRoute mostSimilarRoute = currentBestRoute; - if (routes.size() > ONE_ROUTE) { - mostSimilarRoute = compareRoutes(chosenRoute, routes); - } - return mostSimilarRoute; - } - - private DirectionsRoute compareRoutes(DirectionsRoute chosenRoute, List routes) { - int routeIndex = 0; - String chosenRouteLegDescription = obtainRouteLegDescriptionFrom(chosenRoute); - int minSimilarity = Integer.MAX_VALUE; - for (int index = 0; index < routes.size(); index++) { - String routeLegDescription = obtainRouteLegDescriptionFrom(routes.get(index)); - int currentSimilarity = DamerauLevenshteinAlgorithm.execute(chosenRouteLegDescription, routeLegDescription); - if (currentSimilarity < minSimilarity) { - minSimilarity = currentSimilarity; - routeIndex = index; - } - } - return routes.get(routeIndex); - } - - private String obtainRouteLegDescriptionFrom(DirectionsRoute route) { - List routeLegs = route.legs(); - StringBuilder routeLegDescription = new StringBuilder(); - for (RouteLeg leg : routeLegs) { - routeLegDescription.append(leg.summary()); - } - return routeLegDescription.toString(); - } - - private boolean isValidRoute(DirectionsResponse response) { - return response != null && !response.routes().isEmpty(); - } - - private boolean isNavigationRunning(DirectionsRoute chosenRoute) { - return chosenRoute != null; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteOverviewBtnClickListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteOverviewBtnClickListener.java deleted file mode 100644 index d910413b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/RouteOverviewBtnClickListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.view.View; - -class RouteOverviewBtnClickListener implements View.OnClickListener { - - private NavigationPresenter presenter; - - RouteOverviewBtnClickListener(NavigationPresenter presenter) { - this.presenter = presenter; - } - - @Override - public void onClick(View view) { - presenter.onRouteOverviewClick(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SoundButton.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SoundButton.java deleted file mode 100644 index 1c3fbcc4..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SoundButton.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import androidx.constraintlayout.widget.ConstraintLayout; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import androidx.core.graphics.drawable.DrawableCompat; -import android.util.AttributeSet; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.view.animation.AnimationSet; -import android.view.animation.DecelerateInterpolator; -import android.widget.TextView; - -public class SoundButton extends ConstraintLayout implements NavigationButton { - private static final float ALPHA_VALUE_ZERO = 0; - private static final float ALPHA_VALUE_ONE = 1; - private static final long ANIMATION_DURATION_THREE_HUNDRED_MILLIS = 300; - private static final long ANIMATION_DURATION_ONE_THOUSAND_MILLIS = 1000; - - private FloatingActionButton soundFab; - private TextView soundChipText; - private AnimationSet fadeInSlowOut; - private boolean isMuted; - private MultiOnClickListener multiOnClickListener = new MultiOnClickListener(); - - public SoundButton(Context context) { - this(context, null); - } - - public SoundButton(Context context, AttributeSet attrs) { - this(context, attrs, -1); - } - - public SoundButton(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initialize(context); - } - - /** - * Adds an onClickListener to the button - * - * @param onClickListener to add - */ - @Override - public void addOnClickListener(OnClickListener onClickListener) { - multiOnClickListener.addListener(onClickListener); - } - - /** - * Removes an onClickListener from the button - * - * @param onClickListener to remove - */ - @Override - public void removeOnClickListener(OnClickListener onClickListener) { - multiOnClickListener.removeListener(onClickListener); - } - - /** - * Hides the widget - */ - @Override - public void hide() { - setVisibility(GONE); - } - - /** - * Shows the widget - */ - @Override - public void show() { - setVisibility(VISIBLE); - } - - /** - * Will toggle the view between muted and unmuted states. - * - * @return boolean true if muted, false if not - * @since 0.6.0 - */ - public boolean toggleMute() { - return isMuted ? unmute() : mute(); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - bind(); - setupColors(); - initializeAnimation(); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - setupOnClickListeners(); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - clearListeners(); - } - - /** - * Changes sound {@link FloatingActionButton} - * {@link android.graphics.drawable.Drawable} to denote sound is off. - */ - void soundFabOff() { - soundFab.setImageResource(R.drawable.ic_sound_off); - } - - private void setupOnClickListeners() { - soundFab.setOnClickListener(multiOnClickListener); - } - - private void clearListeners() { - multiOnClickListener.clearListeners(); - multiOnClickListener = null; - setOnClickListener(null); - } - - private void initializeAnimation() { - Animation fadeIn = new AlphaAnimation(ALPHA_VALUE_ZERO, ALPHA_VALUE_ONE); - fadeIn.setInterpolator(new DecelerateInterpolator()); - fadeIn.setDuration(ANIMATION_DURATION_THREE_HUNDRED_MILLIS); - - Animation fadeOut = new AlphaAnimation(ALPHA_VALUE_ONE, ALPHA_VALUE_ZERO); - fadeOut.setInterpolator(new AccelerateInterpolator()); - fadeOut.setStartOffset(ANIMATION_DURATION_ONE_THOUSAND_MILLIS); - fadeOut.setDuration(ANIMATION_DURATION_ONE_THOUSAND_MILLIS); - - fadeInSlowOut = new AnimationSet(false); - fadeInSlowOut.addAnimation(fadeIn); - fadeInSlowOut.addAnimation(fadeOut); - } - - private void setupColors() { - if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { - Drawable soundChipBackground = DrawableCompat.wrap(soundChipText.getBackground()).mutate(); - int navigationViewPrimaryColor = ThemeSwitcher.retrieveThemeColor(getContext(), - R.attr.navigationViewPrimary); - DrawableCompat.setTint(soundChipBackground, navigationViewPrimaryColor); - } - } - - /** - * Sets up mute UI event. - *

- * Shows chip with "Muted" text. - * Changes sound {@link FloatingActionButton} - * {@link android.graphics.drawable.Drawable} to denote sound is off. - *

- * Sets private state variable to true (muted) - * - * @return true, view is in muted state - */ - private boolean mute() { - isMuted = true; - setSoundChipText(getContext().getString(R.string.muted)); - showSoundChip(); - soundFabOff(); - return isMuted; - } - - /** - * Sets up unmuted UI event. - *

- * Shows chip with "Unmuted" text. - * Changes sound {@link FloatingActionButton} - * {@link android.graphics.drawable.Drawable} to denote sound is on. - *

- * Sets private state variable to false (unmuted) - * - * @return false, view is in unmuted state - */ - private boolean unmute() { - isMuted = false; - setSoundChipText(getContext().getString(R.string.unmuted)); - showSoundChip(); - soundFabOn(); - return isMuted; - } - - /** - * Sets {@link TextView} inside of chip view. - * - * @param text to be displayed in chip view ("Muted"/"Umuted") - */ - private void setSoundChipText(String text) { - soundChipText.setText(text); - } - - /** - * Shows and then hides the sound chip using {@link AnimationSet} - */ - private void showSoundChip() { - soundChipText.startAnimation(fadeInSlowOut); - } - - private void bind() { - soundFab = findViewById(R.id.soundFab); - soundChipText = findViewById(R.id.soundText); - } - - private void initialize(Context context) { - inflate(context, R.layout.sound_layout, this); - } - - /** - * Changes sound {@link FloatingActionButton} - * {@link android.graphics.drawable.Drawable} to denote sound is on. - */ - private void soundFabOn() { - soundFab.setImageResource(R.drawable.ic_sound_on); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SummaryBottomSheetCallback.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SummaryBottomSheetCallback.java deleted file mode 100644 index d5d059e1..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/SummaryBottomSheetCallback.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.NonNull; -import com.google.android.material.bottomsheet.BottomSheetBehavior; -import android.view.View; - -class SummaryBottomSheetCallback extends BottomSheetBehavior.BottomSheetCallback { - - private NavigationPresenter presenter; - private NavigationViewEventDispatcher dispatcher; - - SummaryBottomSheetCallback(NavigationPresenter presenter, NavigationViewEventDispatcher dispatcher) { - this.presenter = presenter; - this.dispatcher = dispatcher; - } - - @Override - public void onStateChanged(@NonNull View bottomSheet, int newState) { - dispatcher.onBottomSheetStateChanged(bottomSheet, newState); - presenter.onSummaryBottomSheetHidden(); - } - - @Override - public void onSlide(@NonNull View bottomSheet, float slideOffset) { - // No-op - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java deleted file mode 100644 index 96e2ef5b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.content.Context; -import android.content.SharedPreferences; -import android.content.res.Configuration; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; -import android.preference.PreferenceManager; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import androidx.appcompat.content.res.AppCompatResources; -import android.util.AttributeSet; -import android.util.TypedValue; - -import com.mapbox.mapboxsdk.utils.BitmapUtils; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; - -/** - * This class is used to switch theme colors in {@link NavigationView}. - */ -public class ThemeSwitcher { - - /** - * Looks are current theme and retrieves the color attribute - * for the given set theme. - * - * @param context to retrieve the set theme and resolved attribute and then color res Id with {@link ContextCompat} - * @return color resource identifier for primary theme color - */ - public static int retrieveThemeColor(Context context, int resId) { - TypedValue outValue = resolveAttributeFromId(context, resId); - if (outValue.type >= TypedValue.TYPE_FIRST_COLOR_INT - && outValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { - return outValue.data; - } else { - return ContextCompat.getColor(context, outValue.resourceId); - } - } - - /** - * Returns a map marker {@link Bitmap} based on the current theme setting. - * - * @param context to retrieve the drawable for the given resource ID - * @return {@link Bitmap} map marker dark or light - */ - public static Bitmap retrieveThemeMapMarker(Context context) { - TypedValue destinationMarkerResId = resolveAttributeFromId(context, R.attr.navigationViewDestinationMarker); - int markerResId = destinationMarkerResId.resourceId; - Drawable markerDrawable = ContextCompat.getDrawable(context, markerResId); - return BitmapUtils.getBitmapFromDrawable(markerDrawable); - } - - /** - * Returns a route overview {@link Drawable} based on the current theme setting. - * - * @param context to retrieve overview {@link Drawable} - * @return {@link Drawable} for route overview - dark or light - */ - public static Drawable retrieveThemeOverviewDrawable(Context context) { - TypedValue destinationMarkerResId = resolveAttributeFromId(context, R.attr.navigationViewRouteOverviewDrawable); - int overviewResId = destinationMarkerResId.resourceId; - return AppCompatResources.getDrawable(context, overviewResId); - } - - /** - * Looks are current theme and retrieves the style - * for the given resId set in the theme. - * - * @param context to retrieve the resolved attribute - * @param styleResId for the given style - * @return resolved style resource Id - */ - public static int retrieveNavigationViewStyle(Context context, int styleResId) { - TypedValue outValue = resolveAttributeFromId(context, styleResId); - return outValue.resourceId; - } - - /** - * Called in onCreate() to check the UI Mode (day or night) - * and set the theme colors accordingly. - * - * @param context {@link NavigationView} where the theme will be set - * @param attrs holding custom styles if any are set - */ - static void setTheme(Context context, AttributeSet attrs) { - boolean nightModeEnabled = isNightModeEnabled(context); - - if (shouldSetThemeFromPreferences(context)) { - int prefLightTheme = retrieveThemeResIdFromPreferences(context, NavigationConstants.NAVIGATION_VIEW_LIGHT_THEME); - int prefDarkTheme = retrieveThemeResIdFromPreferences(context, NavigationConstants.NAVIGATION_VIEW_DARK_THEME); - prefLightTheme = prefLightTheme == 0 ? R.style.NavigationViewLight : prefLightTheme; - prefDarkTheme = prefLightTheme == 0 ? R.style.NavigationViewDark : prefDarkTheme; - context.setTheme(nightModeEnabled ? prefDarkTheme : prefLightTheme); - return; - } - - TypedArray styledAttributes = context.obtainStyledAttributes(attrs, R.styleable.NavigationView); - int lightTheme = styledAttributes.getResourceId(R.styleable.NavigationView_navigationLightTheme, - R.style.NavigationViewLight); - int darkTheme = styledAttributes.getResourceId(R.styleable.NavigationView_navigationDarkTheme, - R.style.NavigationViewDark); - styledAttributes.recycle(); - - context.setTheme(nightModeEnabled ? darkTheme : lightTheme); - } - - static String retrieveMapStyle(Context context) { - TypedValue mapStyleAttr = resolveAttributeFromId(context, R.attr.navigationViewMapStyle); - return mapStyleAttr.string.toString(); - } - - /** - * Returns true if the current UI_MODE_NIGHT is enabled, false otherwise. - */ - private static boolean isNightModeEnabled(Context context) { - int currentNightMode = retrieveCurrentUiMode(context); - return currentNightMode == Configuration.UI_MODE_NIGHT_YES; - } - - private static int retrieveCurrentUiMode(Context context) { - return context.getResources().getConfiguration().uiMode - & Configuration.UI_MODE_NIGHT_MASK; - } - - @NonNull - private static TypedValue resolveAttributeFromId(Context context, int resId) { - TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(resId, outValue, true); - return outValue; - } - - private static boolean shouldSetThemeFromPreferences(Context context) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - return preferences.getBoolean(NavigationConstants.NAVIGATION_VIEW_PREFERENCE_SET_THEME, false); - } - - private static int retrieveThemeResIdFromPreferences(Context context, String key) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - return preferences.getInt(key, 0); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ViewRouteListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ViewRouteListener.java deleted file mode 100644 index c7966ac5..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ViewRouteListener.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; - -interface ViewRouteListener { - - void onRouteUpdate(DirectionsRoute directionsRoute); - - void onRouteRequestError(String errorMessage); - - void onDestinationSet(Point destination); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/WifiNetworkChecker.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/WifiNetworkChecker.java deleted file mode 100644 index 152ba355..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/WifiNetworkChecker.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.annotation.NonNull; - -import java.util.HashMap; - -class WifiNetworkChecker { - - private final HashMap statusMap; - - WifiNetworkChecker(HashMap statusMap) { - this.statusMap = statusMap; - initialize(statusMap); - } - - @NonNull - Boolean isFast(Integer wifiLevel) { - Boolean isConnectionFast = statusMap.get(wifiLevel); - if (isConnectionFast == null) { - isConnectionFast = false; - } - return isConnectionFast; - } - - private void initialize(HashMap statusMap) { - statusMap.put(5, true); - statusMap.put(4, true); - statusMap.put(3, true); - statusMap.put(2, false); - statusMap.put(1, false); - statusMap.put(0, false); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertView.java deleted file mode 100644 index a1e9d20f..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertView.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.alert; - -import android.animation.ObjectAnimator; -import android.content.Context; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.LayerDrawable; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.cardview.widget.CardView; -import android.util.AttributeSet; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; -import android.view.animation.LinearInterpolator; -import android.view.animation.OvershootInterpolator; -import android.widget.ProgressBar; -import android.widget.TextView; - -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.ThemeSwitcher; - -/** - * A custom View that can show a quick message to a user. - *

- * Accompanied with a set duration (in millis), the View will automatically dismiss itself - * after the duration countdown has completed. - */ -public class AlertView extends CardView { - - private static final String ALERT_VIEW_PROGRESS = "progress"; - private TextView alertText; - private ProgressBar alertProgressBar; - - private Animation fadeOut; - private Animation slideDownTop; - - public AlertView(Context context) { - this(context, null); - } - - public AlertView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, -1); - } - - public AlertView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - bind(); - initAnimations(); - initBackground(); - } - - /** - * Animates the View from top down to its set position. - *

- * If a non-null duration is passed, a countdown loading bar will show to - * indicate the View will be automatically dismissed if not clicked. - * - * @param alertText text to be shown in the View - * @param duration in milliseconds, how long the view will be shown - * @param showLoading true if should show the progress bar, false if not - */ - public void show(String alertText, long duration, boolean showLoading) { - this.alertText.setText(alertText); - alertProgressBar.setProgress(alertProgressBar.getMax()); - // Start animation based on current visibility - if (getVisibility() == INVISIBLE) { - setVisibility(VISIBLE); - startAnimation(slideDownTop); - - // If a duration is found, start the countdown - if (duration > 0L) { - startCountdown(duration); - } - // Show / hide loading - showLoading(showLoading); - } - } - - /** - * Hides the View with a slide up animation if the View is currently VISIBLE. - * - * @since 0.7.0 - */ - public void hide() { - if (getVisibility() == VISIBLE) { - startAnimation(fadeOut); - setVisibility(INVISIBLE); - } - } - - /** - * Returns the current text being shown by the {@link AlertView}. - * - * @return current text in alertText {@link TextView} - * @since 0.7.0 - */ - public String getAlertText() { - return alertText.getText().toString(); - } - - private void init() { - inflate(getContext(), R.layout.alert_view_layout, this); - } - - private void bind() { - alertText = findViewById(R.id.alertText); - alertProgressBar = findViewById(R.id.alertProgressBar); - } - - private void initAnimations() { - fadeOut = new AlphaAnimation(1, 0); - fadeOut.setInterpolator(new AccelerateInterpolator()); - fadeOut.setDuration(300); - slideDownTop = AnimationUtils.loadAnimation(getContext(), R.anim.slide_down_top); - slideDownTop.setInterpolator(new OvershootInterpolator(2.0f)); - } - - private void initBackground() { - if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { - int progressColor = ThemeSwitcher.retrieveThemeColor(getContext(), - R.attr.navigationViewProgress); - int progressBackgroundColor = ThemeSwitcher.retrieveThemeColor(getContext(), - R.attr.navigationViewProgressBackground); - - LayerDrawable progressBarDrawable = (LayerDrawable) alertProgressBar.getProgressDrawable(); - // ProgressBar progress color - Drawable progressBackgroundDrawable = progressBarDrawable.getDrawable(0); - progressBackgroundDrawable.setColorFilter(progressBackgroundColor, PorterDuff.Mode.SRC_IN); - - - // ProgressBar background color - Drawable progressDrawable = progressBarDrawable.getDrawable(1); - progressDrawable.setColorFilter(progressColor, PorterDuff.Mode.SRC_IN); - - // Hide the background - getBackground().setAlpha(0); - } else { - setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); - } - } - - private void startCountdown(long duration) { - ObjectAnimator countdownAnimation = ObjectAnimator.ofInt(alertProgressBar, ALERT_VIEW_PROGRESS, 0); - countdownAnimation.setInterpolator(new LinearInterpolator()); - countdownAnimation.setDuration(duration); - countdownAnimation.addListener(new AlertViewAnimatorListener(this)); - countdownAnimation.start(); - } - - private void showLoading(boolean showLoading) { - alertProgressBar.setVisibility(showLoading ? VISIBLE : INVISIBLE); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListener.java deleted file mode 100644 index 61c3f6ab..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListener.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.alert; - -import android.animation.Animator; - -import java.lang.ref.WeakReference; - -class AlertViewAnimatorListener implements Animator.AnimatorListener { - - private final WeakReference alertViewWeakReference; - - AlertViewAnimatorListener(AlertView alertView) { - this.alertViewWeakReference = new WeakReference<>(alertView); - } - - @Override - public void onAnimationStart(Animator animation) { - } - - @Override - public void onAnimationEnd(Animator animation) { - hideAlertView(); - } - - @Override - public void onAnimationCancel(Animator animation) { - } - - @Override - public void onAnimationRepeat(Animator animation) { - } - - private void hideAlertView() { - AlertView alertView = alertViewWeakReference.get(); - if (alertView != null) { - alertView.hide(); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraAnimationDelegate.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraAnimationDelegate.java deleted file mode 100644 index fafa56e6..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraAnimationDelegate.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.camera.CameraUpdate; -import com.mapbox.mapboxsdk.location.modes.CameraMode; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -class CameraAnimationDelegate { - - private final MapboxMap mapboxMap; - - CameraAnimationDelegate(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - void render(NavigationCameraUpdate update, int durationMs, MapboxMap.CancelableCallback callback) { - CameraUpdateMode mode = update.getMode(); - CameraUpdate cameraUpdate = update.getCameraUpdate(); - if (mode == CameraUpdateMode.OVERRIDE) { - mapboxMap.getLocationComponent().setCameraMode(CameraMode.NONE); - mapboxMap.animateCamera(cameraUpdate, durationMs, callback); - } else if (!isTracking()) { - mapboxMap.animateCamera(cameraUpdate, durationMs, callback); - } - } - - private boolean isTracking() { - int cameraMode = mapboxMap.getLocationComponent().getCameraMode(); - return cameraMode != CameraMode.NONE; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraOverviewCancelableCallback.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraOverviewCancelableCallback.java deleted file mode 100644 index ed274f10..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraOverviewCancelableCallback.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.camera.CameraUpdate; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -class CameraOverviewCancelableCallback implements MapboxMap.CancelableCallback { - - private static final int OVERVIEW_UPDATE_DURATION_IN_MILLIS = 750; - - private CameraUpdate overviewUpdate; - private MapboxMap mapboxMap; - - CameraOverviewCancelableCallback(CameraUpdate overviewUpdate, MapboxMap mapboxMap) { - this.overviewUpdate = overviewUpdate; - this.mapboxMap = mapboxMap; - } - - @Override - public void onCancel() { - // No-op - } - - @Override - public void onFinish() { - mapboxMap.animateCamera(overviewUpdate, OVERVIEW_UPDATE_DURATION_IN_MILLIS); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraUpdateMode.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraUpdateMode.java deleted file mode 100644 index 3b176d9d..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/CameraUpdateMode.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -/** - * This class is passed to {@link NavigationCameraUpdate} to - * determine the update's behavior when passed to {@link NavigationCamera}. - */ -public enum CameraUpdateMode { - - /** - * For a given {@link NavigationCameraUpdate}, this default mode means the - * {@link NavigationCamera} will ignore the update when tracking is already - * enabled. - *

- * If tracking is disabled, the update animation will execute. - */ - DEFAULT, - - /** - * For a given {@link NavigationCameraUpdate}, this override mode means the - * {@link NavigationCamera} will stop tracking (if tracking) and execute the - * given update animation. - */ - OVERRIDE -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCamera.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCamera.java deleted file mode 100644 index 0fad498d..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCamera.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import android.location.Location; -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; -import com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation; -import com.mapbox.services.android.navigation.v5.navigation.camera.SimpleCamera; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.util.ArrayList; -import java.util.List; - -public class DynamicCamera extends SimpleCamera { - - private static final double MAX_CAMERA_TILT = 60d; - private static final double MIN_CAMERA_TILT = 45d; - private static final double MAX_CAMERA_ZOOM = 16d; - private static final double MIN_CAMERA_ZOOM = 12d; - - private MapboxMap mapboxMap; - private LegStep currentStep; - private boolean hasPassedLowAlertLevel; - private boolean hasPassedMediumAlertLevel; - private boolean hasPassedHighAlertLevel; - private boolean forceUpdateZoom; - private boolean isShutdown = false; - - public DynamicCamera(@NonNull MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - @Override - public double tilt(RouteInformation routeInformation) { - if (isShutdown) { - return DEFAULT_TILT; - } - - RouteProgress progress = routeInformation.routeProgress(); - if (progress != null) { - double distanceRemaining = progress.currentLegProgress().currentStepProgress().distanceRemaining(); - return createTilt(distanceRemaining); - } - return super.tilt(routeInformation); - } - - @Override - public double zoom(RouteInformation routeInformation) { - if (isShutdown) { - return DEFAULT_ZOOM; - } - - if (validLocationAndProgress(routeInformation) && shouldUpdateZoom(routeInformation)) { - return createZoom(routeInformation); - } else if (routeInformation.route() != null) { - return super.zoom(routeInformation); - } - return mapboxMap.getCameraPosition().zoom; - } - - - /** - * Called when the zoom level should force update on the next usage - * of {@link DynamicCamera#zoom(RouteInformation)}. - */ - public void forceResetZoomLevel() { - forceUpdateZoom = true; - } - - public void clearMap() { - isShutdown = true; - mapboxMap = null; - } - - /** - * Creates a tilt value based on the distance remaining for the current {@link LegStep}. - *

- * Checks if the calculated value is within the set min / max bounds. - * - * @param distanceRemaining from the current step - * @return tilt within set min / max bounds - */ - private double createTilt(double distanceRemaining) { - double tilt = distanceRemaining / 5; - if (tilt > MAX_CAMERA_TILT) { - return MAX_CAMERA_TILT; - } else if (tilt < MIN_CAMERA_TILT) { - return MIN_CAMERA_TILT; - } - return Math.round(tilt); - } - - /** - * Creates a zoom value based on the result of {@link MapboxMap#getCameraForLatLngBounds(LatLngBounds, int[])}. - *

- * 0 zoom is the world view, while 22 (default max threshold) is the closest you can position - * the camera to the map. - * - * @param routeInformation for current location and progress - * @return zoom within set min / max bounds - */ - private double createZoom(RouteInformation routeInformation) { - CameraPosition position = createCameraPosition(routeInformation.location(), routeInformation.routeProgress()); - if (position == null) { - return DEFAULT_ZOOM; - } - if (position.zoom > MAX_CAMERA_ZOOM) { - return MAX_CAMERA_ZOOM; - } else if (position.zoom < MIN_CAMERA_ZOOM) { - return MIN_CAMERA_ZOOM; - } - return position.zoom; - } - - /** - * Creates a camera position with the current location and upcoming maneuver location. - *

- * Using {@link MapboxMap#getCameraForLatLngBounds(LatLngBounds, int[])} with a {@link LatLngBounds} - * that includes the current location and upcoming maneuver location. - * - * @param location for current location - * @param routeProgress for upcoming maneuver location - * @return camera position that encompasses both locations - */ - private CameraPosition createCameraPosition(Location location, RouteProgress routeProgress) { - LegStep upComingStep = routeProgress.currentLegProgress().upComingStep(); - if (upComingStep != null) { - Point stepManeuverPoint = upComingStep.maneuver().location(); - - List latLngs = new ArrayList<>(); - LatLng currentLatLng = new LatLng(location); - LatLng maneuverLatLng = new LatLng(stepManeuverPoint.latitude(), stepManeuverPoint.longitude()); - latLngs.add(currentLatLng); - latLngs.add(maneuverLatLng); - - if (latLngs.size() < 1 || currentLatLng.equals(maneuverLatLng)) { - return mapboxMap.getCameraPosition(); - } - - LatLngBounds cameraBounds = new LatLngBounds.Builder() - .includes(latLngs) - .build(); - - int[] padding = {0, 0, 0, 0}; - return mapboxMap.getCameraForLatLngBounds(cameraBounds, padding); - } - return mapboxMap.getCameraPosition(); - } - - private boolean isForceUpdate() { - if (forceUpdateZoom) { - forceUpdateZoom = false; - return true; - } - return false; - } - - /** - * Looks to see if we have a new step. - * - * @param routeProgress provides updated step information - * @return true if new step, false if not - */ - private boolean isNewStep(RouteProgress routeProgress) { - boolean isNewStep = currentStep == null || !currentStep.equals(routeProgress.currentLegProgress().currentStep()); - currentStep = routeProgress.currentLegProgress().currentStep(); - resetAlertLevels(isNewStep); - return isNewStep; - } - - private void resetAlertLevels(boolean isNewStep) { - if (isNewStep) { - hasPassedLowAlertLevel = false; - hasPassedMediumAlertLevel = false; - hasPassedHighAlertLevel = false; - } - } - - private boolean validLocationAndProgress(RouteInformation routeInformation) { - return routeInformation.location() != null && routeInformation.routeProgress() != null; - } - - private boolean shouldUpdateZoom(RouteInformation routeInformation) { - RouteProgress progress = routeInformation.routeProgress(); - return isForceUpdate() - || isNewStep(progress) - || isLowAlert(progress) - || isMediumAlert(progress) - || isHighAlert(progress); - } - - private boolean isLowAlert(RouteProgress progress) { - if (!hasPassedLowAlertLevel) { - double durationRemaining = progress.currentLegProgress().currentStepProgress().durationRemaining(); - double stepDuration = progress.currentLegProgress().currentStep().duration(); - boolean isLowAlert = durationRemaining < NavigationConstants.NAVIGATION_LOW_ALERT_DURATION; - boolean hasValidStepDuration = stepDuration > NavigationConstants.NAVIGATION_LOW_ALERT_DURATION; - if (hasValidStepDuration && isLowAlert) { - hasPassedLowAlertLevel = true; - return true; - } - } - return false; - } - - private boolean isMediumAlert(RouteProgress progress) { - if (!hasPassedMediumAlertLevel) { - double durationRemaining = progress.currentLegProgress().currentStepProgress().durationRemaining(); - double stepDuration = progress.currentLegProgress().currentStep().duration(); - boolean isMediumAlert = durationRemaining < NavigationConstants.NAVIGATION_MEDIUM_ALERT_DURATION; - boolean hasValidStepDuration = stepDuration > NavigationConstants.NAVIGATION_MEDIUM_ALERT_DURATION; - if (hasValidStepDuration && isMediumAlert) { - hasPassedMediumAlertLevel = true; - return true; - } - } - return false; - } - - private boolean isHighAlert(RouteProgress progress) { - if (!hasPassedHighAlertLevel) { - double durationRemaining = progress.currentLegProgress().currentStepProgress().durationRemaining(); - double stepDuration = progress.currentLegProgress().currentStep().duration(); - boolean isHighAlert = durationRemaining < NavigationConstants.NAVIGATION_HIGH_ALERT_DURATION; - boolean hasValidStepDuration = stepDuration > NavigationConstants.NAVIGATION_HIGH_ALERT_DURATION; - if (hasValidStepDuration && isHighAlert) { - hasPassedHighAlertLevel = true; - return true; - } - } - return false; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java deleted file mode 100644 index 19129cbd..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java +++ /dev/null @@ -1,562 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleObserver; -import androidx.lifecycle.OnLifecycleEvent; -import android.location.Location; -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.FragmentActivity; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.camera.CameraUpdate; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.location.LocationComponent; -import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener; -import com.mapbox.mapboxsdk.location.OnLocationCameraTransitionListener; -import com.mapbox.mapboxsdk.location.modes.CameraMode; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.navigation.camera.Camera; -import com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.MathUtils; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import timber.log.Timber; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NAVIGATION_MAX_CAMERA_ADJUSTMENT_ANIMATION_DURATION; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NAVIGATION_MIN_CAMERA_TILT_ADJUSTMENT_ANIMATION_DURATION; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NAVIGATION_MIN_CAMERA_ZOOM_ADJUSTMENT_ANIMATION_DURATION; - -/** - * Updates the map camera while navigating. - *

- * This class listens to the progress of {@link MapboxNavigation} and moves - * the {@link MapboxMap} camera based on the location updates. - * - * @since 0.6.0 - */ -public class NavigationCamera implements LifecycleObserver { - - /** - * Camera tracks the user location, with bearing provided by the location update. - *

- * Equivalent of the {@link CameraMode#TRACKING_GPS}. - */ - public static final int NAVIGATION_TRACKING_MODE_GPS = 0; - /** - * Camera tracks the user location, with bearing always set to north (0). - *

- * Equivalent of the {@link CameraMode#TRACKING_GPS_NORTH}. - */ - public static final int NAVIGATION_TRACKING_MODE_NORTH = 1; - /** - * Camera does not tack the user location. - *

- * Equivalent of the {@link CameraMode#NONE}. - */ - public static final int NAVIGATION_TRACKING_MODE_NONE = 2; - private static final int ONE_POINT = 1; - private final CopyOnWriteArrayList onTrackingModeTransitionListeners - = new CopyOnWriteArrayList<>(); - private final CopyOnWriteArrayList onTrackingModeChangedListeners - = new CopyOnWriteArrayList<>(); - private final OnLocationCameraTransitionListener cameraTransitionListener - = new NavigationCameraTransitionListener(this); - private final OnCameraTrackingChangedListener cameraTrackingChangedListener - = new NavigationCameraTrackingChangedListener(this); - private MapboxMap mapboxMap; - private LocationComponent locationComponent; - private MapboxNavigation navigation; - private RouteInformation currentRouteInformation; - private RouteProgress currentRouteProgress; - @TrackingMode - private int trackingCameraMode = NAVIGATION_TRACKING_MODE_GPS; - private boolean isCameraResetting; - private CameraAnimationDelegate animationDelegate; - private ProgressChangeListener progressChangeListener = new ProgressChangeListener() { - @Override - public void onProgressChange(Location location, RouteProgress routeProgress) { - currentRouteProgress = routeProgress; - if (isTrackingEnabled()) { - currentRouteInformation = buildRouteInformationFromLocation(location, routeProgress); - if (!isCameraResetting) { - adjustCameraFromLocation(currentRouteInformation); - } - } - } - }; - - /** - * Creates an instance of {@link NavigationCamera}. - * - * @param mapboxMap for moving the camera - * @param navigation for listening to location updates - * @param locationComponent for managing camera mode - */ - public NavigationCamera(@NonNull MapboxMap mapboxMap, @NonNull MapboxNavigation navigation, - @NonNull LocationComponent locationComponent) { - this.mapboxMap = mapboxMap; - this.navigation = navigation; - this.locationComponent = locationComponent; - this.animationDelegate = new CameraAnimationDelegate(mapboxMap); - this.locationComponent.addOnCameraTrackingChangedListener(cameraTrackingChangedListener); - initializeWith(navigation); - } - - /** - * Creates an instance of {@link NavigationCamera}. - *

- * Camera will start tracking current user location by default. - * - * @param mapboxMap for moving the camera - * @param locationComponent for managing camera mode - */ - public NavigationCamera(@NonNull MapboxMap mapboxMap, LocationComponent locationComponent) { - this.mapboxMap = mapboxMap; - this.locationComponent = locationComponent; - this.animationDelegate = new CameraAnimationDelegate(mapboxMap); - this.locationComponent.addOnCameraTrackingChangedListener(cameraTrackingChangedListener); - updateCameraTrackingMode(trackingCameraMode); - } - - /** - * Used for testing only. - */ - NavigationCamera(MapboxMap mapboxMap, MapboxNavigation navigation, ProgressChangeListener progressChangeListener, - LocationComponent locationComponent, RouteInformation currentRouteInformation) { - this.mapboxMap = mapboxMap; - this.locationComponent = locationComponent; - this.navigation = navigation; - this.progressChangeListener = progressChangeListener; - this.currentRouteInformation = currentRouteInformation; - } - - /** - * Called when beginning navigation with a route. - * - * @param route used to update route information - */ - public void start(DirectionsRoute route) { - if (route != null) { - currentRouteInformation = buildRouteInformationFromRoute(route); - } - navigation.addProgressChangeListener(progressChangeListener); - } - - /** - * Called during rotation to update route information. - * - * @param location used to update route information - */ - public void resume(Location location) { - if (location != null) { - currentRouteInformation = buildRouteInformationFromLocation(location, null); - } - navigation.addProgressChangeListener(progressChangeListener); - } - - /** - * Updates the {@link TrackingMode} that's going to be used when camera tracking is enabled. - * - * @param trackingMode the tracking mode - */ - public void updateCameraTrackingMode(@TrackingMode int trackingMode) { - setCameraMode(trackingMode); - } - - /** - * Getter for current state of tracking. - * - * @return true if tracking, false if not - */ - public boolean isTrackingEnabled() { - return trackingCameraMode != NAVIGATION_TRACKING_MODE_NONE; - } - - /** - * Getter for {@link TrackingMode} that's being used when tracking is enabled. - * - * @return tracking mode - */ - @TrackingMode - public int getCameraTrackingMode() { - return trackingCameraMode; - } - - /** - * Resets the map camera / padding to the last known camera position. - *

- * You can also specify a tracking mode to reset with. For example if you would like - * to reset the camera and continue tracking, you would use {@link NavigationCamera#NAVIGATION_TRACKING_MODE_GPS}. - * - * @param trackingMode the tracking mode - */ - public void resetCameraPositionWith(@TrackingMode int trackingMode) { - resetWith(trackingMode); - } - - /** - * This method stops the map camera from tracking the current location, and then zooms - * out to an overview of the current route being traveled. - * - * @param padding in pixels around the bounding box of the overview (left, top, right, bottom) - */ - public void showRouteOverview(int[] padding) { - updateCameraTrackingMode(NAVIGATION_TRACKING_MODE_NONE); - RouteInformation routeInformation = buildRouteInformationFromProgress(currentRouteProgress); - animateCameraForRouteOverview(routeInformation, padding); - } - - /** - * Animate the camera to a new location defined within {@link CameraUpdate} passed to the - * {@link NavigationCameraUpdate} using a transition animation that evokes powered flight. - * If the camera is in a tracking mode, this animation is going to be ignored, or break the tracking, - * based on the {@link CameraUpdateMode}. - * - * @param update the change that should be applied to the camera. - * @see CameraUpdateMode for how this update interacts with the current tracking - */ - public void update(NavigationCameraUpdate update) { - animationDelegate.render(update, MapboxConstants.ANIMATION_DURATION, null); - } - - /** - * Animate the camera to a new location defined within {@link CameraUpdate} passed to the - * {@link NavigationCameraUpdate} using a transition animation that evokes powered flight. - * The animation will last a specified amount of time given in milliseconds. If the camera is in a tracking mode, - * this animation is going to be ignored, or break the tracking, based on the {@link CameraUpdateMode}. - * - * @param update the change that should be applied to the camera. - * @param durationMs the duration of the animation in milliseconds. This must be strictly - * positive, otherwise an IllegalArgumentException will be thrown. - * @see CameraUpdateMode for how this update interacts with the current tracking - */ - public void update(NavigationCameraUpdate update, int durationMs) { - animationDelegate.render(update, durationMs, null); - } - - /** - * Animate the camera to a new location defined within {@link CameraUpdate} passed to the - * {@link NavigationCameraUpdate} using a transition animation that evokes powered flight. The animation will - * last a specified amount of time given in milliseconds. A callback can be used to be notified when animating - * the camera stops. During the animation, a call to {@link MapboxMap#getCameraPosition()} returns an intermediate - * location of the camera in flight. If the camera is in a tracking mode, - * this animation is going to be ignored, or break the tracking, based on the {@link CameraUpdateMode}. - * - * @param update the change that should be applied to the camera. - * @param durationMs the duration of the animation in milliseconds. This must be strictly - * positive, otherwise an IllegalArgumentException will be thrown. - * @param callback an optional callback to be notified from the main thread when the animation - * stops. If the animation stops due to its natural completion, the callback - * will be notified with onFinish(). If the animation stops due to interruption - * by a later camera movement or a user gesture, onCancel() will be called. - * Do not update or animate the camera from within onCancel(). If a callback - * isn't required, leave it as null. - * @see CameraUpdateMode for how this update interacts with the current tracking - */ - public void update(NavigationCameraUpdate update, int durationMs, @Nullable MapboxMap.CancelableCallback callback) { - animationDelegate.render(update, durationMs, callback); - } - - /** - * Call in {@link FragmentActivity#onStart()} to properly add the {@link ProgressChangeListener} - * for the camera and prevent any leaks or further updates. - */ - @OnLifecycleEvent(Lifecycle.Event.ON_START) - public void onStart() { - if (navigation != null) { - navigation.addProgressChangeListener(progressChangeListener); - } - } - - /** - * Call in {@link FragmentActivity#onStop()} to properly remove the {@link ProgressChangeListener} - * for the camera and prevent any leaks or further updates. - */ - @OnLifecycleEvent(Lifecycle.Event.ON_STOP) - public void onStop() { - if (navigation != null) { - navigation.removeProgressChangeListener(progressChangeListener); - } - } - - /** - * This method can be called if you did not pass an instance of {@link MapboxNavigation} - * to the constructor. - *

- * The camera will begin listening to progress updates and update the route accordingly. - * - * @param navigation to add the camera progress change listener - */ - public void addProgressChangeListener(MapboxNavigation navigation) { - this.navigation = navigation; - navigation.setCameraEngine(new DynamicCamera(mapboxMap)); - navigation.addProgressChangeListener(progressChangeListener); - } - - /** - * Adds given tracking mode transition listener for receiving notification of camera - * transition updates. - * - * @param listener to be added - */ - public void addOnTrackingModeTransitionListener(@NonNull OnTrackingModeTransitionListener listener) { - onTrackingModeTransitionListeners.add(listener); - } - - /** - * Removes given tracking mode transition listener for receiving notification of camera - * transition updates. - * - * @param listener to be removed - */ - public void removeOnTrackingModeTransitionListener(@NonNull OnTrackingModeTransitionListener listener) { - onTrackingModeTransitionListeners.remove(listener); - } - - /** - * Adds given tracking mode changed listener for receiving notification of camera - * mode changes. - * - * @param listener to be added - */ - public void addOnTrackingModeChangedListener(@NonNull OnTrackingModeChangedListener listener) { - onTrackingModeChangedListeners.add(listener); - } - - /** - * Removes given tracking mode transition listener for receiving notification of camera - * mode changes. - * - * @param listener to be removed - */ - public void removeOnTrackingModeChangedListener(@NonNull OnTrackingModeChangedListener listener) { - onTrackingModeChangedListeners.remove(listener); - } - - void updateTransitionListenersFinished(@CameraMode.Mode int cameraMode) { - onCameraTransitionFinished(); - Integer trackingCameraMode = findTrackingModeFor(cameraMode); - if (trackingCameraMode == null) { - return; - } - for (OnTrackingModeTransitionListener listener : onTrackingModeTransitionListeners) { - listener.onTransitionFinished(trackingCameraMode); - } - } - - void updateTransitionListenersCancelled(@CameraMode.Mode int cameraMode) { - Integer trackingCameraMode = findTrackingModeFor(cameraMode); - if (trackingCameraMode == null) { - return; - } - for (OnTrackingModeTransitionListener listener : onTrackingModeTransitionListeners) { - listener.onTransitionCancelled(trackingCameraMode); - } - } - - @Nullable - Integer findTrackingModeFor(@CameraMode.Mode int cameraMode) { - if (cameraMode == CameraMode.TRACKING_GPS) { - return NAVIGATION_TRACKING_MODE_GPS; - } else if (cameraMode == CameraMode.TRACKING_GPS_NORTH) { - return NAVIGATION_TRACKING_MODE_NORTH; - } else if (cameraMode == CameraMode.NONE) { - return NAVIGATION_TRACKING_MODE_NONE; - } else { - return null; - } - } - - void updateIsResetting(boolean isResetting) { - this.isCameraResetting = isResetting; - } - - private void initializeWith(MapboxNavigation navigation) { - navigation.setCameraEngine(new DynamicCamera(mapboxMap)); - updateCameraTrackingMode(trackingCameraMode); - } - - /** - * Creates a camera position based on the given route. - *

- * From the {@link DirectionsRoute}, an initial bearing and target position are created. - * Then using a preset tilt and zoom (based on screen orientation), a {@link CameraPosition} is built. - * - * @param route used to build the camera position - * @return camera position to be animated to - */ - @NonNull - private RouteInformation buildRouteInformationFromRoute(DirectionsRoute route) { - return RouteInformation.create(route, null, null); - } - - /** - * Creates a camera position based on the given location. - *

- * From the {@link Location}, a target position is created. - * Then using a preset tilt and zoom (based on screen orientation), a {@link CameraPosition} is built. - * - * @param location used to build the camera position - * @return camera position to be animated to - */ - @NonNull - private RouteInformation buildRouteInformationFromLocation(Location location, RouteProgress routeProgress) { - return RouteInformation.create(null, location, routeProgress); - } - - @NonNull - private RouteInformation buildRouteInformationFromProgress(RouteProgress routeProgress) { - if (routeProgress == null) { - return RouteInformation.create(null, null, null); - } - return RouteInformation.create(routeProgress.directionsRoute(), null, null); - } - - private void onCameraTransitionFinished() { - if (isCameraResetting && currentRouteInformation != null) { - adjustCameraForReset(currentRouteInformation); - } - } - - private void animateCameraForRouteOverview(RouteInformation routeInformation, int[] padding) { - Camera cameraEngine = navigation.getCameraEngine(); - List routePoints = cameraEngine.overview(routeInformation); - if (!routePoints.isEmpty()) { - animateMapboxMapForRouteOverview(padding, routePoints); - } - } - - private void animateMapboxMapForRouteOverview(int[] padding, List routePoints) { - if (routePoints.size() <= ONE_POINT) { - return; - } - CameraUpdate resetUpdate = buildResetCameraUpdate(); - final CameraUpdate overviewUpdate = buildOverviewCameraUpdate(padding, routePoints); - mapboxMap.animateCamera(resetUpdate, 150, - new CameraOverviewCancelableCallback(overviewUpdate, mapboxMap) - ); - } - - @NonNull - private CameraUpdate buildResetCameraUpdate() { - CameraPosition resetPosition = new CameraPosition.Builder().tilt(0).bearing(0).build(); - return CameraUpdateFactory.newCameraPosition(resetPosition); - } - - @NonNull - private CameraUpdate buildOverviewCameraUpdate(int[] padding, List routePoints) { - final LatLngBounds routeBounds = convertRoutePointsToLatLngBounds(routePoints); - return CameraUpdateFactory.newLatLngBounds( - routeBounds, padding[0], padding[1], padding[2], padding[3] - ); - } - - private LatLngBounds convertRoutePointsToLatLngBounds(List routePoints) { - List latLngs = new ArrayList<>(); - for (Point routePoint : routePoints) { - latLngs.add(new LatLng(routePoint.latitude(), routePoint.longitude())); - } - return new LatLngBounds.Builder() - .includes(latLngs) - .build(); - } - - private void setCameraMode(@TrackingMode int trackingCameraMode) { - @CameraMode.Mode Integer cameraMode = findCameraModeFor(trackingCameraMode); - if (cameraMode != null) { - this.trackingCameraMode = trackingCameraMode; - updateTrackingModeListenersWith(this.trackingCameraMode); - if (cameraMode != locationComponent.getCameraMode()) { - locationComponent.setCameraMode(cameraMode, cameraTransitionListener); - } - } else { - Timber.e("Using unsupported camera tracking mode - %d.", trackingCameraMode); - } - } - - @Nullable - private Integer findCameraModeFor(@TrackingMode int trackingCameraMode) { - if (trackingCameraMode == NAVIGATION_TRACKING_MODE_GPS) { - return CameraMode.TRACKING_GPS; - } else if (trackingCameraMode == NAVIGATION_TRACKING_MODE_NORTH) { - return CameraMode.TRACKING_GPS_NORTH; - } else if (trackingCameraMode == NAVIGATION_TRACKING_MODE_NONE) { - return CameraMode.NONE; - } else { - return null; - } - } - - private void updateTrackingModeListenersWith(@TrackingMode int trackingMode) { - for (OnTrackingModeChangedListener listener : onTrackingModeChangedListeners) { - listener.onTrackingModeChanged(trackingMode); - } - } - - private void resetWith(@TrackingMode int trackingMode) { - updateIsResetting(true); - resetDynamicCamera(navigation.getCameraEngine()); - updateCameraTrackingMode(trackingMode); - } - - private void resetDynamicCamera(Camera camera) { - if (camera instanceof DynamicCamera) { - ((DynamicCamera) camera).forceResetZoomLevel(); - } - } - - private void adjustCameraForReset(RouteInformation routeInformation) { - Camera camera = navigation.getCameraEngine(); - float tilt = (float) camera.tilt(routeInformation); - double zoom = camera.zoom(routeInformation); - locationComponent.zoomWhileTracking(zoom, getZoomAnimationDuration(zoom), new ResetCancelableCallback(this)); - locationComponent.tiltWhileTracking(tilt, getTiltAnimationDuration(tilt)); - } - - private void adjustCameraFromLocation(RouteInformation routeInformation) { - Camera camera = navigation.getCameraEngine(); - float tilt = (float) camera.tilt(routeInformation); - double zoom = camera.zoom(routeInformation); - locationComponent.zoomWhileTracking(zoom, getZoomAnimationDuration(zoom)); - locationComponent.tiltWhileTracking(tilt, getTiltAnimationDuration(tilt)); - } - - private long getZoomAnimationDuration(double zoom) { - double zoomDiff = Math.abs(mapboxMap.getCameraPosition().zoom - zoom); - return (long) MathUtils.clamp( - 500 * zoomDiff, - NAVIGATION_MIN_CAMERA_ZOOM_ADJUSTMENT_ANIMATION_DURATION, - NAVIGATION_MAX_CAMERA_ADJUSTMENT_ANIMATION_DURATION); - } - - private long getTiltAnimationDuration(double tilt) { - double tiltDiff = Math.abs(mapboxMap.getCameraPosition().tilt - tilt); - return (long) MathUtils.clamp( - 500 * tiltDiff, - NAVIGATION_MIN_CAMERA_TILT_ADJUSTMENT_ANIMATION_DURATION, - NAVIGATION_MAX_CAMERA_ADJUSTMENT_ANIMATION_DURATION); - } - - @Retention(RetentionPolicy.SOURCE) - @IntDef( {NAVIGATION_TRACKING_MODE_GPS, - NAVIGATION_TRACKING_MODE_NORTH, - NAVIGATION_TRACKING_MODE_NONE - }) - public @interface TrackingMode { - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListener.java deleted file mode 100644 index 4c864547..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener; - -class NavigationCameraTrackingChangedListener implements OnCameraTrackingChangedListener { - - private final NavigationCamera camera; - - NavigationCameraTrackingChangedListener(NavigationCamera camera) { - this.camera = camera; - } - - @Override - public void onCameraTrackingDismissed() { - camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE); - } - - @Override - public void onCameraTrackingChanged(int currentMode) { - Integer trackingMode = camera.findTrackingModeFor(currentMode); - if (trackingMode != null) { - camera.updateCameraTrackingMode(trackingMode); - } - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListener.java deleted file mode 100644 index 28ed5188..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListener.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.location.OnLocationCameraTransitionListener; - -class NavigationCameraTransitionListener implements OnLocationCameraTransitionListener { - - private final NavigationCamera camera; - - NavigationCameraTransitionListener(NavigationCamera camera) { - this.camera = camera; - } - - @Override - public void onLocationCameraTransitionFinished(int cameraMode) { - camera.updateTransitionListenersFinished(cameraMode); - } - - @Override - public void onLocationCameraTransitionCanceled(int cameraMode) { - camera.updateTransitionListenersCancelled(cameraMode); - camera.updateIsResetting(false); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraUpdate.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraUpdate.java deleted file mode 100644 index e697ccad..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraUpdate.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import androidx.annotation.NonNull; - -import com.mapbox.mapboxsdk.camera.CameraUpdate; - -/** - * Used with {@link NavigationCamera#update(NavigationCameraUpdate)}. - *

- * This class wraps a Maps SDK {@link CameraUpdate}. It adds an option - * for {@link CameraUpdateMode} that determine how the camera update behaves - * with tracking modes. - */ -public class NavigationCameraUpdate { - - private final CameraUpdate cameraUpdate; - private CameraUpdateMode mode = CameraUpdateMode.DEFAULT; - - /** - * Creates and instance of this class, taking a {@link CameraUpdate} - * that has already been built. - * - * @param cameraUpdate with map camera parameters - */ - public NavigationCameraUpdate(@NonNull CameraUpdate cameraUpdate) { - this.cameraUpdate = cameraUpdate; - } - - /** - * Updates the {@link CameraUpdateMode} that will determine this updates - * behavior based on the current tracking mode in {@link NavigationCamera}. - * - * @param mode either default or override - */ - public void setMode(CameraUpdateMode mode) { - this.mode = mode; - } - - @NonNull - CameraUpdate getCameraUpdate() { - return cameraUpdate; - } - - @NonNull - CameraUpdateMode getMode() { - return mode; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeChangedListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeChangedListener.java deleted file mode 100644 index 8bdc0380..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeChangedListener.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -/** - * Use this listener to observe changes in the {@link NavigationCamera} - * tracking mode. - */ -public interface OnTrackingModeChangedListener { - - /** - * Invoked when {@link NavigationCamera} tracking mode changes. - * - * @param trackingMode the current tracking mode - */ - void onTrackingModeChanged(@NavigationCamera.TrackingMode int trackingMode); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeTransitionListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeTransitionListener.java deleted file mode 100644 index d5f428e7..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/OnTrackingModeTransitionListener.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -/** - * Listener that gets invoked when the navigation camera finishes a transition - * to a new tracking mode. - */ -public interface OnTrackingModeTransitionListener { - - /** - * Invoked when the camera has finished a transition to a new tracking mode. - */ - void onTransitionFinished(@NavigationCamera.TrackingMode int trackingMode); - - /** - * Invoked when the transition to a new tracking mode has been cancelled. - */ - void onTransitionCancelled(@NavigationCamera.TrackingMode int trackingMode); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallback.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallback.java deleted file mode 100644 index 08088a3b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallback.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.maps.MapboxMap; - -class ResetCancelableCallback implements MapboxMap.CancelableCallback { - - private final NavigationCamera camera; - - ResetCancelableCallback(NavigationCamera camera) { - this.camera = camera; - } - - @Override - public void onCancel() { - camera.updateIsResetting(false); - } - - @Override - public void onFinish() { - camera.updateIsResetting(false); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java deleted file mode 100644 index cf6edbfd..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * This class allows text to be constructed to fit a given TextView, given specified - * BannerComponents containing abbreviation information and given a list of BannerComponentNodes, - * constructed by InstructionLoader. - */ -class AbbreviationCreator extends NodeCreator { - private static final String SINGLE_SPACE = " "; - private Map> abbreviations; - private TextViewUtils textViewUtils; - - AbbreviationCreator(AbbreviationVerifier abbreviationVerifier, HashMap abbreviations, - TextViewUtils textViewUtils) { - super(abbreviationVerifier); - this.abbreviations = abbreviations; - this.textViewUtils = textViewUtils; - } - - AbbreviationCreator(AbbreviationVerifier abbreviationVerifier) { - this(abbreviationVerifier, new HashMap(), new TextViewUtils()); - } - - AbbreviationCreator() { - this(new AbbreviationVerifier()); - } - - /** - * Adds the given BannerComponents object to the list of abbreviations so that when the list of - * BannerComponentNodes is completed, text can be abbreviated properly to fit the specified - * TextView. - * - * @param bannerComponents object holding the abbreviation information - * @param index in the list of BannerComponentNodes - */ - private void addPriorityInfo(BannerComponents bannerComponents, int index) { - Integer abbreviationPriority = bannerComponents.abbreviationPriority(); - if (abbreviations.get(abbreviationPriority) == null) { - abbreviations.put(abbreviationPriority, new ArrayList()); - } - abbreviations.get(abbreviationPriority).add(index); - } - - /** - * Using the abbreviations HashMap which should already be populated, abbreviates the text in the - * bannerComponentNodes until the text fits the given TextView. - * - * @param textView to check the text fits - * @param bannerComponentNodes containing the text to construct - * @return the properly abbreviated string that will fit in the TextView - */ - private String abbreviateBannerText(TextView textView, List - bannerComponentNodes) { - String bannerText = join(bannerComponentNodes); - - if (abbreviations.isEmpty()) { - return bannerText; - } - - bannerText = abbreviateUntilTextFits(textView, bannerText, bannerComponentNodes); - - abbreviations.clear(); - return bannerText; - } - - private String abbreviateUntilTextFits(TextView textView, String startingText, - List bannerComponentNodes) { - int currAbbreviationPriority = 0; - int maxAbbreviationPriority = Collections.max(abbreviations.keySet()); - String bannerText = startingText; - - while (shouldKeepAbbreviating(textView, bannerText, currAbbreviationPriority, maxAbbreviationPriority)) { - List indices = abbreviations.get(currAbbreviationPriority++); - - boolean abbreviationPriorityExists = abbreviateAtAbbreviationPriority(bannerComponentNodes, indices); - - if (abbreviationPriorityExists) { - bannerText = join(bannerComponentNodes); - } - } - - return bannerText; - } - - private boolean shouldKeepAbbreviating(TextView textView, String bannerText, - int currAbbreviationPriority, int maxAbbreviationPriority) { - - boolean textFits = textViewUtils.textFits(textView, bannerText); - boolean abbreviationPrioritiesLeft = currAbbreviationPriority <= maxAbbreviationPriority; - return !textFits && abbreviationPrioritiesLeft; - } - - private boolean abbreviateAtAbbreviationPriority(List bannerComponentNodes, - List indices) { - if (indices == null || indices.isEmpty()) { - return false; - } - - for (Integer index : indices) { - abbreviate(bannerComponentNodes.get(index)); - } - - return true; - } - - private void abbreviate(BannerComponentNode bannerComponentNode) { - ((AbbreviationNode) bannerComponentNode).setAbbreviate(true); - } - - private String join(List tokens) { - StringBuilder stringBuilder = new StringBuilder(); - Iterator iterator = tokens.iterator(); - BannerComponentNode bannerComponentNode; - - if (iterator.hasNext()) { - bannerComponentNode = iterator.next(); - bannerComponentNode.setStartIndex(stringBuilder.length()); - stringBuilder.append(bannerComponentNode); - - while (iterator.hasNext()) { - stringBuilder.append(SINGLE_SPACE); - bannerComponentNode = iterator.next(); - bannerComponentNode.setStartIndex(stringBuilder.length()); - stringBuilder.append(bannerComponentNode); - } - } - - return stringBuilder.toString(); - } - - @Override - AbbreviationNode setupNode(BannerComponents components, int index, int startIndex, String - modifier) { - addPriorityInfo(components, index); - return new AbbreviationCreator.AbbreviationNode(components, startIndex); - } - - @Override - void preProcess(TextView textView, List bannerComponentNodes) { - String text = abbreviateBannerText(textView, bannerComponentNodes); - textView.setText(text); - } - - /** - * Class used by InstructionLoader to determine that a BannerComponent contains an abbreviation - */ - static class AbbreviationNode extends BannerComponentNode { - private boolean abbreviate; - - AbbreviationNode(BannerComponents bannerComponents, int startIndex) { - super(bannerComponents, startIndex); - } - - @Override - public String toString() { - return abbreviate ? bannerComponents.abbreviation() : bannerComponents.text(); - } - - void setAbbreviate(boolean abbreviate) { - this.abbreviate = abbreviate; - } - - boolean getAbbreviate() { - return abbreviate; - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationVerifier.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationVerifier.java deleted file mode 100644 index d19af8a9..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationVerifier.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.core.utils.TextUtils; - -class AbbreviationVerifier implements NodeVerifier { - @Override - public boolean isNodeType(BannerComponents bannerComponents) { - return hasAbbreviation(bannerComponents); - } - - private boolean hasAbbreviation(BannerComponents components) { - return !TextUtils.isEmpty(components.abbreviation()); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentNode.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentNode.java deleted file mode 100644 index 3766cb6e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentNode.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -/** - * Class used to construct a list of BannerComponents to be populated into a TextView - */ -class BannerComponentNode { - BannerComponents bannerComponents; - int startIndex; - - BannerComponentNode(BannerComponents bannerComponents, int startIndex) { - this.bannerComponents = bannerComponents; - this.startIndex = startIndex; - } - - @Override - public String toString() { - return bannerComponents.text(); - } - - void setStartIndex(int startIndex) { - this.startIndex = startIndex; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTree.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTree.java deleted file mode 100644 index 3a334913..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTree.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import androidx.annotation.NonNull; -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.v5.models.BannerText; - -import java.util.ArrayList; -import java.util.List; - -class BannerComponentTree { - private final NodeCreator[] nodeCreators; - private final List bannerComponentNodes; - - /** - * Creates a master coordinator to make sure the coordinators passed in are used appropriately - * - * @param nodeCreators coordinators in the order that they should process banner components - */ - BannerComponentTree(@NonNull BannerText bannerText, NodeCreator... nodeCreators) { - this.nodeCreators = nodeCreators; - bannerComponentNodes = parseBannerComponents(bannerText); - } - - /** - * Parses the banner components and processes them using the nodeCreators in the order they - * were originally passed - * - * @param bannerText to parse - * @return the list of nodes representing the bannerComponents - */ - private List parseBannerComponents(BannerText bannerText) { - int length = 0; - List bannerComponentNodes = new ArrayList<>(); - - for (BannerComponents components : bannerText.components()) { - BannerComponentNode node = null; - for (NodeCreator nodeCreator : nodeCreators) { - if (nodeCreator.isNodeType(components)) { - node = nodeCreator.setupNode(components, bannerComponentNodes.size(), length, - bannerText.modifier()); - break; - } - } - - if (node != null) { - bannerComponentNodes.add(node); - length += components.text().length(); - } - } - - return bannerComponentNodes; - } - - /** - * Loads the instruction into the given text view. If things have to be done in a particular order, - * the coordinator methods preProcess and postProcess can be used. PreProcess should be used to - * load text into the textView (so there should only be one coordinator calling this method), and - * postProcess should be used to make changes to that text, i.e., to load images into the textView. - * - * @param textView in which to load text and images - */ - void loadInstruction(TextView textView) { - for (NodeCreator nodeCreator : nodeCreators) { - nodeCreator.preProcess(textView, bannerComponentNodes); - } - - for (NodeCreator nodeCreator : nodeCreators) { - nodeCreator.postProcess(textView, bannerComponentNodes); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerInstructionModel.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerInstructionModel.java deleted file mode 100644 index b2a434e6..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerInstructionModel.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.BannerText; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; - -public class BannerInstructionModel extends InstructionModel { - - private final BannerText primaryBannerText; - private final BannerText secondaryBannerText; - private final BannerText subBannerText; - - public BannerInstructionModel(DistanceFormatter distanceFormatter, RouteProgress progress, - BannerInstructions instructions) { - super(distanceFormatter, progress); - primaryBannerText = instructions.primary(); - secondaryBannerText = instructions.secondary(); - subBannerText = instructions.sub(); - } - - BannerText retrievePrimaryBannerText() { - return primaryBannerText; - } - - BannerText retrieveSecondaryBannerText() { - return secondaryBannerText; - } - - BannerText retrieveSubBannerText() { - return subBannerText; - } - - String retrievePrimaryManeuverType() { - return primaryBannerText.type(); - } - - String retrievePrimaryManeuverModifier() { - return primaryBannerText.modifier(); - } - - @Nullable - Double retrievePrimaryRoundaboutAngle() { - return primaryBannerText.degrees(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerShield.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerShield.java deleted file mode 100644 index 88c957a2..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerShield.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -class BannerShield { - private String url; - private String text; - private int nodeIndex; - private int startIndex = -1; - - BannerShield(BannerComponents bannerComponents, int nodeIndex) { - this.url = bannerComponents.imageBaseUrl(); - this.nodeIndex = nodeIndex; - this.text = bannerComponents.text(); - } - - String getUrl() { - return url; - } - - public String getText() { - return text; - } - - public int getNodeIndex() { - return nodeIndex; - } - - public void setStartIndex(int startIndex) { - this.startIndex = startIndex; - } - - public int getStartIndex() { - return startIndex; - } - - int getEndIndex() { - return startIndex + text.length(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java deleted file mode 100644 index 0dfd9cbc..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.ui.v5.R; - -import java.util.List; - -class ExitSignCreator extends NodeCreator { - private String exitNumber; - private int startIndex; - private TextViewUtils textViewUtils; - private String modifier; - private static final String EXIT = "exit"; - private static final String EXIT_NUMBER = "exit-number"; - private static final String LEFT = "left"; - - ExitSignCreator() { - super(new ExitSignVerifier()); - textViewUtils = new TextViewUtils(); - } - - @Override - BannerComponentNode setupNode(BannerComponents components, int index, int startIndex, - String modifier) { - if (components.type().equals(EXIT)) { - return null; - } else if (components.type().equals(EXIT_NUMBER)) { - exitNumber = components.text(); - this.startIndex = startIndex; - this.modifier = modifier; - } - - return new BannerComponentNode(components, startIndex); - } - - /** - * One coordinator should override this method, and this should be the coordinator which populates - * the textView with text. - * - * @param textView to populate - * @param bannerComponentNodes containing instructions - */ - @Override - void postProcess(TextView textView, List bannerComponentNodes) { - if (exitNumber != null) { - LayoutInflater inflater = (LayoutInflater) textView.getContext().getSystemService(Context - .LAYOUT_INFLATER_SERVICE); - - ViewGroup root = (ViewGroup) textView.getParent(); - - TextView exitSignView; - - if (modifier.equals(LEFT)) { - exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_left, root, false); - } else { - exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_right, root, false); - } - - exitSignView.setText(exitNumber); - - textViewUtils.setImageSpan(textView, exitSignView, startIndex, startIndex + exitNumber - .length()); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignVerifier.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignVerifier.java deleted file mode 100644 index e0e48ec2..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignVerifier.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -class ExitSignVerifier implements NodeVerifier { - - @Override - public boolean isNodeType(BannerComponents bannerComponents) { - return bannerComponents.type().equals("exit") || bannerComponents.type().equals("exit-number"); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java deleted file mode 100644 index 19a0328b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.content.Context; -import android.os.Build; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.ImageSpan; -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.BannerText; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.navigation.SdkVersionChecker; -import com.squareup.picasso.Picasso; - -import java.util.ArrayList; -import java.util.List; - -/** - * Utility class that can be used to load a given {@link BannerText} into the provided - * {@link TextView}. - *

- * For each {@link BannerComponents}, either the text or given shield URL will be used (the shield - * URL taking priority). - *

- * If a shield URL is found, {@link Picasso} is used to load the image. Then, once the image is loaded, - * a new {@link ImageSpan} is created and set to the appropriate position of the {@link Spannable} - */ -public class ImageCreator extends NodeCreator { - - private static ImageCreator instance; - private boolean isInitialized; - private Picasso picassoImageLoader; - private List targets; - private UrlDensityMap urlDensityMap; - private List bannerShieldList; - - private ImageCreator(ImageVerifier imageVerifier) { - super(imageVerifier); - } - - @Override - BannerComponentNode setupNode(BannerComponents components, int index, int startIndex, - String modifier) { - addShieldInfo(components, index); - return new BannerComponentNode(components, startIndex); - } - - /** - * Uses the given BannerComponents object to construct a BannerShield object containing the - * information needed to load the proper image into the TextView where appropriate. - * - * @param bannerComponents containing image info - * @param index of the BannerComponentNode which refers to the given BannerComponents - */ - private void addShieldInfo(BannerComponents bannerComponents, int index) { - bannerShieldList.add(new BannerShield(bannerComponents, index)); - } - - /** - * Primary access method (using singleton pattern) - * - * @return ImageCoordinator - */ - public static synchronized ImageCreator getInstance() { - if (instance == null) { - instance = new ImageCreator(new ImageVerifier()); - } - - return instance; - } - - /** - * Must be called before loading images. - *

- * Initializes a new {@link Picasso} instance as well as the - * {@link ArrayList} of {@link InstructionTarget}. - * - * @param context to init Picasso - */ - public void initialize(Context context) { - if (!isInitialized) { - initializePicasso(context); - initializeData(context); - isInitialized = true; - } - } - - /** - * Will pre-fetch images for a given {@link LegStep}. - *

- * If loaded successfully, this will allow the images to be displayed - * without delay in the {@link InstructionView}. - * - * @param legStep providing the image Urls - */ - public void prefetchImageCache(LegStep legStep) { - checkIsInitialized(); - fetchInstructions(legStep); - } - - public void shutdown() { - targets.clear(); - } - - /** - * Takes the given components from the {@link BannerText} and creates - * a new {@link Spannable} with text / {@link ImageSpan}s which is loaded - * into the given {@link TextView}. - * - * @param textView target for the banner text - * @since 0.9.0 - */ - private void loadImages(TextView textView, List bannerComponentNodes) { - if (!hasImages()) { - return; - } - - updateShieldUrlIndices(bannerComponentNodes); - createTargets(textView); - loadTargets(); - } - - private void initializePicasso(Context context) { - Picasso.Builder builder = new Picasso.Builder(context); - picassoImageLoader = builder.build(); - } - - private void initializeData(Context context) { - SdkVersionChecker currentVersionChecker = new SdkVersionChecker(Build.VERSION.SDK_INT); - int displayDensity = context.getResources().getDisplayMetrics().densityDpi; - urlDensityMap = new UrlDensityMap(displayDensity, currentVersionChecker); - targets = new ArrayList<>(); - bannerShieldList = new ArrayList<>(); - } - - private void fetchInstructions(LegStep legStep) { - if (legStep == null || legStep.bannerInstructions() == null - || legStep.bannerInstructions().isEmpty()) { - return; - } - - List bannerInstructionList = new ArrayList<>(legStep.bannerInstructions()); - for (BannerInstructions instructions : bannerInstructionList) { - if (hasComponents(instructions.primary())) { - fetchImageBaseUrls(instructions.primary()); - } - if (hasComponents(instructions.secondary())) { - fetchImageBaseUrls(instructions.secondary()); - } - } - } - - private void updateShieldUrlIndices(List bannerComponentNodes) { - for (BannerShield bannerShield : bannerShieldList) { - bannerShield.setStartIndex(bannerComponentNodes.get(bannerShield.getNodeIndex()).startIndex); - } - } - - private boolean hasComponents(BannerText bannerText) { - return bannerText != null && bannerText.components() != null && !bannerText.components().isEmpty(); - } - - private boolean hasImages() { - return !bannerShieldList.isEmpty(); - } - - /** - * Takes a given {@link BannerText} and fetches a valid - * imageBaseUrl if one is found. - * - * @param bannerText to provide the base URL - */ - private void fetchImageBaseUrls(BannerText bannerText) { - for (BannerComponents components : bannerText.components()) { - if (nodeVerifier.hasImageUrl(components)) { - picassoImageLoader.load(urlDensityMap.get(components.imageBaseUrl())).fetch(); - } - } - } - - private void createTargets(TextView textView) { - Spannable instructionSpannable = new SpannableString(textView.getText()); - - for (final BannerShield bannerShield : bannerShieldList) { - targets.add(new InstructionTarget(textView, instructionSpannable, bannerShieldList, bannerShield, - new InstructionTarget.InstructionLoadedCallback() { - @Override - public void onInstructionLoaded(InstructionTarget target) { - targets.remove(target); - } - })); - } - bannerShieldList.clear(); - } - - private void loadTargets() { - for (InstructionTarget target : new ArrayList<>(targets)) { - picassoImageLoader.load(urlDensityMap.get(target.getShield().getUrl())) - .into(target); - } - } - - private void checkIsInitialized() { - if (!isInitialized) { - throw new RuntimeException("ImageCreator must be initialized prior to loading image URLs"); - } - } - - @Override - void postProcess(TextView textView, List bannerComponentNodes) { - loadImages(textView, bannerComponentNodes); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageVerifier.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageVerifier.java deleted file mode 100644 index 169438f1..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageVerifier.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.text.TextUtils; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -class ImageVerifier implements NodeVerifier { - - @Override - public boolean isNodeType(BannerComponents bannerComponents) { - return hasImageUrl(bannerComponents); - } - - boolean hasImageUrl(BannerComponents components) { - return !TextUtils.isEmpty(components.imageBaseUrl()); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionListTransitionListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionListTransitionListener.java deleted file mode 100644 index 2bf2b08b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionListTransitionListener.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import androidx.annotation.NonNull; -import androidx.transition.Transition; -import androidx.transition.TransitionListenerAdapter; -import androidx.recyclerview.widget.RecyclerView; - -import com.mapbox.services.android.navigation.ui.v5.summary.list.InstructionListAdapter; - -class InstructionListTransitionListener extends TransitionListenerAdapter { - - private static final int TOP = 0; - private final RecyclerView rvInstructions; - private final InstructionListAdapter instructionListAdapter; - - InstructionListTransitionListener(RecyclerView rvInstructions, InstructionListAdapter instructionListAdapter) { - this.rvInstructions = rvInstructions; - this.instructionListAdapter = instructionListAdapter; - } - - @Override - public void onTransitionEnd(@NonNull Transition transition) { - super.onTransitionEnd(transition); - onAnimationFinished(); - } - - @Override - public void onTransitionCancel(@NonNull Transition transition) { - super.onTransitionCancel(transition); - onAnimationFinished(); - } - - private void onAnimationFinished() { - rvInstructions.stopScroll(); - instructionListAdapter.notifyDataSetChanged(); - rvInstructions.smoothScrollToPosition(TOP); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoader.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoader.java deleted file mode 100644 index 8004ca2a..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoader.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import androidx.annotation.NonNull; -import android.text.Spannable; -import android.text.style.ImageSpan; -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.v5.models.BannerText; -import com.squareup.picasso.Picasso; - -/** - * Utility class that can be used to load a given {@link BannerText} into the provided - * {@link TextView}. - *

- * For each {@link BannerComponents}, either the text or given shield URL will be used (the shield - * URL taking priority). - *

- * If a shield URL is found, {@link Picasso} is used to load the image. Then, once the image is loaded, - * a new {@link ImageSpan} is created and set to the appropriate position of the {@link Spannable}/ - */ -public class InstructionLoader { - private TextView textView; - private BannerComponentTree bannerComponentTree; - - /** - * Creates an InstructionLoader which can handle highway shields and also takes into account - * abbreviations. - * - * @param textView to populate with instruction - * @param bannerText containing components to populate into textView - */ - public InstructionLoader(TextView textView, @NonNull BannerText bannerText) { - this(textView, new BannerComponentTree(bannerText, new ExitSignCreator(), - ImageCreator.getInstance(), new AbbreviationCreator(), new TextCreator())); - } - - InstructionLoader(TextView textView, BannerComponentTree bannerComponentTree) { - this.textView = textView; - this.bannerComponentTree = bannerComponentTree; - } - - /** - * Takes the given components from the {@link BannerText} and creates - * a new {@link Spannable} with text / {@link ImageSpan}s which is loaded - * into the given {@link TextView}. - */ - public void loadInstruction() { - bannerComponentTree.loadInstruction(textView); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionModel.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionModel.java deleted file mode 100644 index 44937c1e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionModel.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.text.SpannableString; - -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; - -public class InstructionModel { - - private RouteProgress progress; - private SpannableString stepDistanceRemaining; - private String drivingSide; - - public InstructionModel(DistanceFormatter distanceFormatter, RouteProgress progress) { - this.progress = progress; - double distanceRemaining = progress.currentLegProgress().currentStepProgress().distanceRemaining(); - stepDistanceRemaining = distanceFormatter.formatDistance(distanceRemaining); - this.drivingSide = progress.currentLegProgress().currentStep().drivingSide(); - } - - RouteProgress retrieveProgress() { - return progress; - } - - SpannableString retrieveStepDistanceRemaining() { - return stepDistanceRemaining; - } - - String retrieveDrivingSide() { - return drivingSide; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionTarget.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionTarget.java deleted file mode 100644 index 9539fc8e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionTarget.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; -import android.text.Spannable; -import android.text.Spanned; -import android.text.TextUtils; -import android.text.style.ImageSpan; -import android.widget.TextView; - -import com.squareup.picasso.Picasso; -import com.squareup.picasso.Target; - -import java.util.List; - -import timber.log.Timber; - -public class InstructionTarget implements Target { - - private TextView textView; - private Spannable instructionSpannable; - private List shields; - private BannerShield shield; - private InstructionLoadedCallback instructionLoadedCallback; - private TextViewUtils textViewUtils; - - InstructionTarget(TextView textView, Spannable instructionSpannable, List shields, - BannerShield shield, InstructionLoadedCallback instructionLoadedCallback) { - this(textView, instructionSpannable, shields, shield, new TextViewUtils(), instructionLoadedCallback); - } - - private InstructionTarget(TextView textView, Spannable instructionSpannable, List shields, - BannerShield shield, TextViewUtils textViewUtils, - InstructionLoadedCallback instructionLoadedCallback) { - this.textView = textView; - this.instructionSpannable = instructionSpannable; - this.shields = shields; - this.shield = shield; - this.instructionLoadedCallback = instructionLoadedCallback; - this.textViewUtils = textViewUtils; - } - - BannerShield getShield() { - return shield; - } - - @Override - public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { - Drawable drawable = textViewUtils.createDrawable(textView, bitmap); - createAndSetImageSpan(drawable); - sendInstructionLoadedCallback(); - } - - @Override - public void onBitmapFailed(Exception exception, Drawable errorDrawable) { - setBackupText(); - sendInstructionLoadedCallback(); - Timber.e(exception); - } - - @Override - public void onPrepareLoad(Drawable placeHolderDrawable) { - // no op - } - - interface InstructionLoadedCallback { - void onInstructionLoaded(InstructionTarget target); - } - - private void setBackupText() { - textView.setText(shield.getText()); - } - - private void createAndSetImageSpan(Drawable drawable) { - instructionSpannable.setSpan(new ImageSpan(drawable), - shield.getStartIndex(), shield.getEndIndex(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - - if (shields.indexOf(shield) == shields.size() - 1) { - CharSequence truncatedSequence = truncateImageSpan(instructionSpannable, textView); - textView.setText(truncatedSequence); - } - } - - private void sendInstructionLoadedCallback() { - if (instructionLoadedCallback != null) { - instructionLoadedCallback.onInstructionLoaded(this); - } - } - - private static CharSequence truncateImageSpan(Spannable instructionSpannable, TextView textView) { - int availableSpace = textView.getWidth() - textView.getPaddingRight() - textView.getPaddingLeft(); - if (availableSpace > 0) { - return TextUtils.ellipsize(instructionSpannable, textView.getPaint(), availableSpace, TextUtils.TruncateAt.END); - } else { - return instructionSpannable; - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java deleted file mode 100644 index d09730cc..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java +++ /dev/null @@ -1,782 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.content.Context; -import android.content.res.Configuration; -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.View; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.constraintlayout.widget.ConstraintSet; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.fragment.app.FragmentActivity; -import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleObserver; -import androidx.lifecycle.LifecycleOwner; -import androidx.lifecycle.Observer; -import androidx.lifecycle.OnLifecycleEvent; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.transition.AutoTransition; -import androidx.transition.TransitionManager; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.BannerText; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.ui.v5.NavigationButton; -import com.mapbox.services.android.navigation.ui.v5.NavigationViewModel; -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.SoundButton; -import com.mapbox.services.android.navigation.ui.v5.ThemeSwitcher; -import com.mapbox.services.android.navigation.ui.v5.instruction.maneuver.ManeuverView; -import com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneAdapter; -import com.mapbox.services.android.navigation.ui.v5.listeners.InstructionListListener; -import com.mapbox.services.android.navigation.ui.v5.summary.list.InstructionListAdapter; -import com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; -import com.mapbox.services.android.navigation.v5.utils.LocaleUtils; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -import timber.log.Timber; - -/** - * A view that can be used to display upcoming maneuver information and control - * voice instruction mute / unmute. - *

- * An {@link ImageView} is used to display the maneuver image on the left. - * Two {@link TextView}s are used to display distance to the next maneuver, as well - * as the name of the destination / maneuver name / instruction based on what data is available - *

- * To automatically have this view update with information from - * {@link com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation}, - * add the view as a {@link ProgressChangeListener} and / or {@link OffRouteListener} - * - * @since 0.6.0 - */ -public class InstructionView extends RelativeLayout implements LifecycleObserver { - - private static final String COMPONENT_TYPE_LANE = "lane"; - - private ManeuverView upcomingManeuverView; - private TextView upcomingDistanceText; - private TextView upcomingPrimaryText; - private TextView upcomingSecondaryText; - private ManeuverView subManeuverView; - private TextView subStepText; - private NavigationAlertView alertView; - private View rerouteLayout; - private View turnLaneLayout; - private View subStepLayout; - private RecyclerView rvTurnLanes; - private RecyclerView rvInstructions; - private TurnLaneAdapter turnLaneAdapter; - private ConstraintLayout instructionLayout; - private LinearLayout instructionLayoutText; - private View instructionListLayout; - private InstructionListAdapter instructionListAdapter; - private Animation rerouteSlideUpTop; - private Animation rerouteSlideDownTop; - private LegStep currentStep; - private NavigationViewModel navigationViewModel; - private InstructionListListener instructionListListener; - - private DistanceFormatter distanceFormatter; - private boolean isRerouting; - private SoundButton soundButton; - private LifecycleOwner lifecycleOwner; - - public InstructionView(Context context) { - this(context, null); - } - - public InstructionView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, -1); - } - - public InstructionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initialize(); - } - - /** - * Adds a listener that is triggered when the instruction list in InstructionView is shown or hidden. - * - * @param instructionListListener to be set - */ - public void setInstructionListListener(InstructionListListener instructionListListener) { - this.instructionListListener = instructionListListener; - } - - /** - * Once this view has finished inflating, it will bind the views. - *

- * It will also initialize the {@link RecyclerView} used to display the turn lanes - * and animations used to show / hide views. - */ - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - bind(); - initializeBackground(); - initializeTurnLaneRecyclerView(); - initializeInstructionListRecyclerView(); - initializeAnimations(); - initializeStepListClickListener(); - initializeButtons(); - ImageCreator.getInstance().initialize(getContext()); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - cancelDelayedTransition(); - } - - /** - * Subscribes to a {@link NavigationViewModel} for - * updates from {@link androidx.lifecycle.LiveData}. - *

- * Updates all views with fresh data / shows & hides re-route state. - * - * @param navigationViewModel to which this View is subscribing - * @since 0.6.2 - */ - public void subscribe(LifecycleOwner owner, NavigationViewModel navigationViewModel) { - lifecycleOwner = owner; - lifecycleOwner.getLifecycle().addObserver(this); - this.navigationViewModel = navigationViewModel; - - navigationViewModel.instructionModel.observe(lifecycleOwner, new Observer() { - @Override - public void onChanged(@Nullable InstructionModel model) { - if (model != null) { - updateDataFromInstruction(model); - } - } - }); - navigationViewModel.bannerInstructionModel.observe(lifecycleOwner, new Observer() { - @Override - public void onChanged(@Nullable BannerInstructionModel model) { - if (model != null) { - updateManeuverView(model.retrievePrimaryManeuverType(), model.retrievePrimaryManeuverModifier(), - model.retrievePrimaryRoundaboutAngle(), model.retrieveDrivingSide()); - updateDataFromBannerText(model.retrievePrimaryBannerText(), model.retrieveSecondaryBannerText()); - updateSubStep(model.retrieveSubBannerText(), model.retrievePrimaryManeuverType()); - } - } - }); - navigationViewModel.isOffRoute.observe(lifecycleOwner, new Observer() { - @Override - public void onChanged(@Nullable Boolean isOffRoute) { - if (isOffRoute != null) { - if (isOffRoute) { - showRerouteState(); - } else if (isRerouting) { - hideRerouteState(); - alertView.showReportProblem(); - } - isRerouting = isOffRoute; - } - } - }); - subscribeAlertView(); - initializeButtonListeners(); - showButtons(); - } - - /** - * Unsubscribes {@link NavigationViewModel} {@link androidx.lifecycle.LiveData} objects - * previously added in {@link InstructionView#subscribe(LifecycleOwner, NavigationViewModel)} - * by removing the observers of the {@link LifecycleOwner} when parent view is destroyed - */ - @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) - public void unsubscribe() { - if (navigationViewModel != null) { - navigationViewModel.instructionModel.removeObservers(lifecycleOwner); - navigationViewModel.bannerInstructionModel.removeObservers(lifecycleOwner); - navigationViewModel.isOffRoute.removeObservers(lifecycleOwner); - } - } - - /** - * Use this method inside a {@link ProgressChangeListener} to update this view with all other information - * that is not updated by the {@link InstructionView#updateBannerInstructionsWith(Milestone)}. - *

- * This includes the distance remaining, instruction list, turn lanes, and next step information. - * - * @param routeProgress for route data used to populate the views - * @since 0.20.0 - */ - public void updateDistanceWith(RouteProgress routeProgress) { - if (routeProgress != null && !isRerouting) { - InstructionModel model = new InstructionModel(distanceFormatter, routeProgress); - updateDataFromInstruction(model); - } - } - - /** - * Use this in a {@link com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener} to update - * this view with new banner instructions. - *

- * This method will look at the type of milestone to determine when - * it should update. - * - * @param milestone for retrieving the new BannerInstructions - * @since 0.20.0 - */ - public void updateBannerInstructionsWith(Milestone milestone) { - if (milestone instanceof BannerInstructionMilestone) { - BannerInstructions instructions = ((BannerInstructionMilestone) milestone).getBannerInstructions(); - if (instructions == null || instructions.primary() == null) { - return; - } - BannerText primary = instructions.primary(); - String primaryManeuverModifier = primary.modifier(); - String drivingSide = currentStep.drivingSide(); - updateManeuverView(primary.type(), primaryManeuverModifier, primary.degrees(), drivingSide); - updateDataFromBannerText(primary, instructions.secondary()); - updateSubStep(instructions.sub(), primaryManeuverModifier); - } - } - - - /** - * Will slide the reroute view down from the top of the screen - * and make it visible - * - * @since 0.6.0 - */ - public void showRerouteState() { - if (rerouteLayout.getVisibility() == INVISIBLE) { - rerouteLayout.startAnimation(rerouteSlideDownTop); - rerouteLayout.setVisibility(VISIBLE); - } - } - - /** - * Will slide the reroute view up to the top of the screen - * and hide it - * - * @since 0.6.0 - */ - public void hideRerouteState() { - if (rerouteLayout.getVisibility() == VISIBLE) { - rerouteLayout.startAnimation(rerouteSlideUpTop); - rerouteLayout.setVisibility(INVISIBLE); - } - } - - /** - * Can be used to determine the visibility of the instruction list. - * - * @return true if instruction list is visible, false is not - */ - public boolean isShowingInstructionList() { - return instructionListLayout.getVisibility() == VISIBLE; - } - - /** - * Hide the instruction list. - *

- * This is based on orientation so the different layouts (for portrait vs. landscape) - * can be animated appropriately. - */ - public void hideInstructionList() { - rvInstructions.stopScroll(); - beginDelayedTransition(); - if (isLandscape()) { - updateLandscapeConstraintsTo(R.layout.instruction_layout); - } - instructionListLayout.setVisibility(GONE); - onInstructionListVisibilityChanged(false); - } - - private boolean isLandscape() { - return getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; - } - - /** - * Show the instruction list. - *

- * This is based on orientation so the different layouts (for portrait vs. landscape) - * can be animated appropriately. - */ - public void showInstructionList() { - onInstructionListVisibilityChanged(true); - instructionLayout.requestFocus(); - beginDelayedListTransition(); - if (isLandscape()) { - updateLandscapeConstraintsTo(R.layout.instruction_layout_alt); - } - instructionListLayout.setVisibility(VISIBLE); - } - - public boolean handleBackPressed() { - if (isShowingInstructionList()) { - hideInstructionList(); - return true; - } - return false; - } - - /** - * Sets the distance formatter - * - * @param distanceFormatter to set - */ - public void setDistanceFormatter(DistanceFormatter distanceFormatter) { - if (distanceFormatter != null && !distanceFormatter.equals(this.distanceFormatter)) { - this.distanceFormatter = distanceFormatter; - instructionListAdapter.updateDistanceFormatter(distanceFormatter); - } - } - - /** - * Gets the sound button which is used for muting/unmuting, for uses such as adding listeners and - * hiding the button. - * - * @return sound button with {@link NavigationButton} API - */ - public NavigationButton retrieveSoundButton() { - return soundButton; - } - - /** - * Returns the {@link NavigationAlertView} that is shown during off-route events with - * "Report a Problem" text. - * - * @return alert view that is used in the instruction view - */ - public NavigationAlertView retrieveAlertView() { - return alertView; - } - - /** - * Inflates this layout needed for this view and initializes the locale as the device locale. - */ - private void initialize() { - LocaleUtils localeUtils = new LocaleUtils(); - String language = localeUtils.inferDeviceLanguage(getContext()); - String unitType = localeUtils.getUnitTypeForDeviceLocale(getContext()); - int roundingIncrement = NavigationConstants.ROUNDING_INCREMENT_FIFTY; - distanceFormatter = new DistanceFormatter(getContext(), language, unitType, roundingIncrement); - inflate(getContext(), R.layout.instruction_view_layout, this); - } - - /** - * Finds and binds all necessary views - */ - private void bind() { - upcomingManeuverView = findViewById(R.id.maneuverView); - upcomingDistanceText = findViewById(R.id.stepDistanceText); - upcomingPrimaryText = findViewById(R.id.stepPrimaryText); - upcomingSecondaryText = findViewById(R.id.stepSecondaryText); - subManeuverView = findViewById(R.id.subManeuverView); - subStepText = findViewById(R.id.subStepText); - alertView = findViewById(R.id.alertView); - rerouteLayout = findViewById(R.id.rerouteLayout); - turnLaneLayout = findViewById(R.id.turnLaneLayout); - subStepLayout = findViewById(R.id.subStepLayout); - rvTurnLanes = findViewById(R.id.rvTurnLanes); - instructionLayout = findViewById(R.id.instructionLayout); - instructionLayoutText = findViewById(R.id.instructionLayoutText); - instructionListLayout = findViewById(R.id.instructionListLayout); - rvInstructions = findViewById(R.id.rvInstructions); - soundButton = findViewById(R.id.soundLayout); - } - - /** - * For API 21 and lower, manually set the drawable tint based on the colors - * set in the given navigation theme (light or dark). - */ - private void initializeBackground() { - if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { - int navigationViewBannerBackgroundColor = ThemeSwitcher.retrieveThemeColor(getContext(), - R.attr.navigationViewBannerBackground); - int navigationViewListBackgroundColor = ThemeSwitcher.retrieveThemeColor(getContext(), - R.attr.navigationViewListBackground); - // Instruction Layout landscape - banner background - if (isLandscape()) { - View instructionLayoutManeuver = findViewById(R.id.instructionManeuverLayout); - Drawable maneuverBackground = DrawableCompat.wrap(instructionLayoutManeuver.getBackground()).mutate(); - DrawableCompat.setTint(maneuverBackground, navigationViewBannerBackgroundColor); - - View subStepLayout = findViewById(R.id.subStepLayout); - Drawable subStepBackground = DrawableCompat.wrap(subStepLayout.getBackground()).mutate(); - DrawableCompat.setTint(subStepBackground, navigationViewListBackgroundColor); - - View turnLaneLayout = findViewById(R.id.turnLaneLayout); - Drawable turnLaneBackground = DrawableCompat.wrap(turnLaneLayout.getBackground()).mutate(); - DrawableCompat.setTint(turnLaneBackground, navigationViewListBackgroundColor); - } - } - } - - /** - * Sets up the {@link RecyclerView} that is used to display the turn lanes. - */ - private void initializeTurnLaneRecyclerView() { - turnLaneAdapter = new TurnLaneAdapter(); - rvTurnLanes.setAdapter(turnLaneAdapter); - rvTurnLanes.setHasFixedSize(true); - rvTurnLanes.setLayoutManager(new LinearLayoutManager(getContext(), - LinearLayoutManager.HORIZONTAL, false)); - } - - /** - * Sets up the {@link RecyclerView} that is used to display the list of instructions. - */ - private void initializeInstructionListRecyclerView() { - RouteUtils routeUtils = new RouteUtils(); - instructionListAdapter = new InstructionListAdapter(routeUtils, distanceFormatter); - rvInstructions.setAdapter(instructionListAdapter); - rvInstructions.setHasFixedSize(true); - rvInstructions.setLayoutManager(new LinearLayoutManager(getContext())); - } - - /** - * Initializes all animations needed to show / hide views. - */ - private void initializeAnimations() { - Context context = getContext(); - rerouteSlideDownTop = AnimationUtils.loadAnimation(context, R.anim.slide_down_top); - rerouteSlideUpTop = AnimationUtils.loadAnimation(context, R.anim.slide_up_top); - } - - private void onInstructionListVisibilityChanged(boolean visible) { - if (instructionListListener != null) { - instructionListListener.onInstructionListVisibilityChanged(visible); - } - } - - private void subscribeAlertView() { - alertView.subscribe(navigationViewModel); - } - - private void initializeButtonListeners() { - soundButton.addOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - navigationViewModel.setMuted(soundButton.toggleMute()); - } - }); - } - - private void showButtons() { - soundButton.show(); - } - - private void initializeStepListClickListener() { - if (isLandscape()) { - initializeLandscapeListListener(); - } else { - initializePortraitListListener(); - } - } - - private void initializeButtons() { - soundButton.hide(); - } - - /** - * For portrait orientation, attach the listener to the whole layout - * and use custom animations to hide and show the instructions /sound layout - */ - private void initializePortraitListListener() { - instructionLayout.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View instructionView) { - boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE; - if (!instructionsVisible) { - showInstructionList(); - } else { - hideInstructionList(); - } - } - }); - } - - /** - * For landscape orientation, the click listener is attached to - * the instruction text layout and the constraints are adjusted before animating - */ - private void initializeLandscapeListListener() { - instructionLayoutText.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View instructionLayoutText) { - boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE; - if (!instructionsVisible) { - showInstructionList(); - } else { - hideInstructionList(); - } - } - }); - } - - /** - * Looks to see if we have a new distance text. - * - * @param model provides distance text - */ - private boolean newDistanceText(InstructionModel model) { - return !upcomingDistanceText.getText().toString().isEmpty() - && !TextUtils.isEmpty(model.retrieveStepDistanceRemaining()) - && !upcomingDistanceText.getText().toString() - .contentEquals(model.retrieveStepDistanceRemaining().toString()); - } - - /** - * Sets current distance text. - * - * @param model provides distance text - */ - private void distanceText(InstructionModel model) { - upcomingDistanceText.setText(model.retrieveStepDistanceRemaining()); - } - - private InstructionLoader createInstructionLoader(TextView textView, BannerText - bannerText) { - if (hasComponents(bannerText)) { - return new InstructionLoader(textView, bannerText); - } else { - return null; - } - } - - private boolean hasComponents(BannerText bannerText) { - return bannerText != null && bannerText.components() != null && !bannerText.components().isEmpty(); - } - - /** - * Looks to see if we have a new step. - * - * @param routeProgress provides updated step information - * @return true if new step, false if not - */ - private boolean newStep(RouteProgress routeProgress) { - boolean newStep = currentStep == null || !currentStep.equals(routeProgress.currentLegProgress().currentStep()); - currentStep = routeProgress.currentLegProgress().currentStep(); - return newStep; - } - - private void updateSubStep(BannerText subText, String primaryManeuverModifier) { - if (shouldShowSubStep(subText)) { - String maneuverType = subText.type(); - String maneuverModifier = subText.modifier(); - subManeuverView.setManeuverTypeAndModifier(maneuverType, maneuverModifier); - Double roundaboutAngle = subText.degrees(); - if (roundaboutAngle != null) { - subManeuverView.setRoundaboutAngle(roundaboutAngle.floatValue()); - } - String drivingSide = currentStep.drivingSide(); - subManeuverView.setDrivingSide(drivingSide); - InstructionLoader instructionLoader = createInstructionLoader(subStepText, subText); - if (instructionLoader != null) { - instructionLoader.loadInstruction(); - } - showSubLayout(); - return; - } else { - hideSubLayout(); - } - - if (shouldShowTurnLanes(subText, primaryManeuverModifier)) { - turnLaneAdapter.addTurnLanes(subText.components(), primaryManeuverModifier); - showTurnLanes(); - } else { - hideTurnLanes(); - } - } - - private boolean shouldShowSubStep(@Nullable BannerText subText) { - return subText != null - && subText.type() != null - && !subText.type().contains(COMPONENT_TYPE_LANE); - } - - private void showSubLayout() { - if (!(subStepLayout.getVisibility() == VISIBLE)) { - beginDelayedTransition(); - subStepLayout.setVisibility(VISIBLE); - } - } - - private void hideSubLayout() { - if (subStepLayout.getVisibility() == VISIBLE) { - beginDelayedTransition(); - subStepLayout.setVisibility(GONE); - } - } - - private boolean shouldShowTurnLanes(BannerText subText, String maneuverModifier) { - if (!hasComponents(subText) || TextUtils.isEmpty(maneuverModifier)) { - return false; - } - for (BannerComponents components : subText.components()) { - if (components.type().equals(COMPONENT_TYPE_LANE)) { - return true; - } - } - return false; - } - - private void showTurnLanes() { - if (turnLaneLayout.getVisibility() == GONE) { - beginDelayedTransition(); - turnLaneLayout.setVisibility(VISIBLE); - } - } - - private void hideTurnLanes() { - if (turnLaneLayout.getVisibility() == VISIBLE) { - beginDelayedTransition(); - turnLaneLayout.setVisibility(GONE); - } - } - - @Nullable - private FragmentManager obtainSupportFragmentManager() { - try { - return ((FragmentActivity) getContext()).getSupportFragmentManager(); - } catch (ClassCastException exception) { - Timber.e(exception); - return null; - } - } - - /** - * Adjust the banner text layout {@link ConstraintLayout} vertical bias. - * - * @param percentBias to be set to the text layout - */ - private void adjustBannerTextVerticalBias(float percentBias) { - if (!isLandscape()) { - ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) instructionLayoutText.getLayoutParams(); - params.verticalBias = percentBias; - instructionLayoutText.setLayoutParams(params); - } - } - - private void beginDelayedTransition() { - TransitionManager.beginDelayedTransition(this); - } - - private void beginDelayedListTransition() { - AutoTransition transition = new AutoTransition(); - transition.addListener(new InstructionListTransitionListener(rvInstructions, instructionListAdapter)); - TransitionManager.beginDelayedTransition(this, transition); - } - - private void cancelDelayedTransition() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - clearAnimation(); - } - } - - private void updateDataFromInstruction(InstructionModel model) { - updateDistanceText(model); - updateInstructionList(model); - if (newStep(model.retrieveProgress())) { - LegStep upComingStep = model.retrieveProgress().currentLegProgress().upComingStep(); - ImageCreator.getInstance().prefetchImageCache(upComingStep); - } - } - - /** - * Looks to see if we have a new instruction text. - * Sets new instruction text if found. - */ - private void updateDataFromBannerText(@NonNull BannerText primaryBannerText, BannerText secondaryBannerText) { - if (secondaryBannerText == null) { - loadPrimary(primaryBannerText); - return; - } - loadPrimaryAndSecondary(primaryBannerText, secondaryBannerText); - } - - private void loadPrimary(BannerText primaryBannerText) { - upcomingPrimaryText.setMaxLines(2); - upcomingSecondaryText.setVisibility(GONE); - adjustBannerTextVerticalBias(0.5f); - loadTextWith(primaryBannerText, upcomingPrimaryText); - } - - private void loadPrimaryAndSecondary(BannerText primaryBannerText, BannerText secondaryBannerText) { - upcomingPrimaryText.setMaxLines(1); - upcomingSecondaryText.setVisibility(VISIBLE); - adjustBannerTextVerticalBias(0.65f); - loadTextWith(primaryBannerText, upcomingPrimaryText); - - loadTextWith(secondaryBannerText, upcomingSecondaryText); - } - - private void loadTextWith(BannerText bannerText, TextView textView) { - InstructionLoader instructionLoader = createInstructionLoader(textView, bannerText); - if (instructionLoader != null) { - instructionLoader.loadInstruction(); - } - } - - /** - * Looks to see if we have a new maneuver modifier or type. - * Updates new maneuver image if one is found. - */ - private void updateManeuverView(String maneuverViewType, String maneuverViewModifier, - @Nullable Double roundaboutAngle, String drivingSide) { - upcomingManeuverView.setManeuverTypeAndModifier(maneuverViewType, maneuverViewModifier); - if (roundaboutAngle != null) { - upcomingManeuverView.setRoundaboutAngle(roundaboutAngle.floatValue()); - } - upcomingManeuverView.setDrivingSide(drivingSide); - } - - /** - * Looks to see if we have a new distance text. - * Sets new distance text if found. - * - * @param model provides distance text - */ - private void updateDistanceText(InstructionModel model) { - if (newDistanceText(model)) { - distanceText(model); - } else if (upcomingDistanceText.getText().toString().isEmpty()) { - distanceText(model); - } - } - - private void updateLandscapeConstraintsTo(int layoutRes) { - ConstraintSet collapsed = new ConstraintSet(); - collapsed.clone(getContext(), layoutRes); - collapsed.applyTo(instructionLayout); - } - - /** - * Used to update the instructions list with the current steps. - * - * @param model to provide the current steps and unit type - */ - private void updateInstructionList(InstructionModel model) { - RouteProgress routeProgress = model.retrieveProgress(); - boolean isListShowing = instructionListLayout.getVisibility() == VISIBLE; - rvInstructions.stopScroll(); - instructionListAdapter.updateBannerListWith(routeProgress, isListShowing); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java deleted file mode 100644 index c3f314a4..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; - -import androidx.annotation.Nullable; -import androidx.fragment.app.FragmentActivity; -import androidx.fragment.app.FragmentManager; - -import com.mapbox.services.android.navigation.ui.v5.NavigationViewModel; -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.alert.AlertView; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; - -import timber.log.Timber; - -public class NavigationAlertView extends AlertView { - - private static final long THREE_SECOND_DELAY_IN_MILLIS = 3000; - private NavigationViewModel navigationViewModel; - private boolean isEnabled = true; - - public NavigationAlertView(Context context) { - this(context, null); - } - - public NavigationAlertView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, -1); - } - - public NavigationAlertView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - /** - * Sets the NavigationViewModel in the view - * - * @param navigationViewModel to set - */ - public void subscribe(NavigationViewModel navigationViewModel) { - this.navigationViewModel = navigationViewModel; - } - - - /** - * Shows this alert view to let user report a problem for the given number of milliseconds - */ - public void showReportProblem() { - if (!isEnabled) { - return; - } - final Handler handler = new Handler(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - show(getContext().getString(R.string.report_problem), - NavigationConstants.ALERT_VIEW_PROBLEM_DURATION, true); - } - }, THREE_SECOND_DELAY_IN_MILLIS); - } - - - /** - * This method enables or disables the alert view from being shown during off-route - * events. - *

- * Note this will only happen automatically in the context of - * the {@link com.mapbox.services.android.navigation.ui.v5.NavigationView} or a {@link NavigationViewModel} - * has been added to the instruction view with - * {@link InstructionView#subscribe(androidx.lifecycle.LifecycleOwner, NavigationViewModel)}. - * - * @param isEnabled true to show during off-route events, false to hide - */ - public void updateEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - } - - @Nullable - private FragmentManager obtainSupportFragmentManager() { - try { - return ((FragmentActivity) getContext()).getSupportFragmentManager(); - } catch (ClassCastException exception) { - Timber.e(exception); - return null; - } - } - - private boolean isShowingReportProblem() { - return getAlertText().equals(getContext().getString(R.string.report_problem)); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeCreator.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeCreator.java deleted file mode 100644 index 6955c121..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeCreator.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -import java.util.List; - -abstract class NodeCreator { - V nodeVerifier; - - NodeCreator(V nodeVerifier) { - this.nodeVerifier = nodeVerifier; - } - - boolean isNodeType(BannerComponents bannerComponents) { - return nodeVerifier.isNodeType(bannerComponents); - } - - abstract N setupNode(BannerComponents components, int index, int startIndex, String modifier); - - /** - * One coordinator should override this method, and this should be the coordinator which populates - * the textView with text. - * - * @param textView to populate - * @param bannerComponentNodes containing instructions - */ - void preProcess(TextView textView, List bannerComponentNodes) {} - - /** - * Coordinators which make edits to the text after it's been populated into the text view should - * override this method. This includes coordinators which load images into the text view. - * - * @param textView to populate - * @param bannerComponentNodes containing instructions - */ - void postProcess(TextView textView, List bannerComponentNodes) {} -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeVerifier.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeVerifier.java deleted file mode 100644 index 6ae1475e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NodeVerifier.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -interface NodeVerifier { - boolean isNodeType(BannerComponents bannerComponents); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextCreator.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextCreator.java deleted file mode 100644 index 826220c6..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextCreator.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -/** - * This is the default text coordinator implementation to handle plain text components. - */ -class TextCreator extends NodeCreator { - TextCreator() { - this(new TextVerifier()); - } - - private TextCreator(TextVerifier textVerifier) { - super(textVerifier); - } - - @Override - BannerComponentNode setupNode(BannerComponents components, int index, int startIndex, String - modifier) { - return new BannerComponentNode(components, startIndex); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextVerifier.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextVerifier.java deleted file mode 100644 index 20133cd6..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextVerifier.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -class TextVerifier implements NodeVerifier { - @Override - public boolean isNodeType(BannerComponents bannerComponents) { - return bannerComponents.text() != null && !bannerComponents.text().isEmpty(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextViewUtils.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextViewUtils.java deleted file mode 100644 index a8ba92b5..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/TextViewUtils.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.Spanned; -import android.text.style.ImageSpan; -import android.view.View; -import android.widget.TextView; - -class TextViewUtils { - - boolean textFits(TextView textView, String text) { - Paint paint = new Paint(textView.getPaint()); - float width = paint.measureText(text); - return width < textView.getWidth(); - } - - Drawable createDrawable(TextView textView, Bitmap bitmap) { - Drawable drawable = new BitmapDrawable(textView.getContext().getResources(), bitmap); - int bottom = textView.getLineHeight(); - int right = bottom * bitmap.getWidth() / bitmap.getHeight(); - drawable.setBounds(0, 0, right, bottom); - - return drawable; - } - - void setImageSpan(TextView textView, View view, int start, int end) { - Bitmap bitmap = createBitmapFromView(view); - setImageSpan(textView, bitmap, start, end); - } - - private void setImageSpan(TextView textView, Bitmap bitmap, int start, int end) { - Drawable drawable = createDrawable(textView, bitmap); - setImageSpan(textView, drawable, start, end); - } - - private void setImageSpan(TextView textView, Drawable drawable, int start, int end) { - Spannable instructionSpannable = new SpannableString(textView.getText()); - - instructionSpannable.setSpan(new ImageSpan(drawable), - start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - - textView.setText(instructionSpannable); - } - - private Bitmap createBitmapFromView(View view) { - int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); - view.measure(measureSpec, measureSpec); - - int measuredWidth = view.getMeasuredWidth(); - int measuredHeight = view.getMeasuredHeight(); - - view.layout(0, 0, measuredWidth, measuredHeight); - Bitmap bitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888); - bitmap.eraseColor(Color.TRANSPARENT); - Canvas canvas = new Canvas(bitmap); - view.draw(canvas); - return bitmap; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMap.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMap.java deleted file mode 100644 index 8419ed21..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMap.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.os.Build; -import android.util.DisplayMetrics; -import android.util.SparseArray; - -import com.mapbox.services.android.navigation.v5.navigation.SdkVersionChecker; - -class UrlDensityMap extends SparseArray { - - private static final String ONE_X = "@1x"; - private static final String TWO_X = "@2x"; - private static final String THREE_X = "@3x"; - private static final String FOUR_X = "@4x"; - private static final String DOT_PNG = ".png"; - - private final int displayDensity; - - UrlDensityMap(int displayDensity, SdkVersionChecker sdkVersionChecker) { - super(4); - this.displayDensity = displayDensity; - put(DisplayMetrics.DENSITY_LOW, ONE_X + DOT_PNG); - put(DisplayMetrics.DENSITY_MEDIUM, ONE_X + DOT_PNG); - put(DisplayMetrics.DENSITY_HIGH, TWO_X + DOT_PNG); - put(DisplayMetrics.DENSITY_XHIGH, THREE_X + DOT_PNG); - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.JELLY_BEAN)) { - put(DisplayMetrics.DENSITY_XXHIGH, THREE_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.JELLY_BEAN_MR2)) { - put(DisplayMetrics.DENSITY_XXXHIGH, FOUR_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.KITKAT)) { - put(DisplayMetrics.DENSITY_400, THREE_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.LOLLIPOP)) { - put(DisplayMetrics.DENSITY_560, FOUR_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.LOLLIPOP_MR1)) { - put(DisplayMetrics.DENSITY_280, TWO_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.M)) { - put(DisplayMetrics.DENSITY_360, THREE_X + DOT_PNG); - put(DisplayMetrics.DENSITY_420, THREE_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.N_MR1)) { - put(DisplayMetrics.DENSITY_260, TWO_X + DOT_PNG); - put(DisplayMetrics.DENSITY_300, TWO_X + DOT_PNG); - put(DisplayMetrics.DENSITY_340, THREE_X + DOT_PNG); - } - if (sdkVersionChecker.isEqualOrGreaterThan(Build.VERSION_CODES.P)) { - put(DisplayMetrics.DENSITY_440, THREE_X + DOT_PNG); - } - } - - public String get(String url) { - return url + super.get(displayDensity); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java deleted file mode 100644 index 0e292f47..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.maneuver; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.ManeuverModifier; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.ManeuverType; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_SHARP_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_UTURN; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ARRIVE; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_EXIT_ROTARY; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_FORK; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_OFF_RAMP; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ROTARY; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ROUNDABOUT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ROUNDABOUT_TURN; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.PointF; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.View; - -import androidx.annotation.ColorInt; -import androidx.annotation.FloatRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.core.util.Pair; - -import com.mapbox.services.android.navigation.ui.v5.R; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - - -/** - * A view that draws a maneuver arrow indicating the upcoming maneuver. - * - * @since 0.6.0 - */ -@SuppressWarnings("DoubleBraceInitialization") -public class ManeuverView extends View { - - private static final float TOP_ROUNDABOUT_ANGLE_LIMIT = 300f; - private static final float BOTTOM_ROUNDABOUT_ANGLE_LIMIT = 60f; - private static final float DEFAULT_ROUNDABOUT_ANGLE = 180f; - private static final Map, ManeuverViewUpdate> MANEUVER_VIEW_UPDATE_MAP = new ManeuverViewMap(); - - private static final Set SHOULD_FLIP_MODIFIERS = new HashSet() { - { - add(STEP_MANEUVER_MODIFIER_SLIGHT_LEFT); - add(STEP_MANEUVER_MODIFIER_LEFT); - add(STEP_MANEUVER_MODIFIER_SHARP_LEFT); - add(STEP_MANEUVER_MODIFIER_UTURN); - } - }; - private static final Set ROUNDABOUT_MANEUVER_TYPES = new HashSet() { - { - add(STEP_MANEUVER_TYPE_ROTARY); - add(STEP_MANEUVER_TYPE_ROUNDABOUT); - add(STEP_MANEUVER_TYPE_ROUNDABOUT_TURN); - add(STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT); - add(STEP_MANEUVER_TYPE_EXIT_ROTARY); - } - }; - private static final Set MANEUVER_TYPES_WITH_NULL_MODIFIERS = new HashSet() { - { - add(STEP_MANEUVER_TYPE_OFF_RAMP); - add(STEP_MANEUVER_TYPE_FORK); - add(STEP_MANEUVER_TYPE_ROUNDABOUT); - add(STEP_MANEUVER_TYPE_ROUNDABOUT_TURN); - add(STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT); - add(STEP_MANEUVER_TYPE_ROTARY); - add(STEP_MANEUVER_TYPE_EXIT_ROTARY); - } - }; - @ManeuverType - private String maneuverType = null; - @ManeuverModifier - private String maneuverModifier = null; - @ColorInt - private int primaryColor; - @ColorInt - private int secondaryColor; - private float roundaboutAngle = DEFAULT_ROUNDABOUT_ANGLE; - private Pair maneuverTypeAndModifier = new Pair<>(null, null); - private PointF size; - private String drivingSide = STEP_MANEUVER_MODIFIER_RIGHT; - - /** - * A custom view that can be used with the Mapbox Directions API. - *

- * By providing a {@link String} maneuver type and maneuver modifier, the - * corresponding maneuver icon will be rendered in this view. - * - * @param context to use when creating a view from code - */ - public ManeuverView(Context context) { - super(context); - } - - /** - * A custom view that can be used with the Mapbox Directions API. - *

- * By providing a {@link String} maneuver type and maneuver modifier, the - * corresponding maneuver icon will be rendered in this view. - * - * @param context for inflating a view from XML - * @param attrs for inflating a view from XML - */ - public ManeuverView(Context context, AttributeSet attrs) { - super(context, attrs); - initializeColorFrom(attrs); - } - - /** - * A custom view that can be used with the Mapbox Directions API. - *

- * By providing a {@link String} maneuver type and maneuver modifier, the - * corresponding maneuver icon will be rendered in this view. - * - * @param context for inflation from XML and apply a class-specific base style - * @param attrs for inflation from XML and apply a class-specific base style - * @param defStyle for inflation from XML and apply a class-specific base style - */ - public ManeuverView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - initializeColorFrom(attrs); - } - - /** - * Updates the maneuver type and modifier which determine how this view will - * render itself. - *

- * If determined the provided maneuver type and modifier will render a new image, - * the view will invalidate and redraw itself with the new data. - * - * @param maneuverType to determine the maneuver icon to render - * @param maneuverModifier to determine the maneuver icon to render - */ - public void setManeuverTypeAndModifier(@NonNull String maneuverType, @Nullable String maneuverModifier) { - if (isNewTypeOrModifier(maneuverType, maneuverModifier)) { - this.maneuverType = maneuverType; - this.maneuverModifier = maneuverModifier; - if (checkManeuverTypeWithNullModifier(maneuverType)) { - return; - } - maneuverType = checkManeuverModifier(maneuverType, maneuverModifier); - maneuverTypeAndModifier = new Pair<>(maneuverType, maneuverModifier); - invalidate(); - } - } - - /** - * Updates the angle to render the roundabout maneuver. - *

- * This value will only be considered if the current maneuver type is - * a roundabout. - * - * @param roundaboutAngle angle to be rendered - */ - public void setRoundaboutAngle(@FloatRange(from = 60f, to = 300f) float roundaboutAngle) { - if (ROUNDABOUT_MANEUVER_TYPES.contains(maneuverType) && this.roundaboutAngle != roundaboutAngle) { - updateRoundaboutAngle(roundaboutAngle); - invalidate(); - } - } - - public void setDrivingSide(String drivingSide) { - if (STEP_MANEUVER_MODIFIER_LEFT.equals(drivingSide) || STEP_MANEUVER_MODIFIER_RIGHT.equals(drivingSide)) { - updateDrivingSide(drivingSide); - invalidate(); - } - } - - /** - * Updates maneuver view primary color. - *

- * The {@link ManeuverView} will be invalidated and redrawn - * with the new color provided. - * - * @param primaryColor to be set - */ - public void setPrimaryColor(@ColorInt int primaryColor) { - this.primaryColor = primaryColor; - invalidate(); - } - - /** - * Updates maneuver view secondary color. - *

- * The {@link ManeuverView} will be invalidated and redrawn - * with the new color provided. - * - * @param secondaryColor to be set - */ - public void setSecondaryColor(@ColorInt int secondaryColor) { - this.secondaryColor = secondaryColor; - invalidate(); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - setLayerType(LAYER_TYPE_SOFTWARE, null); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - if (size == null) { - size = new PointF(getMeasuredWidth(), getMeasuredHeight()); - } - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - - // TODO Abstract this "debug" code somehow? - if (isInEditMode()) { - ManeuversStyleKit.drawArrowStraight(canvas, primaryColor, size); - return; - } - - if (maneuverType == null) { - return; - } - - ManeuverViewUpdate maneuverViewUpdate = MANEUVER_VIEW_UPDATE_MAP.get(maneuverTypeAndModifier); - if (maneuverViewUpdate != null) { - maneuverViewUpdate.updateManeuverView(canvas, primaryColor, secondaryColor, size, roundaboutAngle); - } - boolean flip = SHOULD_FLIP_MODIFIERS.contains(maneuverModifier); - if (ROUNDABOUT_MANEUVER_TYPES.contains(maneuverType)) { - flip = STEP_MANEUVER_MODIFIER_LEFT.equals(drivingSide); - } - if (STEP_MANEUVER_MODIFIER_LEFT.equals(drivingSide) && STEP_MANEUVER_MODIFIER_UTURN.contains(maneuverModifier)) { - setScaleX(flip ? 1 : -1); - } else { - setScaleX(flip ? -1 : 1); - } - } - - private void initializeColorFrom(AttributeSet attributeSet) { - TypedArray typedArray = getContext().obtainStyledAttributes(attributeSet, R.styleable.ManeuverView); - primaryColor = typedArray.getColor(R.styleable.ManeuverView_maneuverViewPrimaryColor, - ContextCompat.getColor(getContext(), R.color.mapbox_navigation_view_color_banner_maneuver_primary)); - secondaryColor = typedArray.getColor(R.styleable.ManeuverView_maneuverViewSecondaryColor, - ContextCompat.getColor(getContext(), R.color.mapbox_navigation_view_color_banner_maneuver_secondary)); - typedArray.recycle(); - } - - private boolean isNewTypeOrModifier(String maneuverType, String maneuverModifier) { - if (maneuverType == null) { - return false; - } - return !TextUtils.equals(this.maneuverType, maneuverType) - || !TextUtils.equals(this.maneuverModifier, maneuverModifier); - } - - private boolean checkManeuverTypeWithNullModifier(String maneuverType) { - if (MANEUVER_TYPES_WITH_NULL_MODIFIERS.contains(maneuverType)) { - maneuverTypeAndModifier = new Pair<>(maneuverType, null); - invalidate(); - return true; - } - return false; - } - - @Nullable - private String checkManeuverModifier(String maneuverType, String maneuverModifier) { - if (!maneuverType.contentEquals(STEP_MANEUVER_TYPE_ARRIVE) && maneuverModifier != null) { - maneuverType = null; - } - return maneuverType; - } - - private void updateRoundaboutAngle(float roundaboutAngle) { - if (checkRoundaboutBottomLimit(roundaboutAngle)) { - return; - } - if (checkRoundaboutTopLimit(roundaboutAngle)) { - return; - } - this.roundaboutAngle = roundaboutAngle; - } - - private void updateDrivingSide(String drivingSide) { - this.drivingSide = drivingSide; - } - - private boolean checkRoundaboutBottomLimit(float roundaboutAngle) { - if (roundaboutAngle < BOTTOM_ROUNDABOUT_ANGLE_LIMIT) { - this.roundaboutAngle = BOTTOM_ROUNDABOUT_ANGLE_LIMIT; - return true; - } - return false; - } - - private boolean checkRoundaboutTopLimit(float roundaboutAngle) { - if (roundaboutAngle > TOP_ROUNDABOUT_ANGLE_LIMIT) { - this.roundaboutAngle = TOP_ROUNDABOUT_ANGLE_LIMIT; - return true; - } - return false; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewMap.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewMap.java deleted file mode 100644 index 798f6121..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewMap.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.maneuver; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_SHARP_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_SHARP_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_STRAIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_UTURN; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ARRIVE; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_EXIT_ROTARY; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_FORK; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_MERGE; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_OFF_RAMP; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ROTARY; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ROUNDABOUT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_TYPE_ROUNDABOUT_TURN; - -import android.graphics.Canvas; -import android.graphics.PointF; - -import androidx.core.util.Pair; - -import java.util.HashMap; - -class ManeuverViewMap extends HashMap, ManeuverViewUpdate> { - - ManeuverViewMap() { - put(new Pair(STEP_MANEUVER_TYPE_MERGE, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawMerge(canvas, primaryColor, secondaryColor, size); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_OFF_RAMP, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawOffRamp(canvas, primaryColor, secondaryColor, size); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_FORK, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawFork(canvas, primaryColor, secondaryColor, size); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_ROUNDABOUT, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawRoundabout(canvas, primaryColor, secondaryColor, size, roundaboutAngle); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_ROUNDABOUT_TURN, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawRoundabout(canvas, primaryColor, secondaryColor, size, roundaboutAngle); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawRoundabout(canvas, primaryColor, secondaryColor, size, roundaboutAngle); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_ROTARY, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawRoundabout(canvas, primaryColor, secondaryColor, size, roundaboutAngle); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_EXIT_ROTARY, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawRoundabout(canvas, primaryColor, secondaryColor, size, roundaboutAngle); - } - }); - put(new Pair(STEP_MANEUVER_TYPE_ARRIVE, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrive(canvas, primaryColor, size); - } - }); - put(new Pair<>(STEP_MANEUVER_TYPE_ARRIVE, STEP_MANEUVER_MODIFIER_STRAIGHT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrive(canvas, primaryColor, size); - } - }); - put(new Pair<>(STEP_MANEUVER_TYPE_ARRIVE, STEP_MANEUVER_MODIFIER_RIGHT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArriveRight(canvas, primaryColor, size); - } - }); - put(new Pair<>(STEP_MANEUVER_TYPE_ARRIVE, STEP_MANEUVER_MODIFIER_LEFT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArriveRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_SLIGHT_RIGHT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowSlightRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_RIGHT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_SHARP_RIGHT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowSharpRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_SLIGHT_LEFT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowSlightRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_LEFT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_SHARP_LEFT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowSharpRight(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_UTURN), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrow180Right(canvas, primaryColor, size); - } - }); - put(new Pair(null, STEP_MANEUVER_MODIFIER_STRAIGHT), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowStraight(canvas, primaryColor, size); - } - }); - put(new Pair(null, null), new ManeuverViewUpdate() { - @Override - public void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, - PointF size, float roundaboutAngle) { - ManeuversStyleKit.drawArrowStraight(canvas, primaryColor, size); - } - }); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewUpdate.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewUpdate.java deleted file mode 100644 index ae38309d..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverViewUpdate.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.maneuver; - -import android.graphics.Canvas; -import android.graphics.PointF; - -interface ManeuverViewUpdate { - void updateManeuverView(Canvas canvas, int primaryColor, int secondaryColor, PointF size, float roundaboutAngle); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuversStyleKit.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuversStyleKit.java deleted file mode 100644 index 08b76cd7..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuversStyleKit.java +++ /dev/null @@ -1,1685 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.maneuver; - -import android.graphics.Paint; -import android.graphics.Matrix; -import android.graphics.PointF; -import android.graphics.RectF; -import android.graphics.Canvas; -import android.graphics.Path; -import android.graphics.DashPathEffect; - -import java.util.Stack; - - -/** - * Created on Oct 31, 2017. - * Copyright © 2017 Mapbox. All rights reserved. - *

- * Generated by PaintCode - * http://www.paintcodeapp.com - */ -public class ManeuversStyleKit { - - - // Resizing Behavior - public enum ResizingBehavior { - AspectFit, //!< The content is proportionally resized to fit into the target rectangle. - AspectFill, //!< The content is proportionally resized to completely fill the target rectangle. - Stretch, //!< The content is stretched to match the entire target rectangle. - Center, //!< The content is centered in the target rectangle, but it is NOT resized. - } - - // Canvas Drawings - // Maneuvers - - private static class CacheForArrow180right { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - } - - public static void drawArrow180Right(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArrow180Right(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArrow180Right(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArrow180right.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArrow180right.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArrow180right.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArrow180right.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 2 - { - canvas.save(); - canvas.translate(x, y + 1f); - currentTransformation.peek().postTranslate(x, y + 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForArrow180right.bezierRect; - bezierRect.set(-3.49f, 1f, 14.51f, 14.99f); - Path bezierPath = CacheForArrow180right.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(-3.36f, 2.8f); - bezierPath.lineTo(5.51f, 14.99f); - bezierPath.lineTo(14.37f, 2.8f); - bezierPath.cubicTo(14.45f, 2.71f, 14.51f, 2.59f, 14.51f, 2.46f); - bezierPath.cubicTo(14.51f, 2.19f, 14.28f, 1.96f, 14.01f, 1.96f); - bezierPath.cubicTo(13.97f, 1.96f, 13.89f, 1.97f, 13.89f, 1.97f); - bezierPath.lineTo(8.15f, 3.94f); - bezierPath.cubicTo(8.11f, 3.95f, 8.06f, 3.96f, 8.01f, 3.96f); - bezierPath.cubicTo(7.74f, 3.96f, 7.51f, 3.76f, 7.51f, 3.5f); - bezierPath.cubicTo(7.51f, 3.13f, 7.51f, 1f, 7.51f, 1f); - bezierPath.lineTo(5.51f, 1f); - bezierPath.lineTo(3.5f, 1f); - bezierPath.cubicTo(3.5f, 1f, 3.51f, 3.13f, 3.51f, 3.5f); - bezierPath.cubicTo(3.51f, 3.76f, 3.28f, 3.97f, 3.01f, 3.97f); - bezierPath.cubicTo(2.96f, 3.97f, 2.91f, 3.96f, 2.86f, 3.95f); - bezierPath.lineTo(-2.88f, 1.98f); - bezierPath.cubicTo(-2.88f, 1.98f, -2.95f, 1.96f, -2.99f, 1.96f); - bezierPath.cubicTo(-3.27f, 1.96f, -3.49f, 2.19f, -3.49f, 2.46f); - bezierPath.cubicTo(-3.49f, 2.59f, -3.44f, 2.71f, -3.36f, 2.8f); - bezierPath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - - // Bezier 2 - RectF bezier2Rect = CacheForArrow180right.bezier2Rect; - bezier2Rect.set(-7.5f, -12f, 5.5f, 15f); - Path bezier2Path = CacheForArrow180right.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-7.5f, 15f); - bezier2Path.lineTo(-7.5f, -5.16f); - bezier2Path.cubicTo(-7.5f, -8.91f, -4.55f, -12f, -1f, -12f); - bezier2Path.cubicTo(2.59f, -12f, 5.5f, -8.72f, 5.5f, -5.15f); - bezier2Path.lineTo(5.5f, 4f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - canvas.restore(); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForArrowright { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - } - - public static void drawArrowRight(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArrowRight(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArrowRight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArrowright.paint; - - // Local Variables - float y = size.y / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float x = size.x / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArrowright.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArrowright.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArrowright.frame; - frame.set(0f, 0f, size.x, size.y); - - // Bezier - canvas.save(); - canvas.translate(x, y + 1f); - currentTransformation.peek().postTranslate(x, y + 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - RectF bezierRect = CacheForArrowright.bezierRect; - bezierRect.set(-14.01f, -15.01f, 14.01f, 15.01f); - Path bezierPath = CacheForArrowright.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(-10.01f, 15.01f); - bezierPath.lineTo(-10.01f, 1f); - bezierPath.cubicTo(-10f, 0.49f, -9.84f, -3.99f, -5.05f, -3.99f); - bezierPath.lineTo(2.57f, -3.99f); - bezierPath.cubicTo(2.8f, -3.95f, 2.98f, -3.75f, 2.98f, -3.51f); - bezierPath.cubicTo(2.98f, -3.46f, 2.97f, -3.41f, 2.96f, -3.36f); - bezierPath.lineTo(0.99f, 2.38f); - bezierPath.cubicTo(0.99f, 2.38f, 0.98f, 2.45f, 0.98f, 2.49f); - bezierPath.cubicTo(0.98f, 2.77f, 1.2f, 2.99f, 1.48f, 2.99f); - bezierPath.cubicTo(1.61f, 2.99f, 1.73f, 2.94f, 1.82f, 2.86f); - bezierPath.lineTo(14.01f, -6.01f); - bezierPath.lineTo(1.82f, -14.87f); - bezierPath.cubicTo(1.73f, -14.95f, 1.61f, -15.01f, 1.48f, -15.01f); - bezierPath.cubicTo(1.2f, -15.01f, 0.98f, -14.78f, 0.98f, -14.51f); - bezierPath.cubicTo(0.98f, -14.47f, 0.99f, -14.4f, 0.99f, -14.4f); - bezierPath.lineTo(2.96f, -8.65f); - bezierPath.cubicTo(2.97f, -8.61f, 2.98f, -8.56f, 2.98f, -8.51f); - bezierPath.cubicTo(2.98f, -8.24f, 2.76f, -8.01f, 2.5f, -8.01f); - bezierPath.cubicTo(2.14f, -8.01f, -5.05f, -7.99f, -5.05f, -7.99f); - bezierPath.cubicTo(-11.58f, -7.99f, -13.99f, -2.63f, -14.01f, 0.99f); - bezierPath.lineTo(-14.01f, 15.01f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - canvas.restore(); - } - - private static class CacheForArrowslightright { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - private static RectF bezier4Rect = new RectF(); - private static Path bezier4Path = new Path(); - private static RectF clipRect = new RectF(); - } - - public static void drawArrowSlightRight(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArrowSlightRight(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArrowSlightRight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArrowslightright.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArrowslightright.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArrowslightright.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArrowslightright.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 3 - { - canvas.save(); - canvas.translate(x + 1f, y + 1f); - currentTransformation.peek().postTranslate(x + 1f, y + 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier 3 - RectF bezier3Rect = CacheForArrowslightright.bezier3Rect; - bezier3Rect.set(-8.34f, -5.09f, 0.99f, 15.06f); - Path bezier3Path = CacheForArrowslightright.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(0.99f, -5.09f); - bezier3Path.lineTo(-6.55f, 1.88f); - bezier3Path.cubicTo(-7.71f, 3.63f, -8.34f, 5.75f, -8.34f, 7.93f); - bezier3Path.lineTo(-8.34f, 15.06f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - canvas.restore(); - - // Bezier 4 - RectF bezier4Rect = CacheForArrowslightright.bezier4Rect; - bezier4Rect.set(-3.5f, -12.76f, 9.88f, 0.3f); - Path bezier4Path = CacheForArrowslightright.bezier4Path; - bezier4Path.reset(); - bezier4Path.moveTo(-2.97f, -12.04f); - bezier4Path.lineTo(9.88f, -12.76f); - bezier4Path.lineTo(7.31f, -0.15f); - bezier4Path.cubicTo(7.3f, -0.02f, 7.24f, 0.09f, 7.15f, 0.18f); - bezier4Path.cubicTo(6.94f, 0.36f, 6.62f, 0.34f, 6.44f, 0.13f); - bezier4Path.cubicTo(6.41f, 0.1f, 6.38f, 0.03f, 6.38f, 0.03f); - bezier4Path.lineTo(4f, -4.19f); - bezier4Path.cubicTo(3.99f, -4.23f, 3.96f, -4.27f, 3.93f, -4.31f); - bezier4Path.cubicTo(3.75f, -4.51f, 3.25f, -4.38f, 3.05f, -4.21f); - bezier4Path.cubicTo(2.78f, -3.98f, 0.97f, -2.41f, 0.97f, -2.41f); - bezier4Path.lineTo(-0.34f, -3.92f); - bezier4Path.lineTo(-1.65f, -5.44f); - bezier4Path.cubicTo(-1.65f, -5.44f, 0.16f, -7f, 0.43f, -7.24f); - bezier4Path.cubicTo(0.63f, -7.41f, 0.74f, -7.81f, 0.57f, -8.01f); - bezier4Path.cubicTo(0.53f, -8.05f, 0.54f, -8.12f, 0.5f, -8.15f); - bezier4Path.lineTo(-3.31f, -11.12f); - bezier4Path.cubicTo(-3.31f, -11.12f, -3.36f, -11.18f, -3.38f, -11.21f); - bezier4Path.cubicTo(-3.56f, -11.42f, -3.53f, -11.74f, -3.32f, -11.92f); - bezier4Path.cubicTo(-3.22f, -12.01f, -3.09f, -12.05f, -2.97f, -12.04f); - bezier4Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier4Path, paint); - - // Clip - RectF clipRect = CacheForArrowslightright.clipRect; - clipRect.set(-10.2f, -13.7f, 10.2f, 13.05f); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForArrowstraight { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - } - - public static void drawArrowStraight(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArrowStraight(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArrowStraight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArrowstraight.paint; - - // Local Variables - float y = size.y / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float x = size.x / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArrowstraight.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArrowstraight.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArrowstraight.frame; - frame.set(0f, 0f, size.x, size.y); - - // Bezier - canvas.save(); - canvas.translate(x, y + 1f); - currentTransformation.peek().postTranslate(x, y + 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - RectF bezierRect = CacheForArrowstraight.bezierRect; - bezierRect.set(-9f, -15.02f, 9f, 15.02f); - Path bezierPath = CacheForArrowstraight.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(8.86f, -2.82f); - bezierPath.lineTo(0f, -15.02f); - bezierPath.lineTo(-8.86f, -2.82f); - bezierPath.cubicTo(-8.95f, -2.73f, -9f, -2.62f, -9f, -2.48f); - bezierPath.cubicTo(-9f, -2.21f, -8.78f, -1.98f, -8.5f, -1.98f); - bezierPath.cubicTo(-8.46f, -1.98f, -8.39f, -2f, -8.39f, -2f); - bezierPath.lineTo(-2.64f, -3.96f); - bezierPath.cubicTo(-2.6f, -3.98f, -2.55f, -3.98f, -2.5f, -3.98f); - bezierPath.cubicTo(-2.23f, -3.98f, -2f, -3.76f, -2f, -3.5f); - bezierPath.lineTo(-2f, 15.02f); - bezierPath.lineTo(2f, 15.02f); - bezierPath.cubicTo(2f, 15.02f, 2f, -3.14f, 2f, -3.5f); - bezierPath.cubicTo(2f, -3.76f, 2.23f, -3.98f, 2.5f, -3.98f); - bezierPath.cubicTo(2.55f, -3.98f, 2.6f, -3.98f, 2.64f, -3.96f); - bezierPath.lineTo(8.39f, -2f); - bezierPath.cubicTo(8.39f, -2f, 8.46f, -1.98f, 8.5f, -1.98f); - bezierPath.cubicTo(8.78f, -1.98f, 9f, -2.21f, 9f, -2.48f); - bezierPath.cubicTo(9f, -2.62f, 8.95f, -2.73f, 8.86f, -2.82f); - bezierPath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - canvas.restore(); - } - - private static class CacheForArrowsharpright { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - } - - public static void drawArrowSharpRight(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArrowSharpRight(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArrowSharpRight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArrowsharpright.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArrowsharpright.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArrowsharpright.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArrowsharpright.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 2 - { - canvas.save(); - canvas.translate(x, y); - currentTransformation.peek().postTranslate(x, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForArrowsharpright.bezierRect; - bezierRect.set(-2.12f, -7.97f, 13.13f, 7.5f); - Path bezierPath = CacheForArrowsharpright.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(-1.66f, 4.57f); - bezierPath.lineTo(13.13f, 7.5f); - bezierPath.lineTo(11.36f, -7.47f); - bezierPath.cubicTo(11.36f, -7.59f, 11.32f, -7.71f, 11.23f, -7.81f); - bezierPath.cubicTo(11.04f, -8.01f, 10.73f, -8.03f, 10.52f, -7.84f); - bezierPath.cubicTo(10.49f, -7.81f, 10.45f, -7.75f, 10.45f, -7.75f); - bezierPath.lineTo(7.57f, -2.41f); - bezierPath.cubicTo(7.54f, -2.37f, 7.51f, -2.33f, 7.48f, -2.3f); - bezierPath.cubicTo(7.28f, -2.11f, 6.96f, -2.12f, 6.78f, -2.31f); - bezierPath.cubicTo(6.54f, -2.57f, 5.09f, -4.15f, 5.09f, -4.15f); - bezierPath.lineTo(3.61f, -2.79f); - bezierPath.lineTo(2.14f, -1.43f); - bezierPath.cubicTo(2.14f, -1.43f, 3.6f, 0.14f, 3.85f, 0.41f); - bezierPath.cubicTo(4.02f, 0.6f, 4.01f, 0.92f, 3.81f, 1.1f); - bezierPath.cubicTo(3.77f, 1.14f, 3.73f, 1.16f, 3.69f, 1.18f); - bezierPath.lineTo(-1.87f, 3.64f); - bezierPath.cubicTo(-1.87f, 3.64f, -1.93f, 3.68f, -1.96f, 3.7f); - bezierPath.cubicTo(-2.16f, 3.89f, -2.17f, 4.21f, -1.99f, 4.41f); - bezierPath.cubicTo(-1.9f, 4.51f, -1.78f, 4.56f, -1.66f, 4.57f); - bezierPath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - - // Bezier 3 - RectF bezier3Rect = CacheForArrowsharpright.bezier3Rect; - bezier3Rect.set(-11.12f, -8.5f, 4.88f, 16f); - Path bezier3Path = CacheForArrowsharpright.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(-11.12f, -4f); - bezier3Path.cubicTo(-11.12f, -4f, -11.33f, -8.5f, -6.62f, -8.5f); - bezier3Path.cubicTo(-1.91f, -8.5f, 1.88f, -4.5f, 1.88f, -4.5f); - bezier3Path.lineTo(4.88f, -1.5f); - bezier3Path.moveTo(-11.12f, -4.5f); - bezier3Path.lineTo(-11.12f, 1.5f); - bezier3Path.moveTo(-11.12f, 1.5f); - bezier3Path.lineTo(-11.12f, 3.5f); - bezier3Path.moveTo(-11.12f, 3.5f); - bezier3Path.lineTo(-11.12f, 12.98f); - bezier3Path.lineTo(-11.12f, 16f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - canvas.restore(); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForArrive { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF ovalRect = new RectF(); - private static Path ovalPath = new Path(); - private static RectF rectangleRect = new RectF(); - private static Path rectanglePath = new Path(); - } - - public static void drawArrive(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArrive(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArrive(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArrive.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArrive.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArrive.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArrive.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 2 - { - canvas.save(); - canvas.translate(x, y + 1f); - currentTransformation.peek().postTranslate(x, y + 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForArrive.bezierRect; - bezierRect.set(0.06f, 6.6f, 0.06f, 15f); - Path bezierPath = CacheForArrive.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(0.06f, 6.6f); - bezierPath.lineTo(0.06f, 15f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Bezier 2 - RectF bezier2Rect = CacheForArrive.bezier2Rect; - bezier2Rect.set(-8f, -9.03f, 8f, 2.48f); - Path bezier2Path = CacheForArrive.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-2f, 2.48f); - bezier2Path.cubicTo(-2f, 2.48f, -2f, 2.09f, -2f, 1.73f); - bezier2Path.cubicTo(-2f, 1.46f, -2.23f, 1.12f, -2.5f, 1.12f); - bezier2Path.cubicTo(-2.55f, 1.12f, -2.6f, 1.07f, -2.64f, 1.08f); - bezier2Path.lineTo(-7.39f, 2.02f); - bezier2Path.cubicTo(-7.39f, 2.02f, -7.46f, 2.01f, -7.5f, 2.01f); - bezier2Path.cubicTo(-7.78f, 2.01f, -8f, 1.78f, -8f, 1.51f); - bezier2Path.cubicTo(-8f, 1.37f, -7.95f, 1.25f, -7.86f, 1.16f); - bezier2Path.lineTo(0f, -9.03f); - bezier2Path.lineTo(7.86f, 1.16f); - bezier2Path.cubicTo(7.95f, 1.25f, 8f, 1.37f, 8f, 1.5f); - bezier2Path.cubicTo(8f, 1.77f, 7.78f, 2f, 7.5f, 2f); - bezier2Path.cubicTo(7.46f, 2f, 7.39f, 1.99f, 7.39f, 1.99f); - bezier2Path.lineTo(2.64f, 1.02f); - bezier2Path.cubicTo(2.6f, 1.01f, 2.55f, 1f, 2.5f, 1f); - bezier2Path.cubicTo(2.23f, 1f, 2f, 1.46f, 2f, 1.73f); - bezier2Path.cubicTo(2f, 2.09f, 2f, 2.48f, 2f, 2.48f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - - // Oval - RectF ovalRect = CacheForArrive.ovalRect; - ovalRect.set(-3f, -16.6f, 3.1f, -10.5f); - Path ovalPath = CacheForArrive.ovalPath; - ovalPath.reset(); - ovalPath.addOval(ovalRect, Path.Direction.CW); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(ovalPath, paint); - - // Rectangle - RectF rectangleRect = CacheForArrive.rectangleRect; - rectangleRect.set(-2f, 3.63f, 2f, 5.58f); - Path rectanglePath = CacheForArrive.rectanglePath; - rectanglePath.reset(); - rectanglePath.moveTo(rectangleRect.left, rectangleRect.top); - rectanglePath.lineTo(rectangleRect.right, rectangleRect.top); - rectanglePath.lineTo(rectangleRect.right, rectangleRect.bottom); - rectanglePath.lineTo(rectangleRect.left, rectangleRect.bottom); - rectanglePath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(rectanglePath, paint); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForStarting { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - } - - public static void drawStarting(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawStarting(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawStarting(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForStarting.paint; - - // Local Variables - float y = size.y / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float x = size.x / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForStarting.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForStarting.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForStarting.frame; - frame.set(0f, 0f, size.x, size.y); - - // Bezier 2 - canvas.save(); - canvas.translate(x, y); - currentTransformation.peek().postTranslate(x, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - RectF bezier2Rect = CacheForStarting.bezier2Rect; - bezier2Rect.set(-10f, -10.5f, 10f, 10.5f); - Path bezier2Path = CacheForStarting.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(0f, -10.5f); - bezier2Path.lineTo(-10f, 10.5f); - bezier2Path.lineTo(0.07f, 4.2f); - bezier2Path.lineTo(10f, 10.5f); - bezier2Path.lineTo(0f, -10.5f); - bezier2Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - bezier2Path.setFillType(Path.FillType.EVEN_ODD); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - canvas.restore(); - - canvas.restore(); - } - - private static class CacheForDestination { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - } - - public static void drawDestination(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawDestination(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawDestination(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForDestination.paint; - - // Local Variables - float y = size.y / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float x = size.x / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForDestination.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForDestination.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForDestination.frame; - frame.set(0f, 0f, size.x, size.y); - - // Bezier - canvas.save(); - canvas.translate(x, y); - currentTransformation.peek().postTranslate(x, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - RectF bezierRect = CacheForDestination.bezierRect; - bezierRect.set(-8f, -12f, 8f, 12f); - Path bezierPath = CacheForDestination.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(0f, -7f); - bezierPath.cubicTo(-0.34f, -7f, -0.66f, -6.94f, -0.97f, -6.84f); - bezierPath.cubicTo(-2.15f, -6.44f, -3f, -5.32f, -3f, -4f); - bezierPath.cubicTo(-3f, -2.34f, -1.66f, -1f, 0f, -1f); - bezierPath.cubicTo(1.66f, -1f, 3f, -2.34f, 3f, -4f); - bezierPath.cubicTo(3f, -5.66f, 1.66f, -7f, 0f, -7f); - bezierPath.close(); - bezierPath.moveTo(8f, -4f); - bezierPath.cubicTo(8f, 0.42f, 4f, 3f, 0f, 12f); - bezierPath.cubicTo(-4f, 3f, -8f, 0.42f, -8f, -4f); - bezierPath.cubicTo(-8f, -6.36f, -6.98f, -8.49f, -5.35f, -9.95f); - bezierPath.cubicTo(-4.83f, -10.42f, -4.25f, -10.81f, -3.63f, -11.13f); - bezierPath.cubicTo(-2.54f, -11.69f, -1.31f, -12f, 0f, -12f); - bezierPath.cubicTo(4.42f, -12f, 8f, -8.42f, 8f, -4f); - bezierPath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - canvas.restore(); - } - - private static class CacheForMerge { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - } - - public static void drawMerge(Canvas canvas, int primaryColor, int secondaryColor, PointF size) { - ManeuversStyleKit.drawMerge(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, secondaryColor, size); - } - - public static void drawMerge(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, int secondaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForMerge.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForMerge.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForMerge.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForMerge.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 3 - { - canvas.save(); - canvas.translate(x, y + 1f); - currentTransformation.peek().postTranslate(x, y + 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForMerge.bezierRect; - bezierRect.set(0.07f, -10.51f, 8.07f, 15f); - Path bezierPath = CacheForMerge.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(8.07f, 15f); - bezierPath.lineTo(8.07f, 12.47f); - bezierPath.cubicTo(8.07f, 10.53f, 7.44f, 8.65f, 6.28f, 7.1f); - bezierPath.lineTo(1.86f, 1.19f); - bezierPath.cubicTo(0.69f, -0.36f, 0.07f, -2.25f, 0.07f, -4.19f); - bezierPath.lineTo(0.07f, -10.51f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(secondaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Bezier 2 - RectF bezier2Rect = CacheForMerge.bezier2Rect; - bezier2Rect.set(-8.06f, -10.6f, -0.06f, 15f); - Path bezier2Path = CacheForMerge.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-8.06f, 15f); - bezier2Path.lineTo(-8.06f, 12.39f); - bezier2Path.cubicTo(-8.06f, 10.45f, -7.43f, 8.56f, -6.27f, 7.01f); - bezier2Path.lineTo(-1.85f, 1.11f); - bezier2Path.cubicTo(-0.69f, -0.45f, -0.06f, -2.33f, -0.06f, -4.27f); - bezier2Path.lineTo(-0.06f, -10.6f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - canvas.restore(); - - // Bezier 3 - RectF bezier3Rect = CacheForMerge.bezier3Rect; - bezier3Rect.set(-8.07f, -16.48f, 7.93f, -2.96f); - Path bezier3Path = CacheForMerge.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(7.8f, -6.29f); - bezier3Path.lineTo(-0.07f, -16.48f); - bezier3Path.lineTo(-7.93f, -6.29f); - bezier3Path.cubicTo(-8.01f, -6.2f, -8.07f, -6.08f, -8.07f, -5.95f); - bezier3Path.cubicTo(-8.07f, -5.67f, -7.84f, -5.45f, -7.57f, -5.45f); - bezier3Path.cubicTo(-7.53f, -5.45f, -7.45f, -5.46f, -7.45f, -5.46f); - bezier3Path.lineTo(-2.71f, -6.43f); - bezier3Path.cubicTo(-2.66f, -6.44f, -2.62f, -6.45f, -2.57f, -6.45f); - bezier3Path.cubicTo(-2.3f, -6.45f, -2.07f, -5.98f, -2.07f, -5.72f); - bezier3Path.cubicTo(-2.07f, -5.36f, -2.07f, -2.96f, -2.07f, -2.96f); - bezier3Path.lineTo(-0.07f, -2.96f); - bezier3Path.lineTo(1.94f, -2.96f); - bezier3Path.cubicTo(1.94f, -2.96f, 1.93f, -5.36f, 1.93f, -5.72f); - bezier3Path.cubicTo(1.93f, -5.98f, 2.16f, -6.33f, 2.43f, -6.33f); - bezier3Path.cubicTo(2.48f, -6.33f, 2.53f, -6.38f, 2.58f, -6.37f); - bezier3Path.lineTo(7.32f, -5.43f); - bezier3Path.cubicTo(7.32f, -5.43f, 7.4f, -5.43f, 7.43f, -5.43f); - bezier3Path.cubicTo(7.71f, -5.43f, 7.93f, -5.66f, 7.93f, -5.94f); - bezier3Path.cubicTo(7.93f, -6.07f, 7.88f, -6.2f, 7.8f, -6.29f); - bezier3Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForFork { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - } - - public static void drawFork(Canvas canvas, int primaryColor, int secondaryColor, PointF size) { - ManeuversStyleKit.drawFork(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, secondaryColor, size); - } - - public static void drawFork(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, int secondaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForFork.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForFork.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForFork.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForFork.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 3 - { - canvas.save(); - canvas.translate(x + 2.99f, y); - currentTransformation.peek().postTranslate(x + 2.99f, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForFork.bezierRect; - bezierRect.set(-12.57f, -12.73f, -3.99f, 16f); - Path bezierPath = CacheForFork.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(-3.99f, 16f); - bezierPath.lineTo(-3.99f, 9f); - bezierPath.cubicTo(-3.99f, 7.06f, -4.74f, 5.17f, -5.9f, 3.62f); - bezierPath.lineTo(-10.32f, -2.29f); - bezierPath.cubicTo(-11.48f, -3.84f, -12.57f, -5.73f, -12.57f, -7.67f); - bezierPath.lineTo(-12.57f, -12.73f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(secondaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Bezier 2 - RectF bezier2Rect = CacheForFork.bezier2Rect; - bezier2Rect.set(-3.99f, -2.2f, 2.23f, 16f); - Path bezier2Path = CacheForFork.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(2.23f, -2.2f); - bezier2Path.lineTo(-2.2f, 3.7f); - bezier2Path.cubicTo(-3.36f, 5.25f, -3.99f, 7.06f, -3.99f, 9f); - bezier2Path.lineTo(-3.99f, 16f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - canvas.restore(); - - // Bezier 3 - RectF bezier3Rect = CacheForFork.bezier3Rect; - bezier3Rect.set(-2.99f, -13.42f, 10.58f, 0f); - Path bezier3Path = CacheForFork.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(-2.61f, -9.17f); - bezier3Path.lineTo(9.54f, -13.42f); - bezier3Path.lineTo(10.57f, -0.59f); - bezier3Path.cubicTo(10.59f, -0.47f, 10.57f, -0.34f, 10.5f, -0.23f); - bezier3Path.cubicTo(10.35f, 0f, 10.04f, 0.07f, 9.81f, -0.08f); - bezier3Path.cubicTo(9.77f, -0.1f, 9.72f, -0.15f, 9.72f, -0.15f); - bezier3Path.lineTo(6.27f, -3.55f); - bezier3Path.cubicTo(6.24f, -3.59f, 6.2f, -3.62f, 6.16f, -3.65f); - bezier3Path.cubicTo(5.94f, -3.8f, 5.49f, -3.53f, 5.35f, -3.31f); - bezier3Path.cubicTo(5.15f, -3.01f, 3.85f, -1f, 3.85f, -1f); - bezier3Path.lineTo(2.17f, -2.09f); - bezier3Path.lineTo(0.49f, -3.19f); - bezier3Path.cubicTo(0.49f, -3.19f, 1.8f, -5.19f, 1.99f, -5.49f); - bezier3Path.cubicTo(2.14f, -5.71f, 2.13f, -6.13f, 1.91f, -6.28f); - bezier3Path.cubicTo(1.87f, -6.3f, 1.85f, -6.37f, 1.81f, -6.39f); - bezier3Path.lineTo(-2.68f, -8.19f); - bezier3Path.cubicTo(-2.68f, -8.19f, -2.74f, -8.23f, -2.77f, -8.26f); - bezier3Path.cubicTo(-3f, -8.41f, -3.06f, -8.72f, -2.91f, -8.95f); - bezier3Path.cubicTo(-2.84f, -9.06f, -2.73f, -9.14f, -2.61f, -9.17f); - bezier3Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForOfframp { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - } - - public static void drawOffRamp(Canvas canvas, int primaryColor, int secondaryColor, PointF size) { - ManeuversStyleKit.drawOffRamp(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, secondaryColor, size); - } - - public static void drawOffRamp(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, int secondaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForOfframp.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForOfframp.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForOfframp.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForOfframp.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 3 - { - canvas.save(); - canvas.translate(x + 3.38f, y); - currentTransformation.peek().postTranslate(x + 3.38f, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForOfframp.bezierRect; - bezierRect.set(-10.38f, -13f, -10.38f, 16f); - Path bezierPath = CacheForOfframp.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(-10.38f, 16f); - bezierPath.lineTo(-10.38f, 7.51f); - bezierPath.cubicTo(-10.38f, 5.7f, -10.38f, -13f, -10.38f, -13f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(secondaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Bezier 2 - RectF bezier2Rect = CacheForOfframp.bezier2Rect; - bezier2Rect.set(-10.38f, -4.4f, -0.81f, 16f); - Path bezier2Path = CacheForOfframp.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-0.81f, -4.4f); - bezier2Path.lineTo(-8.35f, 1.79f); - bezier2Path.cubicTo(-9.51f, 3.34f, -10.38f, 5.23f, -10.38f, 7.17f); - bezier2Path.lineTo(-10.38f, 16f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - canvas.restore(); - - // Bezier 3 - RectF bezier3Rect = CacheForOfframp.bezier3Rect; - bezier3Rect.set(-5.38f, -12.07f, 8f, 0.99f); - Path bezier3Path = CacheForOfframp.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(-4.85f, -11.35f); - bezier3Path.lineTo(8f, -12.07f); - bezier3Path.lineTo(5.43f, 0.55f); - bezier3Path.cubicTo(5.42f, 0.67f, 5.36f, 0.79f, 5.27f, 0.87f); - bezier3Path.cubicTo(5.06f, 1.05f, 4.74f, 1.03f, 4.56f, 0.82f); - bezier3Path.cubicTo(4.53f, 0.79f, 4.5f, 0.73f, 4.5f, 0.73f); - bezier3Path.lineTo(2.12f, -3.49f); - bezier3Path.cubicTo(2.11f, -3.54f, 2.08f, -3.58f, 2.05f, -3.62f); - bezier3Path.cubicTo(1.87f, -3.82f, 1.37f, -3.69f, 1.17f, -3.52f); - bezier3Path.cubicTo(0.9f, -3.28f, -0.91f, -1.71f, -0.91f, -1.71f); - bezier3Path.lineTo(-2.23f, -3.23f); - bezier3Path.lineTo(-3.54f, -4.74f); - bezier3Path.cubicTo(-3.54f, -4.74f, -1.72f, -6.31f, -1.45f, -6.54f); - bezier3Path.cubicTo(-1.25f, -6.72f, -1.14f, -7.11f, -1.32f, -7.32f); - bezier3Path.cubicTo(-1.35f, -7.36f, -1.34f, -7.43f, -1.38f, -7.45f); - bezier3Path.lineTo(-5.19f, -10.43f); - bezier3Path.cubicTo(-5.19f, -10.43f, -5.24f, -10.49f, -5.26f, -10.52f); - bezier3Path.cubicTo(-5.44f, -10.73f, -5.41f, -11.05f, -5.2f, -11.23f); - bezier3Path.cubicTo(-5.1f, -11.31f, -4.97f, -11.36f, -4.85f, -11.35f); - bezier3Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForArriveright { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF ovalRect = new RectF(); - private static Path ovalPath = new Path(); - private static RectF rectangleRect = new RectF(); - private static Path rectanglePath = new Path(); - } - - public static void drawArriveRight(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArriveRight(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArriveRight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArriveright.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArriveright.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArriveright.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArriveright.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group - { - canvas.save(); - canvas.translate(x, y); - currentTransformation.peek().postTranslate(x, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForArriveright.bezierRect; - bezierRect.set(-0.99f, 5.6f, -0.99f, 16f); - Path bezierPath = CacheForArriveright.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(-0.99f, 5.6f); - bezierPath.lineTo(-0.99f, 16f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Bezier 2 - RectF bezier2Rect = CacheForArriveright.bezier2Rect; - bezier2Rect.set(-9.05f, -10.03f, 6.95f, 1.48f); - Path bezier2Path = CacheForArriveright.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-3.05f, 1.48f); - bezier2Path.cubicTo(-3.05f, 1.48f, -3.05f, 1.09f, -3.05f, 0.73f); - bezier2Path.cubicTo(-3.05f, 0.46f, -3.28f, 0.12f, -3.55f, 0.12f); - bezier2Path.cubicTo(-3.6f, 0.12f, -3.65f, 0.07f, -3.69f, 0.08f); - bezier2Path.lineTo(-8.44f, 1.02f); - bezier2Path.cubicTo(-8.44f, 1.02f, -8.51f, 1.01f, -8.55f, 1.01f); - bezier2Path.cubicTo(-8.83f, 1.01f, -9.05f, 0.78f, -9.05f, 0.51f); - bezier2Path.cubicTo(-9.05f, 0.37f, -9f, 0.25f, -8.91f, 0.16f); - bezier2Path.lineTo(-1.05f, -10.03f); - bezier2Path.lineTo(6.81f, 0.16f); - bezier2Path.cubicTo(6.9f, 0.25f, 6.95f, 0.37f, 6.95f, 0.5f); - bezier2Path.cubicTo(6.95f, 0.77f, 6.73f, 1f, 6.45f, 1f); - bezier2Path.cubicTo(6.41f, 1f, 6.34f, 0.99f, 6.34f, 0.99f); - bezier2Path.lineTo(1.59f, 0.02f); - bezier2Path.cubicTo(1.55f, 0.01f, 1.5f, -0f, 1.45f, -0f); - bezier2Path.cubicTo(1.18f, -0f, 0.95f, 0.46f, 0.95f, 0.73f); - bezier2Path.cubicTo(0.95f, 1.09f, 0.96f, 1.48f, 0.96f, 1.48f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - - // Oval - RectF ovalRect = CacheForArriveright.ovalRect; - ovalRect.set(2.95f, -15.6f, 9.05f, -9.5f); - Path ovalPath = CacheForArriveright.ovalPath; - ovalPath.reset(); - ovalPath.addOval(ovalRect, Path.Direction.CW); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(ovalPath, paint); - - // Rectangle - RectF rectangleRect = CacheForArriveright.rectangleRect; - rectangleRect.set(-3.05f, 2.63f, 0.95f, 4.58f); - Path rectanglePath = CacheForArriveright.rectanglePath; - rectanglePath.reset(); - rectanglePath.moveTo(rectangleRect.left, rectangleRect.top); - rectanglePath.lineTo(rectangleRect.right, rectangleRect.top); - rectanglePath.lineTo(rectangleRect.right, rectangleRect.bottom); - rectanglePath.lineTo(rectangleRect.left, rectangleRect.bottom); - rectanglePath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(rectanglePath, paint); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForRoundabout { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF rectangle2Rect = new RectF(); - private static Path rectangle2Path = new Path(); - private static float[] rectangle2CornerRadii = new float[8]; - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - private static PaintCodeDashPathEffect bezier3PathDashEffect = new PaintCodeDashPathEffect(); - } - - public static void drawRoundabout(Canvas canvas, int primaryColor, int secondaryColor, PointF size, float roundabout_angle) { - ManeuversStyleKit.drawRoundabout(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, secondaryColor, size, roundabout_angle, 6.5f); - } - - public static void drawRoundabout(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, int secondaryColor, PointF size, float roundabout_angle, float roundabout_radius) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForRoundabout.paint; - - // Local Variables - float roundabout_percentage = roundabout_angle / 360f * 2f * (float) Math.PI * roundabout_radius; - float scale = Math.min(size.x / 32f, size.y / 32f); - float roundabout_arrow_height = scale * (float) Math.cos((roundabout_angle - 180f) * (float) Math.PI / 180f) * 20f; - float roundabout_y = size.y - scale * (roundabout_radius * 2f + 4f) + 1f + roundabout_arrow_height / 4f; - float roundabout_arrow_width = scale * 0.75f * (float) Math.sin((roundabout_angle - 180f) * (float) Math.PI / 180f) * 16f; - float roundabout_x = size.x / 2f + roundabout_arrow_width / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForRoundabout.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForRoundabout.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForRoundabout.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 3 - { - canvas.save(); - canvas.translate(roundabout_x - 0f, roundabout_y - 1f); - currentTransformation.peek().postTranslate(roundabout_x - 0f, roundabout_y - 1f); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForRoundabout.bezierRect; - bezierRect.set(-6.5f, -5.5f, 6.5f, 7.5f); - Path bezierPath = CacheForRoundabout.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(6.5f, 1f); - bezierPath.cubicTo(6.5f, 2.8f, 5.78f, 4.42f, 4.6f, 5.59f); - bezierPath.cubicTo(3.43f, 6.77f, 1.8f, 7.5f, 0f, 7.5f); - bezierPath.cubicTo(-1.79f, 7.5f, -3.41f, 6.78f, -4.59f, 5.61f); - bezierPath.cubicTo(-5.77f, 4.43f, -6.5f, 2.8f, -6.5f, 1f); - bezierPath.cubicTo(-6.5f, -0.79f, -5.77f, -2.42f, -4.6f, -3.59f); - bezierPath.cubicTo(-3.42f, -4.77f, -1.79f, -5.5f, 0f, -5.5f); - bezierPath.cubicTo(1.79f, -5.5f, 3.42f, -4.77f, 4.6f, -3.59f); - bezierPath.cubicTo(5.77f, -2.42f, 6.5f, -0.79f, 6.5f, 1f); - bezierPath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(secondaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Rectangle 2 - RectF rectangle2Rect = CacheForRoundabout.rectangle2Rect; - rectangle2Rect.set(-1.97f, 5.5f, 2.03f, 17.5f); - Path rectangle2Path = CacheForRoundabout.rectangle2Path; - rectangle2Path.reset(); - float rectangle2CornerRadius = Math.min(Math.min(rectangle2Rect.width(), rectangle2Rect.height()) / 2f, 1f); - float[] rectangle2CornerRadii = CacheForRoundabout.rectangle2CornerRadii; - rectangle2CornerRadii[0] = rectangle2CornerRadii[1] = rectangle2CornerRadius; - rectangle2CornerRadii[2] = rectangle2CornerRadii[3] = rectangle2CornerRadius; - rectangle2CornerRadii[4] = rectangle2CornerRadii[5] = 0f; - rectangle2CornerRadii[6] = rectangle2CornerRadii[7] = 0f; - rectangle2Path.addRoundRect(rectangle2Rect, rectangle2CornerRadii, Path.Direction.CW); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(rectangle2Path, paint); - - // Group - { - // Bezier 2 - canvas.save(); - canvas.translate(0f, 1f); - currentTransformation.peek().postTranslate(0f, 1f); - canvas.rotate(-(roundabout_angle + 90f)); - currentTransformation.peek().postRotate(-(roundabout_angle + 90f)); - RectF bezier2Rect = CacheForRoundabout.bezier2Rect; - bezier2Rect.set(-20.5f, -7.99f, -4.5f, 8.01f); - Path bezier2Path = CacheForRoundabout.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-9.47f, -7.49f); - bezier2Path.cubicTo(-9.47f, -7.45f, -9.49f, -7.38f, -9.49f, -7.38f); - bezier2Path.cubicTo(-9.57f, -6.97f, -10.45f, -2.64f, -10.45f, -2.64f); - bezier2Path.cubicTo(-10.47f, -2.59f, -10.47f, -2.54f, -10.47f, -2.49f); - bezier2Path.cubicTo(-10.47f, -2.25f, -10.09f, -2.03f, -9.82f, -2f); - bezier2Path.lineTo(-5.5f, -2f); - bezier2Path.cubicTo(-4.95f, -2f, -4.5f, -1.55f, -4.5f, -1f); - bezier2Path.lineTo(-4.5f, 1f); - bezier2Path.cubicTo(-4.5f, 1.55f, -4.95f, 2f, -5.5f, 2f); - bezier2Path.cubicTo(-5.5f, 2f, -9.38f, 2.01f, -9.75f, 2.01f); - bezier2Path.cubicTo(-10.01f, 2.01f, -10.35f, 2.24f, -10.35f, 2.51f); - bezier2Path.cubicTo(-10.35f, 2.56f, -10.41f, 2.6f, -10.39f, 2.65f); - bezier2Path.lineTo(-9.46f, 7.39f); - bezier2Path.cubicTo(-9.46f, 7.39f, -9.46f, 7.47f, -9.46f, 7.51f); - bezier2Path.cubicTo(-9.46f, 7.78f, -9.69f, 8.01f, -9.97f, 8.01f); - bezier2Path.cubicTo(-10.1f, 8.01f, -10.22f, 7.95f, -10.31f, 7.87f); - bezier2Path.lineTo(-20.5f, 0.01f); - bezier2Path.lineTo(-10.31f, -7.86f); - bezier2Path.cubicTo(-10.22f, -7.94f, -10.11f, -7.99f, -9.97f, -7.99f); - bezier2Path.cubicTo(-9.7f, -7.99f, -9.47f, -7.77f, -9.47f, -7.49f); - bezier2Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - canvas.restore(); - } - - // Bezier 3 - canvas.save(); - canvas.translate(1f, 2f); - currentTransformation.peek().postTranslate(1f, 2f); - canvas.rotate(-90f); - currentTransformation.peek().postRotate(-90f); - canvas.scale(-1f, 1f); - currentTransformation.peek().postScale(-1f, 1f); - RectF bezier3Rect = CacheForRoundabout.bezier3Rect; - bezier3Rect.set(-7.5f, -7.5f, 5.5f, 5.5f); - Path bezier3Path = CacheForRoundabout.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(5.5f, -1f); - bezier3Path.cubicTo(5.5f, 0.79f, 4.78f, 2.41f, 3.6f, 3.59f); - bezier3Path.cubicTo(2.43f, 4.77f, 0.8f, 5.5f, -1f, 5.5f); - bezier3Path.cubicTo(-2.79f, 5.5f, -4.41f, 4.78f, -5.59f, 3.61f); - bezier3Path.cubicTo(-6.77f, 2.43f, -7.5f, 0.8f, -7.5f, -1f); - bezier3Path.cubicTo(-7.5f, -2.79f, -6.77f, -4.42f, -5.6f, -5.6f); - bezier3Path.cubicTo(-4.42f, -6.77f, -2.79f, -7.5f, -1f, -7.5f); - bezier3Path.cubicTo(0.79f, -7.5f, 2.42f, -6.77f, 3.6f, -5.6f); - bezier3Path.cubicTo(4.77f, -4.42f, 5.5f, -2.79f, 5.5f, -1f); - bezier3Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - paint.setPathEffect(CacheForRoundabout.bezier3PathDashEffect.get(roundabout_percentage, 1000f, 0f)); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - canvas.restore(); - canvas.restore(); - - canvas.restore(); - } - - canvas.restore(); - } - - private static class CacheForArriveright2 { - private static Paint paint = new Paint(); - private static RectF originalFrame = new RectF(0f, 0f, 32f, 32f); - private static RectF resizedFrame = new RectF(); - private static RectF frame = new RectF(); - private static RectF bezierRect = new RectF(); - private static Path bezierPath = new Path(); - private static RectF bezier2Rect = new RectF(); - private static Path bezier2Path = new Path(); - private static RectF rectangleRect = new RectF(); - private static Path rectanglePath = new Path(); - private static RectF bezier3Rect = new RectF(); - private static Path bezier3Path = new Path(); - } - - public static void drawArriveright2(Canvas canvas, int primaryColor, PointF size) { - ManeuversStyleKit.drawArriveright2(canvas, new RectF(0f, 0f, 32f, 32f), ResizingBehavior.AspectFit, primaryColor, size); - } - - public static void drawArriveright2(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { - // General Declarations - Stack currentTransformation = new Stack(); - currentTransformation.push(new Matrix()); - Paint paint = CacheForArriveright2.paint; - - // Local Variables - float x = size.x / 2f; - float scale = Math.min(size.x / 32f, size.y / 32f); - float y = size.y / 2f; - - // Resize to Target Frame - canvas.save(); - RectF resizedFrame = CacheForArriveright2.resizedFrame; - ManeuversStyleKit.resizingBehaviorApply(resizing, CacheForArriveright2.originalFrame, targetFrame, resizedFrame); - canvas.translate(resizedFrame.left, resizedFrame.top); - canvas.scale(resizedFrame.width() / 32f, resizedFrame.height() / 32f); - - // Frame - RectF frame = CacheForArriveright2.frame; - frame.set(0f, 0f, size.x, size.y); - - // Group 2 - { - canvas.save(); - canvas.translate(x, y); - currentTransformation.peek().postTranslate(x, y); - canvas.scale(scale, scale); - currentTransformation.peek().postScale(scale, scale); - - // Bezier - RectF bezierRect = CacheForArriveright2.bezierRect; - bezierRect.set(0.06f, 6.6f, 0.06f, 16f); - Path bezierPath = CacheForArriveright2.bezierPath; - bezierPath.reset(); - bezierPath.moveTo(0.06f, 6.6f); - bezierPath.lineTo(0.06f, 16f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStrokeWidth(4f); - paint.setStrokeJoin(Paint.Join.ROUND); - paint.setStrokeMiter(10f); - canvas.save(); - paint.setStyle(Paint.Style.STROKE); - paint.setColor(primaryColor); - canvas.drawPath(bezierPath, paint); - canvas.restore(); - - // Bezier 2 - RectF bezier2Rect = CacheForArriveright2.bezier2Rect; - bezier2Rect.set(-8f, -9.03f, 8f, 2.48f); - Path bezier2Path = CacheForArriveright2.bezier2Path; - bezier2Path.reset(); - bezier2Path.moveTo(-2f, 2.48f); - bezier2Path.cubicTo(-2f, 2.48f, -2f, 2.09f, -2f, 1.73f); - bezier2Path.cubicTo(-2f, 1.46f, -2.23f, 1.12f, -2.5f, 1.12f); - bezier2Path.cubicTo(-2.55f, 1.12f, -2.6f, 1.07f, -2.64f, 1.08f); - bezier2Path.lineTo(-7.39f, 2.02f); - bezier2Path.cubicTo(-7.39f, 2.02f, -7.46f, 2.01f, -7.5f, 2.01f); - bezier2Path.cubicTo(-7.78f, 2.01f, -8f, 1.78f, -8f, 1.51f); - bezier2Path.cubicTo(-8f, 1.37f, -7.95f, 1.25f, -7.86f, 1.16f); - bezier2Path.lineTo(0f, -9.03f); - bezier2Path.lineTo(7.86f, 1.16f); - bezier2Path.cubicTo(7.95f, 1.25f, 8f, 1.37f, 8f, 1.5f); - bezier2Path.cubicTo(8f, 1.77f, 7.78f, 2f, 7.5f, 2f); - bezier2Path.cubicTo(7.46f, 2f, 7.39f, 1.99f, 7.39f, 1.99f); - bezier2Path.lineTo(2.64f, 1.02f); - bezier2Path.cubicTo(2.6f, 1.01f, 2.55f, 1f, 2.5f, 1f); - bezier2Path.cubicTo(2.23f, 1f, 2f, 1.46f, 2f, 1.73f); - bezier2Path.cubicTo(2f, 2.09f, 2f, 2.48f, 2f, 2.48f); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier2Path, paint); - - // Rectangle - RectF rectangleRect = CacheForArriveright2.rectangleRect; - rectangleRect.set(-2f, 3.63f, 2f, 5.58f); - Path rectanglePath = CacheForArriveright2.rectanglePath; - rectanglePath.reset(); - rectanglePath.moveTo(rectangleRect.left, rectangleRect.top); - rectanglePath.lineTo(rectangleRect.right, rectangleRect.top); - rectanglePath.lineTo(rectangleRect.right, rectangleRect.bottom); - rectanglePath.lineTo(rectangleRect.left, rectangleRect.bottom); - rectanglePath.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(rectanglePath, paint); - - // Bezier 3 - RectF bezier3Rect = CacheForArriveright2.bezier3Rect; - bezier3Rect.set(3f, -15.57f, 9f, -6.57f); - Path bezier3Path = CacheForArriveright2.bezier3Path; - bezier3Path.reset(); - bezier3Path.moveTo(6f, -13.69f); - bezier3Path.cubicTo(5.87f, -13.69f, 5.75f, -13.67f, 5.64f, -13.63f); - bezier3Path.cubicTo(5.19f, -13.48f, 4.88f, -13.06f, 4.88f, -12.57f); - bezier3Path.cubicTo(4.88f, -11.95f, 5.38f, -11.44f, 6f, -11.44f); - bezier3Path.cubicTo(6.62f, -11.44f, 7.13f, -11.95f, 7.13f, -12.57f); - bezier3Path.cubicTo(7.13f, -13.19f, 6.62f, -13.69f, 6f, -13.69f); - bezier3Path.close(); - bezier3Path.moveTo(9f, -12.57f); - bezier3Path.cubicTo(9f, -10.91f, 7.5f, -9.94f, 6f, -6.57f); - bezier3Path.cubicTo(4.5f, -9.94f, 3f, -10.91f, 3f, -12.57f); - bezier3Path.cubicTo(3f, -13.45f, 3.38f, -14.25f, 4f, -14.8f); - bezier3Path.cubicTo(4.19f, -14.97f, 4.41f, -15.12f, 4.64f, -15.24f); - bezier3Path.cubicTo(5.05f, -15.45f, 5.51f, -15.57f, 6f, -15.57f); - bezier3Path.cubicTo(7.66f, -15.57f, 9f, -14.22f, 9f, -12.57f); - bezier3Path.close(); - - paint.reset(); - paint.setFlags(Paint.ANTI_ALIAS_FLAG); - paint.setStyle(Paint.Style.FILL); - paint.setColor(primaryColor); - canvas.drawPath(bezier3Path, paint); - - canvas.restore(); - } - - canvas.restore(); - } - - - // Resizing Behavior - public static void resizingBehaviorApply(ResizingBehavior behavior, RectF rect, RectF target, RectF result) { - if (rect.equals(target) || target == null) { - result.set(rect); - return; - } - - if (behavior == ResizingBehavior.Stretch) { - result.set(target); - return; - } - - float xRatio = Math.abs(target.width() / rect.width()); - float yRatio = Math.abs(target.height() / rect.height()); - float scale = 0f; - - switch (behavior) { - case AspectFit: { - scale = Math.min(xRatio, yRatio); - break; - } - case AspectFill: { - scale = Math.max(xRatio, yRatio); - break; - } - case Center: { - scale = 1f; - break; - } - default: - break; - } - - float newWidth = Math.abs(rect.width() * scale); - float newHeight = Math.abs(rect.height() * scale); - result.set(target.centerX() - newWidth / 2, - target.centerY() - newHeight / 2, - target.centerX() + newWidth / 2, - target.centerY() + newHeight / 2); - } - - -} - -class PaintCodeDashPathEffect { - private DashPathEffect effect; - private float dash, gap, phase; - - DashPathEffect get(float dash, float gap, float phase) { - if (this.dash != dash || this.gap != gap || this.phase != phase) { - this.dash = dash; - this.gap = gap; - this.phase = phase; - this.effect = new DashPathEffect(new float[] {dash, gap}, phase); - } - return this.effect; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneAdapter.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneAdapter.java deleted file mode 100644 index 1fb530f0..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneAdapter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.turnlane; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.ui.v5.R; - -import java.util.ArrayList; -import java.util.List; - -public class TurnLaneAdapter extends RecyclerView.Adapter { - - private static final String EMPTY_STRING = ""; - private String maneuverModifier = EMPTY_STRING; - private List laneComponents = new ArrayList<>(); - - @NonNull - @Override - public TurnLaneViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.turn_lane_listitem_layout, parent, false); - - return new TurnLaneViewHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull TurnLaneViewHolder holder, int position) { - BannerComponents lane = laneComponents.get(position); - holder.turnLaneView.updateLaneView(lane, maneuverModifier); - } - - @Override - public int getItemCount() { - return laneComponents.size(); - } - - public void addTurnLanes(List laneComponents, String maneuverModifier) { - this.laneComponents.clear(); - this.laneComponents.addAll(laneComponents); - this.maneuverModifier = maneuverModifier; - notifyDataSetChanged(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneDrawableMap.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneDrawableMap.java deleted file mode 100644 index b4eab3f6..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneDrawableMap.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.turnlane; - -import com.mapbox.services.android.navigation.ui.v5.R; - -import java.util.HashMap; - -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_RIGHT; -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_RIGHT_ONLY; -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_SLIGHT_RIGHT; -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_STRAIGHT; -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_STRAIGHT_ONLY; -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_UTURN; - -class TurnLaneDrawableMap extends HashMap { - - TurnLaneDrawableMap() { - put(DRAW_LANE_STRAIGHT, R.drawable.ic_lane_straight); - put(DRAW_LANE_UTURN, R.drawable.ic_lane_uturn); - put(DRAW_LANE_RIGHT, R.drawable.ic_lane_right); - put(DRAW_LANE_SLIGHT_RIGHT, R.drawable.ic_lane_slight_right); - put(DRAW_LANE_RIGHT_ONLY, R.drawable.ic_lane_right_only); - put(DRAW_LANE_STRAIGHT_ONLY, R.drawable.ic_lane_straight_only); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java deleted file mode 100644 index 49a9cec0..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.turnlane; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; -import androidx.appcompat.widget.AppCompatImageView; -import android.util.AttributeSet; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -/** - * Use this view to render turn lane data. - *

- * Based on the data provided, a turn lane will render. It's opacity will be - * determined by whether or not the lane is "active". - */ -public class TurnLaneView extends AppCompatImageView { - - private static final float HALF_OPACITY = 0.4f; - private static final float FULL_OPACITY = 1.0f; - private static final int SCALE_FLIPPED = -1; - private static final int SCALE_NORMAL = 1; - private final TurnLaneDrawableMap laneDrawableMap = new TurnLaneDrawableMap(); - - public TurnLaneView(Context context) { - super(context); - } - - public TurnLaneView(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - } - - public TurnLaneView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - /** - * Updates this view based on the banner component lane data and the given maneuver - * modifier (to highlight which lane should be chosen). - * - * @param lane data {@link BannerComponents} - * @param maneuverModifier for the given maneuver - */ - public void updateLaneView(@NonNull BannerComponents lane, @NonNull String maneuverModifier) { - if (hasInvalidData(lane)) { - return; - } - - TurnLaneViewData drawData = buildTurnLaneViewData(lane, maneuverModifier); - Integer resId = findDrawableResId(drawData); - if (resId == null) { - return; - } - drawFor(lane, drawData, resId); - } - - private boolean hasInvalidData(@NonNull BannerComponents lane) { - return lane.directions() == null || lane.active() == null; - } - - @NonNull - private TurnLaneViewData buildTurnLaneViewData(@NonNull BannerComponents lane, @NonNull String maneuverModifier) { - StringBuilder builder = new StringBuilder(); - for (String indication : lane.directions()) { - builder.append(indication); - } - String laneIndications = builder.toString(); - return new TurnLaneViewData(laneIndications, maneuverModifier); - } - - @Nullable - private Integer findDrawableResId(TurnLaneViewData drawData) { - String drawMethod = drawData.getDrawMethod(); - Integer resId = laneDrawableMap.get(drawMethod); - if (resId == null) { - return null; - } - return resId; - } - - private void drawFor(@NonNull BannerComponents lane, TurnLaneViewData drawData, Integer resId) { - final Drawable turnLaneDrawable = VectorDrawableCompat.create( - getResources(), resId, getContext().getTheme() - ); - setImageDrawable(turnLaneDrawable); - setAlpha(!lane.active() ? HALF_OPACITY : FULL_OPACITY); - setScaleX(drawData.shouldBeFlipped() ? SCALE_FLIPPED : SCALE_NORMAL); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewData.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewData.java deleted file mode 100644 index 617391c4..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewData.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.turnlane; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.STEP_MANEUVER_MODIFIER_STRAIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.TURN_LANE_INDICATION_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.TURN_LANE_INDICATION_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.TURN_LANE_INDICATION_SLIGHT_LEFT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.TURN_LANE_INDICATION_SLIGHT_RIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.TURN_LANE_INDICATION_STRAIGHT; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.TURN_LANE_INDICATION_UTURN; - -class TurnLaneViewData { - - static final String DRAW_LANE_SLIGHT_RIGHT = "draw_lane_slight_right"; - static final String DRAW_LANE_RIGHT = "draw_lane_right"; - static final String DRAW_LANE_STRAIGHT = "draw_lane_straight"; - static final String DRAW_LANE_UTURN = "draw_lane_uturn"; - static final String DRAW_LANE_RIGHT_ONLY = "draw_lane_right_only"; - static final String DRAW_LANE_STRAIGHT_ONLY = "draw_lane_straight_only"; - - private boolean shouldFlip; - private String drawMethod; - - TurnLaneViewData(String laneIndications, String maneuverModifier) { - buildDrawData(laneIndications, maneuverModifier); - } - - boolean shouldBeFlipped() { - return shouldFlip; - } - - String getDrawMethod() { - return drawMethod; - } - - private void buildDrawData(String laneIndications, String maneuverModifier) { - - // U-turn - if (laneIndications.contentEquals(TURN_LANE_INDICATION_UTURN)) { - drawMethod = DRAW_LANE_UTURN; - shouldFlip = true; - return; - } - - // Straight - if (laneIndications.contentEquals(TURN_LANE_INDICATION_STRAIGHT)) { - drawMethod = DRAW_LANE_STRAIGHT; - return; - } - - // Right or left - if (laneIndications.contentEquals(TURN_LANE_INDICATION_RIGHT)) { - drawMethod = DRAW_LANE_RIGHT; - return; - } else if (laneIndications.contentEquals(TURN_LANE_INDICATION_LEFT)) { - drawMethod = DRAW_LANE_RIGHT; - shouldFlip = true; - return; - } - - // Slight right or slight left - if (laneIndications.contentEquals(TURN_LANE_INDICATION_SLIGHT_RIGHT)) { - drawMethod = DRAW_LANE_SLIGHT_RIGHT; - return; - } else if (laneIndications.contentEquals(TURN_LANE_INDICATION_SLIGHT_LEFT)) { - drawMethod = DRAW_LANE_SLIGHT_RIGHT; - shouldFlip = true; - return; - } - - // Straight and right or left - if (isStraightPlusIndication(laneIndications, TURN_LANE_INDICATION_RIGHT)) { - setDrawMethodWithModifier(maneuverModifier); - } else if (isStraightPlusIndication(laneIndications, TURN_LANE_INDICATION_LEFT)) { - setDrawMethodWithModifier(maneuverModifier); - shouldFlip = true; - } - } - - private void setDrawMethodWithModifier(String maneuverModifier) { - if (maneuverModifier.contains(STEP_MANEUVER_MODIFIER_RIGHT)) { - drawMethod = DRAW_LANE_RIGHT_ONLY; - } else if (maneuverModifier.contains(STEP_MANEUVER_MODIFIER_STRAIGHT)) { - drawMethod = DRAW_LANE_STRAIGHT_ONLY; - } else { - drawMethod = DRAW_LANE_RIGHT_ONLY; - } - } - - private boolean isStraightPlusIndication(String laneIndications, String turnLaneIndication) { - return laneIndications.contains(TURN_LANE_INDICATION_STRAIGHT) - && laneIndications.contains(turnLaneIndication); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewHolder.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewHolder.java deleted file mode 100644 index 9975ed9e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewHolder.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.turnlane; - -import androidx.recyclerview.widget.RecyclerView; -import android.view.View; - -import com.mapbox.services.android.navigation.ui.v5.R; - -class TurnLaneViewHolder extends RecyclerView.ViewHolder { - - TurnLaneView turnLaneView; - - TurnLaneViewHolder(View itemView) { - super(itemView); - turnLaneView = itemView.findViewById(R.id.turnLaneView); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/BannerInstructionsListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/BannerInstructionsListener.java deleted file mode 100644 index 9153af5e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/BannerInstructionsListener.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.listeners; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; - -/** - * This listener will be triggered when a {@link BannerInstructions} is about to be displayed. - *

- * The listener gives you the option to override any values and pass as the return value, - * which will be the value used for the banner instructions. - * - * @since 0.16.0 - */ -public interface BannerInstructionsListener { - - /** - * Listener tied to {@link BannerInstructions} that are about to be displayed. - *

- * To prevent the given {@link BannerInstructions} from being displayed, you can return null - * and it will be ignored. - * - * @param instructions about to be displayed - * @return instructions to be displayed; null if should be ignored - * @since 0.16.0 - */ - BannerInstructions willDisplay(BannerInstructions instructions); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/InstructionListListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/InstructionListListener.java deleted file mode 100644 index 85c2667b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/InstructionListListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.listeners; - -/** - * A listener that is triggered when the instruction list in InstructionView is shown or hidden. - */ -public interface InstructionListListener { - /** - * Triggered when the instruction list is shown or hidden. - * - * @param visible whether the list is shown or hidden - * @since 0.15.0 - */ - void onInstructionListVisibilityChanged(boolean visible); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/NavigationListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/NavigationListener.java deleted file mode 100644 index 632ceebc..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/NavigationListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.listeners; - -/** - * A listener that can be implemented and - * added to {@link com.mapbox.services.android.navigation.ui.v5.NavigationViewOptions} to - * hook into navigation related events occurring in {@link com.mapbox.services.android.navigation.ui.v5.NavigationView}. - */ -public interface NavigationListener { - - /** - * Will be triggered when the user clicks - * on the cancel "X" icon while navigating. - * - * @since 0.8.0 - */ - void onCancelNavigation(); - - /** - * Will be triggered when {@link com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation} - * has finished and the service is completely shut down. - * - * @since 0.8.0 - */ - void onNavigationFinished(); - - /** - * Will be triggered when {@link com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation} - * has been initialized and the user is navigating the given route. - * - * @since 0.8.0 - */ - void onNavigationRunning(); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/RouteListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/RouteListener.java deleted file mode 100644 index 63ac5a36..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/RouteListener.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.listeners; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; - -/** - * A listener that can be implemented and added to {@link com.mapbox.services.android.navigation.ui.v5.NavigationViewOptions} to - * hook into route related events occurring in {@link com.mapbox.services.android.navigation.ui.v5.NavigationView}. - */ -public interface RouteListener { - - /** - * Will trigger in an off route scenario. Given the {@link Point} the user has gone - * off route, this listener can return true or false. - *

- * Returning true will allow the SDK to proceed with the re-route process and fetch a new route - * with this given off route {@link Point}. - *

- * Returning false will stop the re-route process and the user will continue without a - * new route in the direction they are traveling. - * - * @param offRoutePoint the given point the user has gone off route - * @return true if the reroute should be allowed, false if not - * @since 0.8.0 - */ - boolean allowRerouteFrom(Point offRoutePoint); - - /** - * Will triggered only if {@link RouteListener#allowRerouteFrom(Point)} returns true. - *

- * This serves as the official off route event and will continue the process to fetch a new route - * with the given off route {@link Point}. - * - * @param offRoutePoint the given point the user has gone off route - * @since 0.8.0 - */ - void onOffRoute(Point offRoutePoint); - - /** - * Will trigger when a new {@link DirectionsRoute} has been retrieved post off route. - *

- * This is the new route the user will be following until another off route event is triggered. - * - * @param directionsRoute the new directions route - * @since 0.8.0 - */ - void onRerouteAlong(DirectionsRoute directionsRoute); - - /** - * Will trigger if the request for a new {@link DirectionsRoute} fails. - * - * @since 0.8.0 - */ - void onFailedReroute(String errorMessage); - - /** - * Will trigger when a user has arrived at a given waypoint along a {@link DirectionsRoute}. - *

- * For example, if there are two {@link LegStep}s, this callback will be triggered twice, once for each waypoint. - * - * @since 0.14.0 - */ - void onArrival(); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/SpeechAnnouncementListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/SpeechAnnouncementListener.java deleted file mode 100644 index 73da8f71..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/listeners/SpeechAnnouncementListener.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.listeners; - -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechAnnouncement; - -/** - * This listener will be triggered when a voice announcement is about to be voiced. - *

- * The listener gives you the option to override any values and pass as the return value, - * which will be the value used for the voice announcement. - * - * @since 0.16.0 - */ -public interface SpeechAnnouncementListener { - - /** - * Listener tied to voice announcements that are about to be voiced. - *

- * To prevent the given announcement from being announced, you can return null - * and it will be ignored. - *

- * If the {@code SpeechAnnouncement#ssmlAnnouncement} is malformed, - * the {@link com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayer} will fall back to what is - * included in the {@code SpeechAnnouncement#announcement} with {@link android.speech.tts.TextToSpeech}. - * - * @param announcement about to be announced - * @return speech announcement to be played; null if should be ignored - */ - SpeechAnnouncement willVoice(SpeechAnnouncement announcement); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FeatureFilterTask.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FeatureFilterTask.java deleted file mode 100644 index e5c6558a..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FeatureFilterTask.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.location.Location; -import android.os.AsyncTask; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.Point; - -import java.util.List; - -class FeatureFilterTask extends AsyncTask { - - private final WaynameFeatureFilter filter; - private final OnFeatureFilteredCallback callback; - - FeatureFilterTask(List queriedFeatures, Location currentLocation, - List currentStepPoints, OnFeatureFilteredCallback callback) { - filter = new WaynameFeatureFilter(queriedFeatures, currentLocation, currentStepPoints); - this.callback = callback; - } - - @Override - protected Feature doInBackground(Void... voids) { - return filter.filterFeatures(); - } - - @Override - protected void onPostExecute(Feature feature) { - super.onPostExecute(feature); - callback.onFeatureFiltered(feature); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FpsDelegateProgressChangeListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FpsDelegateProgressChangeListener.java deleted file mode 100644 index 4f05f799..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/FpsDelegateProgressChangeListener.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -class FpsDelegateProgressChangeListener implements ProgressChangeListener { - - private final MapFpsDelegate fpsDelegate; - - FpsDelegateProgressChangeListener(MapFpsDelegate fpsDelegate) { - this.fpsDelegate = fpsDelegate; - } - - @Override - public void onProgressChange(Location location, RouteProgress routeProgress) { - fpsDelegate.adjustFpsFor(routeProgress); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegate.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegate.java deleted file mode 100644 index 20060c89..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegate.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import androidx.annotation.NonNull; - -import com.mapbox.mapboxsdk.location.LocationComponent; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -class LocationFpsDelegate implements MapboxMap.OnCameraIdleListener { - - private static final int ZOOM_LEVEL_FIVE = 5; - private static final int ZOOM_LEVEL_TEN = 10; - private static final int ZOOM_LEVEL_FOURTEEN = 14; - private static final int ZOOM_LEVEL_SIXTEEN = 16; - private static final int ZOOM_LEVEL_EIGHTEEN = 18; - private static final int MAX_ANIMATION_FPS_THREE = 3; - private static final int MAX_ANIMATION_FPS_FIVE = 5; - private static final int MAX_ANIMATION_FPS_TEN = 10; - private static final int MAX_ANIMATION_FPS_FIFTEEN = 15; - private static final int MAX_ANIMATION_FPS_TWENTY_FIVE = 25; - private static final int MAX_ANIMATION_FPS = Integer.MAX_VALUE; - private final MapboxMap mapboxMap; - private final LocationComponent locationComponent; - private int currentFps = MAX_ANIMATION_FPS; - private boolean isEnabled = true; - - LocationFpsDelegate(@NonNull MapboxMap mapboxMap, @NonNull LocationComponent locationComponent) { - this.mapboxMap = mapboxMap; - this.locationComponent = locationComponent; - mapboxMap.addOnCameraIdleListener(this); - } - - @Override - public void onCameraIdle() { - if (!isEnabled) { - return; - } - updateMaxFps(); - } - - void onStart() { - mapboxMap.addOnCameraIdleListener(this); - } - - void onStop() { - mapboxMap.removeOnCameraIdleListener(this); - } - - void updateEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - resetMaxFps(); - } - - boolean isEnabled() { - return isEnabled; - } - - private void updateMaxFps() { - double zoom = mapboxMap.getCameraPosition().zoom; - int maxAnimationFps = buildFpsFrom(zoom); - if (currentFps != maxAnimationFps) { - locationComponent.setMaxAnimationFps(maxAnimationFps); - currentFps = maxAnimationFps; - } - } - - private int buildFpsFrom(double zoom) { - int maxAnimationFps; - if (zoom < ZOOM_LEVEL_FIVE) { - maxAnimationFps = MAX_ANIMATION_FPS_THREE; - } else if (zoom < ZOOM_LEVEL_TEN) { - maxAnimationFps = MAX_ANIMATION_FPS_FIVE; - } else if (zoom < ZOOM_LEVEL_FOURTEEN) { - maxAnimationFps = MAX_ANIMATION_FPS_TEN; - } else if (zoom < ZOOM_LEVEL_SIXTEEN) { - maxAnimationFps = MAX_ANIMATION_FPS_FIFTEEN; - } else if (zoom < ZOOM_LEVEL_EIGHTEEN) { - maxAnimationFps = MAX_ANIMATION_FPS_TWENTY_FIVE; - } else { - maxAnimationFps = MAX_ANIMATION_FPS; - } - return maxAnimationFps; - } - - private void resetMaxFps() { - if (!isEnabled) { - locationComponent.setMaxAnimationFps(MAX_ANIMATION_FPS); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapBatteryMonitor.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapBatteryMonitor.java deleted file mode 100644 index 20b5c177..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapBatteryMonitor.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.BatteryManager; -import android.os.Build; - -class MapBatteryMonitor { - - private static final int DEFAULT_BATTERY_LEVEL = -1; - - boolean isPluggedIn(Context context) { - Intent batteryStatus = registerBatteryUpdates(context); - if (batteryStatus == null) { - return false; - } - - int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, DEFAULT_BATTERY_LEVEL); - boolean pluggedUsb = chargePlug == BatteryManager.BATTERY_PLUGGED_USB; - boolean pluggedAc = chargePlug == BatteryManager.BATTERY_PLUGGED_AC; - boolean isPlugged = pluggedUsb || pluggedAc; - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { - isPlugged = isPlugged || chargePlug == BatteryManager.BATTERY_PLUGGED_WIRELESS; - } - return isPlugged; - } - - private static Intent registerBatteryUpdates(Context context) { - IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); - return context.registerReceiver(null, filter); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegate.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegate.java deleted file mode 100644 index d947e2ef..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegate.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.content.Context; - -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera; -import com.mapbox.services.android.navigation.ui.v5.camera.OnTrackingModeChangedListener; -import com.mapbox.services.android.navigation.ui.v5.camera.OnTrackingModeTransitionListener; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.navigation.NavigationConstants; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteLegProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -class MapFpsDelegate implements OnTrackingModeChangedListener, OnTrackingModeTransitionListener { - - static final int DEFAULT_MAX_FPS_THRESHOLD = 20; - private static final double VALID_DURATION_IN_SECONDS_UNTIL_NEXT_MANEUVER = 7d; - private static final double VALID_DURATION_IN_SECONDS_SINCE_PREVIOUS_MANEUVER = 5d; - private static final int DEVICE_MAX_FPS = Integer.MAX_VALUE; - private static final int LOW_POWER_MAX_FPS = 30; - - private final MapView mapView; - private final MapBatteryMonitor batteryMonitor; - private final ProgressChangeListener fpsProgressListener = new FpsDelegateProgressChangeListener(this); - private MapboxNavigation navigation; - private int maxFpsThreshold = DEFAULT_MAX_FPS_THRESHOLD; - private boolean isTracking = true; - private boolean isEnabled = true; - - MapFpsDelegate(MapView mapView, MapBatteryMonitor batteryMonitor) { - this.mapView = mapView; - this.batteryMonitor = batteryMonitor; - } - - @Override - public void onTrackingModeChanged(int trackingMode) { - int trackingModeNone = NavigationCamera.NAVIGATION_TRACKING_MODE_NONE; - if (trackingMode == trackingModeNone) { - updateCameraTracking(trackingModeNone); - } - } - - @Override - public void onTransitionFinished(int trackingMode) { - updateCameraTracking(trackingMode); - } - - @Override - public void onTransitionCancelled(int trackingMode) { - updateCameraTracking(trackingMode); - } - - void addProgressChangeListener(MapboxNavigation navigation) { - this.navigation = navigation; - navigation.addProgressChangeListener(fpsProgressListener); - } - - void onStart() { - if (navigation != null) { - navigation.addProgressChangeListener(fpsProgressListener); - } - } - - void onStop() { - if (navigation != null) { - navigation.removeProgressChangeListener(fpsProgressListener); - } - } - - void updateEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - resetMaxFps(!isEnabled); - } - - void updateMaxFpsThreshold(int maxFps) { - this.maxFpsThreshold = maxFps; - } - - void adjustFpsFor(RouteProgress routeProgress) { - if (!isEnabled || !isTracking) { - return; - } - - int maxFps = determineMaxFpsFrom(routeProgress, mapView.getContext()); - mapView.setMaximumFps(maxFps); - } - - private void updateCameraTracking(@NavigationCamera.TrackingMode int trackingMode) { - isTracking = trackingMode != NavigationCamera.NAVIGATION_TRACKING_MODE_NONE; - resetMaxFps(!isTracking); - } - - private void resetMaxFps(boolean shouldReset) { - if (shouldReset) { - mapView.setMaximumFps(DEVICE_MAX_FPS); - } - } - - private int determineMaxFpsFrom(RouteProgress routeProgress, Context context) { - final boolean isPluggedIn = batteryMonitor.isPluggedIn(context); - RouteLegProgress routeLegProgress = routeProgress.currentLegProgress(); - - if (isPluggedIn) { - return LOW_POWER_MAX_FPS; - } else if (validLowFpsManeuver(routeLegProgress) || validLowFpsDuration(routeLegProgress)) { - return maxFpsThreshold; - } else { - return LOW_POWER_MAX_FPS; - } - } - - private boolean validLowFpsManeuver(RouteLegProgress routeLegProgress) { - final String maneuverModifier = routeLegProgress.currentStep().maneuver().modifier(); - return maneuverModifier != null - && (maneuverModifier.equals(NavigationConstants.STEP_MANEUVER_MODIFIER_STRAIGHT) - || maneuverModifier.equals(NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_LEFT) - || maneuverModifier.equals(NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_RIGHT)); - } - - private boolean validLowFpsDuration(RouteLegProgress routeLegProgress) { - final double expectedStepDuration = routeLegProgress.currentStep().duration(); - final double durationUntilNextManeuver = routeLegProgress.currentStepProgress().durationRemaining(); - final double durationSincePreviousManeuver = expectedStepDuration - durationUntilNextManeuver; - return durationUntilNextManeuver > VALID_DURATION_IN_SECONDS_UNTIL_NEXT_MANEUVER - && durationSincePreviousManeuver > VALID_DURATION_IN_SECONDS_SINCE_PREVIOUS_MANEUVER; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractor.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractor.java deleted file mode 100644 index 6279c870..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractor.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.Color; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; - -import java.util.List; - -import static com.mapbox.mapboxsdk.style.layers.Property.NONE; -import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineColor; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineWidth; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; -import static com.mapbox.services.android.navigation.ui.v5.map.NavigationMapboxMap.STREETS_LAYER_ID; - -class MapLayerInteractor { - - private static final float DEFAULT_WIDTH = 20f; - private static final int LAST_INDEX = 0; - - private final MapboxMap mapboxMap; - - MapLayerInteractor(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - void updateLayerVisibility(boolean isVisible, String layerIdentifier) { - // TODO add sourceIdentifier logic when https://github.com/mapbox/mapbox-gl-native/issues/12691 lands - List layers = mapboxMap.getStyle().getLayers(); - updateLayerWithVisibility(layerIdentifier, layers, isVisible); - } - - boolean isLayerVisible(String layerIdentifier) { - // TODO add sourceIdentifier logic when https://github.com/mapbox/mapbox-gl-native/issues/12691 lands - List layers = mapboxMap.getStyle().getLayers(); - return findLayerVisibility(layerIdentifier, layers); - } - - void addStreetsLayer(String sourceId, String sourceLayer) { - LineLayer streetsLayer = new LineLayer(STREETS_LAYER_ID, sourceId) - .withProperties( - lineWidth(DEFAULT_WIDTH), - lineColor(Color.WHITE) - ) - .withSourceLayer(sourceLayer); - mapboxMap.getStyle().addLayerAt(streetsLayer, LAST_INDEX); - } - - private void updateLayerWithVisibility(String layerIdentifier, List layers, boolean isVisible) { - for (Layer layer : layers) { - if (isValid(layer)) { - String sourceLayerId = retrieveSourceLayerId(layer); - if (sourceLayerId.equals(layerIdentifier)) { - layer.setProperties(visibility(isVisible ? VISIBLE : NONE)); - } - } - } - } - - private boolean findLayerVisibility(String layerIdentifier, List layers) { - for (Layer layer : layers) { - if (isValid(layer)) { - String sourceLayerId = retrieveSourceLayerId(layer); - if (sourceLayerId.equals(layerIdentifier)) { - return layer.getVisibility().value.equals(VISIBLE); - } - } - } - return false; - } - - private boolean isValid(Layer layer) { - return layer instanceof LineLayer || layer instanceof SymbolLayer; - } - - private String retrieveSourceLayerId(Layer layer) { - String sourceIdentifier; - if (layer instanceof LineLayer) { - sourceIdentifier = ((LineLayer) layer).getSourceLayer(); - } else { - sourceIdentifier = ((SymbolLayer) layer).getSourceLayer(); - } - return sourceIdentifier; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustor.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustor.java deleted file mode 100644 index 7414efa0..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustor.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.content.Context; -import android.content.res.Resources; - -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.services.android.navigation.ui.v5.R; - -class MapPaddingAdjustor { - - private static final int BOTTOMSHEET_PADDING_MULTIPLIER = 4; - private static final int WAYNAME_PADDING_MULTIPLIER = 2; - - private final MapboxMap mapboxMap; - private final int[] defaultPadding; - private int[] customPadding; - - MapPaddingAdjustor(MapView mapView, MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - defaultPadding = calculateDefaultPadding(mapView); - } - - // Testing only - MapPaddingAdjustor(MapboxMap mapboxMap, int[] defaultPadding) { - this.mapboxMap = mapboxMap; - this.defaultPadding = defaultPadding; - } - - void updatePaddingWithDefault() { - customPadding = null; - updatePaddingWith(defaultPadding); - } - - void adjustLocationIconWith(int[] customPadding) { - this.customPadding = customPadding; - updatePaddingWith(customPadding); - } - - int[] retrieveCurrentPadding() { - return mapboxMap.getPadding(); - } - - boolean isUsingDefault() { - return customPadding == null; - } - - void updatePaddingWith(int[] padding) { - mapboxMap.setPadding(padding[0], padding[1], padding[2], padding[3]); - } - - void resetPadding() { - if (isUsingDefault()) { - updatePaddingWithDefault(); - } else { - adjustLocationIconWith(customPadding); - } - } - - private int[] calculateDefaultPadding(MapView mapView) { - int defaultTopPadding = calculateTopPaddingWithoutWayname(mapView); - Resources resources = mapView.getContext().getResources(); - int waynameLayoutHeight = (int) resources.getDimension(R.dimen.wayname_view_height); - int topPadding = defaultTopPadding - (waynameLayoutHeight * WAYNAME_PADDING_MULTIPLIER); - return new int[] {0, topPadding, 0, 0}; - } - - private int calculateTopPaddingWithoutWayname(MapView mapView) { - Context context = mapView.getContext(); - Resources resources = context.getResources(); - int mapViewHeight = mapView.getHeight(); - int bottomSheetHeight = (int) resources.getDimension(R.dimen.summary_bottomsheet_height); - return mapViewHeight - (bottomSheetHeight * BOTTOMSHEET_PADDING_MULTIPLIER); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayName.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayName.java deleted file mode 100644 index 97b3f193..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayName.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.PointF; -import android.location.Location; -import android.os.AsyncTask; -import androidx.annotation.NonNull; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.mapbox.services.android.navigation.ui.v5.map.NavigationMapboxMap.STREETS_LAYER_ID; - -class MapWayName { - - private static final String NAME_PROPERTY = "name"; - private static final String EMPTY_CURRENT_WAY_NAME = ""; - private final MapWaynameProgressChangeListener progressChangeListener = new MapWaynameProgressChangeListener(this); - private final Set onWayNameChangedListeners; - private WaynameFeatureFinder featureInteractor; - private List currentStepPoints = new ArrayList<>(); - private Location currentLocation = null; - private MapboxNavigation navigation; - private boolean isAutoQueryEnabled; - private FeatureFilterTask filterTask; - private String wayName = EMPTY_CURRENT_WAY_NAME; - - MapWayName(WaynameFeatureFinder featureInteractor, MapPaddingAdjustor paddingAdjustor) { - this.featureInteractor = featureInteractor; - paddingAdjustor.updatePaddingWithDefault(); - this.onWayNameChangedListeners = new HashSet<>(); - } - - void updateWayNameWithPoint(PointF point) { - if (!isAutoQueryEnabled) { - return; - } - List roadLabelFeatures = findRoadLabelFeatures(point); - boolean invalidLabelFeatures = roadLabelFeatures.isEmpty(); - if (invalidLabelFeatures) { - return; - } - executeFeatureFilterTask(roadLabelFeatures); - } - - void updateProgress(Location currentLocation, List currentStepPoints) { - if (!this.currentStepPoints.equals(currentStepPoints)) { - this.currentStepPoints = currentStepPoints; - } - if (this.currentLocation == null || !this.currentLocation.equals(currentLocation)) { - this.currentLocation = currentLocation; - } - } - - void updateWayNameQueryMap(boolean isEnabled) { - isAutoQueryEnabled = isEnabled; - } - - void addProgressChangeListener(MapboxNavigation navigation) { - this.navigation = navigation; - navigation.addProgressChangeListener(progressChangeListener); - } - - boolean addOnWayNameChangedListener(OnWayNameChangedListener listener) { - return onWayNameChangedListeners.add(listener); - } - - boolean removeOnWayNameChangedListener(OnWayNameChangedListener listener) { - return onWayNameChangedListeners.remove(listener); - } - - void onStart() { - if (navigation != null) { - navigation.addProgressChangeListener(progressChangeListener); - } - } - - void onStop() { - if (isTaskRunning()) { - filterTask.cancel(true); - } - if (navigation != null) { - navigation.removeProgressChangeListener(progressChangeListener); - } - } - - private List findRoadLabelFeatures(PointF point) { - String[] layerIds = {STREETS_LAYER_ID}; - return featureInteractor.queryRenderedFeatures(point, layerIds); - } - - private void executeFeatureFilterTask(List roadFeatures) { - if (isTaskRunning()) { - filterTask.cancel(true); - } - - if (hasValidProgressData()) { - filterTask = new FeatureFilterTask(roadFeatures, currentLocation, currentStepPoints, - new OnFeatureFilteredCallback() { - @Override - public void onFeatureFiltered(@NonNull Feature feature) { - updateWayNameLayerWithNameProperty(feature); - } - }); - filterTask.execute(); - } - } - - private boolean isTaskRunning() { - return filterTask != null - && (filterTask.getStatus() == AsyncTask.Status.PENDING - || filterTask.getStatus() == AsyncTask.Status.RUNNING); - } - - private boolean hasValidProgressData() { - return currentLocation != null && !currentStepPoints.isEmpty(); - } - - private void updateWayNameLayerWithNameProperty(Feature roadFeature) { - boolean hasValidNameProperty = roadFeature.hasNonNullValueForProperty(NAME_PROPERTY); - if (hasValidNameProperty) { - String currentWayName = roadFeature.getStringProperty(NAME_PROPERTY); - boolean newWayName = !wayName.contentEquals(currentWayName); - if (newWayName) { - updateListenersWith(currentWayName); - wayName = currentWayName; - } - } else { - updateListenersWith(EMPTY_CURRENT_WAY_NAME); - } - } - - private void updateListenersWith(String currentWayName) { - for (OnWayNameChangedListener listener : onWayNameChangedListeners) { - listener.onWayNameChanged(currentWayName); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListener.java deleted file mode 100644 index bada63dc..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListener.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import androidx.annotation.NonNull; - -import java.util.List; - -class MapWayNameChangedListener implements OnWayNameChangedListener { - - private final List listeners; - - MapWayNameChangedListener(List listeners) { - this.listeners = listeners; - } - - @Override - public void onWayNameChanged(@NonNull String wayName) { - for (OnWayNameChangedListener listener : listeners) { - listener.onWayNameChanged(wayName); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWaynameProgressChangeListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWaynameProgressChangeListener.java deleted file mode 100644 index 73a8e836..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/MapWaynameProgressChangeListener.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -class MapWaynameProgressChangeListener implements ProgressChangeListener { - - private final MapWayName mapWayName; - - MapWaynameProgressChangeListener(MapWayName mapWayName) { - this.mapWayName = mapWayName; - } - - @Override - public void onProgressChange(Location location, RouteProgress routeProgress) { - mapWayName.updateProgress(location, routeProgress.currentStepPoints()); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapSettings.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapSettings.java deleted file mode 100644 index 05802b25..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapSettings.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera; - -import static com.mapbox.services.android.navigation.ui.v5.map.MapFpsDelegate.DEFAULT_MAX_FPS_THRESHOLD; - -class NavigationMapSettings implements Parcelable { - - private int cameraTrackingMode; - private int[] currentPadding; - private boolean shouldUseDefaultPadding; - private int maxFps = DEFAULT_MAX_FPS_THRESHOLD; - private boolean maxFpsEnabled = true; - private boolean mapWayNameEnabled; - private boolean locationFpsEnabled = true; - - NavigationMapSettings() { - } - - void updateCameraTrackingMode(@NavigationCamera.TrackingMode int cameraTrackingMode) { - this.cameraTrackingMode = cameraTrackingMode; - } - - @NavigationCamera.TrackingMode - int retrieveCameraTrackingMode() { - return cameraTrackingMode; - } - - void updateCurrentPadding(int[] currentPadding) { - this.currentPadding = currentPadding; - } - - int[] retrieveCurrentPadding() { - return currentPadding; - } - - void updateShouldUseDefaultPadding(boolean shouldUseDefaultPadding) { - this.shouldUseDefaultPadding = shouldUseDefaultPadding; - } - - boolean shouldUseDefaultPadding() { - return shouldUseDefaultPadding; - } - - void updateMaxFps(int maxFps) { - this.maxFps = maxFps; - } - - int retrieveMaxFps() { - return maxFps; - } - - void updateMaxFpsEnabled(boolean maxFpsEnabled) { - this.maxFpsEnabled = maxFpsEnabled; - } - - boolean isMaxFpsEnabled() { - return maxFpsEnabled; - } - - void updateWayNameEnabled(boolean mapWayNameEnabled) { - this.mapWayNameEnabled = mapWayNameEnabled; - } - - boolean isMapWayNameEnabled() { - return mapWayNameEnabled; - } - - void updateLocationFpsEnabled(boolean locationFpsEnabled) { - this.locationFpsEnabled = locationFpsEnabled; - } - - boolean isLocationFpsEnabled() { - return locationFpsEnabled; - } - - private NavigationMapSettings(Parcel in) { - cameraTrackingMode = in.readInt(); - currentPadding = in.createIntArray(); - shouldUseDefaultPadding = in.readByte() != 0; - maxFps = in.readInt(); - maxFpsEnabled = in.readByte() != 0; - mapWayNameEnabled = in.readByte() != 0; - locationFpsEnabled = in.readByte() != 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(cameraTrackingMode); - dest.writeIntArray(currentPadding); - dest.writeByte((byte) (shouldUseDefaultPadding ? 1 : 0)); - dest.writeInt(maxFps); - dest.writeByte((byte) (maxFpsEnabled ? 1 : 0)); - dest.writeByte((byte) (mapWayNameEnabled ? 1 : 0)); - dest.writeByte((byte) (locationFpsEnabled ? 1 : 0)); - } - - @Override - public int describeContents() { - return 0; - } - - public static final Creator CREATOR = new Creator() { - @Override - public NavigationMapSettings createFromParcel(Parcel in) { - return new NavigationMapSettings(in); - } - - @Override - public NavigationMapSettings[] newArray(int size) { - return new NavigationMapSettings[size]; - } - }; -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java deleted file mode 100644 index a8a9878f..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java +++ /dev/null @@ -1,774 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.PointF; -import android.location.Location; -import android.os.Bundle; -import android.os.PersistableBundle; -import androidx.annotation.AnyRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.FragmentActivity; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.location.LocationComponent; -import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions; -import com.mapbox.mapboxsdk.location.LocationComponentOptions; -import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener; -import com.mapbox.mapboxsdk.location.modes.RenderMode; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions; -import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.mapboxsdk.style.sources.VectorSource; -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.ThemeSwitcher; -import com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera; -import com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute; -import com.mapbox.services.android.navigation.ui.v5.route.OnRouteSelectionChangeListener; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import static com.mapbox.services.android.navigation.ui.v5.map.NavigationSymbolManager.MAPBOX_NAVIGATION_MARKER_NAME; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NAVIGATION_MINIMUM_MAP_ZOOM; - -/** - * Wrapper class for {@link MapboxMap}. - *

- * This class initializes various map-related components and plugins that are - * useful for providing a navigation-driven map experience. - *

- * These APIs include drawing a route line, camera animations, and more. - */ -public class NavigationMapboxMap { - - static final String STREETS_LAYER_ID = "streetsLayer"; - private static final String MAPBOX_STREETS_V7_URL = "mapbox.mapbox-streets-v7"; - private static final String MAPBOX_STREETS_V8_URL = "mapbox.mapbox-streets-v8"; - private static final String STREETS_SOURCE_ID = "com.mapbox.services.android.navigation.streets"; - private static final String STREETS_V7_ROAD_LABEL = "road_label"; - private static final String STREETS_V8_ROAD_LABEL = "road"; - private static final String INCIDENTS_LAYER_ID = "closures"; - private static final String TRAFFIC_LAYER_ID = "traffic"; - private static final int[] ZERO_MAP_PADDING = {0, 0, 0, 0}; - private static final double NAVIGATION_MAXIMUM_MAP_ZOOM = 18d; - private final CopyOnWriteArrayList onWayNameChangedListeners - = new CopyOnWriteArrayList<>(); - private final MapWayNameChangedListener internalWayNameChangedListener - = new MapWayNameChangedListener(onWayNameChangedListeners); - private NavigationMapSettings settings = new NavigationMapSettings(); - private MapView mapView; - private MapboxMap mapboxMap; - private LocationComponent locationComponent; - private MapPaddingAdjustor mapPaddingAdjustor; - private NavigationSymbolManager navigationSymbolManager; - private MapLayerInteractor layerInteractor; - private NavigationMapRoute mapRoute; - private NavigationCamera mapCamera; - @Nullable - private MapWayName mapWayName; - @Nullable - private MapFpsDelegate mapFpsDelegate; - private LocationFpsDelegate locationFpsDelegate; - - /** - * Constructor that can be used once {@link com.mapbox.mapboxsdk.maps.OnMapReadyCallback} - * has been called via {@link MapView#getMapAsync(OnMapReadyCallback)}. - * - * @param mapView for map size and Context - * @param mapboxMap for APIs to interact with the map - */ - public NavigationMapboxMap(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap) { - this.mapView = mapView; - this.mapboxMap = mapboxMap; - initializeLocationComponent(mapView, mapboxMap); - initializeMapPaddingAdjustor(mapView, mapboxMap); - initializeNavigationSymbolManager(mapView, mapboxMap); - initializeMapLayerInteractor(mapboxMap); - initializeRoute(mapView, mapboxMap); - initializeCamera(mapboxMap, locationComponent); - initializeLocationFpsDelegate(mapboxMap, locationComponent); - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(MapLayerInteractor layerInteractor) { - this.layerInteractor = layerInteractor; - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(LocationComponent locationComponent) { - this.locationComponent = locationComponent; - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(NavigationMapRoute mapRoute) { - this.mapRoute = mapRoute; - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(NavigationSymbolManager navigationSymbolManager) { - this.navigationSymbolManager = navigationSymbolManager; - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(@NonNull MapWayName mapWayName, @NonNull MapFpsDelegate mapFpsDelegate) { - this.mapWayName = mapWayName; - this.mapFpsDelegate = mapFpsDelegate; - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(@NonNull MapWayName mapWayName, @NonNull MapFpsDelegate mapFpsDelegate, - NavigationMapRoute mapRoute, NavigationCamera mapCamera, - LocationFpsDelegate locationFpsDelegate) { - this.mapWayName = mapWayName; - this.mapFpsDelegate = mapFpsDelegate; - this.mapRoute = mapRoute; - this.mapCamera = mapCamera; - this.locationFpsDelegate = locationFpsDelegate; - } - - // Package private (no modifier) for testing purposes - NavigationMapboxMap(MapboxMap mapboxMap, MapLayerInteractor layerInteractor, MapPaddingAdjustor adjustor) { - this.layerInteractor = layerInteractor; - initializeWayName(mapboxMap, adjustor); - } - - /** - * Adds a marker icon on the map at the given position. - *

- * The icon used for this method can be defined in your theme with - * the attribute navigationViewDestinationMarker. - * - * @param context to retrieve the icon drawable from the theme - * @param position the point at which the marker will be placed - * @deprecated Use {@link NavigationMapboxMap#addDestinationMarker(Point)} instead. - * A {@link Context} is no longer needed. - */ - @Deprecated - public void addMarker(Context context, Point position) { - navigationSymbolManager.addDestinationMarkerFor(position); - } - - /** - * Adds a marker icon on the map at the given position. - *

- * The icon used for this method can be defined in your theme with - * the attribute navigationViewDestinationMarker. - * - * @param position the point at which the marker will be placed - */ - public void addDestinationMarker(Point position) { - navigationSymbolManager.addDestinationMarkerFor(position); - } - - /** - * Adds a custom marker to the map based on the options provided. - *

- * Please note, the map will manage all markers added. Calling {@link NavigationMapboxMap#clearMarkers()} - * will clear all destination / custom markers that have been added to the map. - * - * @param options for the custom {@link com.mapbox.mapboxsdk.plugins.annotation.Symbol} - */ - public void addCustomMarker(SymbolOptions options) { - navigationSymbolManager.addCustomSymbolFor(options); - } - - /** - * Clears all markers on the map that have been added by this class. - *

- * This will not clear all markers from the map entirely. Does nothing - * if no markers have been added. - */ - public void clearMarkers() { - navigationSymbolManager.removeAllMarkerSymbols(); - } - - /** - * Updates the location icon on the map and way name data (if found) - * for the given {@link Location}. - * - * @param location to update the icon and query the map - */ - public void updateLocation(Location location) { - locationComponent.forceLocationUpdate(location); - updateMapWayNameWithLocation(location); - } - - /** - * The maximum preferred frames per second at which to render the map. - *

- * This property only takes effect when the application has limited resources, such as when - * the device is running on battery power. By default, this is set to 20fps. - *

- * Throttling will also only take effect when the camera is currently tracking - * the user location. - * - * @param maxFpsThreshold to be used to limit map frames per second - */ - public void updateMapFpsThrottle(int maxFpsThreshold) { - if (mapFpsDelegate != null) { - mapFpsDelegate.updateMaxFpsThreshold(maxFpsThreshold); - } else { - settings.updateMaxFps(maxFpsThreshold); - } - } - - /** - * Enabled by default, the navigation map will throttle frames per second when the application has - * limited resources, such as when the device is running on battery power. - *

- * Throttling will also only take effect when the camera is currently tracking - * the user location. - * - * @param isEnabled true to enable (default), false to render at device ability - */ - public void updateMapFpsThrottleEnabled(boolean isEnabled) { - if (mapFpsDelegate != null) { - mapFpsDelegate.updateEnabled(isEnabled); - } else { - settings.updateMaxFpsEnabled(isEnabled); - } - } - - /** - * Enabled by default, the navigation map will throttle frames per second of the location icon - * based on the map zoom level. - * - * @param isEnabled true to enable (default), false to render at device ability - */ - public void updateLocationFpsThrottleEnabled(boolean isEnabled) { - locationFpsDelegate.updateEnabled(isEnabled); - } - - /** - * Updates how the user location is shown on the map. - *

- *

    - *
  • {@link RenderMode#NORMAL}: Shows user location, bearing ignored
  • - *
  • {@link RenderMode#COMPASS}: Shows user location with bearing considered from compass
  • - *
  • {@link RenderMode#GPS}: Shows user location with bearing considered from location
  • - *
- * - * @param renderMode GPS, NORMAL, or COMPASS - */ - public void updateLocationLayerRenderMode(@RenderMode.Mode int renderMode) { - locationComponent.setRenderMode(renderMode); - } - - /** - * Can be used to automatically drive the map camera / route updates and arrow - * once navigation has started. - *

- * These will automatically be removed in {@link MapboxNavigation#onDestroy()}. - * - * @param navigation to add the progress listeners - */ - public void addProgressChangeListener(@NonNull MapboxNavigation navigation) { - initializeWayName(mapboxMap, mapPaddingAdjustor); - initializeFpsDelegate(mapView); - mapRoute.addProgressChangeListener(navigation); - mapCamera.addProgressChangeListener(navigation); - mapWayName.addProgressChangeListener(navigation); - mapFpsDelegate.addProgressChangeListener(navigation); - } - - /** - * Can be used to store the current state of the map in - * {@link FragmentActivity#onSaveInstanceState(Bundle, PersistableBundle)}. - *

- * This method uses {@link NavigationMapboxMapInstanceState}, stored with the provided key. This key - * can also later be used to extract the {@link NavigationMapboxMapInstanceState}. - * - * @param key used to store the state - * @param outState to store state variables - */ - public void saveStateWith(String key, Bundle outState) { - settings.updateCurrentPadding(mapPaddingAdjustor.retrieveCurrentPadding()); - settings.updateShouldUseDefaultPadding(mapPaddingAdjustor.isUsingDefault()); - settings.updateCameraTrackingMode(mapCamera.getCameraTrackingMode()); - settings.updateLocationFpsEnabled(locationFpsDelegate.isEnabled()); - NavigationMapboxMapInstanceState instanceState = new NavigationMapboxMapInstanceState(settings); - outState.putParcelable(key, instanceState); - } - - /** - * Can be used to restore a {@link NavigationMapboxMap} after it has been initialized. - *

- * This cannot be called in {@link FragmentActivity#onRestoreInstanceState(Bundle)} - * because we cannot guarantee the map is re-initialized at that point. - *

- * You can extract the {@link NavigationMapboxMapInstanceState} in onRestoreInstanceState and then - * restore the map once it's ready. - * - * @param instanceState to extract state variables - */ - public void restoreFrom(NavigationMapboxMapInstanceState instanceState) { - settings = instanceState.retrieveSettings(); - restoreMapWith(settings); - } - - /** - * Will draw the given {@link DirectionsRoute} on the map using the colors defined - * in your given style. - * - * @param route to be drawn - */ - public void drawRoute(@NonNull DirectionsRoute route) { - mapRoute.addRoute(route); - } - - /** - * Will draw the given list of {@link DirectionsRoute} on the map using the colors defined - * in your given style. - *

- * The primary route will default to the first route in the directions route list. - * All other routes in the list will be drawn on the map using the alternative route style. - * - * @param routes to be drawn - */ - public void drawRoutes(@NonNull List routes) { - mapRoute.addRoutes(routes); - } - - /** - * Set a {@link OnRouteSelectionChangeListener} to know which route the user has currently - * selected as their primary route. - * - * @param listener a listener which lets you know when the user has changed - * the primary route and provides the current direction - * route which the user has selected - */ - public void setOnRouteSelectionChangeListener(@NonNull OnRouteSelectionChangeListener listener) { - mapRoute.setOnRouteSelectionChangeListener(listener); - } - - /** - * Toggle whether or not you'd like the map to display the alternative routes. This option can be used - * for when the user actually begins the navigation session and alternative routes aren't needed - * anymore. - * - * @param alternativesVisible true if you'd like alternative routes to be displayed on the map, - * else false - */ - public void showAlternativeRoutes(boolean alternativesVisible) { - mapRoute.showAlternativeRoutes(alternativesVisible); - } - - /** - * Will remove the drawn route displayed on the map. Does nothing - * if no route is drawn. - */ - public void removeRoute() { - mapRoute.removeRoute(); - } - - /** - * Provides the camera being used to animate the map camera positions - * along the route, driven by the progress change listener. - * - * @return camera used to animate map - */ - public NavigationCamera retrieveCamera() { - return mapCamera; - } - - /** - * Updates the {@link NavigationCamera.TrackingMode} that will be used when camera tracking is enabled. - * - * @param trackingMode the tracking mode - * @since 0.21.0 - */ - public void updateCameraTrackingMode(@NavigationCamera.TrackingMode int trackingMode) { - mapCamera.updateCameraTrackingMode(trackingMode); - } - - /** - * Centers the map camera to the beginning of the provided {@link DirectionsRoute}. - * - * @param directionsRoute to update the camera position - */ - public void startCamera(@NonNull DirectionsRoute directionsRoute) { - mapCamera.start(directionsRoute); - } - - /** - * Centers the map camera around the provided {@link Location}. - * - * @param location to update the camera position - */ - public void resumeCamera(@NonNull Location location) { - mapCamera.resume(location); - } - - /** - * Resets the map camera / padding to the last known camera position. - *

- * You can also specify a tracking mode to reset with. For example if you would like - * to reset the camera and continue tracking, you would use {@link NavigationCamera#NAVIGATION_TRACKING_MODE_GPS}. - * - * @param trackingCameraMode the tracking mode - */ - public void resetCameraPositionWith(@NavigationCamera.TrackingMode int trackingCameraMode) { - mapCamera.resetCameraPositionWith(trackingCameraMode); - } - - /** - * This method resets the map padding to the default padding that is - * generated when navigation begins (location icon moved to lower half of the screen) or - * the custom padding that was last passed via {@link MapPaddingAdjustor#adjustLocationIconWith(int[])}. - *

- * The custom padding will be used if it exists, otherwise the default will be used. - */ - public void resetPadding() { - mapPaddingAdjustor.resetPadding(); - } - - /** - * Adjusts the map camera to {@link DirectionsRoute} being traveled along. - *

- * Also includes the given padding. - * - * @param padding for creating the overview camera position - */ - public void showRouteOverview(int[] padding) { - mapPaddingAdjustor.updatePaddingWith(ZERO_MAP_PADDING); - mapCamera.showRouteOverview(padding); - } - - /** - * Enables or disables the way name chip underneath the location icon. - * - * @param isEnabled true to enable, false to disable - */ - public void updateWaynameQueryMap(boolean isEnabled) { - if (mapWayName != null) { - mapWayName.updateWayNameQueryMap(isEnabled); - } else { - settings.updateWayNameEnabled(isEnabled); - } - } - - /** - * Should be used in {@link FragmentActivity#onStart()} to ensure proper - * accounting for the lifecycle. - */ - public void onStart() { - mapCamera.onStart(); - mapRoute.onStart(); - handleWayNameOnStart(); - handleFpsOnStart(); - locationFpsDelegate.onStart(); - } - - /** - * Should be used in {@link FragmentActivity#onStop()} to ensure proper - * accounting for the lifecycle. - */ - public void onStop() { - mapCamera.onStop(); - mapRoute.onStop(); - handleWayNameOnStop(); - handleFpsOnStop(); - locationFpsDelegate.onStop(); - } - - /** - * Hide or show the location icon on the map. - * - * @param isVisible true to show, false to hide - */ - public void updateLocationVisibilityTo(boolean isVisible) { - locationComponent.setLocationComponentEnabled(isVisible); - } - - /** - * Provides the {@link MapboxMap} originally given in the constructor. - *

- * This method gives access to all map-related APIs. - * - * @return map provided in the constructor - */ - public MapboxMap retrieveMap() { - return mapboxMap; - } - - /** - * Updates the visibility of incidents layers on the map (if any exist). - * - * @param isVisible true if incidents should be visible, false otherwise - */ - public void updateIncidentsVisibility(boolean isVisible) { - layerInteractor.updateLayerVisibility(isVisible, INCIDENTS_LAYER_ID); - } - - /** - * Returns true if the map has incidents layers and they are visible and - * will return false otherwise. - * - * @return true if the map has incidents layers and they are visible, false otherwise - */ - public boolean isIncidentsVisible() { - return layerInteractor.isLayerVisible(INCIDENTS_LAYER_ID); - } - - /** - * Updates the visibility of traffic layers on the map (if any exist). - * - * @param isVisible true if traffic should be visible, false otherwise - */ - public void updateTrafficVisibility(boolean isVisible) { - layerInteractor.updateLayerVisibility(isVisible, TRAFFIC_LAYER_ID); - } - - /** - * Returns true if the map has traffic layers and they are visible and - * will return false otherwise. - * - * @return true if the map has traffic layers and they are visible, false otherwise - */ - public boolean isTrafficVisible() { - return layerInteractor.isLayerVisible(TRAFFIC_LAYER_ID); - } - - /** - * Add a {@link OnCameraTrackingChangedListener} to the {@link LocationComponent} that is - * wrapped within this class. - *

- * This listener will fire any time camera tracking is dismissed or the camera mode is updated. - * - * @param listener to be added - */ - public void addOnCameraTrackingChangedListener(OnCameraTrackingChangedListener listener) { - locationComponent.addOnCameraTrackingChangedListener(listener); - } - - /** - * Remove a {@link OnCameraTrackingChangedListener} from the {@link LocationComponent} that is - * wrapped within this class. - * - * @param listener to be removed - */ - public void removeOnCameraTrackingChangedListener(OnCameraTrackingChangedListener listener) { - locationComponent.removeOnCameraTrackingChangedListener(listener); - } - - /** - * Add a {@link OnWayNameChangedListener} for listening to updates - * to the way name shown on the map below the location icon. - * - * @param listener to be added - * @return true if added, false if listener was not found - */ - public boolean addOnWayNameChangedListener(OnWayNameChangedListener listener) { - return onWayNameChangedListeners.add(listener); - } - - /** - * Remove a {@link OnWayNameChangedListener} for listening to updates - * to the way name shown on the map below the location icon. - * - * @param listener to be removed - * @return true if removed, false if listener was not found - */ - public boolean removeOnWayNameChangedListener(OnWayNameChangedListener listener) { - return onWayNameChangedListeners.remove(listener); - } - - /** - * Use this method to position the location icon on the map. - *

- * For example, to position the icon in the center of the map, you can pass {0, 0, 0, 0} which - * eliminates the default padding we provide when navigation begins. - * - * @param customPadding true if should be centered on the map, false to position above the bottom view - */ - public void adjustLocationIconWith(int[] customPadding) { - mapPaddingAdjustor.adjustLocationIconWith(customPadding); - } - - @SuppressLint("MissingPermission") - private void initializeLocationComponent(MapView mapView, MapboxMap map) { - locationComponent = map.getLocationComponent(); - map.setMinZoomPreference(NAVIGATION_MINIMUM_MAP_ZOOM); - map.setMaxZoomPreference(NAVIGATION_MAXIMUM_MAP_ZOOM); - Context context = mapView.getContext(); - Style style = map.getStyle(); - int locationLayerStyleRes = findLayerStyleRes(context); - LocationComponentOptions options = LocationComponentOptions.createFromAttributes(context, locationLayerStyleRes); - LocationComponentActivationOptions activationOptions = LocationComponentActivationOptions.builder(context, style) - .locationComponentOptions(options) - .useDefaultLocationEngine(false) - .build(); - locationComponent.activateLocationComponent(activationOptions); - locationComponent.setLocationComponentEnabled(true); - } - - private int findLayerStyleRes(Context context) { - int locationLayerStyleRes = ThemeSwitcher.retrieveNavigationViewStyle(context, - R.attr.navigationViewLocationLayerStyle); - if (!isValid(locationLayerStyleRes)) { - locationLayerStyleRes = R.style.NavigationLocationLayerStyle; - } - return locationLayerStyleRes; - } - - private boolean isValid(@AnyRes int resId) { - return resId != -1 && (resId & 0xff000000) != 0 && (resId & 0x00ff0000) != 0; - } - - private void initializeMapPaddingAdjustor(MapView mapView, MapboxMap mapboxMap) { - mapPaddingAdjustor = new MapPaddingAdjustor(mapView, mapboxMap); - } - - private void initializeNavigationSymbolManager(MapView mapView, MapboxMap mapboxMap) { - Bitmap markerBitmap = ThemeSwitcher.retrieveThemeMapMarker(mapView.getContext()); - mapboxMap.getStyle().addImage(MAPBOX_NAVIGATION_MARKER_NAME, markerBitmap); - SymbolManager symbolManager = new SymbolManager(mapView, mapboxMap, mapboxMap.getStyle()); - navigationSymbolManager = new NavigationSymbolManager(symbolManager); - SymbolOnStyleLoadedListener onStyleLoadedListener = new SymbolOnStyleLoadedListener(mapboxMap, markerBitmap); - mapView.addOnDidFinishLoadingStyleListener(onStyleLoadedListener); - } - - private void initializeMapLayerInteractor(MapboxMap mapboxMap) { - layerInteractor = new MapLayerInteractor(mapboxMap); - } - - private void initializeRoute(MapView mapView, MapboxMap map) { - Context context = mapView.getContext(); - int routeStyleRes = ThemeSwitcher.retrieveNavigationViewStyle(context, R.attr.navigationViewRouteStyle); - mapRoute = new NavigationMapRoute(null, mapView, map, routeStyleRes); - } - - private void initializeCamera(MapboxMap map, LocationComponent locationComponent) { - mapCamera = new NavigationCamera(map, locationComponent); - } - - private void initializeLocationFpsDelegate(MapboxMap map, LocationComponent locationComponent) { - locationFpsDelegate = new LocationFpsDelegate(map, locationComponent); - } - - private void initializeWayName(MapboxMap mapboxMap, MapPaddingAdjustor paddingAdjustor) { - if (mapWayName != null) { - return; - } - initializeStreetsSource(mapboxMap); - WaynameFeatureFinder featureFinder = new WaynameFeatureFinder(mapboxMap); - mapWayName = new MapWayName(featureFinder, paddingAdjustor); - mapWayName.updateWayNameQueryMap(settings.isMapWayNameEnabled()); - mapWayName.addOnWayNameChangedListener(internalWayNameChangedListener); - } - - private void initializeStreetsSource(MapboxMap mapboxMap) { - List sources = mapboxMap.getStyle().getSources(); - Source sourceV7 = findSourceByUrl(sources, MAPBOX_STREETS_V7_URL); - Source sourceV8 = findSourceByUrl(sources, MAPBOX_STREETS_V8_URL); - - if (sourceV7 != null) { - layerInteractor.addStreetsLayer(sourceV7.getId(), STREETS_V7_ROAD_LABEL); - } else if (sourceV8 != null) { - layerInteractor.addStreetsLayer(sourceV8.getId(), STREETS_V8_ROAD_LABEL); - } else { - VectorSource streetSource = new VectorSource(STREETS_SOURCE_ID, MAPBOX_STREETS_V8_URL); - mapboxMap.getStyle().addSource(streetSource); - layerInteractor.addStreetsLayer(STREETS_SOURCE_ID, STREETS_V8_ROAD_LABEL); - } - } - - @Nullable - private Source findSourceByUrl(List sources, String streetsUrl) { - for (Source source : sources) { - if (source instanceof VectorSource) { - VectorSource vectorSource = (VectorSource) source; - String url = vectorSource.getUrl(); - if (url != null && url.contains(streetsUrl)) { - return vectorSource; - } - } - } - return null; - } - - private void initializeFpsDelegate(MapView mapView) { - if (mapFpsDelegate != null) { - return; - } - MapBatteryMonitor batteryMonitor = new MapBatteryMonitor(); - mapFpsDelegate = new MapFpsDelegate(mapView, batteryMonitor); - mapFpsDelegate.updateEnabled(settings.isMaxFpsEnabled()); - mapFpsDelegate.updateMaxFpsThreshold(settings.retrieveMaxFps()); - addFpsListenersToCamera(); - } - - private void addFpsListenersToCamera() { - mapCamera.addOnTrackingModeTransitionListener(mapFpsDelegate); - mapCamera.addOnTrackingModeChangedListener(mapFpsDelegate); - } - - private void removeFpsListenersFromCamera() { - mapCamera.removeOnTrackingModeTransitionListener(mapFpsDelegate); - mapCamera.removeOnTrackingModeChangedListener(mapFpsDelegate); - } - - private void updateMapWayNameWithLocation(Location location) { - if (mapWayName == null) { - return; - } - LatLng latLng = new LatLng(location); - PointF mapPoint = mapboxMap.getProjection().toScreenLocation(latLng); - mapWayName.updateWayNameWithPoint(mapPoint); - } - - private void restoreMapWith(NavigationMapSettings settings) { - updateCameraTrackingMode(settings.retrieveCameraTrackingMode()); - updateLocationFpsThrottleEnabled(settings.isLocationFpsEnabled()); - if (settings.shouldUseDefaultPadding()) { - mapPaddingAdjustor.updatePaddingWithDefault(); - } else { - adjustLocationIconWith(settings.retrieveCurrentPadding()); - } - if (mapWayName != null) { - mapWayName.updateWayNameQueryMap(settings.isMapWayNameEnabled()); - } - if (mapFpsDelegate != null) { - mapFpsDelegate.updateMaxFpsThreshold(settings.retrieveMaxFps()); - mapFpsDelegate.updateEnabled(settings.isMaxFpsEnabled()); - } - } - - private void handleWayNameOnStart() { - if (mapWayName != null) { - mapWayName.onStart(); - mapWayName.addOnWayNameChangedListener(internalWayNameChangedListener); - } - } - - private void handleFpsOnStart() { - if (mapFpsDelegate != null) { - mapFpsDelegate.onStart(); - addFpsListenersToCamera(); - } - } - - private void handleWayNameOnStop() { - if (mapWayName != null) { - mapWayName.onStop(); - mapWayName.removeOnWayNameChangedListener(internalWayNameChangedListener); - } - } - - private void handleFpsOnStop() { - if (mapFpsDelegate != null) { - mapFpsDelegate.onStop(); - removeFpsListenersFromCamera(); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapInstanceState.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapInstanceState.java deleted file mode 100644 index a0bd9641..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapInstanceState.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.os.Parcel; -import android.os.Parcelable; - -public class NavigationMapboxMapInstanceState implements Parcelable { - - private final NavigationMapSettings settings; - - NavigationMapboxMapInstanceState(NavigationMapSettings settings) { - this.settings = settings; - } - - NavigationMapSettings retrieveSettings() { - return settings; - } - - private NavigationMapboxMapInstanceState(Parcel in) { - settings = in.readParcelable(NavigationMapSettings.class.getClassLoader()); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(settings, flags); - } - - @Override - public int describeContents() { - return 0; - } - - public static final Creator CREATOR = - new Creator() { - @Override - public NavigationMapboxMapInstanceState createFromParcel(Parcel in) { - return new NavigationMapboxMapInstanceState(in); - } - - @Override - public NavigationMapboxMapInstanceState[] newArray(int size) { - return new NavigationMapboxMapInstanceState[size]; - } - }; -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManager.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManager.java deleted file mode 100644 index 71c7cd63..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManager.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import androidx.annotation.NonNull; - -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.plugins.annotation.Symbol; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions; - -import java.util.ArrayList; -import java.util.List; - -class NavigationSymbolManager { - - static final String MAPBOX_NAVIGATION_MARKER_NAME = "mapbox-navigation-marker"; - private final List mapMarkersSymbols = new ArrayList<>(); - private final SymbolManager symbolManager; - - NavigationSymbolManager(SymbolManager symbolManager) { - this.symbolManager = symbolManager; - symbolManager.setIconAllowOverlap(true); - symbolManager.setIconIgnorePlacement(true); - } - - void addDestinationMarkerFor(Point position) { - SymbolOptions options = createSymbolOptionsFor(position); - createSymbolFrom(options); - } - - void addCustomSymbolFor(SymbolOptions options) { - createSymbolFrom(options); - } - - void removeAllMarkerSymbols() { - for (Symbol markerSymbol : mapMarkersSymbols) { - symbolManager.delete(markerSymbol); - } - mapMarkersSymbols.clear(); - } - - @NonNull - private SymbolOptions createSymbolOptionsFor(Point position) { - LatLng markerPosition = new LatLng(position.latitude(), - position.longitude()); - return new SymbolOptions() - .withLatLng(markerPosition) - .withIconImage(MAPBOX_NAVIGATION_MARKER_NAME); - } - - private void createSymbolFrom(SymbolOptions options) { - Symbol symbol = symbolManager.create(options); - mapMarkersSymbols.add(symbol); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnFeatureFilteredCallback.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnFeatureFilteredCallback.java deleted file mode 100644 index c3e1bfbc..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnFeatureFilteredCallback.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import androidx.annotation.NonNull; - -import com.mapbox.geojson.Feature; - -interface OnFeatureFilteredCallback { - void onFeatureFiltered(@NonNull Feature feature); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnWayNameChangedListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnWayNameChangedListener.java deleted file mode 100644 index cff69222..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/OnWayNameChangedListener.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import androidx.annotation.NonNull; - -/** - * A listener that can be added to the {@link NavigationMapboxMap} with - * {@link NavigationMapboxMap#addOnWayNameChangedListener(OnWayNameChangedListener)}. - *

- * This listener is triggered when a new way name is found along the route. It will be triggered - * regardless of the map way name visibility - * ({@link com.mapbox.services.android.navigation.ui.v5.NavigationView#updateWayNameVisibility(boolean)}). - * This is so you can hide our implementation of the way name UI and update your own if you'd like. - */ -public interface OnWayNameChangedListener { - - /** - * Triggered every time a new way name is found along the route. - * This will mainly be when transitioning steps, onto new roads. - * - * @param wayName found along the route - */ - void onWayNameChanged(@NonNull String wayName); -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListener.java deleted file mode 100644 index 14a4baa4..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.Bitmap; - -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -import static com.mapbox.services.android.navigation.ui.v5.map.NavigationSymbolManager.MAPBOX_NAVIGATION_MARKER_NAME; - -class SymbolOnStyleLoadedListener implements MapView.OnDidFinishLoadingStyleListener { - - private final MapboxMap mapboxMap; - private final Bitmap markerBitmap; - - SymbolOnStyleLoadedListener(MapboxMap mapboxMap, Bitmap markerBitmap) { - this.mapboxMap = mapboxMap; - this.markerBitmap = markerBitmap; - } - - @Override - public void onDidFinishLoadingStyle() { - mapboxMap.getStyle().addImage(MAPBOX_NAVIGATION_MARKER_NAME, markerBitmap); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WayNameView.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WayNameView.java deleted file mode 100644 index baccc711..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WayNameView.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.graphics.drawable.DrawableCompat; -import android.util.AttributeSet; -import android.widget.FrameLayout; -import android.widget.TextView; - -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.ThemeSwitcher; - -public class WayNameView extends FrameLayout { - - private TextView wayNameText; - - public WayNameView(Context context) { - super(context); - initialize(); - } - - public WayNameView(@NonNull Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - initialize(); - } - - public WayNameView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initialize(); - } - - public void updateWayNameText(String wayNameText) { - this.wayNameText.setText(wayNameText); - } - - public String retrieveWayNameText() { - return wayNameText.getText().toString(); - } - - public void updateVisibility(boolean isVisible) { - int visibility = isVisible ? VISIBLE : INVISIBLE; - if (getVisibility() != visibility) { - setVisibility(visibility); - } - } - - private void initialize() { - inflate(getContext(), R.layout.wayname_view_layout, this); - wayNameText = findViewById(R.id.waynameText); - Drawable waynameTextBackground = wayNameText.getBackground(); - initializeBackground(waynameTextBackground); - } - - private void initializeBackground(Drawable waynameTextBackground) { - if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { - int navigationViewPrimaryColor = ThemeSwitcher.retrieveThemeColor(getContext(), - R.attr.navigationViewPrimary); - Drawable soundChipBackground = DrawableCompat.wrap(waynameTextBackground).mutate(); - DrawableCompat.setTint(soundChipBackground, navigationViewPrimaryColor); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilter.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilter.java deleted file mode 100644 index d265b031..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilter.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.location.Location; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.Geometry; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.MultiLineString; -import com.mapbox.geojson.Point; -import com.mapbox.turf.TurfMeasurement; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; - -import static com.mapbox.turf.TurfConstants.UNIT_METRES; -import static com.mapbox.turf.TurfMeasurement.along; -import static com.mapbox.turf.TurfMisc.lineSlice; -import static com.mapbox.turf.TurfMisc.lineSliceAlong; - -class WaynameFeatureFilter { - - private static final int FIRST = 0; - private static final int ONE_FEATURE = 1; - private static final int TWO_POINTS = 2; - private static final double ZERO_METERS = 0d; - private static final double TEN = 10d; - private final List queriedFeatures; - private final Point currentPoint; - private final LineString currentStepLineString; - - WaynameFeatureFilter(List queriedFeatures, Location currentLocation, List currentStepPoints) { - this.queriedFeatures = new ArrayList<>(new HashSet<>(queriedFeatures)); - this.currentPoint = Point.fromLngLat(currentLocation.getLongitude(), currentLocation.getLatitude()); - this.currentStepLineString = LineString.fromLngLats(currentStepPoints); - } - - @NonNull - Feature filterFeatures() { - return filterQueriedFeatures(); - } - - @NonNull - private Feature filterQueriedFeatures() { - Feature filteredFeature = queriedFeatures.get(FIRST); - if (queriedFeatures.size() == ONE_FEATURE) { - return filteredFeature; - } - double smallestUserDistanceToFeature = Double.POSITIVE_INFINITY; - for (Feature feature : queriedFeatures) { - Geometry featureGeometry = feature.geometry(); - if (featureGeometry == null) { - continue; - } - List featureLineStrings = new ArrayList<>(); - if (featureGeometry instanceof LineString) { - featureLineStrings.add((LineString) featureGeometry); - } else if (featureGeometry instanceof MultiLineString) { - featureLineStrings = ((MultiLineString) featureGeometry).lineStrings(); - } - - for (LineString featureLineString : featureLineStrings) { - List currentStepCoordinates = currentStepLineString.coordinates(); - int stepCoordinatesSize = currentStepCoordinates.size(); - if (stepCoordinatesSize < TWO_POINTS) { - return filteredFeature; - } - int lastStepCoordinate = stepCoordinatesSize - 1; - Point lastStepPoint = currentStepCoordinates.get(lastStepCoordinate); - if (currentPoint.equals(lastStepPoint)) { - return filteredFeature; - } - List lineCoordinates = featureLineString.coordinates(); - int lineCoordinatesSize = lineCoordinates.size(); - if (lineCoordinatesSize < TWO_POINTS) { - return filteredFeature; - } - int lastLineCoordinate = lineCoordinatesSize - 1; - Point lastLinePoint = lineCoordinates.get(lastLineCoordinate); - if (currentPoint.equals(lastLinePoint)) { - return filteredFeature; - } - - Point firstLinePoint = lineCoordinates.get(FIRST); - if (currentPoint.equals(firstLinePoint)) { - return filteredFeature; - } - - LineString stepSliceFromCurrentPoint = lineSlice(currentPoint, lastStepPoint, currentStepLineString); - Point pointAheadUserOnStep = along(stepSliceFromCurrentPoint, TEN, UNIT_METRES); - LineString reversedFeatureLine = reverseFeatureLineStringCoordinates(featureLineString); - LineString currentAheadLine = reversedFeatureLine; - LineString currentBehindLine = featureLineString; - - Point currentDirectionAhead = firstLinePoint; - Point currentDirectionBehind = lastLinePoint; - - double distanceCurrentFirst = calculateDistance(currentPoint, firstLinePoint); - double distanceAheadFirst = calculateDistance(pointAheadUserOnStep, firstLinePoint); - if (distanceAheadFirst >= distanceCurrentFirst) { - currentAheadLine = featureLineString; - currentBehindLine = reversedFeatureLine; - currentDirectionAhead = lastLinePoint; - currentDirectionBehind = firstLinePoint; - } - - LineString sliceFromCurrentPoint = lineSlice(currentPoint, currentDirectionAhead, currentAheadLine); - Point pointAheadFeature = along(sliceFromCurrentPoint, TEN, UNIT_METRES); - LineString reverseSliceFromCurrentPoint = lineSlice(currentPoint, currentDirectionBehind, currentBehindLine); - Point pointBehindFeature = along(reverseSliceFromCurrentPoint, TEN, UNIT_METRES); - - double userDistanceToAheadFeature = calculateDistance(pointAheadUserOnStep, pointAheadFeature); - double userDistanceToBehindFeature = calculateDistance(pointAheadUserOnStep, pointBehindFeature); - double minDistanceToFeature = Math.min(userDistanceToAheadFeature, userDistanceToBehindFeature); - - if (minDistanceToFeature < smallestUserDistanceToFeature) { - smallestUserDistanceToFeature = minDistanceToFeature; - filteredFeature = feature; - } - } - } - return filteredFeature; - } - - private double calculateDistance(Point lhs, Point rhs) { - if (lhs == null || rhs == null) { - return Double.POSITIVE_INFINITY; - } - return TurfMeasurement.distance(lhs, rhs); - } - - @Nullable - Point findPointFromCurrentPoint(Point currentPoint, LineString lineString) { - List lineStringCoordinates = lineString.coordinates(); - int coordinateSize = lineStringCoordinates.size(); - if (coordinateSize < TWO_POINTS) { - return null; - } - Point lastLinePoint = lineStringCoordinates.get(coordinateSize - 1); - if (currentPoint == null || currentPoint.equals(lastLinePoint)) { - return null; - } - LineString sliceFromCurrentPoint = lineSlice(currentPoint, lastLinePoint, lineString); - LineString meterSlice = lineSliceAlong(sliceFromCurrentPoint, ZERO_METERS, (double) 10, UNIT_METRES); - List slicePoints = meterSlice.coordinates(); - if (slicePoints.isEmpty()) { - return null; - } - return slicePoints.get(FIRST); - } - - @NonNull - private LineString reverseFeatureLineStringCoordinates(LineString featureLineString) { - List reversedFeatureCoordinates = new ArrayList<>(featureLineString.coordinates()); - Collections.reverse(reversedFeatureCoordinates); - return LineString.fromLngLats(reversedFeatureCoordinates); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinder.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinder.java deleted file mode 100644 index 04981365..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinder.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.PointF; - -import com.mapbox.geojson.Feature; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -import java.util.List; - -class WaynameFeatureFinder { - - private MapboxMap mapboxMap; - - WaynameFeatureFinder(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - List queryRenderedFeatures(PointF point, String[] layerIds) { - return mapboxMap.queryRenderedFeatures(point, layerIds); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/package-info.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/package-info.java deleted file mode 100644 index 81b6655b..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Contains classes which define the UI components of the Navigation UI SDK - * - * @since 0.4.0 - */ -package com.mapbox.services.android.navigation.ui.v5; \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/FeatureProcessingTask.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/FeatureProcessingTask.java deleted file mode 100644 index d9ce02c9..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/FeatureProcessingTask.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.os.Handler; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.core.constants.Constants; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.PRIMARY_ROUTE_PROPERTY_KEY; - -class FeatureProcessingTask extends Thread { - - private final List routes; - private final List routeFeatureCollections = new ArrayList<>(); - private final WeakReference callbackWeakReference; - private final HashMap routeLineStrings = new HashMap<>(); - private AtomicBoolean cancelThread = new AtomicBoolean(false); - private Handler postHandler; - - FeatureProcessingTask(List routes, OnRouteFeaturesProcessedCallback callback, Handler handler) { - this.routes = routes; - this.callbackWeakReference = new WeakReference<>(callback); - this.postHandler = handler; - } - - @Override - public void run() { - for (int i = 0; i < routes.size(); i++) { - if (cancelThread.get()) { - return; - } - DirectionsRoute route = routes.get(i); - boolean isPrimary = i == 0; - FeatureCollection routeFeatureCollection = createRouteFeatureCollection(route, isPrimary); - routeFeatureCollections.add(routeFeatureCollection); - } - if (!cancelThread.get()) { - completion(); - } - } - - void cancel() { - cancelThread.set(true); - } - - private void completion() { - final OnRouteFeaturesProcessedCallback callback = callbackWeakReference.get(); - if (callback != null) { - postHandler.post(new Runnable() { - @Override - public void run() { - if (cancelThread.get()) { - return; - } - callback.onRouteFeaturesProcessed(routeFeatureCollections, routeLineStrings); - } - }); - } - } - - private FeatureCollection createRouteFeatureCollection(DirectionsRoute route, boolean isPrimary) { - final List features = new ArrayList<>(); - - LineString routeGeometry = LineString.fromPolyline(route.geometry(), Constants.PRECISION_6); - Feature routeFeature = Feature.fromGeometry(routeGeometry); - routeFeature.addBooleanProperty(PRIMARY_ROUTE_PROPERTY_KEY, isPrimary); - features.add(routeFeature); - routeLineStrings.put(routeGeometry, route); - - List congestionFeatures = buildCongestionFeaturesFromRoute(route, routeGeometry, isPrimary); - features.addAll(congestionFeatures); - return FeatureCollection.fromFeatures(features); - } - - private List buildCongestionFeaturesFromRoute(DirectionsRoute route, LineString lineString, - boolean isPrimary) { - final List features = new ArrayList<>(); - for (RouteLeg leg : route.legs()) { - if (leg.annotation() != null && leg.annotation().congestion() != null) { - for (int i = 0; i < leg.annotation().congestion().size(); i++) { - // See https://github.com/mapbox/mapbox-navigation-android/issues/353 - if (leg.annotation().congestion().size() + 1 <= lineString.coordinates().size()) { - - List points = new ArrayList<>(); - points.add(lineString.coordinates().get(i)); - points.add(lineString.coordinates().get(i + 1)); - - LineString congestionLineString = LineString.fromLngLats(points); - Feature feature = Feature.fromGeometry(congestionLineString); - String congestionValue = leg.annotation().congestion().get(i); - feature.addStringProperty(RouteConstants.CONGESTION_KEY, congestionValue); - feature.addBooleanProperty(PRIMARY_ROUTE_PROPERTY_KEY, isPrimary); - features.add(feature); - } - } - } else { - Feature feature = Feature.fromGeometry(lineString); - features.add(feature); - } - } - return features; - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteArrow.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteArrow.java deleted file mode 100644 index 0690b98d..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteArrow.java +++ /dev/null @@ -1,351 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; -import androidx.annotation.ColorInt; -import androidx.annotation.StyleRes; -import androidx.core.content.ContextCompat; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.appcompat.content.res.AppCompatResources; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.MathUtils; -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.utils.MapImageUtils; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; -import com.mapbox.turf.TurfMisc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static com.mapbox.mapboxsdk.style.expressions.Expression.color; -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.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.layers.Property.ICON_ROTATION_ALIGNMENT_MAP; -import static com.mapbox.mapboxsdk.style.layers.Property.NONE; -import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_BEARING; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_CASING_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_CASING_OFFSET; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_ICON; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_ICON_CASING; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_OFFSET; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HEAD_SOURCE_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_HIDDEN_ZOOM_LEVEL; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_SHAFT_CASING_LINE_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_SHAFT_LINE_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ARROW_SHAFT_SOURCE_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.LAYER_ABOVE_UPCOMING_MANEUVER_ARROW; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MAX_ARROW_ZOOM; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MAX_DEGREES; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MAX_ZOOM_ARROW_HEAD_CASING_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MAX_ZOOM_ARROW_HEAD_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MAX_ZOOM_ARROW_SHAFT_CASING_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MAX_ZOOM_ARROW_SHAFT_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MIN_ARROW_ZOOM; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MIN_ZOOM_ARROW_HEAD_CASING_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MIN_ZOOM_ARROW_HEAD_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MIN_ZOOM_ARROW_SHAFT_CASING_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MIN_ZOOM_ARROW_SHAFT_SCALE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.OPAQUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.THIRTY; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.TRANSPARENT; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.TWO_POINTS; - -class MapRouteArrow { - - @ColorInt - private final int arrowColor; - @ColorInt - private final int arrowBorderColor; - - private List arrowLayerIds; - private GeoJsonSource arrowShaftGeoJsonSource; - private GeoJsonSource arrowHeadGeoJsonSource; - - private final MapView mapView; - private final MapboxMap mapboxMap; - - MapRouteArrow(MapView mapView, MapboxMap mapboxMap, @StyleRes int styleRes) { - this.mapView = mapView; - this.mapboxMap = mapboxMap; - - Context context = mapView.getContext(); - TypedArray typedArray = context.obtainStyledAttributes(styleRes, R.styleable.NavigationMapRoute); - arrowColor = typedArray.getColor(R.styleable.NavigationMapRoute_upcomingManeuverArrowColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_upcoming_maneuver_arrow_color)); - arrowBorderColor = typedArray.getColor(R.styleable.NavigationMapRoute_upcomingManeuverArrowBorderColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_upcoming_maneuver_arrow_border_color)); - typedArray.recycle(); - - initialize(); - } - - void addUpcomingManeuverArrow(RouteProgress routeProgress) { - boolean invalidUpcomingStepPoints = routeProgress.upcomingStepPoints() == null - || routeProgress.upcomingStepPoints().size() < TWO_POINTS; - boolean invalidCurrentStepPoints = routeProgress.currentStepPoints().size() < TWO_POINTS; - if (invalidUpcomingStepPoints || invalidCurrentStepPoints) { - updateVisibilityTo(false); - return; - } - updateVisibilityTo(true); - - List maneuverPoints = obtainArrowPointsFrom(routeProgress); - updateArrowShaftWith(maneuverPoints); - updateArrowHeadWith(maneuverPoints); - } - - void updateVisibilityTo(boolean visible) { - Style style = mapboxMap.getStyle(); - if (style != null) { - for (String layerId : arrowLayerIds) { - Layer layer = style.getLayer(layerId); - if (layer != null) { - String targetVisibility = visible ? VISIBLE : NONE; - if (!targetVisibility.equals(layer.getVisibility().getValue())) { - layer.setProperties(visibility(targetVisibility)); - } - } - } - } - } - - private List obtainArrowPointsFrom(RouteProgress routeProgress) { - List reversedCurrent = new ArrayList<>(routeProgress.currentStepPoints()); - Collections.reverse(reversedCurrent); - - LineString arrowLineCurrent = LineString.fromLngLats(reversedCurrent); - LineString arrowLineUpcoming = LineString.fromLngLats(routeProgress.upcomingStepPoints()); - - LineString arrowCurrentSliced = TurfMisc.lineSliceAlong(arrowLineCurrent, 0, THIRTY, TurfConstants.UNIT_METERS); - LineString arrowUpcomingSliced = TurfMisc.lineSliceAlong(arrowLineUpcoming, 0, THIRTY, TurfConstants.UNIT_METERS); - - Collections.reverse(arrowCurrentSliced.coordinates()); - - List combined = new ArrayList<>(); - combined.addAll(arrowCurrentSliced.coordinates()); - combined.addAll(arrowUpcomingSliced.coordinates()); - return combined; - } - - private void updateArrowShaftWith(List points) { - LineString shaft = LineString.fromLngLats(points); - Feature arrowShaftGeoJsonFeature = Feature.fromGeometry(shaft); - arrowShaftGeoJsonSource.setGeoJson(arrowShaftGeoJsonFeature); - } - - private void updateArrowHeadWith(List points) { - double azimuth = TurfMeasurement.bearing(points.get(points.size() - 2), points.get(points.size() - 1)); - Feature arrowHeadGeoJsonFeature = Feature.fromGeometry(points.get(points.size() - 1)); - arrowHeadGeoJsonFeature.addNumberProperty(ARROW_BEARING, (float) MathUtils.wrap(azimuth, 0, MAX_DEGREES)); - arrowHeadGeoJsonSource.setGeoJson(arrowHeadGeoJsonFeature); - } - - private void initialize() { - initializeArrowShaft(); - initializeArrowHead(); - - addArrowHeadIcon(); - addArrowHeadIconCasing(); - - LineLayer shaftLayer = createArrowShaftLayer(); - LineLayer shaftCasingLayer = createArrowShaftCasingLayer(); - SymbolLayer headLayer = createArrowHeadLayer(); - SymbolLayer headCasingLayer = createArrowHeadCasingLayer(); - - mapboxMap.getStyle().addLayerBelow(shaftCasingLayer, LAYER_ABOVE_UPCOMING_MANEUVER_ARROW); - mapboxMap.getStyle().addLayerAbove(headCasingLayer, shaftCasingLayer.getId()); - - mapboxMap.getStyle().addLayerAbove(shaftLayer, headCasingLayer.getId()); - mapboxMap.getStyle().addLayerAbove(headLayer, shaftLayer.getId()); - - createArrowLayerList(shaftLayer, shaftCasingLayer, headLayer, headCasingLayer); - } - - private void initializeArrowShaft() { - arrowShaftGeoJsonSource = new GeoJsonSource( - ARROW_SHAFT_SOURCE_ID, - FeatureCollection.fromFeatures(new Feature[]{}), - new GeoJsonOptions().withMaxZoom(16) - ); - mapboxMap.getStyle().addSource(arrowShaftGeoJsonSource); - } - - private void initializeArrowHead() { - arrowHeadGeoJsonSource = new GeoJsonSource( - ARROW_HEAD_SOURCE_ID, - FeatureCollection.fromFeatures(new Feature[]{}), - new GeoJsonOptions().withMaxZoom(16) - ); - mapboxMap.getStyle().addSource(arrowHeadGeoJsonSource); - } - - private void addArrowHeadIcon() { - int headResId = R.drawable.ic_arrow_head; - Drawable arrowHead = AppCompatResources.getDrawable(mapView.getContext(), headResId); - if (arrowHead == null) { - return; - } - Drawable head = DrawableCompat.wrap(arrowHead); - DrawableCompat.setTint(head.mutate(), arrowColor); - Bitmap icon = MapImageUtils.getBitmapFromDrawable(head); - mapboxMap.getStyle().addImage(ARROW_HEAD_ICON, icon); - } - - private void addArrowHeadIconCasing() { - int casingResId = R.drawable.ic_arrow_head_casing; - Drawable arrowHeadCasing = AppCompatResources.getDrawable(mapView.getContext(), casingResId); - if (arrowHeadCasing == null) { - return; - } - Drawable headCasing = DrawableCompat.wrap(arrowHeadCasing); - DrawableCompat.setTint(headCasing.mutate(), arrowBorderColor); - Bitmap icon = MapImageUtils.getBitmapFromDrawable(headCasing); - mapboxMap.getStyle().addImage(ARROW_HEAD_ICON_CASING, icon); - } - - private LineLayer createArrowShaftLayer() { - LineLayer shaftLayer = (LineLayer) mapboxMap.getStyle().getLayer(ARROW_SHAFT_LINE_LAYER_ID); - if (shaftLayer != null) { - mapboxMap.getStyle().removeLayer(shaftLayer); - } - return new LineLayer(ARROW_SHAFT_LINE_LAYER_ID, ARROW_SHAFT_SOURCE_ID).withProperties( - PropertyFactory.lineColor(color(arrowColor)), - PropertyFactory.lineWidth( - interpolate(linear(), zoom(), - stop(MIN_ARROW_ZOOM, MIN_ZOOM_ARROW_SHAFT_SCALE), - stop(MAX_ARROW_ZOOM, MAX_ZOOM_ARROW_SHAFT_SCALE) - ) - ), - PropertyFactory.lineCap(Property.LINE_CAP_ROUND), - PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND), - PropertyFactory.visibility(NONE), - PropertyFactory.lineOpacity( - step(zoom(), OPAQUE, - stop( - ARROW_HIDDEN_ZOOM_LEVEL, TRANSPARENT - ) - ) - ) - ); - } - - private LineLayer createArrowShaftCasingLayer() { - LineLayer shaftCasingLayer = (LineLayer) mapboxMap.getStyle().getLayer(ARROW_SHAFT_CASING_LINE_LAYER_ID); - if (shaftCasingLayer != null) { - mapboxMap.getStyle().removeLayer(shaftCasingLayer); - } - return new LineLayer(ARROW_SHAFT_CASING_LINE_LAYER_ID, ARROW_SHAFT_SOURCE_ID).withProperties( - PropertyFactory.lineColor(color(arrowBorderColor)), - PropertyFactory.lineWidth( - interpolate(linear(), zoom(), - stop(MIN_ARROW_ZOOM, MIN_ZOOM_ARROW_SHAFT_CASING_SCALE), - stop(MAX_ARROW_ZOOM, MAX_ZOOM_ARROW_SHAFT_CASING_SCALE) - ) - ), - PropertyFactory.lineCap(Property.LINE_CAP_ROUND), - PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND), - PropertyFactory.visibility(NONE), - PropertyFactory.lineOpacity( - step(zoom(), OPAQUE, - stop( - ARROW_HIDDEN_ZOOM_LEVEL, TRANSPARENT - ) - ) - ) - ); - } - - private SymbolLayer createArrowHeadLayer() { - SymbolLayer headLayer = (SymbolLayer) mapboxMap.getStyle().getLayer(ARROW_HEAD_LAYER_ID); - if (headLayer != null) { - mapboxMap.getStyle().removeLayer(headLayer); - } - return new SymbolLayer(ARROW_HEAD_LAYER_ID, ARROW_HEAD_SOURCE_ID) - .withProperties( - PropertyFactory.iconImage(ARROW_HEAD_ICON), - iconAllowOverlap(true), - iconIgnorePlacement(true), - PropertyFactory.iconSize(interpolate(linear(), zoom(), - stop(MIN_ARROW_ZOOM, MIN_ZOOM_ARROW_HEAD_SCALE), - stop(MAX_ARROW_ZOOM, MAX_ZOOM_ARROW_HEAD_SCALE) - ) - ), - PropertyFactory.iconOffset(ARROW_HEAD_OFFSET), - PropertyFactory.iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP), - PropertyFactory.iconRotate(get(ARROW_BEARING)), - PropertyFactory.visibility(NONE), - PropertyFactory.iconOpacity( - step(zoom(), OPAQUE, - stop( - ARROW_HIDDEN_ZOOM_LEVEL, TRANSPARENT - ) - ) - ) - ); - } - - private SymbolLayer createArrowHeadCasingLayer() { - SymbolLayer headCasingLayer = (SymbolLayer) mapboxMap.getStyle().getLayer(ARROW_HEAD_CASING_LAYER_ID); - if (headCasingLayer != null) { - mapboxMap.getStyle().removeLayer(headCasingLayer); - } - return new SymbolLayer(ARROW_HEAD_CASING_LAYER_ID, ARROW_HEAD_SOURCE_ID).withProperties( - PropertyFactory.iconImage(ARROW_HEAD_ICON_CASING), - iconAllowOverlap(true), - iconIgnorePlacement(true), - PropertyFactory.iconSize(interpolate( - linear(), zoom(), - stop(MIN_ARROW_ZOOM, MIN_ZOOM_ARROW_HEAD_CASING_SCALE), - stop(MAX_ARROW_ZOOM, MAX_ZOOM_ARROW_HEAD_CASING_SCALE) - )), - PropertyFactory.iconOffset(ARROW_HEAD_CASING_OFFSET), - PropertyFactory.iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP), - PropertyFactory.iconRotate(get(ARROW_BEARING)), - PropertyFactory.visibility(NONE), - PropertyFactory.iconOpacity( - step(zoom(), OPAQUE, - stop( - ARROW_HIDDEN_ZOOM_LEVEL, TRANSPARENT - ) - ) - ) - ); - } - - private void createArrowLayerList(LineLayer shaftLayer, LineLayer shaftCasingLayer, SymbolLayer headLayer, - SymbolLayer headCasingLayer) { - arrowLayerIds = new ArrayList<>(); - arrowLayerIds.add(shaftCasingLayer.getId()); - arrowLayerIds.add(shaftLayer.getId()); - arrowLayerIds.add(headCasingLayer.getId()); - arrowLayerIds.add(headLayer.getId()); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListener.java deleted file mode 100644 index f74a98be..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListener.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; -import com.mapbox.turf.TurfMisc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -class MapRouteClickListener implements MapboxMap.OnMapClickListener { - - private final MapRouteLine routeLine; - - private OnRouteSelectionChangeListener onRouteSelectionChangeListener; - private boolean alternativesVisible = true; - - MapRouteClickListener(MapRouteLine routeLine) { - this.routeLine = routeLine; - } - - @Override - public boolean onMapClick(@NonNull LatLng point) { - if (!isRouteVisible()) { - return false; - } - HashMap routeLineStrings = routeLine.retrieveRouteLineStrings(); - if (invalidMapClick(routeLineStrings)) { - return false; - } - List directionsRoutes = routeLine.retrieveDirectionsRoutes(); - findClickedRoute(point, routeLineStrings, directionsRoutes); - return false; - } - - void setOnRouteSelectionChangeListener(OnRouteSelectionChangeListener listener) { - onRouteSelectionChangeListener = listener; - } - - void updateAlternativesVisible(boolean alternativesVisible) { - this.alternativesVisible = alternativesVisible; - } - - private boolean invalidMapClick(HashMap routeLineStrings) { - return routeLineStrings == null || routeLineStrings.isEmpty() || !alternativesVisible; - } - - private boolean isRouteVisible() { - return routeLine.retrieveVisibility(); - } - - private void findClickedRoute(@NonNull LatLng point, HashMap routeLineStrings, - List directionsRoutes) { - - HashMap routeDistancesAwayFromClick = new HashMap<>(); - Point clickPoint = Point.fromLngLat(point.getLongitude(), point.getLatitude()); - - calculateClickDistances(routeDistancesAwayFromClick, clickPoint, routeLineStrings); - List distancesAwayFromClick = new ArrayList<>(routeDistancesAwayFromClick.keySet()); - Collections.sort(distancesAwayFromClick); - - DirectionsRoute clickedRoute = routeDistancesAwayFromClick.get(distancesAwayFromClick.get(0)); - int newPrimaryRouteIndex = directionsRoutes.indexOf(clickedRoute); - if (routeLine.updatePrimaryRouteIndex(newPrimaryRouteIndex) && onRouteSelectionChangeListener != null) { - DirectionsRoute selectedRoute = directionsRoutes.get(newPrimaryRouteIndex); - onRouteSelectionChangeListener.onNewPrimaryRouteSelected(selectedRoute); - } - } - - private void calculateClickDistances(HashMap routeDistancesAwayFromClick, - Point clickPoint, HashMap routeLineStrings) { - for (LineString lineString : routeLineStrings.keySet()) { - Point pointOnLine = findPointOnLine(clickPoint, lineString); - if (pointOnLine == null) { - return; - } - double distance = TurfMeasurement.distance(clickPoint, pointOnLine, TurfConstants.UNIT_METERS); - routeDistancesAwayFromClick.put(distance, routeLineStrings.get(lineString)); - } - } - - private Point findPointOnLine(Point clickPoint, LineString lineString) { - List linePoints = lineString.coordinates(); - Feature feature = TurfMisc.nearestPointOnLine(clickPoint, linePoints); - return (Point) feature.geometry(); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteDrawableProvider.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteDrawableProvider.java deleted file mode 100644 index a60ee00e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteDrawableProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import androidx.annotation.Nullable; -import androidx.appcompat.content.res.AppCompatResources; - -class MapRouteDrawableProvider { - - private final Context context; - - MapRouteDrawableProvider(Context context) { - this.context = context; - } - - @Nullable - Drawable retrieveDrawable(int resId) { - return AppCompatResources.getDrawable(context, resId); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLayerProvider.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLayerProvider.java deleted file mode 100644 index 6540c129..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLayerProvider.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.services.android.navigation.ui.v5.utils.MapImageUtils; - -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.literal; -import static com.mapbox.mapboxsdk.style.expressions.Expression.match; -import static com.mapbox.mapboxsdk.style.expressions.Expression.product; -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.iconIgnorePlacement; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconPitchAlignment; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineCap; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineColor; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineJoin; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineWidth; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.DESTINATION_MARKER_NAME; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.HEAVY_CONGESTION_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.MODERATE_CONGESTION_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ORIGIN_MARKER_NAME; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.PRIMARY_ROUTE_PROPERTY_KEY; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_SHIELD_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_SOURCE_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.SEVERE_CONGESTION_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_DESTINATION_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_ORIGIN_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_PROPERTY_KEY; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_SOURCE_ID; - -class MapRouteLayerProvider { - - LineLayer initializeRouteShieldLayer(Style style, float routeScale, float alternativeRouteScale, - int routeShieldColor, int alternativeRouteShieldColor) { - LineLayer shieldLayer = style.getLayerAs(ROUTE_SHIELD_LAYER_ID); - if (shieldLayer != null) { - style.removeLayer(shieldLayer); - } - - shieldLayer = new LineLayer(ROUTE_SHIELD_LAYER_ID, ROUTE_SOURCE_ID).withProperties( - lineCap(Property.LINE_CAP_ROUND), - lineJoin(Property.LINE_JOIN_ROUND), - lineWidth( - interpolate( - exponential(1.5f), zoom(), - stop(10f, 7f), - stop(14f, product(literal(10.5f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(16.5f, product(literal(15.5f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(19f, product(literal(24f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(22f, product(literal(29f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))) - ) - ), - lineColor( - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), color(routeShieldColor), - color(alternativeRouteShieldColor) - ) - ) - ); - return shieldLayer; - } - - LineLayer initializeRouteLayer(Style style, boolean roundedLineCap, float routeScale, - float alternativeRouteScale, int routeDefaultColor, int routeModerateColor, - int routeSevereColor, int alternativeRouteDefaultColor, - int alternativeRouteModerateColor, int alternativeRouteSevereColor) { - LineLayer routeLayer = style.getLayerAs(ROUTE_LAYER_ID); - if (routeLayer != null) { - style.removeLayer(routeLayer); - } - - String lineCap = Property.LINE_CAP_ROUND; - String lineJoin = Property.LINE_JOIN_ROUND; - if (!roundedLineCap) { - lineCap = Property.LINE_CAP_BUTT; - lineJoin = Property.LINE_JOIN_BEVEL; - } - - routeLayer = new LineLayer(ROUTE_LAYER_ID, ROUTE_SOURCE_ID).withProperties( - lineCap(lineCap), - lineJoin(lineJoin), - lineWidth( - interpolate( - exponential(1.5f), zoom(), - stop(4f, product(literal(3f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(10f, product(literal(4f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(13f, product(literal(6f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(16f, product(literal(10f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(19f, product(literal(14f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))), - stop(22f, product(literal(18f), - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), literal(routeScale), - literal(alternativeRouteScale)))) - ) - ), - lineColor( - switchCase( - get(PRIMARY_ROUTE_PROPERTY_KEY), match( - Expression.toString(get(RouteConstants.CONGESTION_KEY)), - color(routeDefaultColor), - stop(MODERATE_CONGESTION_VALUE, color(routeModerateColor)), - stop(HEAVY_CONGESTION_VALUE, color(routeSevereColor)), - stop(SEVERE_CONGESTION_VALUE, color(routeSevereColor)) - ), - match( - Expression.toString(get(RouteConstants.CONGESTION_KEY)), - color(alternativeRouteDefaultColor), - stop(MODERATE_CONGESTION_VALUE, color(alternativeRouteModerateColor)), - stop(HEAVY_CONGESTION_VALUE, color(alternativeRouteSevereColor)), - stop(SEVERE_CONGESTION_VALUE, color(alternativeRouteSevereColor)) - ) - ) - ) - ); - return routeLayer; - } - - SymbolLayer initializeWayPointLayer(Style style, Drawable originIcon, - Drawable destinationIcon) { - SymbolLayer wayPointLayer = style.getLayerAs(WAYPOINT_LAYER_ID); - if (wayPointLayer != null) { - style.removeLayer(wayPointLayer); - } - - Bitmap bitmap = MapImageUtils.getBitmapFromDrawable(originIcon); - style.addImage(ORIGIN_MARKER_NAME, bitmap); - bitmap = MapImageUtils.getBitmapFromDrawable(destinationIcon); - style.addImage(DESTINATION_MARKER_NAME, bitmap); - - wayPointLayer = new SymbolLayer(WAYPOINT_LAYER_ID, WAYPOINT_SOURCE_ID).withProperties( - iconImage( - match( - Expression.toString(get(WAYPOINT_PROPERTY_KEY)), literal(ORIGIN_MARKER_NAME), - stop(WAYPOINT_ORIGIN_VALUE, literal(ORIGIN_MARKER_NAME)), - stop(WAYPOINT_DESTINATION_VALUE, literal(DESTINATION_MARKER_NAME)) - )), - iconSize( - interpolate( - exponential(1.5f), zoom(), - stop(0f, 0.6f), - stop(10f, 0.8f), - stop(12f, 1.3f), - stop(22f, 2.8f) - ) - ), - iconPitchAlignment(Property.ICON_PITCH_ALIGNMENT_MAP), - iconAllowOverlap(true), - iconIgnorePlacement(true) - ); - return wayPointLayer; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLine.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLine.java deleted file mode 100644 index e698e73e..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLine.java +++ /dev/null @@ -1,493 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; -import android.os.Handler; - -import androidx.annotation.ColorInt; -import androidx.core.content.ContextCompat; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.ui.v5.utils.MapUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; - -import static com.mapbox.mapboxsdk.style.expressions.Expression.literal; -import static com.mapbox.mapboxsdk.style.layers.Property.NONE; -import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.PRIMARY_ROUTE_PROPERTY_KEY; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_SHIELD_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_SOURCE_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_DESTINATION_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_ORIGIN_VALUE; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_PROPERTY_KEY; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_SOURCE_ID; - -class MapRouteLine { - - @ColorInt - private int routeDefaultColor; - @ColorInt - private int routeModerateColor; - @ColorInt - private int routeSevereColor; - @ColorInt - private int alternativeRouteDefaultColor; - @ColorInt - private int alternativeRouteModerateColor; - @ColorInt - private int alternativeRouteSevereColor; - @ColorInt - private int alternativeRouteShieldColor; - @ColorInt - private int routeShieldColor; - private float routeScale; - private float alternativeRouteScale; - private boolean roundedLineCap; - - private Style style; - - private final HashMap routeLineStrings = new HashMap<>(); - private final List routeFeatureCollections = new ArrayList<>(); - private final List directionsRoutes = new ArrayList<>(); - private final List routeLayerIds; - - private final GeoJsonSource wayPointSource; - private final GeoJsonSource routeLineSource; - private int primaryRouteIndex; - private boolean isVisible = true; - private boolean alternativesVisible = true; - private FeatureCollection drawnRouteFeatureCollection; - private FeatureCollection drawnWaypointsFeatureCollection; - private AtomicReference featureProcessingTaskRef = new AtomicReference<>(null); - private FeatureProcessingTask featureProcessingTask; - private boolean isFeatureProcessingTaskInjected = false; - private AtomicReference primaryRouteUpdateTaskRef = new AtomicReference<>(null); - private PrimaryRouteUpdateTask primaryRouteUpdateTask; - private boolean isPrimaryRouteUpdateTaskInjected = false; - private Handler mainHandler; - - MapRouteLine(Context context, - Style style, - int styleRes, - String belowLayer, - MapRouteDrawableProvider drawableProvider, - MapRouteSourceProvider sourceProvider, - MapRouteLayerProvider layerProvider, - Handler handler) { - this(context, style, styleRes, belowLayer, drawableProvider, sourceProvider, layerProvider, - FeatureCollection.fromFeatures(new Feature[]{}), - FeatureCollection.fromFeatures(new Feature[]{}), - new ArrayList(), - new ArrayList(), - new HashMap(), - 0, - true, - true, - handler); - } - - MapRouteLine(Context context, - Style style, - int styleRes, - String belowLayer, - MapRouteDrawableProvider drawableProvider, - MapRouteSourceProvider sourceProvider, - MapRouteLayerProvider layerProvider, - FeatureCollection routesFeatureCollection, - FeatureCollection waypointsFeatureCollection, - List directionsRoutes, - List routeFeatureCollections, - HashMap routeLineStrings, - int primaryRouteIndex, - boolean isVisible, - boolean alternativesVisible, - Handler handler - ) { - this.routeLayerIds = new ArrayList<>(); - this.mainHandler = handler; - this.style = style; - - TypedArray typedArray = context.obtainStyledAttributes(styleRes, R.styleable.NavigationMapRoute); - // Primary Route attributes - routeDefaultColor = typedArray.getColor(R.styleable.NavigationMapRoute_routeColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_layer_blue)); - routeModerateColor = typedArray.getColor( - R.styleable.NavigationMapRoute_routeModerateCongestionColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_layer_congestion_yellow)); - routeSevereColor = typedArray.getColor( - R.styleable.NavigationMapRoute_routeSevereCongestionColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_layer_congestion_red)); - routeShieldColor = typedArray.getColor(R.styleable.NavigationMapRoute_routeShieldColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_shield_layer_color)); - routeScale = typedArray.getFloat(R.styleable.NavigationMapRoute_routeScale, 1.0f); - roundedLineCap = typedArray.getBoolean(R.styleable.NavigationMapRoute_roundedLineCap, true); - - // Secondary Routes attributes - alternativeRouteDefaultColor = typedArray.getColor( - R.styleable.NavigationMapRoute_alternativeRouteColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_alternative_color)); - alternativeRouteModerateColor = typedArray.getColor( - R.styleable.NavigationMapRoute_alternativeRouteModerateCongestionColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_alternative_congestion_yellow)); - alternativeRouteSevereColor = typedArray.getColor( - R.styleable.NavigationMapRoute_alternativeRouteSevereCongestionColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_alternative_congestion_red)); - alternativeRouteShieldColor = typedArray.getColor( - R.styleable.NavigationMapRoute_alternativeRouteShieldColor, - ContextCompat.getColor(context, R.color.mapbox_navigation_route_alternative_shield_color)); - alternativeRouteScale = typedArray.getFloat( - R.styleable.NavigationMapRoute_alternativeRouteScale, 1.0f); - - GeoJsonOptions wayPointGeoJsonOptions = new GeoJsonOptions().withMaxZoom(16); - drawnWaypointsFeatureCollection = waypointsFeatureCollection; - wayPointSource = sourceProvider.build(WAYPOINT_SOURCE_ID, drawnWaypointsFeatureCollection, wayPointGeoJsonOptions); - style.addSource(wayPointSource); - - GeoJsonOptions routeLineGeoJsonOptions = new GeoJsonOptions().withMaxZoom(16); - drawnRouteFeatureCollection = routesFeatureCollection; - routeLineSource = sourceProvider.build(ROUTE_SOURCE_ID, drawnRouteFeatureCollection, routeLineGeoJsonOptions); - style.addSource(routeLineSource); - - // Waypoint attributes - int originWaypointIcon = typedArray.getResourceId( - R.styleable.NavigationMapRoute_originWaypointIcon, R.drawable.ic_route_origin); - int destinationWaypointIcon = typedArray.getResourceId( - R.styleable.NavigationMapRoute_destinationWaypointIcon, R.drawable.ic_route_destination); - typedArray.recycle(); - - Drawable originIcon = drawableProvider.retrieveDrawable(originWaypointIcon); - Drawable destinationIcon = drawableProvider.retrieveDrawable(destinationWaypointIcon); - belowLayer = findRouteBelowLayerId(belowLayer, style); - - initializeLayers(style, layerProvider, originIcon, destinationIcon, belowLayer); - - this.directionsRoutes.addAll(directionsRoutes); - this.routeFeatureCollections.addAll(routeFeatureCollections); - this.routeLineStrings.putAll(routeLineStrings); - - updateAlternativeVisibilityTo(alternativesVisible); - updateRoutesFor(primaryRouteIndex); - updateVisibilityTo(isVisible); - } - - // For testing only - MapRouteLine(GeoJsonSource routeLineSource, GeoJsonSource wayPointSource, List routeLayerIds) { - this.routeLineSource = routeLineSource; - this.wayPointSource = wayPointSource; - this.routeLayerIds = routeLayerIds; - } - - void draw(DirectionsRoute directionsRoute) { - List route = new ArrayList<>(); - route.add(directionsRoute); - draw(route); - } - - void draw(List directionsRoutes) { - if (directionsRoutes.isEmpty()) { - return; - } - clearRouteData(); - this.directionsRoutes.addAll(directionsRoutes); - primaryRouteIndex = 0; - alternativesVisible = directionsRoutes.size() > 1; - isVisible = true; - generateRouteFeatureCollectionsFrom(directionsRoutes); - } - - void toggleAlternativeVisibilityWith(boolean alternativesVisible) { - this.alternativesVisible = alternativesVisible; - updateAlternativeVisibilityTo(alternativesVisible); - } - - boolean retrieveAlternativesVisible() { - return alternativesVisible; - } - - void updateVisibilityTo(boolean isVisible) { - updateAllLayersVisibilityTo(isVisible); - } - - boolean retrieveVisibility() { - return isVisible; - } - - HashMap retrieveRouteLineStrings() { - return routeLineStrings; - } - - List retrieveRouteFeatureCollections() { - return routeFeatureCollections; - } - - FeatureCollection retrieveDrawnRouteFeatureCollections() { - return drawnRouteFeatureCollection; - } - - FeatureCollection retrieveDrawnWaypointsFeatureCollections() { - return drawnWaypointsFeatureCollection; - } - - List retrieveDirectionsRoutes() { - return directionsRoutes; - } - - boolean updatePrimaryRouteIndex(int primaryRouteIndex) { - boolean isNewIndex = this.primaryRouteIndex != primaryRouteIndex - && primaryRouteIndex < directionsRoutes.size() && primaryRouteIndex >= 0; - if (isNewIndex) { - this.primaryRouteIndex = primaryRouteIndex; - updateRoutesFor(primaryRouteIndex); - } - return isNewIndex; - } - - int retrievePrimaryRouteIndex() { - return primaryRouteIndex; - } - - private void drawRoutes(List routeFeatureCollections) { - List routeFeatures = new ArrayList<>(); - for (int i = routeFeatureCollections.size() - 1; i >= 0; i--) { - routeFeatures.addAll(routeFeatureCollections.get(i).features()); - } - setRoutesSource(FeatureCollection.fromFeatures(routeFeatures)); - } - - private void clearRouteData() { - clearRouteListData(); - setRoutesSource(FeatureCollection.fromFeatures(new Feature[]{})); - setWaypointsSource(FeatureCollection.fromFeatures(new Feature[]{})); - } - - private void clearRouteListData() { - if (!directionsRoutes.isEmpty()) { - directionsRoutes.clear(); - } - if (!routeLineStrings.isEmpty()) { - routeLineStrings.clear(); - } - if (!routeFeatureCollections.isEmpty()) { - routeFeatureCollections.clear(); - } - } - - private void generateRouteFeatureCollectionsFrom(List routes) { - // Retrieve a possibly null task. The retrieve is atomic. - FeatureProcessingTask task = featureProcessingTaskRef.getAndSet(retrieveFeatureProcessingTask(routes)); - // If the previous task is valid, cancel it. - if (task != null) { - task.cancel(); - } - // Retrieve the newly created task again. Maybe null - task = featureProcessingTaskRef.get(); - - // If the new task is not null, start it - if (task != null) { - task.start(); - } - } - - // Testing only - void injectFeatureProcessingTask(FeatureProcessingTask featureProcessingTask) { - this.isFeatureProcessingTaskInjected = true; - this.featureProcessingTask = featureProcessingTask; - } - - private FeatureProcessingTask retrieveFeatureProcessingTask(List routes) { - if (isFeatureProcessingTaskInjected) { - return featureProcessingTask; - } - return new FeatureProcessingTask(routes, routeFeaturesProcessedCallback, mainHandler); - } - - private OnRouteFeaturesProcessedCallback routeFeaturesProcessedCallback = new OnRouteFeaturesProcessedCallback() { - @Override - public void onRouteFeaturesProcessed(List routeFeatureCollections, - HashMap routeLineStrings) { - MapRouteLine.this.routeFeatureCollections.addAll(routeFeatureCollections); - MapRouteLine.this.routeLineStrings.putAll(routeLineStrings); - drawRoutes(routeFeatureCollections); - drawWayPoints(); - updateAlternativeVisibilityTo(alternativesVisible); - updateRoutesFor(primaryRouteIndex); - updateVisibilityTo(isVisible); - } - }; - - // Testing only - OnRouteFeaturesProcessedCallback retrieveRouteFeaturesProcessedCallback() { - return routeFeaturesProcessedCallback; - } - - private void drawWayPoints() { - DirectionsRoute primaryRoute = directionsRoutes.get(primaryRouteIndex); - setWaypointsSource(buildWayPointFeatureCollectionFrom(primaryRoute)); - } - - private FeatureCollection buildWayPointFeatureCollectionFrom(DirectionsRoute route) { - final List wayPointFeatures = new ArrayList<>(); - for (RouteLeg leg : route.legs()) { - wayPointFeatures.add(buildWayPointFeatureFromLeg(leg, 0)); - wayPointFeatures.add(buildWayPointFeatureFromLeg(leg, leg.steps().size() - 1)); - } - return FeatureCollection.fromFeatures(wayPointFeatures); - } - - private Feature buildWayPointFeatureFromLeg(RouteLeg leg, int index) { - Feature feature = Feature.fromGeometry(Point.fromLngLat( - leg.steps().get(index).maneuver().location().longitude(), - leg.steps().get(index).maneuver().location().latitude() - )); - feature.addStringProperty(WAYPOINT_PROPERTY_KEY, index == 0 ? WAYPOINT_ORIGIN_VALUE : WAYPOINT_DESTINATION_VALUE); - return feature; - } - - private void updateRoutesFor(int newPrimaryIndex) { - this.primaryRouteIndex = newPrimaryIndex; - if (newPrimaryIndex < 0 || newPrimaryIndex > routeFeatureCollections.size() - 1) { - return; - } - PrimaryRouteUpdateTask task = primaryRouteUpdateTaskRef.getAndSet(retrievePrimaryRouteUpdateTask(newPrimaryIndex)); - if (task != null) { - task.cancel(); - } - - // Retrieve the newly created task again. Maybe null - task = primaryRouteUpdateTaskRef.get(); - - // If the new task is not null, start it - if (task != null) { - task.start(); - } - } - - // Testing only - void injectPrimaryRouteUpdateTask(PrimaryRouteUpdateTask primaryRouteUpdateTask) { - this.isPrimaryRouteUpdateTaskInjected = true; - this.primaryRouteUpdateTask = primaryRouteUpdateTask; - } - - private PrimaryRouteUpdateTask retrievePrimaryRouteUpdateTask(int newPrimaryIndex) { - if (isPrimaryRouteUpdateTaskInjected) { - return primaryRouteUpdateTask; - } - return new PrimaryRouteUpdateTask(newPrimaryIndex, - routeFeatureCollections, primaryRouteUpdatedCallback, mainHandler); - } - - private OnPrimaryRouteUpdatedCallback primaryRouteUpdatedCallback = new OnPrimaryRouteUpdatedCallback() { - @Override - public void onPrimaryRouteUpdated(List updatedRouteCollections) { - drawRoutes(updatedRouteCollections); - } - }; - - // Testing only - OnPrimaryRouteUpdatedCallback retrievePrimaryRouteUpdatedCallback() { - return primaryRouteUpdatedCallback; - } - - private String findRouteBelowLayerId(String belowLayer, Style style) { - if (belowLayer == null || belowLayer.isEmpty()) { - List styleLayers = style.getLayers(); - for (int i = 0; i < styleLayers.size(); i++) { - if (!(styleLayers.get(i) instanceof SymbolLayer) - // Avoid placing the route on top of the user location layer - && !styleLayers.get(i).getId().contains(RouteConstants.MAPBOX_LOCATION_ID)) { - belowLayer = styleLayers.get(i).getId(); - } - } - } - return belowLayer; - } - - private void initializeLayers(Style style, MapRouteLayerProvider layerProvider, - Drawable originIcon, Drawable destinationIcon, - String belowLayer) { - LineLayer routeShieldLayer = layerProvider.initializeRouteShieldLayer( - style, routeScale, alternativeRouteScale, - routeShieldColor, alternativeRouteShieldColor - ); - MapUtils.addLayerToMap(style, routeShieldLayer, belowLayer); - routeLayerIds.add(routeShieldLayer.getId()); - - LineLayer routeLayer = layerProvider.initializeRouteLayer( - style, roundedLineCap, routeScale, alternativeRouteScale, - routeDefaultColor, routeModerateColor, routeSevereColor, - alternativeRouteDefaultColor, alternativeRouteModerateColor, - alternativeRouteSevereColor - ); - MapUtils.addLayerToMap(style, routeLayer, belowLayer); - routeLayerIds.add(routeLayer.getId()); - - SymbolLayer wayPointLayer = layerProvider.initializeWayPointLayer( - style, originIcon, destinationIcon - ); - MapUtils.addLayerToMap(style, wayPointLayer, belowLayer); - routeLayerIds.add(wayPointLayer.getId()); - } - - private void updateAlternativeVisibilityTo(boolean isAlternativeVisible) { - this.alternativesVisible = isAlternativeVisible; - if (style != null && style.isFullyLoaded()) { - for (String layerId : routeLayerIds) { - if (layerId.equals(ROUTE_LAYER_ID) || layerId.equals(ROUTE_SHIELD_LAYER_ID)) { - Layer layer = style.getLayer(layerId); - if (layer != null) { - LineLayer route = (LineLayer) layer; - if (isAlternativeVisible) { - route.setFilter(literal(true)); - } else { - route.setFilter(Expression.eq(Expression.get(PRIMARY_ROUTE_PROPERTY_KEY), true)); - } - } - } - } - } - } - - private void updateAllLayersVisibilityTo(boolean isVisible) { - this.isVisible = isVisible; - if (style != null && style.isFullyLoaded()) { - for (String layerId : routeLayerIds) { - Layer layer = style.getLayer(layerId); - if (layer != null) { - layer.setProperties( - visibility(isVisible ? VISIBLE : NONE) - ); - } - } - } - } - - private void setRoutesSource(FeatureCollection featureCollection) { - drawnRouteFeatureCollection = featureCollection; - routeLineSource.setGeoJson(drawnRouteFeatureCollection); - } - - private void setWaypointsSource(FeatureCollection featureCollection) { - drawnWaypointsFeatureCollection = featureCollection; - wayPointSource.setGeoJson(drawnWaypointsFeatureCollection); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListener.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListener.java deleted file mode 100644 index 2d172782..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.util.List; - -class MapRouteProgressChangeListener implements ProgressChangeListener { - - private final MapRouteLine routeLine; - private final MapRouteArrow routeArrow; - private boolean isVisible = true; - - MapRouteProgressChangeListener(MapRouteLine routeLine, MapRouteArrow routeArrow) { - this.routeLine = routeLine; - this.routeArrow = routeArrow; - } - - @Override - public void onProgressChange(Location location, RouteProgress routeProgress) { - if (!isVisible) { - return; - } - DirectionsRoute currentRoute = routeProgress.directionsRoute(); - List directionsRoutes = routeLine.retrieveDirectionsRoutes(); - int primaryRouteIndex = routeLine.retrievePrimaryRouteIndex(); - addNewRoute(currentRoute, directionsRoutes, primaryRouteIndex); - routeArrow.addUpcomingManeuverArrow(routeProgress); - } - - void updateVisibility(boolean isVisible) { - this.isVisible = isVisible; - } - - private void addNewRoute(DirectionsRoute currentRoute, List directionsRoutes, - int primaryRouteIndex) { - if (isANewRoute(currentRoute, directionsRoutes, primaryRouteIndex)) { - routeLine.draw(currentRoute); - } - } - - private boolean isANewRoute(DirectionsRoute currentRoute, List directionsRoutes, - int primaryRouteIndex) { - boolean noRoutes = directionsRoutes.isEmpty(); - return noRoutes || !currentRoute.equals(directionsRoutes.get(primaryRouteIndex)); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteSourceProvider.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteSourceProvider.java deleted file mode 100644 index 4c64a16f..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteSourceProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; - -class MapRouteSourceProvider { - - GeoJsonSource build(String id, FeatureCollection featureCollection, GeoJsonOptions options) { - return new GeoJsonSource(id, featureCollection, options); - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapboxRouteFetcher.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapboxRouteFetcher.java deleted file mode 100644 index 9e705b24..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/MapboxRouteFetcher.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.content.Context; -import android.location.Location; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.services.android.navigation.v5.route.RouteFetcher; -import com.mapbox.services.android.navigation.v5.route.RouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; -import com.mapbox.services.android.navigation.v5.utils.TextUtils; - -import java.lang.ref.WeakReference; -import java.util.Arrays; -import java.util.List; - -import retrofit2.Call; -import retrofit2.Callback; -import retrofit2.Response; -import timber.log.Timber; - -/** - * This class can be used to fetch new routes given a {@link Location} origin and - * {@link RouteOptions} provided by a {@link RouteProgress}. - */ -public class MapboxRouteFetcher extends RouteFetcher { - - private static final double BEARING_TOLERANCE = 90d; - private static final String SEMICOLON = ";"; - private static final int ORIGIN_APPROACH_THRESHOLD = 1; - private static final int ORIGIN_APPROACH = 0; - private static final int FIRST_POSITION = 0; - private static final int SECOND_POSITION = 1; - private final WeakReference contextWeakReference; - - private RouteProgress routeProgress; - private RouteUtils routeUtils; - - private NavigationRoute navigationRoute; - - public MapboxRouteFetcher(Context context) { - contextWeakReference = new WeakReference<>(context); - routeUtils = new RouteUtils(); - } - - /** - * Calculates a new {@link DirectionsRoute} given - * the current {@link Location} and {@link RouteProgress} along the route. - *

- * Uses {@link RouteOptions#coordinates()} and {@link RouteProgress#remainingWaypoints()} - * to determine the amount of remaining waypoints there are along the given route. - * - * @param location current location of the device - * @param routeProgress for remaining waypoints along the route - * @since 0.13.0 - */ - - public void findRouteFromRouteProgress(Location location, RouteProgress routeProgress) { - this.routeProgress = routeProgress; - NavigationRoute.Builder builder = buildRequest(location, routeProgress); - findRouteWith(builder); - } - - @Nullable - public NavigationRoute.Builder buildRequest(Location location, RouteProgress progress) { - Context context = contextWeakReference.get(); - if (invalid(context, location, progress)) { - return null; - } - Point origin = Point.fromLngLat(location.getLongitude(), location.getLatitude()); - Double bearing = location.hasBearing() ? Float.valueOf(location.getBearing()).doubleValue() : null; - RouteOptions options = progress.directionsRoute().routeOptions(); - NavigationRoute.Builder builder = NavigationRoute.builder(context) - .origin(origin, bearing, BEARING_TOLERANCE) - .routeOptions(options); - - List remainingWaypoints = routeUtils.calculateRemainingWaypoints(progress); - if (remainingWaypoints == null) { - Timber.e("An error occurred fetching a new route"); - return null; - } - addDestination(remainingWaypoints, builder); - addWaypoints(remainingWaypoints, builder); - addWaypointNames(progress, builder); - addApproaches(progress, builder); - return builder; - } - - private void addDestination(List remainingWaypoints, NavigationRoute.Builder builder) { - if (!remainingWaypoints.isEmpty()) { - builder.destination(retrieveDestinationWaypoint(remainingWaypoints)); - } - } - - private Point retrieveDestinationWaypoint(List remainingWaypoints) { - int lastWaypoint = remainingWaypoints.size() - 1; - return remainingWaypoints.remove(lastWaypoint); - } - - private void addWaypoints(List remainingCoordinates, NavigationRoute.Builder builder) { - if (!remainingCoordinates.isEmpty()) { - for (Point coordinate : remainingCoordinates) { - builder.addWaypoint(coordinate); - } - } - } - - private void addWaypointNames(RouteProgress progress, NavigationRoute.Builder builder) { - String[] remainingWaypointNames = routeUtils.calculateRemainingWaypointNames(progress); - if (remainingWaypointNames != null) { - builder.addWaypointNames(remainingWaypointNames); - } - } - - private void addApproaches(RouteProgress progress, NavigationRoute.Builder builder) { - String[] remainingApproaches = calculateRemainingApproaches(progress); - if (remainingApproaches != null) { - builder.addApproaches(remainingApproaches); - } - } - - private String[] calculateRemainingApproaches(RouteProgress routeProgress) { - RouteOptions routeOptions = routeProgress.directionsRoute().routeOptions(); - if (routeOptions == null || TextUtils.isEmpty(routeOptions.approaches())) { - return null; - } - String allApproaches = routeOptions.approaches(); - String[] splitApproaches = allApproaches.split(SEMICOLON); - int coordinatesSize = routeProgress.directionsRoute().routeOptions().coordinates().size(); - String[] remainingApproaches = Arrays.copyOfRange(splitApproaches, - coordinatesSize - routeProgress.remainingWaypoints(), coordinatesSize); - String[] approaches = new String[remainingApproaches.length + ORIGIN_APPROACH_THRESHOLD]; - approaches[ORIGIN_APPROACH] = splitApproaches[ORIGIN_APPROACH]; - System.arraycopy(remainingApproaches, FIRST_POSITION, approaches, SECOND_POSITION, remainingApproaches.length); - return approaches; - } - - /** - * Cancels the Directions API call if it has not been executed yet. - */ - public void cancelRouteCall() { - if (navigationRoute != null) { - navigationRoute.cancelCall(); - } - } - - /** - * Executes the given NavigationRoute builder, eventually triggering - * any {@link RouteListener} that has been added via {@link MapboxRouteFetcher#addRouteListener(RouteListener)}. - * - * @param builder to be executed - */ - public void findRouteWith(NavigationRoute.Builder builder) { - if (builder != null) { - navigationRoute = builder.build(); - navigationRoute.getRoute(directionsResponseCallback); - } - } - - private boolean invalid(Context context, Location location, RouteProgress routeProgress) { - return context == null || location == null || routeProgress == null; - } - - private Callback directionsResponseCallback = new Callback() { - @Override - public void onResponse(@NonNull Call call, - @NonNull Response response) { - if (!response.isSuccessful()) { - return; - } - /* - This part here is critical. We use Mapbox Directions API SDK to fetch a route from Mapbox. Now we convert it from Mapbox to our internal model for navigation. - The json is similar to the Mapbox Directions API, therefore we can do this easily. - Be aware, the fromJson -> toJson handling should work fine usually, for production use, there might be better options - */ - DirectionsResponse maplibreResponse = DirectionsResponse.fromJson(response.body().toJson()); - updateListeners(maplibreResponse, routeProgress); - } - - @Override - public void onFailure(@NonNull Call call, @NonNull Throwable throwable) { - updateListenersWithError(throwable); - } - }; - - private void updateListeners(DirectionsResponse response, RouteProgress routeProgress) { - for (RouteListener listener : routeListeners) { - listener.onResponseReceived(response, routeProgress); - } - } - - private void updateListenersWithError(Throwable throwable) { - for (RouteListener listener : routeListeners) { - listener.onErrorReceived(throwable); - } - } -} diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRoute.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRoute.java deleted file mode 100644 index 5ece5922..00000000 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRoute.java +++ /dev/null @@ -1,409 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.app.Activity; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleObserver; -import androidx.lifecycle.OnLifecycleEvent; -import android.content.Context; -import android.os.Handler; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.Size; -import androidx.annotation.StyleRes; - -import androidx.fragment.app.Fragment; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.services.android.navigation.ui.v5.R; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; - -import java.util.ArrayList; -import java.util.List; - -/** - * Provide a route using {@link NavigationMapRoute#addRoutes(List)} and a route will be drawn using - * runtime styling. The route will automatically be placed below all labels independent of specific - * style. If the map styles changed when a routes drawn on the map, the route will automatically be - * redrawn onto the new map style. If during a navigation session, the user gets re-routed, the - * route line will be redrawn to reflect the new geometry. - *

- * You are given the option when first constructing an instance of this class to pass in a style - * resource. This allows for custom colorizing and line scaling of the route. Inside your - * applications {@code style.xml} file, you extend {@code - - - - - - - - \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/BaseTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/BaseTest.java deleted file mode 100644 index 2a50a649..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/BaseTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.io.IOException; - -public class BaseTest { - - protected static final double DELTA = 1E-10; - protected static final String ACCESS_TOKEN = "pk.XXX"; - - private TestRouteBuilder routeBuilder; - private TestRouteProgressBuilder routeProgressBuilder; - - public BaseTest() { - routeBuilder = new TestRouteBuilder(); - routeProgressBuilder = new TestRouteProgressBuilder(); - } - - protected String loadJsonFixture(String filename) throws IOException { - return routeBuilder.loadJsonFixture(filename); - } - - protected DirectionsRoute buildTestDirectionsRoute() throws IOException { - return routeBuilder.buildTestDirectionsRoute(null); - } - - protected RouteProgress buildRouteProgress(DirectionsRoute route, - double stepDistanceRemaining, - double legDistanceRemaining, - double distanceRemaining, - int stepIndex, - int legIndex) throws Exception { - return routeProgressBuilder.buildTestRouteProgress( - route, stepDistanceRemaining, legDistanceRemaining, distanceRemaining, stepIndex, legIndex - ); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProviderTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProviderTest.java deleted file mode 100644 index 028b3974..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/ConnectivityStatusProviderTest.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.content.Context; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.net.wifi.WifiInfo; -import android.net.wifi.WifiManager; -import android.telephony.TelephonyManager; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(RobolectricTestRunner.class) -public class ConnectivityStatusProviderTest { - - @Test - public void isConnected_returnsTrueWithConnectedInfo() { - Context context = buildMockContextForMobile(true); - ConnectivityStatusProvider statusProvider = new ConnectivityStatusProvider(context); - - boolean isConnected = statusProvider.isConnected(); - - assertTrue(isConnected); - } - - @Test - public void isConnected_returnsFalseWithDisconnectedInfo() { - Context context = buildMockContextForMobile(false); - ConnectivityStatusProvider statusProvider = new ConnectivityStatusProvider(context); - - boolean isConnected = statusProvider.isConnected(); - - assertFalse(isConnected); - } - - @Test - public void isConnectedFast_returnsTrueWithWifi() { - Context context = buildMockContextForWifi(ConnectivityManager.TYPE_WIFI, -20); - ConnectivityStatusProvider statusProvider = new ConnectivityStatusProvider(context); - - boolean isFast = statusProvider.isConnectedFast(); - - assertTrue(isFast); - } - - @Test - public void isConnectedFast_returnsTrueWithLTE() { - Context context = buildMockContextForMobile(ConnectivityManager.TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_LTE); - ConnectivityStatusProvider statusProvider = new ConnectivityStatusProvider(context); - - boolean isFast = statusProvider.isConnectedFast(); - - assertTrue(isFast); - } - - @Test - public void isConnectedFast_returnsTrueWithEDGE() { - Context context = buildMockContextForMobile(ConnectivityManager.TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_EDGE); - ConnectivityStatusProvider statusProvider = new ConnectivityStatusProvider(context); - - boolean isFast = statusProvider.isConnectedFast(); - - assertFalse(isFast); - } - - private Context buildMockContextForMobile(boolean isConnected) { - Context context = mock(Context.class); - ConnectivityManager connectivityManager = mock(ConnectivityManager.class); - NetworkInfo networkInfo = mock(NetworkInfo.class); - when(networkInfo.isConnected()).thenReturn(isConnected); - when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo); - when(context.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(connectivityManager); - WifiManager wifiManager = mock(WifiManager.class); - WifiInfo wifiInfo = mock(WifiInfo.class); - when(wifiInfo.getRssi()).thenReturn(-20); - when(wifiManager.getConnectionInfo()).thenReturn(wifiInfo); - when(context.getSystemService(Context.WIFI_SERVICE)).thenReturn(wifiManager); - return context; - } - - private Context buildMockContextForWifi(int type, int rssiLevel) { - Context context = mock(Context.class); - ConnectivityManager connectivityManager = mock(ConnectivityManager.class); - NetworkInfo networkInfo = mock(NetworkInfo.class); - when(networkInfo.isConnected()).thenReturn(true); - when(networkInfo.getType()).thenReturn(type); - when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo); - when(context.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(connectivityManager); - WifiManager wifiManager = mock(WifiManager.class); - WifiInfo wifiInfo = mock(WifiInfo.class); - when(wifiInfo.getRssi()).thenReturn(rssiLevel); - when(wifiManager.getConnectionInfo()).thenReturn(wifiInfo); - when(context.getSystemService(Context.WIFI_SERVICE)).thenReturn(wifiManager); - return context; - } - - private Context buildMockContextForMobile(int type, int subType) { - Context context = mock(Context.class); - ConnectivityManager connectivityManager = mock(ConnectivityManager.class); - NetworkInfo networkInfo = mock(NetworkInfo.class); - when(networkInfo.isConnected()).thenReturn(true); - when(networkInfo.getType()).thenReturn(type); - when(networkInfo.getSubtype()).thenReturn(subType); - when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo); - when(context.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(connectivityManager); - WifiManager wifiManager = mock(WifiManager.class); - WifiInfo wifiInfo = mock(WifiInfo.class); - when(wifiInfo.getRssi()).thenReturn(-20); - when(wifiManager.getConnectionInfo()).thenReturn(wifiInfo); - when(context.getSystemService(Context.WIFI_SERVICE)).thenReturn(wifiManager); - return context; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductorTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductorTest.java deleted file mode 100644 index 0ffcb60c..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/LocationEngineConductorTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import android.content.Context; -import android.content.pm.PackageManager; -import android.location.LocationManager; - -import androidx.annotation.NonNull; - -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine; - -import org.junit.Test; - -public class LocationEngineConductorTest extends BaseTest { - - @Test - public void sanity() { - LocationEngineConductor locationEngineConductor = new LocationEngineConductor(); - - assertNotNull(locationEngineConductor); - } - - @Test - public void onInitWithSimulation_replayEngineIsProvided() { - LocationEngineConductor locationEngineConductor = new LocationEngineConductor(); - boolean simulateRouteEnabled = true; - locationEngineConductor.initializeLocationEngine(createMockContext(), null, simulateRouteEnabled); - - LocationEngine locationEngine = locationEngineConductor.obtainLocationEngine(); - - assertTrue(locationEngine instanceof ReplayRouteLocationEngine); - } - - @Test - public void onInitWithSimulationAndCustomEngine_customEngineIsProvided() { - LocationEngineConductor locationEngineConductor = new LocationEngineConductor(); - LocationEngine customEngine = mock(LocationEngine.class); - boolean simulateRouteEnabled = true; - locationEngineConductor.initializeLocationEngine(createMockContext(), customEngine, simulateRouteEnabled); - - LocationEngine locationEngine = locationEngineConductor.obtainLocationEngine(); - - assertEquals(customEngine, locationEngine); - } - - @NonNull - private Context createMockContext() { - Context mockContext = mock(Context.class); - LocationManager mockLocationManager = mock(LocationManager.class); - when(mockContext.getSystemService(Context.LOCATION_SERVICE)).thenReturn(mockLocationManager); - when(mockContext.getPackageManager()).thenReturn(mock(PackageManager.class)); - when(mockContext.getApplicationContext()).thenReturn(mock(Context.class)); - return mockContext; - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListenerTest.java deleted file mode 100644 index 281a0b91..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationOnCameraTrackingChangedListenerTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.google.android.material.bottomsheet.BottomSheetBehavior; - -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationOnCameraTrackingChangedListenerTest { - - @Test - public void onCameraTrackingDismissed_presenterNotifiedWithVisibleBottomsheet() { - NavigationPresenter presenter = mock(NavigationPresenter.class); - BottomSheetBehavior behavior = mock(BottomSheetBehavior.class); - when(behavior.getState()).thenReturn(BottomSheetBehavior.STATE_EXPANDED); - NavigationOnCameraTrackingChangedListener listener = new NavigationOnCameraTrackingChangedListener( - presenter, behavior - ); - - listener.onCameraTrackingDismissed(); - - verify(presenter).onCameraTrackingDismissed(); - } - - @Test - public void onCameraTrackingDismissed_ignoredWithHiddenBottomsheet() { - NavigationPresenter presenter = mock(NavigationPresenter.class); - BottomSheetBehavior behavior = mock(BottomSheetBehavior.class); - when(behavior.getState()).thenReturn(BottomSheetBehavior.STATE_HIDDEN); - NavigationOnCameraTrackingChangedListener listener = new NavigationOnCameraTrackingChangedListener( - presenter, behavior - ); - - listener.onCameraTrackingDismissed(); - - verify(presenter, times(0)).onCameraTrackingDismissed(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenterTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenterTest.java deleted file mode 100644 index a80b4309..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationPresenterTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; - -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationPresenterTest { - - @Test - public void onRouteOverviewButtonClick_cameraIsAdjustedToRoute() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRouteOverviewClick(); - - verify(view).updateCameraRouteOverview(); - } - - @Test - public void onRouteOverviewButtonClick_recenterBtnIsShown() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRouteOverviewClick(); - - verify(view).showRecenterBtn(); - } - - @Test - public void onRouteOverviewButtonClick_mapWaynameIsHidden() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRouteOverviewClick(); - - verify(view).updateWayNameVisibility(false); - } - - @Test - public void onRecenterBtnClick_recenterBtnIsHidden() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRecenterClick(); - - verify(view).hideRecenterBtn(); - } - - @Test - public void onRecenterBtnClick_cameraIsResetToTracking() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRecenterClick(); - - verify(view).resetCameraPosition(); - } - - @Test - public void onRecenterBtnClick_mapWayNameIsShown() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRecenterClick(); - - verify(view).updateWayNameVisibility(true); - } - - @Test - public void onWayNameChanged_mapWayNameIsShown() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onWayNameChanged("Some way name"); - - verify(view).updateWayNameVisibility(true); - } - - @Test - public void onWayNameChanged_mapWayNameIsUpdated() { - String someWayName = "Some way name"; - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onWayNameChanged(someWayName); - - verify(view).updateWayNameView(someWayName); - } - - @Test - public void onWayNameChanged_mapWayNameIsHidden() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onWayNameChanged(""); - - verify(view).updateWayNameVisibility(false); - } - - @Test - public void onWayNameChanged_mapWayNameIsHiddenWithCollapsedBottomsheet() { - NavigationContract.View view = mock(NavigationContract.View.class); - when(view.isSummaryBottomSheetHidden()).thenReturn(true); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onWayNameChanged("some valid way name"); - - verify(view).updateWayNameVisibility(false); - } - - @Test - public void onNavigationStopped_mapWayNameIsHidden() { - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onNavigationStopped(); - - verify(view).updateWayNameVisibility(false); - } - - @Test - public void onRouteUpdate_routeIsDrawn() { - DirectionsRoute directionsRoute = mock(DirectionsRoute.class); - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRouteUpdate(directionsRoute); - - verify(view).drawRoute(directionsRoute); - } - - @Test - public void onRouteUpdate_overviewIsShownWhenResumeState() { - DirectionsRoute directionsRoute = mock(DirectionsRoute.class); - NavigationContract.View view = mock(NavigationContract.View.class); - when(view.isRecenterButtonVisible()).thenReturn(true); - NavigationPresenter presenter = new NavigationPresenter(view); - presenter.updateResumeState(true); - - presenter.onRouteUpdate(directionsRoute); - - verify(view).updateCameraRouteOverview(); - } - - @Test - public void onRouteUpdate_cameraIsStartedOnFirstRoute() { - DirectionsRoute directionsRoute = mock(DirectionsRoute.class); - NavigationContract.View view = mock(NavigationContract.View.class); - NavigationPresenter presenter = new NavigationPresenter(view); - - presenter.onRouteUpdate(directionsRoute); - - verify(view).startCamera(directionsRoute); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcherTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcherTest.java deleted file mode 100644 index 3597991e..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcherTest.java +++ /dev/null @@ -1,407 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.ui.v5.listeners.BannerInstructionsListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.InstructionListListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.NavigationListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.RouteListener; -import com.mapbox.services.android.navigation.ui.v5.listeners.SpeechAnnouncementListener; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechAnnouncement; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; - -import org.junit.Test; - -public class NavigationViewEventDispatcherTest { - - @Test - public void sanity() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - - assertNotNull(eventDispatcher); - } - - @Test - public void setNavigationListener_cancelListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - NavigationViewModel viewModel = mock(NavigationViewModel.class); - eventDispatcher.assignNavigationListener(navigationListener, viewModel); - - eventDispatcher.onCancelNavigation(); - - verify(navigationListener, times(1)).onCancelNavigation(); - } - - @Test - public void setNavigationListener_runningListenerCalledIfRunning() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - NavigationViewModel viewModel = mock(NavigationViewModel.class); - when(viewModel.isRunning()).thenReturn(true); - - eventDispatcher.assignNavigationListener(navigationListener, viewModel); - - verify(navigationListener, times(1)).onNavigationRunning(); - } - - @Test - public void setNavigationListener_finishedListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - NavigationViewModel viewModel = mock(NavigationViewModel.class); - eventDispatcher.assignNavigationListener(navigationListener, viewModel); - - eventDispatcher.onNavigationFinished(); - - verify(navigationListener, times(1)).onNavigationFinished(); - } - - @Test - public void setNavigationListener_runningListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - NavigationViewModel viewModel = mock(NavigationViewModel.class); - eventDispatcher.assignNavigationListener(navigationListener, viewModel); - - eventDispatcher.onNavigationRunning(); - - verify(navigationListener, times(1)).onNavigationRunning(); - } - - @Test - public void onNavigationListenerNotSet_runningListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - - eventDispatcher.onNavigationRunning(); - - verify(navigationListener, times(0)).onNavigationRunning(); - } - - @Test - public void onNavigationListenerNotSet_cancelListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - - eventDispatcher.onCancelNavigation(); - - verify(navigationListener, times(0)).onCancelNavigation(); - } - - @Test - public void onNavigationListenerNotSet_finishedListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationListener navigationListener = mock(NavigationListener.class); - - eventDispatcher.onNavigationFinished(); - - verify(navigationListener, times(0)).onNavigationFinished(); - } - - @Test - public void setRouteListener_offRouteListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - Point point = mock(Point.class); - eventDispatcher.assignRouteListener(routeListener); - - eventDispatcher.onOffRoute(point); - - verify(routeListener, times(1)).onOffRoute(point); - } - - @Test - public void setRouteListener_rerouteAlongListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - DirectionsRoute directionsRoute = mock(DirectionsRoute.class); - eventDispatcher.assignRouteListener(routeListener); - - eventDispatcher.onRerouteAlong(directionsRoute); - - verify(routeListener, times(1)).onRerouteAlong(directionsRoute); - } - - @Test - public void setRouteListener_failedRerouteListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - String errorMessage = "errorMessage"; - eventDispatcher.assignRouteListener(routeListener); - - eventDispatcher.onFailedReroute(errorMessage); - - verify(routeListener, times(1)).onFailedReroute(errorMessage); - } - - @Test - public void setRouteListener_allowRerouteFromListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - Point point = mock(Point.class); - eventDispatcher.assignRouteListener(routeListener); - - eventDispatcher.allowRerouteFrom(point); - - verify(routeListener, times(1)).allowRerouteFrom(point); - } - - @Test - public void onRouteListenerNotSet_allowRerouteFromListenerIsNotCalled_andReturnsTrue() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - Point point = mock(Point.class); - - boolean shouldAllowReroute = eventDispatcher.allowRerouteFrom(point); - - verify(routeListener, times(0)).allowRerouteFrom(point); - assertTrue(shouldAllowReroute); - } - - @Test - public void onRouteListenerNotSet_offRouteListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - Point point = mock(Point.class); - - eventDispatcher.onOffRoute(point); - - verify(routeListener, times(0)).onOffRoute(point); - } - - @Test - public void onRouteListenerNotSet_rerouteAlongListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - DirectionsRoute directionsRoute = mock(DirectionsRoute.class); - - eventDispatcher.onRerouteAlong(directionsRoute); - - verify(routeListener, times(0)).onRerouteAlong(directionsRoute); - } - - @Test - public void onRouteListenerNotSet_failedListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - String errorMessage = "errorMessage"; - - eventDispatcher.onFailedReroute(errorMessage); - - verify(routeListener, times(0)).onFailedReroute(errorMessage); - } - - @Test - public void onRouteListenerNotSet_allowRerouteListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - Point point = mock(Point.class); - - eventDispatcher.allowRerouteFrom(point); - - verify(routeListener, times(0)).allowRerouteFrom(point); - } - - @Test - public void setArrivalListener_arrivalListenerIsCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - eventDispatcher.assignRouteListener(routeListener); - - eventDispatcher.onArrival(); - - verify(routeListener, times(1)).onArrival(); - } - - @Test - public void onRouteListenerNotSet_arrivalListenerIsNotCalled() throws Exception { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - RouteListener routeListener = mock(RouteListener.class); - - eventDispatcher.onArrival(); - - verify(routeListener, times(0)).onArrival(); - } - - @Test - public void onInstructionListShown_listenerReturnsTrue() { - InstructionListListener instructionListListener = mock(InstructionListListener.class); - NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(instructionListListener); - - eventDispatcher.onInstructionListVisibilityChanged(true); - - verify(instructionListListener, times(1)).onInstructionListVisibilityChanged(true); - } - - @Test - public void onInstructionListHidden_listenerReturnsFalse() { - InstructionListListener instructionListListener = mock(InstructionListListener.class); - NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(instructionListListener); - - eventDispatcher.onInstructionListVisibilityChanged(false); - - verify(instructionListListener, times(1)).onInstructionListVisibilityChanged(false); - } - - @Test - public void onProgressChangeListenerAddedInOptions_isAddedToNavigation() { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationViewOptions options = mock(NavigationViewOptions.class); - ProgressChangeListener progressChangeListener = setupProgressChangeListener(options); - NavigationViewModel navigationViewModel = mock(NavigationViewModel.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - when(navigationViewModel.retrieveNavigation()).thenReturn(navigation); - - eventDispatcher.initializeListeners(options, navigationViewModel); - - verify(navigation, times(1)).addProgressChangeListener(progressChangeListener); - } - - @Test - public void onProgressChangeListenerAddedInOptions_isRemovedInOnDestroy() { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationViewOptions options = mock(NavigationViewOptions.class); - ProgressChangeListener progressChangeListener = setupProgressChangeListener(options); - NavigationViewModel navigationViewModel = mock(NavigationViewModel.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - when(navigationViewModel.retrieveNavigation()).thenReturn(navigation); - eventDispatcher.initializeListeners(options, navigationViewModel); - - eventDispatcher.onDestroy(navigation); - - verify(navigation, times(1)).removeProgressChangeListener(progressChangeListener); - } - - @Test - public void onMilestoneEventListenerAddedInOptions_isAddedToNavigation() { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationViewOptions options = mock(NavigationViewOptions.class); - MilestoneEventListener milestoneEventListener = setupMilestoneEventListener(options); - NavigationViewModel navigationViewModel = mock(NavigationViewModel.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - when(navigationViewModel.retrieveNavigation()).thenReturn(navigation); - - eventDispatcher.initializeListeners(options, navigationViewModel); - - verify(navigation, times(1)).addMilestoneEventListener(milestoneEventListener); - } - - @Test - public void onMilestoneEventListenerAddedInOptions_isRemovedInOnDestroy() { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - NavigationViewOptions options = mock(NavigationViewOptions.class); - MilestoneEventListener milestoneEventListener = setupMilestoneEventListener(options); - NavigationViewModel navigationViewModel = mock(NavigationViewModel.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - when(navigationViewModel.retrieveNavigation()).thenReturn(navigation); - eventDispatcher.initializeListeners(options, navigationViewModel); - - eventDispatcher.onDestroy(navigation); - - verify(navigation, times(1)).removeMilestoneEventListener(milestoneEventListener); - } - - @Test - public void onNewBannerInstruction_instructionListenerIsCalled() { - BannerInstructions modifiedInstructions = mock(BannerInstructions.class); - BannerInstructions originalInstructions = mock(BannerInstructions.class); - BannerInstructionsListener bannerInstructionsListener = mock(BannerInstructionsListener.class); - when(bannerInstructionsListener.willDisplay(originalInstructions)).thenReturn(modifiedInstructions); - NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(bannerInstructionsListener); - - eventDispatcher.onBannerDisplay(originalInstructions); - - verify(bannerInstructionsListener).willDisplay(originalInstructions); - } - - @Test - public void onNewVoiceAnnouncement_instructionListenerIsCalled() { - SpeechAnnouncement originalAnnouncement = mock(SpeechAnnouncement.class); - SpeechAnnouncementListener speechAnnouncementListener = mock(SpeechAnnouncementListener.class); - SpeechAnnouncement newAnnouncement = SpeechAnnouncement.builder() - .announcement("New announcement").build(); - when(speechAnnouncementListener.willVoice(originalAnnouncement)).thenReturn(newAnnouncement); - NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(speechAnnouncementListener); - - eventDispatcher.onAnnouncement(originalAnnouncement); - - verify(speechAnnouncementListener).willVoice(originalAnnouncement); - } - - @Test - public void onNewVoiceAnnouncement_announcementToBeVoicedIsReturned() { - SpeechAnnouncement originalAnnouncement = SpeechAnnouncement.builder().announcement("announcement").build(); - SpeechAnnouncementListener speechAnnouncementListener = mock(SpeechAnnouncementListener.class); - SpeechAnnouncement newAnnouncement = SpeechAnnouncement.builder() - .announcement("New announcement").build(); - when(speechAnnouncementListener.willVoice(originalAnnouncement)).thenReturn(newAnnouncement); - NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(speechAnnouncementListener); - - SpeechAnnouncement modifiedAnnouncement = eventDispatcher.onAnnouncement(originalAnnouncement); - - assertEquals("New announcement", modifiedAnnouncement.announcement()); - } - - @Test - public void onNewVoiceAnnouncement_ssmlAnnouncementToBeVoicedIsReturned() { - SpeechAnnouncement originalAnnouncement = SpeechAnnouncement.builder().announcement("announcement").build(); - SpeechAnnouncementListener speechAnnouncementListener = mock(SpeechAnnouncementListener.class); - SpeechAnnouncement newAnnouncement = SpeechAnnouncement.builder() - .announcement("New announcement") - .ssmlAnnouncement("New SSML announcement").build(); - when(speechAnnouncementListener.willVoice(originalAnnouncement)).thenReturn(newAnnouncement); - NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(speechAnnouncementListener); - - SpeechAnnouncement modifiedAnnouncement = eventDispatcher.onAnnouncement(originalAnnouncement); - - assertEquals("New SSML announcement", modifiedAnnouncement.ssmlAnnouncement()); - } - - @NonNull - private NavigationViewEventDispatcher buildViewEventDispatcher(SpeechAnnouncementListener speechAnnouncementListener) { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - eventDispatcher.assignSpeechAnnouncementListener(speechAnnouncementListener); - return eventDispatcher; - } - - @NonNull - private NavigationViewEventDispatcher buildViewEventDispatcher(BannerInstructionsListener bannerInstructionsListener) { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - eventDispatcher.assignBannerInstructionsListener(bannerInstructionsListener); - return eventDispatcher; - } - - - @NonNull - private NavigationViewEventDispatcher buildViewEventDispatcher(InstructionListListener instructionListListener) { - NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); - eventDispatcher.assignInstructionListListener(instructionListListener); - return eventDispatcher; - } - - private ProgressChangeListener setupProgressChangeListener(NavigationViewOptions options) { - ProgressChangeListener progressChangeListener = mock(ProgressChangeListener.class); - when(options.progressChangeListener()).thenReturn(progressChangeListener); - return progressChangeListener; - } - - private MilestoneEventListener setupMilestoneEventListener(NavigationViewOptions options) { - MilestoneEventListener milestoneEventListener = mock(MilestoneEventListener.class); - when(options.milestoneEventListener()).thenReturn(milestoneEventListener); - return milestoneEventListener; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListenerTest.java deleted file mode 100644 index a562521f..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelProgressChangeListenerTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class NavigationViewModelProgressChangeListenerTest { - - @Test - public void checksNavigationViewModelRouteProgressIsUpdatedWhenOnProgressChange() { - NavigationViewModel mockedNavigationViewModel = mock(NavigationViewModel.class); - NavigationViewModelProgressChangeListener theNavigationViewModelProgressChangeListener = - new NavigationViewModelProgressChangeListener(mockedNavigationViewModel); - Location anyLocation = mock(Location.class); - RouteProgress theRouteProgress = mock(RouteProgress.class); - - theNavigationViewModelProgressChangeListener.onProgressChange(anyLocation, theRouteProgress); - - verify(mockedNavigationViewModel).updateRouteProgress(eq(theRouteProgress)); - } - - @Test - public void checksNavigationViewModelLocationIsUpdatedWhenOnProgressChange() { - NavigationViewModel mockedNavigationViewModel = mock(NavigationViewModel.class); - NavigationViewModelProgressChangeListener theNavigationViewModelProgressChangeListener = - new NavigationViewModelProgressChangeListener(mockedNavigationViewModel); - Location theLocation = mock(Location.class); - RouteProgress anyRouteProgress = mock(RouteProgress.class); - - theNavigationViewModelProgressChangeListener.onProgressChange(theLocation, anyRouteProgress); - - verify(mockedNavigationViewModel).updateLocation(eq(theLocation)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelTest.java deleted file mode 100644 index a8492e19..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewModelTest.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import android.app.Application; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayer; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -@RunWith(RobolectricTestRunner.class) -public class NavigationViewModelTest { - - @Test - public void stopNavigation_progressListenersAreRemoved() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - MapConnectivityController mockedConnectivityController = mock(MapConnectivityController.class); - NavigationViewRouter router = mock(NavigationViewRouter.class); - NavigationViewModel viewModel = new NavigationViewModel(application, navigation, mockedConnectivityController, router); - - viewModel.stopNavigation(); - - verify(navigation).removeProgressChangeListener(null); - } - - @Test - public void stopNavigation_milestoneListenersAreRemoved() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - MapConnectivityController mockedConnectivityController = mock(MapConnectivityController.class); - NavigationViewRouter router = mock(NavigationViewRouter.class); - NavigationViewModel viewModel = new NavigationViewModel(application, navigation, mockedConnectivityController, router); - - viewModel.stopNavigation(); - - verify(navigation).removeMilestoneEventListener(null); - } - - @Test - public void stopNavigation_mapOfflineManagerOnDestroyIsCalledIfNotNull() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - MapConnectivityController mockedConnectivityController = mock(MapConnectivityController.class); - NavigationViewRouter router = mock(NavigationViewRouter.class); - NavigationViewModel viewModel = new NavigationViewModel(application, navigation, mockedConnectivityController, router); - - viewModel.onDestroy(false); - } - - @Test - public void updateRoute_navigationIsNotUpdatedWhenChangingConfigurations() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - DirectionsRoute route = mock(DirectionsRoute.class); - MapConnectivityController mockedConnectivityController = mock(MapConnectivityController.class); - NavigationViewRouter router = mock(NavigationViewRouter.class); - NavigationViewModel viewModel = new NavigationViewModel(application, navigation, mockedConnectivityController,router); - viewModel.onDestroy(true); - - viewModel.updateRoute(route); - - verify(navigation, times(0)).startNavigation(route); - } - - @Test - public void navigationRouter_onDestroyInvokedWhenViewModelIsDestroyed() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - MapConnectivityController mockedConnectivityController = mock(MapConnectivityController.class); - NavigationViewRouter mockedRouter = mock(NavigationViewRouter.class); - NavigationViewModel viewModel = new NavigationViewModel(application, navigation, mockedConnectivityController, mockedRouter); - viewModel.onCleared(); - verify(mockedRouter).onDestroy(); - } - - @Test - public void updateRoute_navigationIsUpdated() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - LocationEngineConductor conductor = mock(LocationEngineConductor.class); - NavigationViewEventDispatcher dispatcher = mock(NavigationViewEventDispatcher.class); - SpeechPlayer speechPlayer = mock(SpeechPlayer.class); - DirectionsRoute route = mock(DirectionsRoute.class); - NavigationViewModel viewModel = new NavigationViewModel( - application, navigation, conductor, dispatcher, speechPlayer - ); - viewModel.isOffRoute.postValue(true); - - viewModel.updateRoute(route); - - verify(navigation).startNavigation(route); - } - - @Test - public void isMuted_falseWithNullSpeechPlayer() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - LocationEngineConductor conductor = mock(LocationEngineConductor.class); - NavigationViewEventDispatcher dispatcher = mock(NavigationViewEventDispatcher.class); - SpeechPlayer speechPlayer = null; - NavigationViewModel viewModel = new NavigationViewModel( - application, navigation, conductor, dispatcher, speechPlayer - ); - - boolean isMuted = viewModel.isMuted(); - - assertFalse(isMuted); - } - - @Test - public void isMuted_trueWithMutedSpeechPlayer() { - Application application = mock(Application.class); - MapboxNavigation navigation = mock(MapboxNavigation.class); - LocationEngineConductor conductor = mock(LocationEngineConductor.class); - NavigationViewEventDispatcher dispatcher = mock(NavigationViewEventDispatcher.class); - SpeechPlayer speechPlayer = mock(SpeechPlayer.class); - when(speechPlayer.isMuted()).thenReturn(true); - NavigationViewModel viewModel = new NavigationViewModel( - application, navigation, conductor, dispatcher, speechPlayer - ); - - boolean isMuted = viewModel.isMuted(); - - assertTrue(isMuted); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListenerTest.java deleted file mode 100644 index b868273d..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouteEngineListenerTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import androidx.lifecycle.MutableLiveData; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationViewRouteEngineListenerTest { - - @Test - public void onRouteUpdate_checksUpdateRouteCalled() { - NavigationViewModel mockedNavigationViewModel = mock(NavigationViewModel.class); - DirectionsRoute aDirectionsRoute = mock(DirectionsRoute.class); - NavigationViewRouteEngineListener theRouteEngineListener - = new NavigationViewRouteEngineListener(mockedNavigationViewModel); - - theRouteEngineListener.onRouteUpdate(aDirectionsRoute); - - verify(mockedNavigationViewModel).updateRoute(eq(aDirectionsRoute)); - } - - @Test - public void checksSendEventFailedRerouteCalledIfNavigationIsOffRoute() { - NavigationViewModel mockedNavigationViewModel = mock(NavigationViewModel.class); - when(mockedNavigationViewModel.isOffRoute()).thenReturn(true); - String anError = "An error occurred!"; - NavigationViewRouteEngineListener theRouteEngineListener - = new NavigationViewRouteEngineListener(mockedNavigationViewModel); - - theRouteEngineListener.onRouteRequestError(anError); - - verify(mockedNavigationViewModel).sendEventFailedReroute(eq(anError)); - } - - @Test - public void checksSendEventFailedRerouteNotCalledIfNavigationIsNotOffRoute() { - NavigationViewModel mockedNavigationViewModel = mock(NavigationViewModel.class); - when(mockedNavigationViewModel.isOffRoute()).thenReturn(false); - String anError = "An error occurred!"; - NavigationViewRouteEngineListener theRouteEngineListener - = new NavigationViewRouteEngineListener(mockedNavigationViewModel); - - theRouteEngineListener.onRouteRequestError(anError); - - verify(mockedNavigationViewModel, times(0)).sendEventFailedReroute(eq(anError)); - } - - @Test - public void checksOnDestinationSet() { - NavigationViewModel mockedNavigationViewModel = mock(NavigationViewModel.class); - Point mockedPoint = mock(Point.class); - MutableLiveData mockedDestination = mock(MutableLiveData.class); - when(mockedNavigationViewModel.retrieveDestination()).thenReturn(mockedDestination); - NavigationViewRouteEngineListener theRouteEngineListener - = new NavigationViewRouteEngineListener(mockedNavigationViewModel); - - theRouteEngineListener.onDestinationSet(mockedPoint); - - verify(mockedDestination).setValue(eq(mockedPoint)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouterTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouterTest.java deleted file mode 100644 index a3886c73..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewRouterTest.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static junit.framework.Assert.assertNotNull; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import android.location.Location; - -import androidx.annotation.NonNull; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.ui.v5.route.MapboxRouteFetcher; -import com.mapbox.services.android.navigation.ui.v5.route.NavigationRoute; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.DirectionsWaypoint; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.core.constants.Constants; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -public class NavigationViewRouterTest extends BaseTest { - - private static final String DIRECTIONS_PRECISION_6 = "directions_v5_precision_6.json"; - - @Test - public void sanity() { - ViewRouteListener routeEngineListener = mock(ViewRouteListener.class); - NavigationViewRouter routeEngine = buildRouteEngine(routeEngineListener); - - assertNotNull(routeEngine); - } - - @Test - public void onExtractOptionsWithRoute_routeUpdateCallbackIsCalled() throws Exception { - ViewRouteListener routeEngineListener = mock(ViewRouteListener.class); - NavigationViewRouter routeEngine = buildRouteEngine(routeEngineListener); - NavigationViewOptions options = buildNavigationViewOptionsWithRoute(); - DirectionsRoute directionsRoute = options.directionsRoute(); - - routeEngine.extractRouteOptions(options); - - verify(routeEngineListener).onRouteUpdate(directionsRoute); - } - - @Test - public void onExtractOptionsWithRoute_destinationCallbackIsCalled() throws Exception { - ViewRouteListener routeEngineListener = mock(ViewRouteListener.class); - NavigationViewRouter routeEngine = buildRouteEngine(routeEngineListener); - NavigationViewOptions options = buildNavigationViewOptionsWithRoute(); - Point destination = findDestinationPoint(options); - - routeEngine.extractRouteOptions(options); - - verify(routeEngineListener).onDestinationSet(destination); - } - - @Test - public void onRouteResponseReceived_routeUpdateCallbackIsCalled() throws Exception { - ViewRouteListener routeEngineListener = mock(ViewRouteListener.class); - NavigationViewRouter routeEngine = buildRouteEngine(routeEngineListener); - DirectionsResponse response = buildDirectionsResponse(); - DirectionsRoute route = response.routes().get(0); - RouteProgress routeProgress = mock(RouteProgress.class); - - routeEngine.onResponseReceived(response, routeProgress); - - verify(routeEngineListener).onRouteUpdate(route); - } - - @Test - public void onErrorReceived_errorListenerIsTriggered() { - ViewRouteListener routeEngineListener = mock(ViewRouteListener.class); - NavigationViewRouter routeEngine = buildRouteEngine(routeEngineListener); - Throwable throwable = mock(Throwable.class); - when(throwable.getMessage()).thenReturn("error"); - - routeEngine.onErrorReceived(throwable); - - verify(routeEngineListener).onRouteRequestError(eq("error")); - } - - @Test - public void findRouteFrom_fastConnectionGoesToOnline() { - MapboxRouteFetcher onlineRouter = mock(MapboxRouteFetcher.class); - NavigationRoute.Builder builder = mock(NavigationRoute.Builder.class); - when(onlineRouter.buildRequest(any(Location.class), any(RouteProgress.class))).thenReturn(builder); - ConnectivityStatusProvider status = mock(ConnectivityStatusProvider.class); - when(status.isConnectedFast()).thenReturn(true); - NavigationViewRouter router = new NavigationViewRouter( - onlineRouter, - status, - mock(RouteComparator.class), - mock(ViewRouteListener.class), - mock(RouteCallStatus.class) - ); - router.updateLocation(mock(Location.class)); - - router.findRouteFrom(mock(RouteProgress.class)); - - verify(onlineRouter).findRouteWith(builder); - } - - - @Test - public void findRouteFrom_secondRequestIgnored() { - MapboxRouteFetcher onlineRouter = mock(MapboxRouteFetcher.class); - NavigationRoute.Builder builder = mock(NavigationRoute.Builder.class); - when(onlineRouter.buildRequest(any(Location.class), any(RouteProgress.class))).thenReturn(builder); - ConnectivityStatusProvider status = mock(ConnectivityStatusProvider.class); - when(status.isConnectedFast()).thenReturn(false); - NavigationViewRouter router = new NavigationViewRouter( - onlineRouter, - status, - mock(RouteComparator.class), - mock(ViewRouteListener.class), - mock(RouteCallStatus.class) - ); - router.updateLocation(mock(Location.class)); - - router.findRouteFrom(mock(RouteProgress.class)); - router.findRouteFrom(mock(RouteProgress.class)); - } - - @Test - public void onDestroy_clearsListeners() { - MapboxRouteFetcher onlineRouter = mock(MapboxRouteFetcher.class); - NavigationViewRouter router = new NavigationViewRouter( - onlineRouter, - mock(ConnectivityStatusProvider.class), - mock(RouteComparator.class), - mock(ViewRouteListener.class), - mock(RouteCallStatus.class) - ); - - router.onDestroy(); - - verify(onlineRouter).cancelRouteCall(); - } - - @Test - public void onDestroy_cancelsOnlineRouteCall() { - MapboxRouteFetcher onlineRouter = mock(MapboxRouteFetcher.class); - NavigationViewRouter router = new NavigationViewRouter( - onlineRouter, - mock(ConnectivityStatusProvider.class), - mock(RouteComparator.class), - mock(ViewRouteListener.class), - mock(RouteCallStatus.class) - ); - - router.onDestroy(); - - verify(onlineRouter).clearListeners(); - } - - @NonNull - private NavigationViewRouter buildRouteEngine(ViewRouteListener routeEngineListener) { - return new NavigationViewRouter(mock(MapboxRouteFetcher.class), mock(ConnectivityStatusProvider.class), - routeEngineListener); - } - - private NavigationViewOptions buildNavigationViewOptionsWithRoute() throws IOException { - return NavigationViewOptions.builder() - .directionsRoute(buildDirectionsRoute()) - .build(); - } - - private Point findDestinationPoint(NavigationViewOptions options) { - List coordinates = options.directionsRoute().routeOptions().coordinates(); - return coordinates.get(coordinates.size() - 1); - } - - private DirectionsRoute buildDirectionsRoute() throws IOException { - Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(DIRECTIONS_PRECISION_6); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - RouteOptions options = buildRouteOptionsWithCoordinates(response); - return response.routes().get(0).toBuilder().routeOptions(options).build(); - } - - private DirectionsResponse buildDirectionsResponse() throws IOException { - Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(DIRECTIONS_PRECISION_6); - return gson.fromJson(body, DirectionsResponse.class); - } - - private RouteOptions buildRouteOptionsWithCoordinates(DirectionsResponse response) { - List coordinates = new ArrayList<>(); - for (DirectionsWaypoint waypoint : response.waypoints()) { - coordinates.add(waypoint.location()); - } - return RouteOptions.builder() - .baseUrl(Constants.BASE_API_URL) - .user("user") - .profile("profile") - .accessToken(ACCESS_TOKEN) - .requestUuid("uuid") - .geometries("mocked_geometries") - .coordinates(coordinates).build(); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriberTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriberTest.java deleted file mode 100644 index ad7a4c70..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewSubscriberTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleOwner; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.Observer; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; - -public class NavigationViewSubscriberTest { - - @Mock - private LifecycleOwner lifecycleOwner; - @Mock - private Lifecycle lifecycle; - @Mock - private NavigationPresenter navigationPresenter; - @Mock - private NavigationViewModel navigationViewModel; - - @Rule - public MockitoRule mockitoRule = MockitoJUnit.rule(); - - private NavigationViewSubscriber theNavigationViewSubscriber; - - @Before - public void setup() { - when(lifecycleOwner.getLifecycle()).thenReturn(lifecycle); - - theNavigationViewSubscriber = new NavigationViewSubscriber(lifecycleOwner, - navigationViewModel, navigationPresenter); - } - - @Test - public void checkLifecycleObserverAddedWhenCreateSubscriber() { - verify(lifecycleOwner.getLifecycle()).addObserver(theNavigationViewSubscriber); - } - - @Test - public void checkObserversAreRemovedWhenUnsubscribe() { - when(navigationViewModel.retrieveRoute()).thenReturn(mock(MutableLiveData.class)); - when(navigationViewModel.retrieveNavigationLocation()).thenReturn(mock(MutableLiveData.class)); - when(navigationViewModel.retrieveDestination()).thenReturn(mock(MutableLiveData.class)); - when(navigationViewModel.retrieveShouldRecordScreenshot()).thenReturn(mock(MutableLiveData.class)); - - theNavigationViewSubscriber.unsubscribe(); - - verify(navigationViewModel.retrieveRoute()).removeObservers(eq(lifecycleOwner)); - verify(navigationViewModel.retrieveNavigationLocation()).removeObservers(eq(lifecycleOwner)); - verify(navigationViewModel.retrieveDestination()).removeObservers(eq(lifecycleOwner)); - verify(navigationViewModel.retrieveShouldRecordScreenshot()).removeObservers(eq(lifecycleOwner)); - } - - @Test - public void checkObserversAreAddedWhenSubscribe() { - when(navigationViewModel.retrieveRoute()).thenReturn(mock(MutableLiveData.class)); - when(navigationViewModel.retrieveNavigationLocation()).thenReturn(mock(MutableLiveData.class)); - when(navigationViewModel.retrieveDestination()).thenReturn(mock(MutableLiveData.class)); - when(navigationViewModel.retrieveShouldRecordScreenshot()).thenReturn(mock(MutableLiveData.class)); - - theNavigationViewSubscriber.subscribe(); - - verify(navigationViewModel.retrieveRoute()).observe(eq(lifecycleOwner), any(Observer.class)); - verify(navigationViewModel.retrieveNavigationLocation()).observe(eq(lifecycleOwner), any(Observer.class)); - verify(navigationViewModel.retrieveDestination()).observe(eq(lifecycleOwner), any(Observer.class)); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListenerTest.java deleted file mode 100644 index dabb618f..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewWayNameListenerTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import com.mapbox.services.android.navigation.ui.v5.map.OnWayNameChangedListener; - -import org.junit.Test; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class NavigationViewWayNameListenerTest { - - @Test - public void onWayNameChanged_presenterReceivesNewWayName() { - NavigationPresenter presenter = mock(NavigationPresenter.class); - String newWayName = "New way name"; - OnWayNameChangedListener listener = new NavigationViewWayNameListener(presenter); - - listener.onWayNameChanged(newWayName); - - verify(presenter).onWayNameChanged(newWayName); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatusTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatusTest.java deleted file mode 100644 index 96e74cda..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/RouteCallStatusTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import org.junit.Test; - -import java.util.Date; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class RouteCallStatusTest { - - @Test - public void setResponseReceived_isNoLongerRouting() { - Date callDate = mock(Date.class); - RouteCallStatus callStatus = new RouteCallStatus(callDate); - - callStatus.setResponseReceived(); - - assertFalse(callStatus.isRouting(mock(Date.class))); - } - - @Test - public void isRouting_returnsTrueUnderTwoSeconds() { - Date callDate = mock(Date.class); - when(callDate.getTime()).thenReturn(0L); - Date currentDate = mock(Date.class); - when((currentDate.getTime())).thenReturn(1000L); - RouteCallStatus callStatus = new RouteCallStatus(callDate); - - boolean isRouting = callStatus.isRouting(currentDate); - - assertTrue(isRouting); - } - - @Test - public void isRouting_returnsFalseOverFiveSeconds() { - Date callDate = mock(Date.class); - when(callDate.getTime()).thenReturn(0L); - Date currentDate = mock(Date.class); - when((currentDate.getTime())).thenReturn(5100L); - RouteCallStatus callStatus = new RouteCallStatus(callDate); - - boolean isRouting = callStatus.isRouting(currentDate); - - assertFalse(isRouting); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteBuilder.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteBuilder.java deleted file mode 100644 index f8a244aa..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteBuilder.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static com.google.common.base.Charsets.UTF_8; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.core.constants.Constants; -import com.mapbox.geojson.Point; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; - - -class TestRouteBuilder { - - private static final String DIRECTIONS_PRECISION_6 = "directions_v5_precision_6.json"; - private static final String ACCESS_TOKEN = "pk.XXX"; - - String loadJsonFixture(String filename) throws IOException { - ClassLoader classLoader = getClass().getClassLoader(); - InputStream inputStream = classLoader.getResourceAsStream(filename); - Scanner scanner = new Scanner(inputStream, UTF_8.name()).useDelimiter("\\A"); - return scanner.hasNext() ? scanner.next() : ""; - } - - DirectionsRoute buildTestDirectionsRoute(@Nullable String fixtureName) throws IOException { - fixtureName = checkNullFixtureName(fixtureName); - Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(fixtureName); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - DirectionsRoute route = response.routes().get(0); - return buildRouteWithOptions(route); - } - - private DirectionsRoute buildRouteWithOptions(DirectionsRoute route) throws IOException { - List coordinates = new ArrayList<>(); - RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder() - .baseUrl(Constants.BASE_API_URL) - .user("user") - .profile("profile") - .accessToken(ACCESS_TOKEN) - .requestUuid("uuid") - .geometries("mocked_geometries") - .voiceInstructions(true) - .bannerInstructions(true) - .coordinates(coordinates).build(); - - return route.toBuilder() - .routeOptions(routeOptionsWithoutVoiceInstructions) - .build(); - } - - @NonNull - private String checkNullFixtureName(@Nullable String fixtureName) { - if (fixtureName == null) { - fixtureName = DIRECTIONS_PRECISION_6; - } - return fixtureName; - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteProgressBuilder.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteProgressBuilder.java deleted file mode 100644 index 3ed0c614..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/TestRouteProgressBuilder.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5; - -import static com.mapbox.core.constants.Constants.PRECISION_6; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.createDistancesToIntersections; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.createIntersectionsList; - -import android.util.Pair; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.StepIntersection; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.util.List; - -class TestRouteProgressBuilder { - - RouteProgress buildDefaultTestRouteProgress(DirectionsRoute testRoute) { - return buildTestRouteProgress(testRoute, 100, 100, - 100, 0, 0); - } - - RouteProgress buildTestRouteProgress(DirectionsRoute route, - double stepDistanceRemaining, - double legDistanceRemaining, - double distanceRemaining, - int stepIndex, - int legIndex) { - List steps = route.legs().get(legIndex).steps(); - LegStep currentStep = steps.get(stepIndex); - List currentStepPoints = buildCurrentStepPoints(currentStep); - int upcomingStepIndex = stepIndex + 1; - List upcomingStepPoints = null; - LegStep upcomingStep = null; - if (upcomingStepIndex < steps.size()) { - upcomingStep = steps.get(upcomingStepIndex); - String upcomingStepGeometry = upcomingStep.geometry(); - upcomingStepPoints = buildStepPointsFromGeometry(upcomingStepGeometry); - } - - List intersections = createIntersectionsList(currentStep, upcomingStep); - List> intersectionDistances = createDistancesToIntersections( - currentStepPoints, intersections - ); - - return RouteProgress.builder() - .stepDistanceRemaining(stepDistanceRemaining) - .legDistanceRemaining(legDistanceRemaining) - .distanceRemaining(distanceRemaining) - .directionsRoute(route) - .currentStepPoints(currentStepPoints) - .upcomingStepPoints(upcomingStepPoints) - .stepIndex(stepIndex) - .legIndex(legIndex) - .intersections(intersections) - .currentIntersection(intersections.get(0)) - .intersectionDistancesAlongStep(intersectionDistances) - .build(); - } - - @NonNull - private List buildCurrentStepPoints(LegStep currentStep) { - String currentStepGeometry = currentStep.geometry(); - return buildStepPointsFromGeometry(currentStepGeometry); - } - - private List buildStepPointsFromGeometry(String stepGeometry) { - return PolylineUtils.decode(stepGeometry, PRECISION_6); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListenerTest.java deleted file mode 100644 index 0fa43051..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/alert/AlertViewAnimatorListenerTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.alert; - -import android.animation.Animator; - -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class AlertViewAnimatorListenerTest { - - @Test - public void onAnimationEnd_alertViewIsHidden() { - AlertView alertView = mock(AlertView.class); - AlertViewAnimatorListener listener = new AlertViewAnimatorListener(alertView); - - listener.onAnimationEnd(mock(Animator.class)); - - verify(alertView).hide(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCameraTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCameraTest.java deleted file mode 100644 index af89282b..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCameraTest.java +++ /dev/null @@ -1,251 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import android.location.Location; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.core.constants.Constants; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.services.android.navigation.ui.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class DynamicCameraTest extends BaseTest { - - private static final String DIRECTIONS_PRECISION_6 = "directions_v5_precision_6.json"; - - @Test - public void sanity() { - DynamicCamera cameraEngine = buildDynamicCamera(); - - assertNotNull(cameraEngine); - } - - @Test - public void onInformationFromRoute_engineCreatesCorrectZoom() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteInformation routeInformation = RouteInformation.create(buildDirectionsRoute(), null, null); - - double zoom = cameraEngine.zoom(routeInformation); - - assertEquals(15d, zoom); - } - - @Test - public void onCameraPositionNull_engineReturnsDefaultZoom() throws Exception { - DynamicCamera theCameraEngine = buildDynamicCamera(); - RouteInformation anyRouteInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(1000d)); - - double defaultZoom = theCameraEngine.zoom(anyRouteInformation); - - assertEquals(15d, defaultZoom); - } - - @Test - public void onCameraPositionZoomGreaterThanMax_engineReturnsMaxCameraZoom() throws Exception { - MapboxMap mapboxMap = mock(MapboxMap.class); - CameraPosition cameraPositionWithZoomGreaterThanMax = new CameraPosition.Builder() - .zoom(20d) - .build(); - when(mapboxMap.getCameraForLatLngBounds(any(LatLngBounds.class), any(int[].class))).thenReturn(cameraPositionWithZoomGreaterThanMax); - DynamicCamera theCameraEngine = new DynamicCamera(mapboxMap); - RouteInformation anyRouteInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(1000d)); - - double maxCameraZoom = theCameraEngine.zoom(anyRouteInformation); - - assertEquals(16d, maxCameraZoom); - } - - @Test - public void onCameraPositionZoomLessThanMin_engineReturnsMinCameraZoom() throws Exception { - MapboxMap mapboxMap = mock(MapboxMap.class); - CameraPosition cameraPositionWithZoomLessThanMin = new CameraPosition.Builder() - .zoom(10d) - .build(); - when(mapboxMap.getCameraForLatLngBounds(any(LatLngBounds.class), any(int[].class))).thenReturn(cameraPositionWithZoomLessThanMin); - DynamicCamera theCameraEngine = new DynamicCamera(mapboxMap); - RouteInformation anyRouteInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(1000d)); - - double maxCameraZoom = theCameraEngine.zoom(anyRouteInformation); - - assertEquals(12d, maxCameraZoom); - } - - @Test - public void onCameraPositionZoomGreaterThanMinAndLessThanMax_engineReturnsCameraPositionZoom() throws Exception { - MapboxMap mapboxMap = mock(MapboxMap.class); - CameraPosition cameraPositionWithZoomGreaterThanMinAndLessThanMax = new CameraPosition.Builder() - .zoom(14d) - .build(); - when(mapboxMap.getCameraForLatLngBounds(any(LatLngBounds.class), any(int[].class))).thenReturn(cameraPositionWithZoomGreaterThanMinAndLessThanMax); - DynamicCamera theCameraEngine = new DynamicCamera(mapboxMap); - RouteInformation anyRouteInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(1000d)); - - double maxCameraZoom = theCameraEngine.zoom(anyRouteInformation); - - assertEquals(14d, maxCameraZoom); - } - - @Test - public void onIsResetting_dynamicCameraReturnsDefault() throws Exception { - RouteInformation routeInformation = RouteInformation.create(buildDirectionsRoute(), null, null); - DynamicCamera cameraEngine = buildDynamicCamera(); - cameraEngine.forceResetZoomLevel(); - - double zoom = cameraEngine.zoom(routeInformation); - - assertEquals(15d, zoom); - } - - @Test - public void onInformationFromRoute_engineCreatesCorrectTilt() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteInformation routeInformation = RouteInformation.create(buildDirectionsRoute(), null, null); - - double tilt = cameraEngine.tilt(routeInformation); - - assertEquals(50d, tilt); - } - - @Test - public void onHighDistanceRemaining_engineCreatesCorrectTilt() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteInformation routeInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(1000d)); - - double tilt = cameraEngine.tilt(routeInformation); - - assertEquals(60d, tilt); - } - - @Test - public void onMediumDistanceRemaining_engineCreatesCorrectTilt() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteInformation routeInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(200d)); - - double tilt = cameraEngine.tilt(routeInformation); - - assertEquals(45d, tilt); - } - - @Test - public void onLowDistanceRemaining_engineCreatesCorrectTilt() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteInformation routeInformation = RouteInformation.create(null, - buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(null)); - - double tilt = cameraEngine.tilt(routeInformation); - - assertEquals(45d, tilt); - } - - @Test - public void onInformationFromRoute_engineCreatesOverviewPointList() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - DirectionsRoute route = buildDirectionsRoute(); - List routePoints = generateRouteCoordinates(route); - RouteInformation routeInformation = RouteInformation.create(route, null, null); - - List overviewPoints = cameraEngine.overview(routeInformation); - - assertEquals(routePoints, overviewPoints); - } - - @Test - public void onInformationFromRouteProgress_engineCreatesOverviewPointList() throws Exception { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteProgress routeProgress = buildDefaultRouteProgress(null); - List routePoints = buildRouteCoordinatesFrom(routeProgress); - RouteInformation routeInformation = RouteInformation.create(null, null, routeProgress); - - List overviewPoints = cameraEngine.overview(routeInformation); - - assertEquals(routePoints, overviewPoints); - } - - @Test - public void noRouteInformation_engineCreatesEmptyOverviewPointList() { - DynamicCamera cameraEngine = buildDynamicCamera(); - RouteInformation routeInformation = RouteInformation.create(null, null, null); - - List overviewPoints = cameraEngine.overview(routeInformation); - - assertTrue(overviewPoints.isEmpty()); - } - - @Nullable - private List buildRouteCoordinatesFrom(RouteProgress routeProgress) { - DirectionsRoute route = routeProgress.directionsRoute(); - return generateRouteCoordinates(route); - } - - @NonNull - private DynamicCamera buildDynamicCamera() { - MapboxMap mapboxMap = mock(MapboxMap.class); - return new DynamicCamera(mapboxMap); - } - - private Location buildDefaultLocationUpdate(double lng, double lat) { - return buildLocationUpdate(lng, lat, System.currentTimeMillis()); - } - - private Location buildLocationUpdate(double lng, double lat, long time) { - Location location = mock(Location.class); - when(location.getLongitude()).thenReturn(lng); - when(location.getLatitude()).thenReturn(lat); - when(location.getSpeed()).thenReturn(30f); - when(location.getBearing()).thenReturn(100f); - when(location.getAccuracy()).thenReturn(10f); - when(location.getTime()).thenReturn(time); - return location; - } - - private RouteProgress buildDefaultRouteProgress(@Nullable Double stepDistanceRemaining) throws Exception { - DirectionsRoute aRoute = buildDirectionsRoute(); - double stepDistanceRemainingFinal = stepDistanceRemaining == null ? 100 : stepDistanceRemaining; - return buildRouteProgress(aRoute, stepDistanceRemainingFinal, 0, 0, 0, 0); - } - - private DirectionsRoute buildDirectionsRoute() throws IOException { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(DIRECTIONS_PRECISION_6); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response.routes().get(0); - } - - private List generateRouteCoordinates(DirectionsRoute route) { - if (route == null) { - return Collections.emptyList(); - } - LineString lineString = LineString.fromPolyline(route.geometry(), Constants.PRECISION_6); - return lineString.coordinates(); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTest.java deleted file mode 100644 index 8de0ac99..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTest.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.camera.CameraUpdate; -import com.mapbox.mapboxsdk.location.LocationComponent; -import com.mapbox.mapboxsdk.location.OnLocationCameraTransitionListener; -import com.mapbox.mapboxsdk.location.modes.CameraMode; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.services.android.navigation.ui.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; - -import org.junit.Test; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationCameraTest extends BaseTest { - - @Test - public void sanity() { - NavigationCamera camera = buildCamera(); - - assertNotNull(camera); - } - - @Test - public void setTrackingEnabled_trackingIsEnabled() { - LocationComponent locationComponent = mock(LocationComponent.class); - NavigationCamera camera = buildCamera(locationComponent); - - verify(locationComponent, times(1)).setCameraMode(eq(CameraMode.TRACKING_GPS), - any(OnLocationCameraTransitionListener.class)); - verify(locationComponent, times(0)).setCameraMode(eq(CameraMode.NONE), - any(OnLocationCameraTransitionListener.class)); - - camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE); - verify(locationComponent, times(1)).setCameraMode(eq(CameraMode.NONE), - any(OnLocationCameraTransitionListener.class)); - - camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS); - verify(locationComponent, times(2)).setCameraMode(eq(CameraMode.TRACKING_GPS), - any(OnLocationCameraTransitionListener.class)); - - assertTrue(camera.isTrackingEnabled()); - } - - @Test - public void setTrackingDisabled_trackingIsDisabled() { - LocationComponent locationComponent = mock(LocationComponent.class); - NavigationCamera camera = buildCamera(locationComponent); - - verify(locationComponent, times(1)).setCameraMode(eq(CameraMode.TRACKING_GPS), - any(OnLocationCameraTransitionListener.class)); - verify(locationComponent, times(0)).setCameraMode(eq(CameraMode.NONE), - any(OnLocationCameraTransitionListener.class)); - - camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS); - verify(locationComponent, times(2)).setCameraMode(eq(CameraMode.TRACKING_GPS), - any(OnLocationCameraTransitionListener.class)); - - camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE); - verify(locationComponent, times(1)).setCameraMode(eq(CameraMode.NONE), - any(OnLocationCameraTransitionListener.class)); - - assertFalse(camera.isTrackingEnabled()); - } - - @Test - public void onResetCamera_trackingIsResumed() { - NavigationCamera camera = buildCamera(); - - camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE); - camera.resetCameraPositionWith(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS); - - assertTrue(camera.isTrackingEnabled()); - } - - @Test - public void onResetCamera_dynamicCameraIsReset() { - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getCameraPosition()).thenReturn(mock(CameraPosition.class)); - MapboxNavigation navigation = mock(MapboxNavigation.class); - DynamicCamera dynamicCamera = mock(DynamicCamera.class); - when(navigation.getCameraEngine()).thenReturn(dynamicCamera); - RouteInformation currentRouteInformation = mock(RouteInformation.class); - NavigationCamera camera = buildCamera(mapboxMap, navigation, currentRouteInformation); - - camera.resetCameraPositionWith(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS); - - verify(dynamicCamera).forceResetZoomLevel(); - } - - @Test - public void onStartWithNullRoute_progressListenerIsAdded() { - MapboxNavigation navigation = mock(MapboxNavigation.class); - ProgressChangeListener listener = mock(ProgressChangeListener.class); - NavigationCamera camera = buildCamera(navigation, listener); - - camera.start(null); - - verify(navigation, times(1)).addProgressChangeListener(listener); - } - - @Test - public void onResumeWithNullLocation_progressListenerIsAdded() { - MapboxNavigation navigation = mock(MapboxNavigation.class); - ProgressChangeListener listener = mock(ProgressChangeListener.class); - NavigationCamera camera = buildCamera(navigation, listener); - - camera.resume(null); - - verify(navigation, times(1)).addProgressChangeListener(listener); - } - - @Test - public void update_defaultIsIgnoredWhileTracking() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - when(locationComponent.getCameraMode()).thenReturn(CameraMode.TRACKING_GPS); - when(mapboxMap.getLocationComponent()).thenReturn(locationComponent); - CameraUpdate cameraUpdate = mock(CameraUpdate.class); - MapboxMap.CancelableCallback callback = mock(MapboxMap.CancelableCallback.class); - NavigationCameraUpdate navigationCameraUpdate = new NavigationCameraUpdate(cameraUpdate); - NavigationCamera camera = buildCamera(mapboxMap); - - camera.update(navigationCameraUpdate, 300, callback); - - verify(mapboxMap, times(0)).animateCamera(cameraUpdate); - } - - @Test - public void update_defaultIsAcceptedWithNoTracking() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - when(locationComponent.getCameraMode()).thenReturn(CameraMode.NONE); - when(mapboxMap.getLocationComponent()).thenReturn(locationComponent); - CameraUpdate cameraUpdate = mock(CameraUpdate.class); - MapboxMap.CancelableCallback callback = mock(MapboxMap.CancelableCallback.class); - NavigationCameraUpdate navigationCameraUpdate = new NavigationCameraUpdate(cameraUpdate); - NavigationCamera camera = buildCamera(mapboxMap); - - camera.update(navigationCameraUpdate, 300, callback); - - verify(mapboxMap).animateCamera(eq(cameraUpdate), eq(300), eq(callback)); - } - - @Test - public void update_overrideIsAcceptedWhileTracking() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - when(locationComponent.getCameraMode()).thenReturn(CameraMode.TRACKING_GPS); - when(mapboxMap.getLocationComponent()).thenReturn(locationComponent); - CameraUpdate cameraUpdate = mock(CameraUpdate.class); - MapboxMap.CancelableCallback callback = mock(MapboxMap.CancelableCallback.class); - NavigationCameraUpdate navigationCameraUpdate = new NavigationCameraUpdate(cameraUpdate); - navigationCameraUpdate.setMode(CameraUpdateMode.OVERRIDE); - NavigationCamera camera = buildCamera(mapboxMap); - - camera.update(navigationCameraUpdate, 300, callback); - - verify(mapboxMap).animateCamera(eq(cameraUpdate), eq(300), eq(callback)); - } - - @Test - public void update_overrideSetsLocationComponentCameraModeNone() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - when(locationComponent.getCameraMode()).thenReturn(CameraMode.TRACKING_GPS); - when(mapboxMap.getLocationComponent()).thenReturn(locationComponent); - CameraUpdate cameraUpdate = mock(CameraUpdate.class); - MapboxMap.CancelableCallback callback = mock(MapboxMap.CancelableCallback.class); - NavigationCameraUpdate navigationCameraUpdate = new NavigationCameraUpdate(cameraUpdate); - navigationCameraUpdate.setMode(CameraUpdateMode.OVERRIDE); - NavigationCamera camera = buildCamera(mapboxMap); - - camera.update(navigationCameraUpdate, 300, callback); - - verify(locationComponent).setCameraMode(eq(CameraMode.NONE)); - } - - private NavigationCamera buildCamera() { - return new NavigationCamera(mock(MapboxMap.class), mock(MapboxNavigation.class), mock(LocationComponent.class)); - } - - private NavigationCamera buildCamera(MapboxMap mapboxMap) { - return new NavigationCamera(mapboxMap, mock(MapboxNavigation.class), mock(LocationComponent.class)); - } - - private NavigationCamera buildCamera(LocationComponent locationComponent) { - return new NavigationCamera(mock(MapboxMap.class), mock(MapboxNavigation.class), locationComponent); - } - - private NavigationCamera buildCamera(MapboxNavigation navigation, ProgressChangeListener listener) { - return new NavigationCamera(mock(MapboxMap.class), navigation, listener, - mock(LocationComponent.class), mock(RouteInformation.class)); - } - - private NavigationCamera buildCamera(MapboxMap mapboxMap, MapboxNavigation navigation, - RouteInformation routeInformation) { - return new NavigationCamera(mapboxMap, navigation, mock(ProgressChangeListener.class), - mock(LocationComponent.class), routeInformation); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListenerTest.java deleted file mode 100644 index ef85b364..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTrackingChangedListenerTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.location.modes.CameraMode; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationCameraTrackingChangedListenerTest { - - @Test - public void onCameraTrackingDismissed_cameraSetToTrackingNone() { - NavigationCamera camera = mock(NavigationCamera.class); - NavigationCameraTrackingChangedListener listener = new NavigationCameraTrackingChangedListener(camera); - - listener.onCameraTrackingDismissed(); - - verify(camera).updateCameraTrackingMode(eq(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE)); - } - - @Test - public void onCameraTrackingChanged_navigationCameraTrackingUpdated() { - NavigationCamera camera = mock(NavigationCamera.class); - when(camera.findTrackingModeFor(CameraMode.TRACKING_GPS)).thenReturn(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS); - NavigationCameraTrackingChangedListener listener = new NavigationCameraTrackingChangedListener(camera); - - listener.onCameraTrackingChanged(CameraMode.TRACKING_GPS); - - verify(camera).updateCameraTrackingMode(eq(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListenerTest.java deleted file mode 100644 index 23aa1e5f..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCameraTransitionListenerTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import com.mapbox.mapboxsdk.location.modes.CameraMode; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class NavigationCameraTransitionListenerTest { - - @Test - public void onLocationCameraTransitionFinished() { - NavigationCamera camera = mock(NavigationCamera.class); - NavigationCameraTransitionListener listener = new NavigationCameraTransitionListener(camera); - int trackingGps = CameraMode.TRACKING_GPS; - - listener.onLocationCameraTransitionFinished(trackingGps); - - verify(camera).updateTransitionListenersFinished(trackingGps); - } - - @Test - public void onLocationCameraTransitionCanceled() { - NavigationCamera camera = mock(NavigationCamera.class); - NavigationCameraTransitionListener listener = new NavigationCameraTransitionListener(camera); - int trackingGpsNorth = CameraMode.TRACKING_GPS_NORTH; - - listener.onLocationCameraTransitionCanceled(trackingGpsNorth); - - verify(camera).updateTransitionListenersCancelled(trackingGpsNorth); - } - - @Test - public void onLocationCameraTransitionCanceled_cameraStopsResetting() { - NavigationCamera camera = mock(NavigationCamera.class); - NavigationCameraTransitionListener listener = new NavigationCameraTransitionListener(camera); - int trackingGpsNorth = CameraMode.TRACKING_GPS_NORTH; - - listener.onLocationCameraTransitionCanceled(trackingGpsNorth); - - verify(camera).updateIsResetting(eq(false)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallbackTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallbackTest.java deleted file mode 100644 index 44334de3..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/camera/ResetCancelableCallbackTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.camera; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class ResetCancelableCallbackTest { - - @Test - public void onFinish_dynamicCameraIsReset() { - NavigationCamera camera = mock(NavigationCamera.class); - ResetCancelableCallback callback = new ResetCancelableCallback(camera); - - callback.onFinish(); - - verify(camera).updateIsResetting(eq(false)); - } - - @Test - public void onCancel_dynamicCameraIsReset() { - NavigationCamera camera = mock(NavigationCamera.class); - ResetCancelableCallback callback = new ResetCancelableCallback(camera); - - callback.onCancel(); - - verify(camera).updateIsResetting(eq(false)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreatorTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreatorTest.java deleted file mode 100644 index 60ac4ffa..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreatorTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.ui.v5.BaseTest; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class AbbreviationCreatorTest extends BaseTest { - - @Test - public void preProcess_abbreviate() { - String abbreviation = "smtxt"; - BannerComponents bannerComponents = - BannerComponentsFaker.bannerComponentsBuilder() - .abbreviation(abbreviation) - .abbreviationPriority(0) - .build(); - TextView textView = mock(TextView.class); - AbbreviationVerifier abbreviationVerifier = mock(AbbreviationVerifier.class); - when(abbreviationVerifier.isNodeType(bannerComponents)).thenReturn(true); - TextViewUtils textViewUtils = mock(TextViewUtils.class); - when(textViewUtils.textFits(textView, abbreviation)).thenReturn(true); - when(textViewUtils.textFits(textView, bannerComponents.text())).thenReturn(false); - BannerComponentNode node = mock(AbbreviationCreator.AbbreviationNode.class); - when(((AbbreviationCreator.AbbreviationNode) node).getAbbreviate()).thenReturn(true); - when(node.toString()).thenReturn(abbreviation); - AbbreviationCreator abbreviationCreator = new AbbreviationCreator(abbreviationVerifier); - - abbreviationCreator.preProcess(textView, Collections.singletonList(node)); - - verify(textView).setText(abbreviation); - } - - @Test - public void setupNode() { - String abbreviation = "smtxt"; - int abbreviationPriority = 0; - BannerComponents bannerComponents = - BannerComponentsFaker.bannerComponentsBuilder() - .abbreviation(abbreviation) - .abbreviationPriority(abbreviationPriority) - .build(); - AbbreviationVerifier abbreviationVerifier = mock(AbbreviationVerifier.class); - when(abbreviationVerifier.isNodeType(bannerComponents)).thenReturn(true); - HashMap> abbreviations = new HashMap(); - AbbreviationCreator abbreviationCreator = new AbbreviationCreator(abbreviationVerifier, - abbreviations, mock(TextViewUtils.class)); - List bannerComponentNodes = new ArrayList<>(); - bannerComponentNodes.add(new AbbreviationCreator.AbbreviationNode(bannerComponents, 0)); - - abbreviationCreator.setupNode(bannerComponents, 0, 0, ""); - - assertEquals(abbreviations.size(), 1); - assertEquals(abbreviations.get(abbreviationPriority).get(0), Integer.valueOf(0)); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTreeTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTreeTest.java deleted file mode 100644 index bb3ea3c5..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTreeTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.widget.TextView; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; -import com.mapbox.services.android.navigation.v5.models.BannerText; - -import org.junit.Test; -import org.mockito.InOrder; - -import java.util.Collections; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - - -public class BannerComponentTreeTest { - - @Test - public void parseComponents() { - BannerComponents bannerComponents = BannerComponentsFaker.bannerComponents(); - List bannerComponentsList = Collections.singletonList(bannerComponents); - TestCreator testCreator = mock(TestCreator.class); - when(testCreator.isNodeType(bannerComponents)).thenReturn(true); - BannerText bannerText = mock(BannerText.class); - when(bannerText.components()).thenReturn(bannerComponentsList); - - new BannerComponentTree(bannerText, testCreator); - - verify(testCreator).setupNode(bannerComponents, 0, 0, null); - } - - @Test - public void loadInstruction() { - BannerComponents bannerComponents = BannerComponentsFaker.bannerComponents(); - List bannerComponentsList = Collections.singletonList(bannerComponents); - TestNode testNode = mock(TestNode.class); - TestCreator testCreator = mock(TestCreator.class); - when(testCreator.isNodeType(bannerComponents)).thenReturn(true); - when(testCreator.setupNode(bannerComponents, 0, 0, null)).thenReturn(testNode); - TextView textView = mock(TextView.class); - BannerText bannerText = mock(BannerText.class); - when(bannerText.components()).thenReturn(bannerComponentsList); - BannerComponentTree bannerComponentTree = new BannerComponentTree(bannerText, testCreator); - - bannerComponentTree.loadInstruction(textView); - - InOrder inOrder = inOrder(testCreator, testCreator); - inOrder.verify(testCreator).preProcess(any(TextView.class), any(List.class)); - inOrder.verify(testCreator).postProcess(any(TextView.class), any(List.class)); - } - - class TestNode extends BannerComponentNode { - TestNode(BannerComponents bannerComponents, int startIndex) { - super(bannerComponents, startIndex); - } - } - - class TestVerifier implements NodeVerifier { - - @Override - public boolean isNodeType(BannerComponents bannerComponents) { - return true; - } - } - - class TestCreator extends NodeCreator { - TestCreator(TestVerifier nodeVerifier) { - super(nodeVerifier); - } - - @Override - TestNode setupNode(BannerComponents components, int index, int startIndex, String modifier) { - return new TestNode(components, startIndex); - } - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentsFaker.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentsFaker.java deleted file mode 100644 index 0946b502..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentsFaker.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import com.mapbox.services.android.navigation.v5.models.BannerComponents; - -class BannerComponentsFaker { - static BannerComponents bannerComponents() { - return bannerComponentsBuilder().build(); - } - - static BannerComponents.Builder bannerComponentsBuilder() { - return BannerComponents.builder() - .type("some type") - .text("some text"); - } - - static BannerComponents bannerComponentsWithAbbreviation() { - return bannerComponentsBuilder() - .abbreviationPriority(1) - .abbreviation("abbreviation text") - .build(); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoaderTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoaderTest.java deleted file mode 100644 index 37afd855..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionLoaderTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.widget.TextView; - -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class InstructionLoaderTest { - - @Test - public void loadInstruction() { - TextView textView = mock(TextView.class); - BannerComponentTree bannerComponentTree = mock(BannerComponentTree.class); - InstructionLoader instructionLoader = new InstructionLoader(textView, bannerComponentTree); - - instructionLoader.loadInstruction(); - - verify(bannerComponentTree).loadInstruction(textView); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMapTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMapTest.java deleted file mode 100644 index 328e0e07..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/UrlDensityMapTest.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction; - -import android.content.Context; -import android.util.DisplayMetrics; - -import com.mapbox.services.android.navigation.v5.navigation.SdkVersionChecker; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.RETURNS_DEEP_STUBS; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(RobolectricTestRunner.class) -public class UrlDensityMapTest { - - @Test - public void checksDensityLowReturnsOneXPngUrl() { - int lowDensityDpi = 120; - SdkVersionChecker anySdkVersionChecker = new SdkVersionChecker(18); - UrlDensityMap urlDensityMap = new UrlDensityMap(lowDensityDpi, anySdkVersionChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@1x.png", threeXPng); - } - - @Test - public void checksDensityMediumReturnsOneXPngUrl() { - int mediumDensityDpi = 160; - SdkVersionChecker anySdkVersionChecker = new SdkVersionChecker(14); - UrlDensityMap urlDensityMap = new UrlDensityMap(mediumDensityDpi, anySdkVersionChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@1x.png", threeXPng); - } - - @Test - public void checksDensityHighReturnsTwoXPngUrl() { - int highDensityDpi = 240; - SdkVersionChecker anySdkVersionChecker = new SdkVersionChecker(15); - UrlDensityMap urlDensityMap = new UrlDensityMap(highDensityDpi, anySdkVersionChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@2x.png", threeXPng); - } - - @Test - public void checksDensityXHighReturnsThreeXPngUrl() { - int xhighDensityDpi = 320; - SdkVersionChecker anySdkVersionChecker = new SdkVersionChecker(21); - UrlDensityMap urlDensityMap = new UrlDensityMap(xhighDensityDpi, anySdkVersionChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } - - @Test - public void checksAndroidJellyBeanAndDensityXxhighReturnsThreeXPngUrl() { - int xxhighDensityDpi = 480; - SdkVersionChecker jellyBeanChecker = new SdkVersionChecker(16); - UrlDensityMap urlDensityMap = new UrlDensityMap(xxhighDensityDpi, jellyBeanChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } - - @Test - public void checksAndroidJellyBeanMr2AndDensityXxxhighReturnsFourXPngUrl() { - int xxxhighDensityDpi = 640; - SdkVersionChecker jellyBeanMr2Checker = new SdkVersionChecker(18); - UrlDensityMap urlDensityMap = new UrlDensityMap(xxxhighDensityDpi, jellyBeanMr2Checker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@4x.png", threeXPng); - } - - @Test - public void checksAndroidKitkatAndFourHundredDensityReturnsThreeXPngUrl() { - int fourHundredDensityDpi = 400; - SdkVersionChecker kitkatChecker = new SdkVersionChecker(19); - UrlDensityMap urlDensityMap = new UrlDensityMap(fourHundredDensityDpi, kitkatChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } - - @Test - public void checksAndroidLollipopAndFiveHundredAndSixtyDensityReturnsFourXPngUrl() { - int fiveHundredAndSixtyDensityDpi = 560; - SdkVersionChecker lollipopChecker = new SdkVersionChecker(21); - UrlDensityMap urlDensityMap = new UrlDensityMap(fiveHundredAndSixtyDensityDpi, lollipopChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@4x.png", threeXPng); - } - - @Test - public void checksAndroidLollipopMr1AndTwoHundredAndEightyDensityReturnsTwoXPngUrl() { - int twoHundredAndEightyDensityDpi = 280; - SdkVersionChecker lollipopMr1Checker = new SdkVersionChecker(22); - UrlDensityMap urlDensityMap = new UrlDensityMap(twoHundredAndEightyDensityDpi, lollipopMr1Checker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@2x.png", threeXPng); - } - - @Test - public void checksAndroidMAndThreeHundredAndSixtyDensityReturnsThreeXPngUrl() { - int threeHundredAndSixtyDensityDpi = 360; - SdkVersionChecker mChecker = new SdkVersionChecker(23); - UrlDensityMap urlDensityMap = new UrlDensityMap(threeHundredAndSixtyDensityDpi, mChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } - - @Test - public void checksAndroidMAndFourHundredAndTwentyDensityReturnsThreeXPngUrl() { - int fourHundredAndTwentyDensityDpi = 420; - SdkVersionChecker mChecker = new SdkVersionChecker(23); - UrlDensityMap urlDensityMap = new UrlDensityMap(fourHundredAndTwentyDensityDpi, mChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } - - @Test - public void checksAndroidNMr1AndTwoHundredAndSixtyDensityReturnsTwoXPngUrl() { - int twoHundredAndSixtyDensityDpi = 260; - SdkVersionChecker nMr1Checker = new SdkVersionChecker(25); - UrlDensityMap urlDensityMap = new UrlDensityMap(twoHundredAndSixtyDensityDpi, nMr1Checker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@2x.png", threeXPng); - } - - @Test - public void checksAndroidNMr1AndThreeHundredDensityReturnsTwoXPngUrl() { - int threeHundredDensityDpi = 300; - SdkVersionChecker nMr1Checker = new SdkVersionChecker(25); - UrlDensityMap urlDensityMap = new UrlDensityMap(threeHundredDensityDpi, nMr1Checker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@2x.png", threeXPng); - } - - @Test - public void checksAndroidNMr1AndThreeHundredAndFortyDensityReturnsThreeXPngUrl() { - int threeHundredAndFortyDensityDpi = 340; - SdkVersionChecker nMr1Checker = new SdkVersionChecker(25); - UrlDensityMap urlDensityMap = new UrlDensityMap(threeHundredAndFortyDensityDpi, nMr1Checker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } - - @Test - public void checksAndroidPAndFourHundredAndFortyDensityReturnsThreeXPngUrl() { - int fourHundredAndFortyDensityDpi = 440; - SdkVersionChecker androidPChecker = new SdkVersionChecker(28); - UrlDensityMap urlDensityMap = new UrlDensityMap(fourHundredAndFortyDensityDpi, androidPChecker); - String anyUrl = "any.url"; - - String threeXPng = urlDensityMap.get(anyUrl); - - assertEquals(anyUrl + "@3x.png", threeXPng); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewDataTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewDataTest.java deleted file mode 100644 index 99f103cf..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneViewDataTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.instruction.turnlane; - -import org.junit.Test; - -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_RIGHT; -import static com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneViewData.DRAW_LANE_RIGHT_ONLY; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class TurnLaneViewDataTest { - - @Test - public void shouldBeFlipped_trueForUturn() { - String laneIndications = "uturn"; - String maneuverModifier = "modifier"; - TurnLaneViewData data = new TurnLaneViewData(laneIndications, maneuverModifier); - - boolean shouldFlip = data.shouldBeFlipped(); - - assertTrue(shouldFlip); - } - - @Test - public void getDrawMethod_correctForRightLane() { - String laneIndications = "right"; - String maneuverModifier = "modifier"; - TurnLaneViewData data = new TurnLaneViewData(laneIndications, maneuverModifier); - - String drawMethod = data.getDrawMethod(); - - assertEquals(DRAW_LANE_RIGHT, drawMethod); - } - - @Test - public void getDrawMethod_correctForStraightRightLane_modifierRight() { - String laneIndications = "straightright"; - String maneuverModifier = "right"; - TurnLaneViewData data = new TurnLaneViewData(laneIndications, maneuverModifier); - - String drawMethod = data.getDrawMethod(); - - assertEquals(DRAW_LANE_RIGHT_ONLY, drawMethod); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegateTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegateTest.java deleted file mode 100644 index 9eb67c13..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/LocationFpsDelegateTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.location.LocationComponent; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -import org.junit.Test; - -import static org.junit.Assert.assertFalse; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class LocationFpsDelegateTest { - - @Test - public void onCameraIdle_newFpsIsSetZoom16() { - double zoom = 16d; - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getCameraPosition()).thenReturn(buildCameraPosition(zoom)); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.onCameraIdle(); - - verify(locationComponent).setMaxAnimationFps(eq(25)); - } - - @Test - public void onCameraIdle_newFpsIsSetZoom14() { - double zoom = 14d; - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getCameraPosition()).thenReturn(buildCameraPosition(zoom)); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.onCameraIdle(); - - verify(locationComponent).setMaxAnimationFps(eq(15)); - } - - @Test - public void onCameraIdle_newFpsIsSetZoom10() { - double zoom = 10d; - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getCameraPosition()).thenReturn(buildCameraPosition(zoom)); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.onCameraIdle(); - - verify(locationComponent).setMaxAnimationFps(eq(10)); - } - - @Test - public void onCameraIdle_newFpsIsSet5() { - double zoom = 5d; - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getCameraPosition()).thenReturn(buildCameraPosition(zoom)); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.onCameraIdle(); - - verify(locationComponent).setMaxAnimationFps(eq(5)); - } - - @Test - public void onStart_idleListenerAdded() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.onStart(); - - verify(mapboxMap, times(2)).addOnCameraIdleListener(eq(locationFpsDelegate)); - } - - @Test - public void onStop_idleListenerRemoved() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.onStop(); - - verify(mapboxMap).removeOnCameraIdleListener(eq(locationFpsDelegate)); - } - - @Test - public void updateEnabled_falseResetsToMax() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.updateEnabled(false); - - verify(locationComponent).setMaxAnimationFps(eq(Integer.MAX_VALUE)); - } - - @Test - public void isEnabled_returnsFalseWhenSet() { - MapboxMap mapboxMap = mock(MapboxMap.class); - LocationComponent locationComponent = mock(LocationComponent.class); - LocationFpsDelegate locationFpsDelegate = new LocationFpsDelegate(mapboxMap, locationComponent); - - locationFpsDelegate.updateEnabled(false); - - assertFalse(locationFpsDelegate.isEnabled()); - } - - private CameraPosition buildCameraPosition(double zoom) { - return new CameraPosition.Builder().zoom(zoom).build(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegateTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegateTest.java deleted file mode 100644 index 60de5ecb..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapFpsDelegateTest.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.content.Context; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.StepManeuver; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteLegProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteStepProgress; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class MapFpsDelegateTest { - - @Test - public void addProgressChangeListener_navigationReceivesListener() { - MapboxNavigation navigation = mock(MapboxNavigation.class); - MapFpsDelegate delegate = new MapFpsDelegate(mock(MapView.class), mock(MapBatteryMonitor.class)); - - delegate.addProgressChangeListener(navigation); - - verify(navigation).addProgressChangeListener(any(FpsDelegateProgressChangeListener.class)); - } - - @Test - public void onTransitionFinished_resetFpsWhenNotTracking() { - MapView mapView = mock(MapView.class); - MapFpsDelegate delegate = new MapFpsDelegate(mapView, mock(MapBatteryMonitor.class)); - - delegate.onTransitionFinished(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE); - - verify(mapView).setMaximumFps(eq(Integer.MAX_VALUE)); - } - - @Test - public void onTransitionCancelled_resetFpsWhenNotTracking() { - MapView mapView = mock(MapView.class); - MapFpsDelegate delegate = new MapFpsDelegate(mapView, mock(MapBatteryMonitor.class)); - - delegate.onTransitionCancelled(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE); - - verify(mapView).setMaximumFps(eq(Integer.MAX_VALUE)); - } - - @Test - public void onStop_navigationListenerRemoved() { - MapboxNavigation navigation = mock(MapboxNavigation.class); - MapFpsDelegate delegate = new MapFpsDelegate(mock(MapView.class), mock(MapBatteryMonitor.class)); - delegate.addProgressChangeListener(navigation); - - delegate.onStop(); - - verify(navigation).removeProgressChangeListener(any(FpsDelegateProgressChangeListener.class)); - } - - @Test - public void updateEnabledFalse_maxFpsReset() { - MapView mapView = mock(MapView.class); - MapFpsDelegate delegate = new MapFpsDelegate(mapView, mock(MapBatteryMonitor.class)); - - delegate.updateEnabled(false); - - mapView.setMaximumFps(eq(Integer.MAX_VALUE)); - } - - @Test - public void adjustFpsFor_thresholdSetWithCorrectManeuver() { - MapView mapView = mock(MapView.class); - MapBatteryMonitor batteryMonitor = mock(MapBatteryMonitor.class); - when(batteryMonitor.isPluggedIn(any(Context.class))).thenReturn(false); - MapFpsDelegate delegate = new MapFpsDelegate(mapView, batteryMonitor); - RouteProgress routeProgress = buildRouteProgressWith("straight"); - int maxFps = 5; - delegate.updateMaxFpsThreshold(maxFps); - - delegate.adjustFpsFor(routeProgress); - - verify(mapView).setMaximumFps(eq(maxFps)); - } - - @Test - public void adjustFpsFor_thresholdSetWithCorrectDuration() { - MapView mapView = mock(MapView.class); - MapBatteryMonitor batteryMonitor = mock(MapBatteryMonitor.class); - when(batteryMonitor.isPluggedIn(any(Context.class))).thenReturn(false); - MapFpsDelegate delegate = new MapFpsDelegate(mapView, batteryMonitor); - RouteProgress routeProgress = buildRouteProgressWith(100d, 20d); - int maxFps = 5; - delegate.updateMaxFpsThreshold(maxFps); - - delegate.adjustFpsFor(routeProgress); - - verify(mapView).setMaximumFps(eq(maxFps)); - } - - private RouteProgress buildRouteProgressWith(String maneuverModifier) { - RouteProgress routeProgress = mock(RouteProgress.class); - RouteLegProgress routeLegProgress = mock(RouteLegProgress.class); - LegStep currentStep = mock(LegStep.class); - StepManeuver currentManeuver = mock(StepManeuver.class); - when(currentManeuver.modifier()).thenReturn(maneuverModifier); - when(currentStep.maneuver()).thenReturn(currentManeuver); - when(routeLegProgress.currentStep()).thenReturn(currentStep); - when(routeProgress.currentLegProgress()).thenReturn(routeLegProgress); - return routeProgress; - } - - private RouteProgress buildRouteProgressWith(double totalDuration, double durationRemaining) { - RouteProgress routeProgress = mock(RouteProgress.class); - RouteLegProgress routeLegProgress = mock(RouteLegProgress.class); - RouteStepProgress routeStepProgress = mock(RouteStepProgress.class); - StepManeuver currentManeuver = mock(StepManeuver.class); - when(currentManeuver.modifier()).thenReturn("left"); - LegStep currentStep = mock(LegStep.class); - when(currentStep.duration()).thenReturn(totalDuration); - when(routeStepProgress.durationRemaining()).thenReturn(durationRemaining); - when(routeLegProgress.currentStepProgress()).thenReturn(routeStepProgress); - when(routeProgress.currentLegProgress()).thenReturn(routeLegProgress); - when(currentStep.maneuver()).thenReturn(currentManeuver); - when(routeLegProgress.currentStep()).thenReturn(currentStep); - return routeProgress; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractorTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractorTest.java deleted file mode 100644 index 56f3ae0c..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapLayerInteractorTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.layers.CircleLayer; -import com.mapbox.mapboxsdk.style.layers.HeatmapLayer; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class MapLayerInteractorTest { - - @Test - public void updateLayerVisibility_visibilityIsSet() { - LineLayer anySymbolOrLineLayer = mock(LineLayer.class); - when(anySymbolOrLineLayer.getSourceLayer()).thenReturn("any"); - List layers = buildLayerListWith(anySymbolOrLineLayer); - MapboxMap map = mock(MapboxMap.class); - when(map.getStyle()).thenReturn(mock(Style.class)); - when(map.getStyle().getLayers()).thenReturn(layers); - MapLayerInteractor layerInteractor = new MapLayerInteractor(map); - - layerInteractor.updateLayerVisibility(true, "any"); - - verify(anySymbolOrLineLayer).setProperties(any(PropertyValue.class)); - } - - @Test - public void updateLayerVisibility_visibilityIsNotSet() { - SymbolLayer anySymbolOrLineLayer = mock(SymbolLayer.class); - when(anySymbolOrLineLayer.getSourceLayer()).thenReturn("any"); - List layers = buildLayerListWith(anySymbolOrLineLayer); - MapboxMap map = mock(MapboxMap.class); - when(map.getStyle()).thenReturn(mock(Style.class)); - when(map.getStyle().getLayers()).thenReturn(layers); - MapLayerInteractor layerInteractor = new MapLayerInteractor(map); - - layerInteractor.updateLayerVisibility(true, "random"); - - verify(anySymbolOrLineLayer, times(0)).setProperties(any(PropertyValue.class)); - } - - @Test - public void updateLayerVisibility_visibilityIsNotSetIfInvalidLayer() { - CircleLayer invalidLayer = mock(CircleLayer.class); - List layers = buildLayerListWith(invalidLayer); - MapboxMap map = mock(MapboxMap.class); - when(map.getStyle()).thenReturn(mock(Style.class)); - when(map.getStyle().getLayers()).thenReturn(layers); - MapLayerInteractor layerInteractor = new MapLayerInteractor(map); - - layerInteractor.updateLayerVisibility(true, "circle"); - - verify(invalidLayer, times(0)).setProperties(any(PropertyValue.class)); - } - - @Test - public void isLayerVisible_visibleReturnsTrue() { - SymbolLayer anySymbolOrLineLayer = mock(SymbolLayer.class); - when(anySymbolOrLineLayer.getSourceLayer()).thenReturn("any"); - when(anySymbolOrLineLayer.getVisibility()).thenReturn(visibility(Property.VISIBLE)); - List layers = buildLayerListWith(anySymbolOrLineLayer); - MapboxMap map = mock(MapboxMap.class); - when(map.getStyle()).thenReturn(mock(Style.class)); - when(map.getStyle().getLayers()).thenReturn(layers); - MapLayerInteractor layerInteractor = new MapLayerInteractor(map); - - boolean isVisible = layerInteractor.isLayerVisible("any"); - - assertTrue(isVisible); - } - - @Test - public void isLayerVisible_visibleReturnsFalse() { - LineLayer anySymbolOrLineLayer = mock(LineLayer.class); - when(anySymbolOrLineLayer.getSourceLayer()).thenReturn("any"); - when(anySymbolOrLineLayer.getVisibility()).thenReturn(visibility(Property.NONE)); - List layers = buildLayerListWith(anySymbolOrLineLayer); - MapboxMap map = mock(MapboxMap.class); - when(map.getStyle()).thenReturn(mock(Style.class)); - when(map.getStyle().getLayers()).thenReturn(layers); - MapLayerInteractor layerInteractor = new MapLayerInteractor(map); - - boolean isVisible = layerInteractor.isLayerVisible("any"); - - assertFalse(isVisible); - } - - @Test - public void isLayerVisible_visibleReturnsFalseIfInvalidLayer() { - HeatmapLayer invalidLayer = mock(HeatmapLayer.class); - List layers = buildLayerListWith(invalidLayer); - MapboxMap map = mock(MapboxMap.class); - when(map.getStyle()).thenReturn(mock(Style.class)); - when(map.getStyle().getLayers()).thenReturn(layers); - MapLayerInteractor layerInteractor = new MapLayerInteractor(map); - - boolean isVisible = layerInteractor.isLayerVisible("heatmap"); - - assertFalse(isVisible); - } - - private List buildLayerListWith(Layer layerToAdd) { - List layers = new ArrayList<>(); - layers.add(layerToAdd); - return layers; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustorTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustorTest.java deleted file mode 100644 index 1ac03473..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapPaddingAdjustorTest.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import com.mapbox.mapboxsdk.maps.MapboxMap; - -import org.junit.Test; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.TestCase.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -public class MapPaddingAdjustorTest { - - @Test - public void adjustLocationIconWith_customPaddingIsSet() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - int[] customPadding = {0, 0, 0, 0}; - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - - paddingAdjustor.adjustLocationIconWith(customPadding); - - verify(mapboxMap).setPadding(0, 0, 0, 0); - } - - @Test - public void isUsingDefault_falseAfterCustomPaddingIsSet() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - int[] customPadding = {0, 0, 0, 0}; - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - - paddingAdjustor.adjustLocationIconWith(customPadding); - - assertFalse(paddingAdjustor.isUsingDefault()); - } - - @Test - public void isUsingDefault_trueWithoutCustomPadding() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - - assertTrue(paddingAdjustor.isUsingDefault()); - } - - @Test - public void updatePaddingWithZero_updatesMapToZeroPadding() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - - paddingAdjustor.updatePaddingWith(new int[]{0, 0, 0, 0}); - - verify(mapboxMap).setPadding(0, 0, 0, 0); - } - - @Test - public void updatePaddingWithZero_retainsCustomPadding() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - int[] customPadding = {0, 350, 0, 0}; - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - paddingAdjustor.adjustLocationIconWith(customPadding); - paddingAdjustor.updatePaddingWith(new int[]{0, 0, 0, 0}); - - paddingAdjustor.resetPadding(); - - verify(mapboxMap, times(2)).setPadding(0, 350, 0, 0); - } - - @Test - public void updatePaddingWithDefault_defaultIsRestoredAfterCustom() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - int[] customPadding = {0, 0, 0, 0}; - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - paddingAdjustor.adjustLocationIconWith(customPadding); - - paddingAdjustor.updatePaddingWithDefault(); - - verify(mapboxMap).setPadding(0, 250, 0, 0); - } - - @Test - public void retrieveCurrentPadding_returnsCurrentMapPadding() { - MapboxMap mapboxMap = mock(MapboxMap.class); - int[] defaultPadding = {0, 250, 0, 0}; - MapPaddingAdjustor paddingAdjustor = new MapPaddingAdjustor(mapboxMap, defaultPadding); - - paddingAdjustor.retrieveCurrentPadding(); - - verify(mapboxMap).getPadding(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListenerTest.java deleted file mode 100644 index e2f59ea7..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameChangedListenerTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class MapWayNameChangedListenerTest { - - @Test - public void onWayNameChanged_listenersAreUpdated() { - List listeners = new ArrayList<>(); - OnWayNameChangedListener listener = mock(OnWayNameChangedListener.class); - listeners.add(listener); - MapWayNameChangedListener wayNameChangedListener = new MapWayNameChangedListener(listeners); - String someWayName = "some way name"; - - wayNameChangedListener.onWayNameChanged(someWayName); - - verify(listener).onWayNameChanged(eq(someWayName)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameTest.java deleted file mode 100644 index 69706888..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWayNameTest.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.PointF; -import android.location.Location; -import androidx.annotation.NonNull; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@RunWith(RobolectricTestRunner.class) -public class MapWayNameTest { - - @Test - public void onUpdateWaynameWithPoint_queryRenderedFeaturesIsCalled() { - WaynameFeatureFinder featureFinder = mock(WaynameFeatureFinder.class); - MapPaddingAdjustor paddingAdjustor = mock(MapPaddingAdjustor.class); - String[] layerIds = {"streetsLayer"}; - PointF point = mock(PointF.class); - MapWayName mapWayName = new MapWayName(featureFinder, paddingAdjustor); - mapWayName.updateWayNameQueryMap(true); - - mapWayName.updateWayNameWithPoint(point); - - verify(featureFinder).queryRenderedFeatures(point, layerIds); - } - - @Test - public void addOnWayNameChangedListener_duplicateListenerIgnored() { - String roadName = "roadName"; - PointF point = mock(PointF.class); - List roads = buildRoadFeatureList(roadName); - MapWayName mapWayName = buildMapWayname(point, roads); - List stepPoints = new ArrayList<>(); - stepPoints.add(mock(Point.class)); - mapWayName.updateProgress(mock(Location.class), stepPoints); - OnWayNameChangedListener listener = mock(OnWayNameChangedListener.class); - - mapWayName.addOnWayNameChangedListener(listener); - boolean wasAdded = mapWayName.addOnWayNameChangedListener(listener); - - assertFalse(wasAdded); - } - - @Test - public void removeOnWayNameChangedListener_duplicateListenerIgnored() { - String roadName = "roadName"; - PointF point = mock(PointF.class); - List roads = buildRoadFeatureList(roadName); - MapWayName mapWayName = buildMapWayname(point, roads); - List stepPoints = new ArrayList<>(); - stepPoints.add(mock(Point.class)); - mapWayName.updateProgress(mock(Location.class), stepPoints); - OnWayNameChangedListener listener = mock(OnWayNameChangedListener.class); - - mapWayName.removeOnWayNameChangedListener(listener); - boolean wasRemoved = mapWayName.removeOnWayNameChangedListener(listener); - - assertFalse(wasRemoved); - } - - @Test - public void onFeatureWithoutNamePropertyReturned_updateIsIgnored() { - PointF point = mock(PointF.class); - SymbolLayer waynameLayer = mock(SymbolLayer.class); - List roads = new ArrayList<>(); - Feature road = mock(Feature.class); - roads.add(road); - MapWayName mapWayName = buildMapWayname(point, roads); - - mapWayName.updateWayNameWithPoint(point); - - verify(waynameLayer, times(0)).setProperties(any(PropertyValue.class)); - } - - @NonNull - private MapWayName buildMapWayname(PointF point, List roads) { - String[] layerIds = {"streetsLayer"}; - WaynameFeatureFinder featureInteractor = mock(WaynameFeatureFinder.class); - when(featureInteractor.queryRenderedFeatures(point, layerIds)).thenReturn(roads); - MapPaddingAdjustor paddingAdjustor = mock(MapPaddingAdjustor.class); - MapWayName mapWayName = new MapWayName(featureInteractor, paddingAdjustor); - mapWayName.updateWayNameQueryMap(true); - return mapWayName; - } - - @NonNull - private List buildRoadFeatureList(String roadName) { - List roads = new ArrayList<>(); - Feature road = mock(Feature.class); - when(road.hasNonNullValueForProperty("name")).thenReturn(true); - when(road.getStringProperty("name")).thenReturn(roadName); - roads.add(road); - return roads; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapTest.java deleted file mode 100644 index ea77e4b0..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMapTest.java +++ /dev/null @@ -1,336 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.location.LocationComponent; -import com.mapbox.mapboxsdk.location.modes.RenderMode; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.mapboxsdk.style.sources.VectorSource; -import com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera; -import com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute; -import com.mapbox.services.android.navigation.ui.v5.route.OnRouteSelectionChangeListener; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.TestCase.assertTrue; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationMapboxMapTest { - - @Test - public void updateIncidentsVisibility_layerIdentifierIsClosures() { - MapLayerInteractor mockedMapLayerInteractor = mock(MapLayerInteractor.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mockedMapLayerInteractor); - boolean anyVisibility = true; - - theNavigationMap.updateIncidentsVisibility(anyVisibility); - - verify(mockedMapLayerInteractor).updateLayerVisibility(eq(anyVisibility), eq("closures")); - } - - @Test - public void isIncidentsVisible_layerIdentifierIsClosures() { - MapLayerInteractor mockedMapLayerInteractor = mock(MapLayerInteractor.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mockedMapLayerInteractor); - - theNavigationMap.isIncidentsVisible(); - - verify(mockedMapLayerInteractor).isLayerVisible(eq("closures")); - } - - @Test - public void updateTrafficVisibility_layerIdentifierIsTraffic() { - MapLayerInteractor mockedMapLayerInteractor = mock(MapLayerInteractor.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mockedMapLayerInteractor); - boolean anyVisibility = false; - - theNavigationMap.updateTrafficVisibility(anyVisibility); - - verify(mockedMapLayerInteractor).updateLayerVisibility(eq(anyVisibility), eq("traffic")); - } - - @Test - public void isTrafficVisible_layerIdentifierIsTraffic() { - MapLayerInteractor mockedMapLayerInteractor = mock(MapLayerInteractor.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mockedMapLayerInteractor); - - theNavigationMap.isTrafficVisible(); - - verify(mockedMapLayerInteractor).isLayerVisible(eq("traffic")); - } - - @Test - public void updateRenderMode_locationComponentIsUpdatedWithRenderMode() { - LocationComponent locationComponent = mock(LocationComponent.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(locationComponent); - int renderMode = RenderMode.GPS; - - theNavigationMap.updateLocationLayerRenderMode(renderMode); - - verify(locationComponent).setRenderMode(eq(renderMode)); - } - - @Test - public void drawRoutes_mapRoutesAreAdded() { - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapRoute); - List routes = new ArrayList<>(); - - theNavigationMap.drawRoutes(routes); - - verify(mapRoute).addRoutes(eq(routes)); - } - - @Test - public void setOnRouteSelectionChangeListener_listenerIsSet() { - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapRoute); - OnRouteSelectionChangeListener listener = mock(OnRouteSelectionChangeListener.class); - - theNavigationMap.setOnRouteSelectionChangeListener(listener); - - verify(mapRoute).setOnRouteSelectionChangeListener(eq(listener)); - } - - @Test - public void showAlternativeRoutes_correctVisibilityIsSet() { - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapRoute); - boolean notVisible = false; - - theNavigationMap.showAlternativeRoutes(notVisible); - - verify(mapRoute).showAlternativeRoutes(notVisible); - } - - @Test - public void addOnWayNameChangedListener_listenerIsAddedToMapWayname() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate); - OnWayNameChangedListener listener = mock(OnWayNameChangedListener.class); - - boolean isAdded = theNavigationMap.addOnWayNameChangedListener(listener); - - assertTrue(isAdded); - } - - @Test - public void removeOnWayNameChangedListener_listenerIsRemovedFromMapWayname() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate); - OnWayNameChangedListener listener = mock(OnWayNameChangedListener.class); - - theNavigationMap.addOnWayNameChangedListener(listener); - boolean isRemoved = theNavigationMap.removeOnWayNameChangedListener(listener); - - assertTrue(isRemoved); - } - - @Test - public void updateMapFpsThrottle_mapFpsDelegateIsUpdated() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate); - int maxFpsThreshold = 10; - - theNavigationMap.updateMapFpsThrottle(maxFpsThreshold); - - verify(mapFpsDelegate).updateMaxFpsThreshold(maxFpsThreshold); - } - - @Test - public void updateMapFpsThrottleEnabled_mapFpsDelegateIsEnabled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate); - boolean isEnabled = false; - - theNavigationMap.updateMapFpsThrottleEnabled(isEnabled); - - verify(mapFpsDelegate).updateEnabled(isEnabled); - } - - @Test - public void onStart_mapFpsOnStartIsCalled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.onStart(); - - verify(mapFpsDelegate).onStart(); - } - - @Test - public void onStop_mapFpsOnStopIsCalled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.onStop(); - - verify(mapFpsDelegate).onStop(); - } - - @Test - public void onStart_mapWayNameOnStartIsCalled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.onStart(); - - verify(mapWayName).onStart(); - } - - @Test - public void onStop_mapWayNameOnStopIsCalled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.onStop(); - - verify(mapWayName).onStop(); - } - - @Test - public void onInitializeWayName_existingV7StreetSourceIsUsed() { - Style style = mock(Style.class); - String urlV7 = "mapbox://mapbox.mapbox-streets-v7"; - List sources = buildMockSourcesWith(urlV7); - when(style.getSources()).thenReturn(sources); - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getStyle()).thenReturn(style); - MapLayerInteractor layerInteractor = mock(MapLayerInteractor.class); - MapPaddingAdjustor adjustor = mock(MapPaddingAdjustor.class); - - new NavigationMapboxMap(mapboxMap, layerInteractor, adjustor); - - verify(layerInteractor).addStreetsLayer("composite", "road_label"); - } - - @Test - public void updateLocationFpsThrottleEnabled_locationFpsUpdateEnabledIsSet() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.updateLocationFpsThrottleEnabled(false); - - verify(locationFpsDelegate).updateEnabled(eq(false)); - } - - @Test - public void onStart_locationFpsUpdateOnStartIsCalled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.onStart(); - - verify(locationFpsDelegate).onStart(); - } - - @Test - public void onStop_locationFpsUpdateOnStopIsCalled() { - MapWayName mapWayName = mock(MapWayName.class); - MapFpsDelegate mapFpsDelegate = mock(MapFpsDelegate.class); - NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); - NavigationCamera mapCamera = mock(NavigationCamera.class); - LocationFpsDelegate locationFpsDelegate = mock(LocationFpsDelegate.class); - NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapWayName, mapFpsDelegate, - mapRoute, mapCamera, locationFpsDelegate); - - theNavigationMap.onStop(); - - verify(locationFpsDelegate).onStop(); - } - - @Test - public void onInitializeWayName_exisitingV8StreetSourceIsUsed() { - Style style = mock(Style.class); - String urlV7 = "mapbox://mapbox.mapbox-streets-v8"; - List sources = buildMockSourcesWith(urlV7); - when(style.getSources()).thenReturn(sources); - MapboxMap mapboxMap = mock(MapboxMap.class); - when(mapboxMap.getStyle()).thenReturn(style); - MapLayerInteractor layerInteractor = mock(MapLayerInteractor.class); - MapPaddingAdjustor adjustor = mock(MapPaddingAdjustor.class); - - new NavigationMapboxMap(mapboxMap, layerInteractor, adjustor); - - verify(layerInteractor).addStreetsLayer("composite", "road"); - } - - @Test - public void addDestinationMarker_navigationSymbolManagerReceivesPosition() { - Point position = mock(Point.class); - NavigationSymbolManager navigationSymbolManager = mock(NavigationSymbolManager.class); - NavigationMapboxMap map = new NavigationMapboxMap(navigationSymbolManager); - - map.addDestinationMarker(position); - - verify(navigationSymbolManager).addDestinationMarkerFor(position); - } - - @Test - public void addCustomMarker_navigationSymbolManagerReceivesOptions() { - SymbolOptions options = mock(SymbolOptions.class); - NavigationSymbolManager navigationSymbolManager = mock(NavigationSymbolManager.class); - NavigationMapboxMap map = new NavigationMapboxMap(navigationSymbolManager); - - map.addCustomMarker(options); - - verify(navigationSymbolManager).addCustomSymbolFor(options); - } - - private List buildMockSourcesWith(String url) { - List sources = new ArrayList<>(); - VectorSource vectorSource1 = mock(VectorSource.class); - VectorSource vectorSource2 = mock(VectorSource.class); - when(vectorSource2.getId()).thenReturn("composite"); - when(vectorSource2.getUrl()).thenReturn(url); - GeoJsonSource geoJsonSource = mock(GeoJsonSource.class); - sources.add(vectorSource1); - sources.add(vectorSource2); - sources.add(geoJsonSource); - return sources; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManagerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManagerTest.java deleted file mode 100644 index 2427b1ec..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationSymbolManagerTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.plugins.annotation.Symbol; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager; -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationSymbolManagerTest { - - @Test - public void addDestinationMarkerFor_symbolManagerAddsOptions() { - SymbolManager symbolManager = mock(SymbolManager.class); - Symbol symbol = mock(Symbol.class); - when(symbolManager.create(any(SymbolOptions.class))).thenReturn(symbol); - NavigationSymbolManager navigationSymbolManager = new NavigationSymbolManager(symbolManager); - Point position = Point.fromLngLat(1.2345, 1.3456); - - navigationSymbolManager.addDestinationMarkerFor(position); - - verify(symbolManager).create(any(SymbolOptions.class)); - } - - @Test - public void removeAllMarkerSymbols_previouslyAddedMarkersRemoved() { - SymbolManager symbolManager = mock(SymbolManager.class); - Symbol symbol = mock(Symbol.class); - when(symbolManager.create(any(SymbolOptions.class))).thenReturn(symbol); - NavigationSymbolManager navigationSymbolManager = new NavigationSymbolManager(symbolManager); - Point position = Point.fromLngLat(1.2345, 1.3456); - navigationSymbolManager.addDestinationMarkerFor(position); - - navigationSymbolManager.removeAllMarkerSymbols(); - - verify(symbolManager).delete(symbol); - } - - @Test - public void addDestinationMarkerFor_previouslyAddedMarkersRemoved() { - SymbolManager symbolManager = mock(SymbolManager.class); - Symbol symbol = mock(Symbol.class); - SymbolOptions symbolOptions = mock(SymbolOptions.class); - when(symbolManager.create(symbolOptions)).thenReturn(symbol); - NavigationSymbolManager navigationSymbolManager = new NavigationSymbolManager(symbolManager); - - navigationSymbolManager.addCustomSymbolFor(symbolOptions); - - verify(symbolManager).create(symbolOptions); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListenerTest.java deleted file mode 100644 index eb43f977..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/SymbolOnStyleLoadedListenerTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.Bitmap; - -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; - -import org.junit.Test; - -import static com.mapbox.services.android.navigation.ui.v5.map.NavigationSymbolManager.MAPBOX_NAVIGATION_MARKER_NAME; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class SymbolOnStyleLoadedListenerTest { - - @Test - public void onDidFinishLoadingStyle_markerIsAdded() { - MapboxMap mapboxMap = mock(MapboxMap.class); - Style style = mock(Style.class); - when(mapboxMap.getStyle()).thenReturn(style); - Bitmap markerBitmap = mock(Bitmap.class); - SymbolOnStyleLoadedListener listener = new SymbolOnStyleLoadedListener(mapboxMap, markerBitmap); - - listener.onDidFinishLoadingStyle(); - - verify(style).addImage(eq(MAPBOX_NAVIGATION_MARKER_NAME), eq(markerBitmap)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilterTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilterTest.java deleted file mode 100644 index ac57b197..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFilterTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import static com.google.common.base.Charsets.UTF_8; -import static org.mockito.Mockito.mock; - -import android.location.Location; - -import androidx.annotation.NonNull; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; - -import org.junit.Test; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Scanner; - -public class WaynameFeatureFilterTest { - - @Test - public void findPointFromCurrentPoint() { - Feature featureOne = Feature.fromJson(loadJsonFixture("feature_one.json")); - Point currentPoint = Point.fromLngLat(1.234, 4.567); - WaynameFeatureFilter waynameFeatureFilter = buildFilter(); - - Point featureAheadOfUser = waynameFeatureFilter.findPointFromCurrentPoint(currentPoint, (LineString) featureOne.geometry()); - } - - private List buildQueriedFeatures() { - List queriedFeatures = new ArrayList<>(); - Feature featureOne = Feature.fromJson(loadJsonFixture("feature_one.json")); - Feature featureTwo = Feature.fromJson(loadJsonFixture("feature_two.json")); - queriedFeatures.add(featureOne); - queriedFeatures.add(featureTwo); - return queriedFeatures; - } - - private String loadJsonFixture(String filename) { - ClassLoader classLoader = getClass().getClassLoader(); - InputStream inputStream = classLoader.getResourceAsStream(filename); - Scanner scanner = new Scanner(inputStream, UTF_8.name()).useDelimiter("\\A"); - return scanner.hasNext() ? scanner.next() : ""; - } - - @NonNull - private WaynameFeatureFilter buildFilter() { - return new WaynameFeatureFilter(Collections.emptyList(), mock(Location.class), Collections.emptyList()); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinderTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinderTest.java deleted file mode 100644 index a7f39738..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/WaynameFeatureFinderTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.map; - -import android.graphics.PointF; - -import com.mapbox.mapboxsdk.maps.MapboxMap; - -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class WaynameFeatureFinderTest { - - @Test - public void queryRenderedFeatures_mapboxMapIsCalled() { - MapboxMap mapboxMap = mock(MapboxMap.class); - WaynameFeatureFinder featureFinder = new WaynameFeatureFinder(mapboxMap); - PointF point = mock(PointF.class); - String[] layerIds = {"id", "id"}; - - featureFinder.queryRenderedFeatures(point, layerIds); - - verify(mapboxMap).queryRenderedFeatures(point, layerIds); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListenerTest.java deleted file mode 100644 index 7d7dd3c6..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteClickListenerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.core.constants.Constants; -import com.mapbox.geojson.LineString; -import com.mapbox.mapboxsdk.geometry.LatLng; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class MapRouteClickListenerTest { - - @Test - public void checksOnRouteSelectionChangeListenerIsCalledWhenClickedRouteIsFound() { - DirectionsRoute anyRoute = buildMockDirectionsRoute(); - List anyDirectionsRoutes = buildDirectionsRoutes(anyRoute); - LineString anyRouteGeometry = LineString.fromPolyline(anyRoute.geometry(), Constants.PRECISION_6); - HashMap anyLineStringDirectionsRouteMap = - buildLineStringDirectionsRouteHashMap(anyRoute, anyRouteGeometry); - MapRouteLine mockedMapRouteLine = buildMockMapRouteLine(true, anyLineStringDirectionsRouteMap); - when(mockedMapRouteLine.updatePrimaryRouteIndex(anyInt())).thenReturn(true); - when(mockedMapRouteLine.retrieveDirectionsRoutes()).thenReturn(anyDirectionsRoutes); - MapRouteClickListener theMapRouteClickListener = new MapRouteClickListener(mockedMapRouteLine); - OnRouteSelectionChangeListener mockedOnRouteSelectionChangeListener = - buildMockOnRouteSelectionChangeListener(theMapRouteClickListener); - LatLng mockedPoint = mock(LatLng.class); - - theMapRouteClickListener.onMapClick(mockedPoint); - - verify(mockedOnRouteSelectionChangeListener).onNewPrimaryRouteSelected(any(DirectionsRoute.class)); - } - - @Test - public void checksOnRouteSelectionChangeListenerIsNotCalledWhenRouteIsNotVisible() { - HashMap mockedLineStringDirectionsRouteMap = mock(HashMap.class); - MapRouteLine mockedMapRouteLine = buildMockMapRouteLine(false, mockedLineStringDirectionsRouteMap); - MapRouteClickListener theMapRouteClickListener = new MapRouteClickListener(mockedMapRouteLine); - OnRouteSelectionChangeListener mockedOnRouteSelectionChangeListener = - buildMockOnRouteSelectionChangeListener(theMapRouteClickListener); - LatLng mockedPoint = mock(LatLng.class); - - theMapRouteClickListener.onMapClick(mockedPoint); - - verify(mockedOnRouteSelectionChangeListener, never()).onNewPrimaryRouteSelected(any(DirectionsRoute.class)); - } - - private DirectionsRoute buildMockDirectionsRoute() { - DirectionsRoute anyRoute = mock(DirectionsRoute.class); - when(anyRoute.geometry()).thenReturn("awbagAzavnhFp`@~fGr~Ya|BhcBwcYbr\\u{C`tZ~{H~vrBsge@bdo@`kc@dqpAckUbmn" + - "@sphAjnDovu@zviDgasDpa^ixsBbmy@{ubBvou@ajy@|}\\y~q@dycAcotGj{v@cdr@lyUwpC"); - when(anyRoute.routeIndex()).thenReturn("1"); - return anyRoute; - } - - private List buildDirectionsRoutes(DirectionsRoute anyRoute) { - List anyDirectionsRoutes = new ArrayList<>(); - anyDirectionsRoutes.add(anyRoute); - return anyDirectionsRoutes; - } - - private HashMap buildLineStringDirectionsRouteHashMap(DirectionsRoute anyRoute, - LineString anyRouteGeometry) { - HashMap anyLineStringDirectionsRouteMap = new HashMap<>(); - anyLineStringDirectionsRouteMap.put(anyRouteGeometry, anyRoute); - return anyLineStringDirectionsRouteMap; - } - - private MapRouteLine buildMockMapRouteLine(boolean isVisible, - HashMap lineStringDirectionsRouteMap) { - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - when(mockedMapRouteLine.retrieveVisibility()).thenReturn(isVisible); - when(mockedMapRouteLine.retrieveRouteLineStrings()).thenReturn(lineStringDirectionsRouteMap); - return mockedMapRouteLine; - } - - private OnRouteSelectionChangeListener buildMockOnRouteSelectionChangeListener(MapRouteClickListener theMapRouteClickListener) { - OnRouteSelectionChangeListener mockedOnRouteSelectionChangeListener = mock(OnRouteSelectionChangeListener.class); - theMapRouteClickListener.setOnRouteSelectionChangeListener(mockedOnRouteSelectionChangeListener); - return mockedOnRouteSelectionChangeListener; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLineTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLineTest.java deleted file mode 100644 index 6923a7d9..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteLineTest.java +++ /dev/null @@ -1,393 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.ROUTE_SHIELD_LAYER_ID; -import static com.mapbox.services.android.navigation.ui.v5.route.RouteConstants.WAYPOINT_LAYER_ID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyFloat; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; -import android.os.Handler; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.LineString; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.services.android.navigation.ui.v5.BaseTest; -import com.mapbox.services.android.navigation.ui.v5.R; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.robolectric.RobolectricTestRunner; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -@RunWith(RobolectricTestRunner.class) -public class MapRouteLineTest extends BaseTest { - // TODO explore making tasks as Runnables and create the thread in the call-site. - // That way we'll be able to execute the run synchronously, avoiding `CountDownLatch` - - private Style style; - - @Before - public void setUp() { - style = mock(Style.class); - when(style.getLayers()).thenReturn(Collections.emptyList()); - } - - @Test - public void onDraw_routeLineSourceIsSet() throws Exception { - GeoJsonSource routeLineSource = mock(GeoJsonSource.class); - GeoJsonSource wayPointSource = mock(GeoJsonSource.class); - List routeLayerIds = buildMockLayers(); - MapRouteLine routeLine = new MapRouteLine(routeLineSource, wayPointSource, routeLayerIds); - List routes = new ArrayList<>(); - routes.add(buildTestDirectionsRoute()); - ArgumentCaptor runnableFeatures = ArgumentCaptor.forClass(Runnable.class); - ArgumentCaptor runnablePrimary = ArgumentCaptor.forClass(Runnable.class); - CountDownLatch latchRunnableFeatures = new CountDownLatch(1); - CountDownLatch latchRunnablePrimary = new CountDownLatch(1); - CountDownLatch latch = new CountDownLatch(1); - Handler handlerFeatures = mock(Handler.class); - buildFeatureProcessingTask(routes, routeLine, handlerFeatures); - Handler handlerPrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerPrimary); - - routeLine.draw(routes); - latchRunnableFeatures.await(25, TimeUnit.MILLISECONDS); - verify(handlerFeatures).post(runnableFeatures.capture()); - runnableFeatures.getValue().run(); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerPrimary).post(runnablePrimary.capture()); - runnablePrimary.getValue().run(); - - latch.await(25, TimeUnit.MILLISECONDS); - verify(routeLineSource, times(3)).setGeoJson(any(FeatureCollection.class)); - } - - @Test - public void onDraw_wayPointSourceIsSet() throws Exception { - GeoJsonSource routeLineSource = mock(GeoJsonSource.class); - GeoJsonSource wayPointSource = mock(GeoJsonSource.class); - List routeLayerIds = buildMockLayers(); - MapRouteLine routeLine = new MapRouteLine(routeLineSource, wayPointSource, routeLayerIds); - List routes = new ArrayList<>(); - routes.add(buildTestDirectionsRoute()); - ArgumentCaptor runnableFeatures = ArgumentCaptor.forClass(Runnable.class); - ArgumentCaptor runnablePrimary = ArgumentCaptor.forClass(Runnable.class); - CountDownLatch latchRunnableFeatures = new CountDownLatch(1); - CountDownLatch latchRunnablePrimary = new CountDownLatch(1); - CountDownLatch latch = new CountDownLatch(1); - Handler handlerFeatures = mock(Handler.class); - buildFeatureProcessingTask(routes, routeLine, handlerFeatures); - Handler handlerPrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerPrimary); - - routeLine.draw(routes); - latchRunnableFeatures.await(25, TimeUnit.MILLISECONDS); - verify(handlerFeatures).post(runnableFeatures.capture()); - runnableFeatures.getValue().run(); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerPrimary).post(runnablePrimary.capture()); - runnablePrimary.getValue().run(); - - latch.await(25, TimeUnit.MILLISECONDS); - verify(wayPointSource, times(2)).setGeoJson(any(FeatureCollection.class)); - } - - @Test - public void onStyleLoaded_recreateRouteLine() { - TypedArray typedArray = mock(TypedArray.class); - Context context = mock(Context.class); - when(context.obtainStyledAttributes(anyInt(), any(int[].class))).thenReturn(typedArray); - - LineLayer routeShieldLayer = mock(LineLayer.class); - when(routeShieldLayer.getId()).thenReturn(ROUTE_SHIELD_LAYER_ID); - LineLayer routeLayer = mock(LineLayer.class); - when(routeLayer.getId()).thenReturn(ROUTE_LAYER_ID); - SymbolLayer wayPointLayer = mock(SymbolLayer.class); - when(wayPointLayer.getId()).thenReturn(WAYPOINT_LAYER_ID); - MapRouteLayerProvider mapRouteLayerProvider = mock(MapRouteLayerProvider.class); - when(mapRouteLayerProvider.initializeRouteLayer( - eq(style), anyBoolean(), anyFloat(), anyFloat(), - anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt())) - .thenReturn(routeLayer); - when(mapRouteLayerProvider.initializeRouteShieldLayer( - eq(style), anyFloat(), anyFloat(), anyInt(), anyInt() - )).thenReturn(routeShieldLayer); - when(mapRouteLayerProvider.initializeWayPointLayer( - eq(style), any(Drawable.class), any(Drawable.class) - )).thenReturn(wayPointLayer); - - FeatureCollection routesFeatureCollection = mock(FeatureCollection.class); - FeatureCollection waypointsFeatureCollection = mock(FeatureCollection.class); - GeoJsonSource routeLineSource = mock(GeoJsonSource.class); - GeoJsonSource wayPointSource = mock(GeoJsonSource.class); - MapRouteSourceProvider mapRouteSourceProvider = mock(MapRouteSourceProvider.class); - when(mapRouteSourceProvider.build( - eq(RouteConstants.ROUTE_SOURCE_ID), eq(routesFeatureCollection), any(GeoJsonOptions.class) - )).thenReturn(routeLineSource); - when(mapRouteSourceProvider.build( - eq(RouteConstants.WAYPOINT_SOURCE_ID), eq(waypointsFeatureCollection), any(GeoJsonOptions.class) - )).thenReturn(wayPointSource); - - new MapRouteLine( - context, - style, - 10, - null, - buildDrawableProvider(), - mapRouteSourceProvider, - mapRouteLayerProvider, - routesFeatureCollection, - waypointsFeatureCollection, - new ArrayList(), - new ArrayList(), - new HashMap(), - 0, - true, - true, - mock(Handler.class) - ); - - verify(style).addLayer(routeLayer); - verify(style).addLayer(routeShieldLayer); - verify(style).addLayer(wayPointLayer); - verify(style).addSource(routeLineSource); - verify(style).addSource(wayPointSource); - - verify(routeLineSource, times(0)).setGeoJson(any(FeatureCollection.class)); - verify(wayPointSource, times(0)).setGeoJson(any(FeatureCollection.class)); - } - - @Test - public void updatePrimaryIndex_routeLineSourceIsSet() throws Exception { - GeoJsonSource routeLineSource = mock(GeoJsonSource.class); - GeoJsonSource wayPointSource = mock(GeoJsonSource.class); - List routeLayerIds = buildMockLayers(); - MapRouteLine routeLine = new MapRouteLine(routeLineSource, wayPointSource, routeLayerIds); - List routes = new ArrayList<>(); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - ArgumentCaptor runnableFeatures = ArgumentCaptor.forClass(Runnable.class); - ArgumentCaptor runnablePrimary = ArgumentCaptor.forClass(Runnable.class); - CountDownLatch latchRunnableFeatures = new CountDownLatch(1); - CountDownLatch latchRunnablePrimary = new CountDownLatch(1); - CountDownLatch latch = new CountDownLatch(1); - Handler handlerFeatures = mock(Handler.class); - buildFeatureProcessingTask(routes, routeLine, handlerFeatures); - Handler handlerPrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerPrimary); - routeLine.draw(routes); - latchRunnableFeatures.await(25, TimeUnit.MILLISECONDS); - verify(handlerFeatures).post(runnableFeatures.capture()); - runnableFeatures.getValue().run(); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerPrimary).post(runnablePrimary.capture()); - runnablePrimary.getValue().run(); - ArgumentCaptor runnableUpdatePrimary = ArgumentCaptor.forClass(Runnable.class); - Handler handlerUpdatePrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerUpdatePrimary); - - routeLine.updatePrimaryRouteIndex(1); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerUpdatePrimary).post(runnableUpdatePrimary.capture()); - runnableUpdatePrimary.getValue().run(); - - latch.await(25, TimeUnit.MILLISECONDS); - verify(routeLineSource, times(4)).setGeoJson(any(FeatureCollection.class)); - } - - @Test - public void updatePrimaryIndex_newPrimaryRouteIndexUpdated() throws Exception { - GeoJsonSource routeLineSource = mock(GeoJsonSource.class); - GeoJsonSource wayPointSource = mock(GeoJsonSource.class); - List routeLayerIds = buildMockLayers(); - MapRouteLine routeLine = new MapRouteLine(routeLineSource, wayPointSource, routeLayerIds); - List routes = new ArrayList<>(); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - ArgumentCaptor runnableFeatures = ArgumentCaptor.forClass(Runnable.class); - ArgumentCaptor runnablePrimary = ArgumentCaptor.forClass(Runnable.class); - CountDownLatch latchRunnableFeatures = new CountDownLatch(1); - CountDownLatch latchRunnablePrimary = new CountDownLatch(1); - CountDownLatch latch = new CountDownLatch(1); - Handler handlerFeatures = mock(Handler.class); - buildFeatureProcessingTask(routes, routeLine, handlerFeatures); - Handler handlerPrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerPrimary); - routeLine.draw(routes); - latchRunnableFeatures.await(25, TimeUnit.MILLISECONDS); - verify(handlerFeatures).post(runnableFeatures.capture()); - runnableFeatures.getValue().run(); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerPrimary).post(runnablePrimary.capture()); - runnablePrimary.getValue().run(); - ArgumentCaptor runnableUpdatePrimary = ArgumentCaptor.forClass(Runnable.class); - Handler handlerUpdatePrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerUpdatePrimary); - - boolean isNewIndex = routeLine.updatePrimaryRouteIndex(3); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerUpdatePrimary).post(runnableUpdatePrimary.capture()); - runnableUpdatePrimary.getValue().run(); - - latch.await(25, TimeUnit.MILLISECONDS); - assertTrue(isNewIndex); - assertEquals(3, routeLine.retrievePrimaryRouteIndex()); - } - - @Test - public void updatePrimaryIndex_newPrimaryRouteIndexIsNotUpdated() throws Exception { - GeoJsonSource routeLineSource = mock(GeoJsonSource.class); - GeoJsonSource wayPointSource = mock(GeoJsonSource.class); - List routeLayerIds = buildMockLayers(); - MapRouteLine routeLine = new MapRouteLine(routeLineSource, wayPointSource, routeLayerIds); - List routes = new ArrayList<>(); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - routes.add(buildTestDirectionsRoute()); - ArgumentCaptor runnableFeatures = ArgumentCaptor.forClass(Runnable.class); - ArgumentCaptor runnablePrimary = ArgumentCaptor.forClass(Runnable.class); - CountDownLatch latchRunnableFeatures = new CountDownLatch(1); - CountDownLatch latchRunnablePrimary = new CountDownLatch(1); - CountDownLatch latch = new CountDownLatch(1); - Handler handlerFeatures = mock(Handler.class); - buildFeatureProcessingTask(routes, routeLine, handlerFeatures); - Handler handlerPrimary = mock(Handler.class); - buildPrimaryRouteUpdateTask(routeLine, handlerPrimary); - routeLine.draw(routes); - latchRunnableFeatures.await(25, TimeUnit.MILLISECONDS); - verify(handlerFeatures).post(runnableFeatures.capture()); - runnableFeatures.getValue().run(); - latchRunnablePrimary.await(25, TimeUnit.MILLISECONDS); - verify(handlerPrimary).post(runnablePrimary.capture()); - runnablePrimary.getValue().run(); - - boolean isNewIndex = routeLine.updatePrimaryRouteIndex(-1); - - latch.await(25, TimeUnit.MILLISECONDS); - assertFalse(isNewIndex); - assertEquals(0, routeLine.retrievePrimaryRouteIndex()); - } - - @Test - public void routeLineCap_defaultIsSet() { - Context context = mock(Context.class); - TypedArray typedArray = mock(TypedArray.class); - when(context.obtainStyledAttributes(anyInt(), eq(R.styleable.NavigationMapRoute))).thenReturn(typedArray); - when(typedArray.getBoolean(R.styleable.NavigationMapRoute_roundedLineCap, true)).thenReturn(true); - MapRouteLayerProvider layerProvider = buildLayerProvider(); - Handler handler = mock(Handler.class); - - new MapRouteLine(context, style, R.style.NavigationMapRoute, "", - buildDrawableProvider(), mock(MapRouteSourceProvider.class), layerProvider, handler - ); - - verify(layerProvider).initializeRouteLayer(eq(style), eq(true), anyFloat(), anyFloat(), - anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt() - ); - } - - @Test - public void routeLineCap_isSetFromAttributes() { - Context context = mock(Context.class); - TypedArray typedArray = mock(TypedArray.class); - when(context.obtainStyledAttributes(anyInt(), eq(R.styleable.NavigationMapRoute))).thenReturn(typedArray); - when(typedArray.getBoolean(R.styleable.NavigationMapRoute_roundedLineCap, true)).thenReturn(false); - MapRouteLayerProvider layerProvider = buildLayerProvider(); - Handler handler = mock(Handler.class); - - new MapRouteLine(context, style, R.style.NavigationMapRoute, "", - buildDrawableProvider(), mock(MapRouteSourceProvider.class), layerProvider, handler - ); - - verify(layerProvider).initializeRouteLayer(eq(style), eq(false), anyFloat(), anyFloat(), - anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt() - ); - } - - @NonNull - private List buildMockLayers() { - List routeLayers = new ArrayList<>(); - routeLayers.add(ROUTE_LAYER_ID); - routeLayers.add(ROUTE_LAYER_ID); - return routeLayers; - } - - private MapRouteLayerProvider buildLayerProvider() { - LineLayer routeShieldLayer = mock(LineLayer.class); - when(routeShieldLayer.getId()).thenReturn(ROUTE_SHIELD_LAYER_ID); - LineLayer routeLayer = mock(LineLayer.class); - when(routeLayer.getId()).thenReturn(ROUTE_LAYER_ID); - SymbolLayer wayPointLayer = mock(SymbolLayer.class); - when(wayPointLayer.getId()).thenReturn(WAYPOINT_LAYER_ID); - MapRouteLayerProvider mapRouteLayerProvider = mock(MapRouteLayerProvider.class); - when(mapRouteLayerProvider.initializeRouteLayer( - eq(style), anyBoolean(), anyFloat(), anyFloat(), - anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt())) - .thenReturn(routeLayer); - when(mapRouteLayerProvider.initializeRouteShieldLayer( - eq(style), anyFloat(), anyFloat(), anyInt(), anyInt() - )).thenReturn(routeShieldLayer); - when(mapRouteLayerProvider.initializeWayPointLayer( - eq(style), any(Drawable.class), any(Drawable.class) - )).thenReturn(wayPointLayer); - - return mapRouteLayerProvider; - } - - private MapRouteDrawableProvider buildDrawableProvider() { - Drawable drawable = mock(Drawable.class); - MapRouteDrawableProvider mapRouteDrawableProvider = mock(MapRouteDrawableProvider.class); - when(mapRouteDrawableProvider.retrieveDrawable(anyInt())).thenReturn(drawable); - return mapRouteDrawableProvider; - } - - private FeatureProcessingTask buildFeatureProcessingTask(List routes, MapRouteLine routeLine, Handler handler) { - OnRouteFeaturesProcessedCallback featuresProcessedCallback = routeLine.retrieveRouteFeaturesProcessedCallback(); - FeatureProcessingTask featureProcessingTask = new FeatureProcessingTask(routes, featuresProcessedCallback, handler); - routeLine.injectFeatureProcessingTask(featureProcessingTask); - return featureProcessingTask; - } - - private PrimaryRouteUpdateTask buildPrimaryRouteUpdateTask(MapRouteLine routeLine, Handler handler) { - OnPrimaryRouteUpdatedCallback primaryRouteUpdatedCallback = routeLine.retrievePrimaryRouteUpdatedCallback(); - FeatureCollection featureCollectionFirst = FeatureCollection.fromJson("{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034673,38.900205],[-77.034433,38.900204],[-77.033776,38.900206],[-77.033638,38.900207],[-77.033638,38.900324],[-77.03364,38.900698],[-77.03364,38.900755],[-77.033642,38.90123],[-77.033642,38.901335],[-77.033752,38.901335],[-77.034472,38.901335],[-77.034593,38.901335],[-77.034697,38.901335],[-77.034765,38.901335],[-77.036406,38.901334],[-77.036546,38.901334],[-77.036684,38.901334],[-77.038381,38.901334],[-77.038522,38.901334],[-77.038646,38.901335],[-77.038931,38.901334],[-77.039295,38.901334],[-77.039446,38.901333],[-77.040597,38.901333],[-77.041714,38.901333],[-77.04171,38.902029],[-77.041708,38.902395],[-77.041706,38.902523],[-77.042088,38.902524],[-77.042193,38.902524],[-77.042946,38.902524],[-77.043254,38.902524],[-77.043336,38.902524],[-77.043464,38.902524],[-77.043655,38.902526],[-77.043799,38.902525],[-77.044419,38.902526],[-77.044713,38.902526],[-77.044903,38.902527],[-77.045073,38.902527],[-77.045277,38.902528],[-77.045821,38.902529],[-77.046046,38.902529],[-77.046119,38.902529],[-77.046288,38.90253],[-77.046468,38.90253],[-77.04665,38.902531],[-77.047074,38.902561],[-77.04796,38.902562],[-77.048544,38.902563],[-77.048925,38.902564],[-77.049196,38.902566],[-77.050357,38.902568],[-77.05102,38.902569],[-77.051115,38.902569],[-77.051301,38.902569],[-77.051516,38.90257],[-77.052924,38.902564],[-77.053455,38.902561],[-77.054826,38.902574],[-77.05519,38.902578],[-77.055331,38.902579],[-77.055655,38.902584],[-77.055821,38.902584],[-77.055898,38.902616],[-77.055978,38.90265],[-77.056016,38.90267],[-77.056035,38.902697],[-77.056054,38.902797],[-77.056089,38.903119],[-77.056116,38.903187],[-77.056188,38.903267],[-77.056446,38.903488],[-77.056532,38.903578],[-77.056577,38.903647],[-77.056596,38.903732],[-77.056538,38.90403],[-77.056498,38.904122],[-77.05643,38.904242],[-77.056344,38.904386],[-77.056121,38.904715],[-77.056017,38.904853],[-77.055805,38.905129],[-77.055598,38.905461],[-77.055429,38.905772],[-77.055328,38.905976],[-77.055241,38.906153],[-77.055076,38.906513],[-77.055015,38.906647],[-77.054895,38.906907],[-77.054771,38.907185],[-77.054748,38.907234],[-77.054672,38.907396],[-77.054484,38.907778],[-77.054459,38.907822],[-77.054418,38.907888],[-77.054374,38.907952],[-77.054327,38.908015],[-77.054301,38.908047],[-77.054287,38.908066],[-77.05422,38.908149],[-77.054149,38.90823],[-77.054039,38.908348],[-77.053954,38.908432],[-77.05389,38.90849],[-77.053789,38.908574],[-77.053719,38.908627],[-77.053683,38.908653],[-77.053646,38.908678],[-77.053591,38.908713],[-77.053553,38.908736],[-77.053475,38.90878],[-77.053354,38.908842],[-77.053271,38.90888],[-77.053228,38.908898],[-77.053181,38.908919],[-77.053091,38.908955],[-77.053029,38.908976],[-77.052965,38.908994],[-77.052901,38.90901],[-77.052836,38.909023],[-77.05277,38.909033],[-77.052736,38.909037],[-77.052687,38.909041],[-77.052602,38.909045],[-77.052474,38.909046],[-77.052346,38.90904],[-77.051858,38.909005],[-77.05168,38.908994],[-77.051532,38.90899],[-77.051494,38.90899],[-77.05141,38.908995],[-77.051354,38.909002],[-77.051272,38.909016],[-77.051137,38.909048],[-77.051073,38.909067],[-77.051011,38.909089],[-77.05098,38.909101],[-77.05095,38.909114],[-77.050903,38.909136],[-77.050873,38.909151],[-77.050786,38.909201],[-77.050758,38.909219],[-77.050704,38.909257],[-77.05067,38.909285],[-77.05062,38.909333],[-77.050585,38.909369],[-77.050529,38.909432],[-77.050469,38.909511],[-77.050446,38.909557],[-77.050396,38.909708],[-77.050389,38.909747],[-77.050384,38.909795],[-77.05038,38.909848],[-77.050379,38.909874],[-77.05038,38.909923],[-77.050385,38.909973],[-77.050389,38.909998],[-77.050399,38.910047],[-77.050405,38.910066],[-77.050422,38.91012],[-77.050444,38.910178],[-77.050458,38.910206],[-77.050487,38.910256],[-77.050503,38.910281],[-77.050595,38.910406],[-77.050709,38.910512],[-77.05084,38.910649],[-77.050948,38.910758],[-77.051115,38.910938],[-77.051327,38.911167],[-77.051614,38.911453],[-77.051997,38.911802],[-77.052252,38.912071],[-77.052791,38.912473],[-77.053007,38.912621],[-77.053215,38.912747],[-77.053469,38.912859],[-77.053665,38.912924],[-77.053904,38.912983],[-77.054107,38.913037],[-77.054349,38.913139],[-77.054457,38.913202],[-77.054717,38.91339],[-77.055261,38.913874],[-77.055611,38.914149],[-77.055997,38.914383],[-77.056418,38.914609],[-77.056996,38.914895],[-77.057384,38.915117],[-77.057699,38.915346],[-77.057898,38.915515],[-77.058092,38.91573],[-77.058205,38.915892],[-77.0583,38.91609],[-77.058347,38.916226],[-77.058379,38.916355],[-77.058397,38.916486],[-77.0584,38.916681],[-77.058361,38.916933],[-77.058308,38.917098],[-77.058264,38.917194],[-77.058176,38.917338],[-77.05806,38.917474],[-77.057817,38.917697],[-77.057674,38.917812],[-77.057624,38.917851],[-77.057562,38.917889],[-77.057471,38.917943],[-77.057382,38.917994],[-77.057266,38.918051],[-77.057106,38.91812],[-77.056989,38.918169],[-77.056861,38.918216],[-77.056711,38.918266],[-77.05653,38.918334],[-77.056211,38.91845],[-77.056077,38.918486],[-77.055738,38.918584],[-77.055619,38.918623],[-77.055456,38.918681],[-77.055345,38.918724],[-77.055221,38.918787],[-77.055097,38.918872],[-77.054882,38.919056],[-77.054653,38.91925],[-77.054503,38.919375],[-77.054474,38.919401],[-77.054411,38.919451],[-77.054313,38.919523],[-77.054244,38.919568],[-77.054207,38.91959],[-77.05417,38.919607],[-77.054102,38.919635],[-77.054032,38.91966],[-77.053961,38.919682],[-77.053899,38.919699],[-77.053638,38.919745],[-77.053526,38.919758],[-77.053418,38.919774],[-77.053311,38.919792],[-77.053257,38.919802],[-77.053151,38.919824],[-77.052927,38.919879],[-77.052871,38.919895],[-77.052809,38.919912],[-77.05275,38.91993],[-77.052663,38.919958],[-77.052511,38.920012],[-77.052257,38.920112],[-77.052029,38.920224],[-77.051742,38.920385],[-77.051554,38.920514],[-77.051393,38.920669],[-77.051315,38.920798],[-77.051275,38.920901],[-77.051254,38.92099],[-77.051221,38.921101],[-77.051203,38.921226],[-77.051189,38.921397],[-77.051188,38.92147],[-77.051187,38.921566],[-77.051132,38.921739],[-77.051044,38.92187],[-77.05092,38.921973],[-77.05072,38.922092],[-77.050556,38.922154],[-77.05048,38.922193],[-77.050287,38.922345],[-77.050148,38.92247],[-77.04999,38.922634],[-77.049914,38.922729],[-77.04989,38.922762],[-77.049846,38.922828],[-77.049825,38.922862],[-77.049806,38.922896],[-77.049775,38.922969],[-77.049747,38.923042],[-77.049723,38.923117],[-77.049703,38.923192],[-77.049686,38.923267],[-77.049663,38.923499],[-77.049655,38.923573],[-77.049656,38.923649],[-77.049655,38.923701],[-77.049658,38.923805],[-77.049661,38.923857],[-77.049672,38.92396],[-77.049687,38.924063],[-77.04972,38.924226],[-77.049749,38.924346],[-77.049783,38.924466],[-77.049822,38.924585],[-77.049866,38.924702],[-77.04989,38.924761],[-77.049922,38.924826],[-77.050023,38.925019],[-77.050096,38.925151],[-77.050146,38.925238],[-77.050243,38.9254],[-77.050687,38.926159],[-77.050854,38.926451],[-77.05104,38.92677],[-77.051103,38.926876],[-77.051165,38.926983],[-77.051204,38.927044],[-77.051211,38.927055]]},\"properties\":{\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034673,38.900205],[-77.034433,38.900204]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034433,38.900204],[-77.033776,38.900206]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033776,38.900206],[-77.033638,38.900207]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033638,38.900207],[-77.033638,38.900324]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033638,38.900324],[-77.03364,38.900698]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03364,38.900698],[-77.03364,38.900755]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03364,38.900755],[-77.033642,38.90123]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033642,38.90123],[-77.033642,38.901335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033642,38.901335],[-77.033752,38.901335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033752,38.901335],[-77.034472,38.901335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034472,38.901335],[-77.034593,38.901335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034593,38.901335],[-77.034697,38.901335]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034697,38.901335],[-77.034765,38.901335]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034765,38.901335],[-77.036406,38.901334]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.036406,38.901334],[-77.036546,38.901334]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.036546,38.901334],[-77.036684,38.901334]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.036684,38.901334],[-77.038381,38.901334]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.038381,38.901334],[-77.038522,38.901334]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.038522,38.901334],[-77.038646,38.901335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.038646,38.901335],[-77.038931,38.901334]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.038931,38.901334],[-77.039295,38.901334]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039295,38.901334],[-77.039446,38.901333]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039446,38.901333],[-77.040597,38.901333]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040597,38.901333],[-77.041714,38.901333]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041714,38.901333],[-77.04171,38.902029]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04171,38.902029],[-77.041708,38.902395]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041708,38.902395],[-77.041706,38.902523]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041706,38.902523],[-77.042088,38.902524]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.042088,38.902524],[-77.042193,38.902524]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.042193,38.902524],[-77.042946,38.902524]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.042946,38.902524],[-77.043254,38.902524]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.043254,38.902524],[-77.043336,38.902524]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.043336,38.902524],[-77.043464,38.902524]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.043464,38.902524],[-77.043655,38.902526]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.043655,38.902526],[-77.043799,38.902525]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.043799,38.902525],[-77.044419,38.902526]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044419,38.902526],[-77.044713,38.902526]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044713,38.902526],[-77.044903,38.902527]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044903,38.902527],[-77.045073,38.902527]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045073,38.902527],[-77.045277,38.902528]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045277,38.902528],[-77.045821,38.902529]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045821,38.902529],[-77.046046,38.902529]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046046,38.902529],[-77.046119,38.902529]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046119,38.902529],[-77.046288,38.90253]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046288,38.90253],[-77.046468,38.90253]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046468,38.90253],[-77.04665,38.902531]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04665,38.902531],[-77.047074,38.902561]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047074,38.902561],[-77.04796,38.902562]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04796,38.902562],[-77.048544,38.902563]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048544,38.902563],[-77.048925,38.902564]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048925,38.902564],[-77.049196,38.902566]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049196,38.902566],[-77.050357,38.902568]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050357,38.902568],[-77.05102,38.902569]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05102,38.902569],[-77.051115,38.902569]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051115,38.902569],[-77.051301,38.902569]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051301,38.902569],[-77.051516,38.90257]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051516,38.90257],[-77.052924,38.902564]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052924,38.902564],[-77.053455,38.902561]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053455,38.902561],[-77.054826,38.902574]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054826,38.902574],[-77.05519,38.902578]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05519,38.902578],[-77.055331,38.902579]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055331,38.902579],[-77.055655,38.902584]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055655,38.902584],[-77.055821,38.902584]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055821,38.902584],[-77.055898,38.902616]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055898,38.902616],[-77.055978,38.90265]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055978,38.90265],[-77.056016,38.90267]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056016,38.90267],[-77.056035,38.902697]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056035,38.902697],[-77.056054,38.902797]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056054,38.902797],[-77.056089,38.903119]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056089,38.903119],[-77.056116,38.903187]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056116,38.903187],[-77.056188,38.903267]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056188,38.903267],[-77.056446,38.903488]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056446,38.903488],[-77.056532,38.903578]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056532,38.903578],[-77.056577,38.903647]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056577,38.903647],[-77.056596,38.903732]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056596,38.903732],[-77.056538,38.90403]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056538,38.90403],[-77.056498,38.904122]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056498,38.904122],[-77.05643,38.904242]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05643,38.904242],[-77.056344,38.904386]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056344,38.904386],[-77.056121,38.904715]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056121,38.904715],[-77.056017,38.904853]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056017,38.904853],[-77.055805,38.905129]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055805,38.905129],[-77.055598,38.905461]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055598,38.905461],[-77.055429,38.905772]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055429,38.905772],[-77.055328,38.905976]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055328,38.905976],[-77.055241,38.906153]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055241,38.906153],[-77.055076,38.906513]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055076,38.906513],[-77.055015,38.906647]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055015,38.906647],[-77.054895,38.906907]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054895,38.906907],[-77.054771,38.907185]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054771,38.907185],[-77.054748,38.907234]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054748,38.907234],[-77.054672,38.907396]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054672,38.907396],[-77.054484,38.907778]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054484,38.907778],[-77.054459,38.907822]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054459,38.907822],[-77.054418,38.907888]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054418,38.907888],[-77.054374,38.907952]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054374,38.907952],[-77.054327,38.908015]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054327,38.908015],[-77.054301,38.908047]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054301,38.908047],[-77.054287,38.908066]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054287,38.908066],[-77.05422,38.908149]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05422,38.908149],[-77.054149,38.90823]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054149,38.90823],[-77.054039,38.908348]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054039,38.908348],[-77.053954,38.908432]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053954,38.908432],[-77.05389,38.90849]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05389,38.90849],[-77.053789,38.908574]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053789,38.908574],[-77.053719,38.908627]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053719,38.908627],[-77.053683,38.908653]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053683,38.908653],[-77.053646,38.908678]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053646,38.908678],[-77.053591,38.908713]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053591,38.908713],[-77.053553,38.908736]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053553,38.908736],[-77.053475,38.90878]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053475,38.90878],[-77.053354,38.908842]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053354,38.908842],[-77.053271,38.90888]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053271,38.90888],[-77.053228,38.908898]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053228,38.908898],[-77.053181,38.908919]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053181,38.908919],[-77.053091,38.908955]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053091,38.908955],[-77.053029,38.908976]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053029,38.908976],[-77.052965,38.908994]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052965,38.908994],[-77.052901,38.90901]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052901,38.90901],[-77.052836,38.909023]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052836,38.909023],[-77.05277,38.909033]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05277,38.909033],[-77.052736,38.909037]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052736,38.909037],[-77.052687,38.909041]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052687,38.909041],[-77.052602,38.909045]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052602,38.909045],[-77.052474,38.909046]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052474,38.909046],[-77.052346,38.90904]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052346,38.90904],[-77.051858,38.909005]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051858,38.909005],[-77.05168,38.908994]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05168,38.908994],[-77.051532,38.90899]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051532,38.90899],[-77.051494,38.90899]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051494,38.90899],[-77.05141,38.908995]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05141,38.908995],[-77.051354,38.909002]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051354,38.909002],[-77.051272,38.909016]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051272,38.909016],[-77.051137,38.909048]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051137,38.909048],[-77.051073,38.909067]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051073,38.909067],[-77.051011,38.909089]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051011,38.909089],[-77.05098,38.909101]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05098,38.909101],[-77.05095,38.909114]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05095,38.909114],[-77.050903,38.909136]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050903,38.909136],[-77.050873,38.909151]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050873,38.909151],[-77.050786,38.909201]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050786,38.909201],[-77.050758,38.909219]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050758,38.909219],[-77.050704,38.909257]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050704,38.909257],[-77.05067,38.909285]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05067,38.909285],[-77.05062,38.909333]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05062,38.909333],[-77.050585,38.909369]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050585,38.909369],[-77.050529,38.909432]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050529,38.909432],[-77.050469,38.909511]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050469,38.909511],[-77.050446,38.909557]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050446,38.909557],[-77.050396,38.909708]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050396,38.909708],[-77.050389,38.909747]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050389,38.909747],[-77.050384,38.909795]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050384,38.909795],[-77.05038,38.909848]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05038,38.909848],[-77.050379,38.909874]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050379,38.909874],[-77.05038,38.909923]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05038,38.909923],[-77.050385,38.909973]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050385,38.909973],[-77.050389,38.909998]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050389,38.909998],[-77.050399,38.910047]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050399,38.910047],[-77.050405,38.910066]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050405,38.910066],[-77.050422,38.91012]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050422,38.91012],[-77.050444,38.910178]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050444,38.910178],[-77.050458,38.910206]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050458,38.910206],[-77.050487,38.910256]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050487,38.910256],[-77.050503,38.910281]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050503,38.910281],[-77.050595,38.910406]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050595,38.910406],[-77.050709,38.910512]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050709,38.910512],[-77.05084,38.910649]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05084,38.910649],[-77.050948,38.910758]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050948,38.910758],[-77.051115,38.910938]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051115,38.910938],[-77.051327,38.911167]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051327,38.911167],[-77.051614,38.911453]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051614,38.911453],[-77.051997,38.911802]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051997,38.911802],[-77.052252,38.912071]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052252,38.912071],[-77.052791,38.912473]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052791,38.912473],[-77.053007,38.912621]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053007,38.912621],[-77.053215,38.912747]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053215,38.912747],[-77.053469,38.912859]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053469,38.912859],[-77.053665,38.912924]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053665,38.912924],[-77.053904,38.912983]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053904,38.912983],[-77.054107,38.913037]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054107,38.913037],[-77.054349,38.913139]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054349,38.913139],[-77.054457,38.913202]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054457,38.913202],[-77.054717,38.91339]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054717,38.91339],[-77.055261,38.913874]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055261,38.913874],[-77.055611,38.914149]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055611,38.914149],[-77.055997,38.914383]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055997,38.914383],[-77.056418,38.914609]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056418,38.914609],[-77.056996,38.914895]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056996,38.914895],[-77.057384,38.915117]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057384,38.915117],[-77.057699,38.915346]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057699,38.915346],[-77.057898,38.915515]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057898,38.915515],[-77.058092,38.91573]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058092,38.91573],[-77.058205,38.915892]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058205,38.915892],[-77.0583,38.91609]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.0583,38.91609],[-77.058347,38.916226]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058347,38.916226],[-77.058379,38.916355]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058379,38.916355],[-77.058397,38.916486]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058397,38.916486],[-77.0584,38.916681]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.0584,38.916681],[-77.058361,38.916933]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058361,38.916933],[-77.058308,38.917098]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058308,38.917098],[-77.058264,38.917194]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058264,38.917194],[-77.058176,38.917338]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.058176,38.917338],[-77.05806,38.917474]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05806,38.917474],[-77.057817,38.917697]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057817,38.917697],[-77.057674,38.917812]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057674,38.917812],[-77.057624,38.917851]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057624,38.917851],[-77.057562,38.917889]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057562,38.917889],[-77.057471,38.917943]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057471,38.917943],[-77.057382,38.917994]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057382,38.917994],[-77.057266,38.918051]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057266,38.918051],[-77.057106,38.91812]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.057106,38.91812],[-77.056989,38.918169]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056989,38.918169],[-77.056861,38.918216]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056861,38.918216],[-77.056711,38.918266]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056711,38.918266],[-77.05653,38.918334]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05653,38.918334],[-77.056211,38.91845]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056211,38.91845],[-77.056077,38.918486]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.056077,38.918486],[-77.055738,38.918584]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055738,38.918584],[-77.055619,38.918623]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055619,38.918623],[-77.055456,38.918681]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055456,38.918681],[-77.055345,38.918724]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055345,38.918724],[-77.055221,38.918787]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055221,38.918787],[-77.055097,38.918872]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.055097,38.918872],[-77.054882,38.919056]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054882,38.919056],[-77.054653,38.91925]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054653,38.91925],[-77.054503,38.919375]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054503,38.919375],[-77.054474,38.919401]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054474,38.919401],[-77.054411,38.919451]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054411,38.919451],[-77.054313,38.919523]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054313,38.919523],[-77.054244,38.919568]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054244,38.919568],[-77.054207,38.91959]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054207,38.91959],[-77.05417,38.919607]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05417,38.919607],[-77.054102,38.919635]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054102,38.919635],[-77.054032,38.91966]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054032,38.91966],[-77.053961,38.919682]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053961,38.919682],[-77.053899,38.919699]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053899,38.919699],[-77.053638,38.919745]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053638,38.919745],[-77.053526,38.919758]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053526,38.919758],[-77.053418,38.919774]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053418,38.919774],[-77.053311,38.919792]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053311,38.919792],[-77.053257,38.919802]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053257,38.919802],[-77.053151,38.919824]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053151,38.919824],[-77.052927,38.919879]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052927,38.919879],[-77.052871,38.919895]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052871,38.919895],[-77.052809,38.919912]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052809,38.919912],[-77.05275,38.91993]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05275,38.91993],[-77.052663,38.919958]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052663,38.919958],[-77.052511,38.920012]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052511,38.920012],[-77.052257,38.920112]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052257,38.920112],[-77.052029,38.920224]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052029,38.920224],[-77.051742,38.920385]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051742,38.920385],[-77.051554,38.920514]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051554,38.920514],[-77.051393,38.920669]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051393,38.920669],[-77.051315,38.920798]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051315,38.920798],[-77.051275,38.920901]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051275,38.920901],[-77.051254,38.92099]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051254,38.92099],[-77.051221,38.921101]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051221,38.921101],[-77.051203,38.921226]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051203,38.921226],[-77.051189,38.921397]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051189,38.921397],[-77.051188,38.92147]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051188,38.92147],[-77.051187,38.921566]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051187,38.921566],[-77.051132,38.921739]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051132,38.921739],[-77.051044,38.92187]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051044,38.92187],[-77.05092,38.921973]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05092,38.921973],[-77.05072,38.922092]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05072,38.922092],[-77.050556,38.922154]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050556,38.922154],[-77.05048,38.922193]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05048,38.922193],[-77.050287,38.922345]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050287,38.922345],[-77.050148,38.92247]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050148,38.92247],[-77.04999,38.922634]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04999,38.922634],[-77.049914,38.922729]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049914,38.922729],[-77.04989,38.922762]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04989,38.922762],[-77.049846,38.922828]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049846,38.922828],[-77.049825,38.922862]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049825,38.922862],[-77.049806,38.922896]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049806,38.922896],[-77.049775,38.922969]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049775,38.922969],[-77.049747,38.923042]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049747,38.923042],[-77.049723,38.923117]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049723,38.923117],[-77.049703,38.923192]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049703,38.923192],[-77.049686,38.923267]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049686,38.923267],[-77.049663,38.923499]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049663,38.923499],[-77.049655,38.923573]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049655,38.923573],[-77.049656,38.923649]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049656,38.923649],[-77.049655,38.923701]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049655,38.923701],[-77.049658,38.923805]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049658,38.923805],[-77.049661,38.923857]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049661,38.923857],[-77.049672,38.92396]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049672,38.92396],[-77.049687,38.924063]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049687,38.924063],[-77.04972,38.924226]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04972,38.924226],[-77.049749,38.924346]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049749,38.924346],[-77.049783,38.924466]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049783,38.924466],[-77.049822,38.924585]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049822,38.924585],[-77.049866,38.924702]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049866,38.924702],[-77.04989,38.924761]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04989,38.924761],[-77.049922,38.924826]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049922,38.924826],[-77.050023,38.925019]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050023,38.925019],[-77.050096,38.925151]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050096,38.925151],[-77.050146,38.925238]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050146,38.925238],[-77.050243,38.9254]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050243,38.9254],[-77.050687,38.926159]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050687,38.926159],[-77.050854,38.926451]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.050854,38.926451],[-77.05104,38.92677]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05104,38.92677],[-77.051103,38.926876]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051103,38.926876],[-77.051165,38.926983]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051165,38.926983],[-77.051204,38.927044]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":true}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051204,38.927044],[-77.051211,38.927055]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":true}}]}"); - FeatureCollection featureCollectionSecond = FeatureCollection.fromJson("{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034673,38.900205],[-77.034433,38.900204],[-77.033776,38.900206],[-77.033638,38.900207],[-77.033638,38.900324],[-77.03364,38.900698],[-77.03364,38.900755],[-77.033642,38.90123],[-77.033642,38.901335],[-77.03364,38.901459],[-77.033635,38.901826],[-77.033632,38.902061],[-77.033627,38.902347],[-77.033625,38.90241],[-77.033624,38.902532],[-77.033629,38.902643],[-77.033821,38.902643],[-77.034425,38.902643],[-77.03458,38.902644],[-77.03469,38.902646],[-77.034743,38.902646],[-77.035522,38.902644],[-77.035633,38.902644],[-77.036405,38.902645],[-77.036544,38.902645],[-77.036682,38.902645],[-77.037359,38.902646],[-77.038519,38.902647],[-77.039131,38.902647],[-77.039248,38.90267],[-77.039309,38.902716],[-77.039453,38.902863],[-77.039843,38.903596],[-77.039932,38.903739],[-77.039952,38.903781],[-77.040016,38.903913],[-77.040449,38.904638],[-77.040519,38.904756],[-77.040662,38.904985],[-77.040797,38.905231],[-77.040977,38.905548],[-77.041028,38.905636],[-77.041059,38.905697],[-77.041507,38.906457],[-77.041686,38.906761],[-77.041765,38.906915],[-77.041914,38.907207],[-77.041932,38.907243],[-77.041982,38.907324],[-77.042337,38.907903],[-77.042606,38.908297],[-77.042987,38.908936],[-77.043822,38.910381],[-77.044202,38.911035],[-77.04432,38.911244],[-77.044675,38.91187],[-77.044812,38.912105],[-77.044904,38.912277],[-77.04494,38.912355],[-77.045033,38.912545],[-77.045064,38.912606],[-77.045075,38.912624],[-77.045101,38.912668],[-77.045246,38.912916],[-77.045737,38.913757],[-77.045922,38.914086],[-77.046027,38.914276],[-77.046091,38.914432],[-77.04611,38.914488],[-77.046125,38.914547],[-77.046146,38.914641],[-77.046162,38.914748],[-77.046176,38.914848],[-77.046276,38.915982],[-77.046321,38.916099],[-77.046355,38.916182],[-77.04639,38.916262],[-77.046488,38.91643],[-77.046612,38.91664],[-77.046737,38.916767],[-77.046774,38.916835],[-77.0469,38.917081],[-77.046981,38.91722],[-77.046988,38.917233],[-77.047191,38.917653],[-77.047235,38.91774],[-77.047437,38.918138],[-77.047452,38.918167],[-77.047522,38.918305],[-77.047538,38.918335],[-77.047569,38.918391],[-77.047597,38.918431],[-77.047631,38.918468],[-77.04765,38.918485],[-77.047691,38.918517],[-77.047713,38.918532],[-77.047736,38.918545],[-77.047789,38.918571],[-77.047842,38.91859],[-77.047947,38.91862],[-77.048312,38.918726],[-77.048563,38.9188],[-77.048649,38.91883],[-77.048714,38.918859],[-77.048762,38.918881],[-77.048796,38.918902],[-77.048832,38.918935],[-77.048872,38.918987],[-77.048939,38.91911],[-77.049057,38.919324],[-77.049137,38.919463],[-77.051162,38.922911],[-77.051274,38.923112],[-77.051446,38.923411],[-77.051513,38.923529],[-77.051589,38.92366],[-77.052223,38.9247],[-77.052261,38.924769],[-77.052388,38.924982],[-77.05268,38.925536],[-77.05328,38.926569],[-77.05381,38.92748],[-77.054164,38.928088],[-77.053954,38.928051],[-77.053569,38.927977],[-77.053264,38.927916],[-77.052706,38.927805],[-77.052355,38.927734],[-77.052252,38.927713],[-77.05215,38.927688],[-77.052018,38.927647],[-77.051922,38.92761],[-77.051829,38.927568],[-77.05174,38.927522],[-77.051682,38.927489],[-77.051615,38.927446],[-77.05154,38.927392],[-77.051469,38.927335],[-77.051436,38.927306],[-77.05137,38.927245],[-77.051339,38.927214],[-77.051293,38.927163],[-77.051278,38.927143],[-77.051262,38.927124],[-77.051232,38.927084],[-77.051211,38.927055]]},\"properties\":{\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034673,38.900205],[-77.034433,38.900204]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034433,38.900204],[-77.033776,38.900206]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033776,38.900206],[-77.033638,38.900207]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033638,38.900207],[-77.033638,38.900324]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033638,38.900324],[-77.03364,38.900698]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03364,38.900698],[-77.03364,38.900755]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03364,38.900755],[-77.033642,38.90123]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033642,38.90123],[-77.033642,38.901335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033642,38.901335],[-77.03364,38.901459]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03364,38.901459],[-77.033635,38.901826]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033635,38.901826],[-77.033632,38.902061]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033632,38.902061],[-77.033627,38.902347]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033627,38.902347],[-77.033625,38.90241]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033625,38.90241],[-77.033624,38.902532]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033624,38.902532],[-77.033629,38.902643]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033629,38.902643],[-77.033821,38.902643]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.033821,38.902643],[-77.034425,38.902643]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034425,38.902643],[-77.03458,38.902644]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03458,38.902644],[-77.03469,38.902646]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.03469,38.902646],[-77.034743,38.902646]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.034743,38.902646],[-77.035522,38.902644]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.035522,38.902644],[-77.035633,38.902644]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.035633,38.902644],[-77.036405,38.902645]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.036405,38.902645],[-77.036544,38.902645]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.036544,38.902645],[-77.036682,38.902645]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.036682,38.902645],[-77.037359,38.902646]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.037359,38.902646],[-77.038519,38.902647]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.038519,38.902647],[-77.039131,38.902647]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039131,38.902647],[-77.039248,38.90267]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039248,38.90267],[-77.039309,38.902716]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039309,38.902716],[-77.039453,38.902863]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039453,38.902863],[-77.039843,38.903596]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039843,38.903596],[-77.039932,38.903739]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039932,38.903739],[-77.039952,38.903781]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.039952,38.903781],[-77.040016,38.903913]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040016,38.903913],[-77.040449,38.904638]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040449,38.904638],[-77.040519,38.904756]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040519,38.904756],[-77.040662,38.904985]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040662,38.904985],[-77.040797,38.905231]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040797,38.905231],[-77.040977,38.905548]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.040977,38.905548],[-77.041028,38.905636]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041028,38.905636],[-77.041059,38.905697]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041059,38.905697],[-77.041507,38.906457]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041507,38.906457],[-77.041686,38.906761]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041686,38.906761],[-77.041765,38.906915]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041765,38.906915],[-77.041914,38.907207]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041914,38.907207],[-77.041932,38.907243]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041932,38.907243],[-77.041982,38.907324]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.041982,38.907324],[-77.042337,38.907903]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.042337,38.907903],[-77.042606,38.908297]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.042606,38.908297],[-77.042987,38.908936]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.042987,38.908936],[-77.043822,38.910381]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.043822,38.910381],[-77.044202,38.911035]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044202,38.911035],[-77.04432,38.911244]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04432,38.911244],[-77.044675,38.91187]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044675,38.91187],[-77.044812,38.912105]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044812,38.912105],[-77.044904,38.912277]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.044904,38.912277],[-77.04494,38.912355]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04494,38.912355],[-77.045033,38.912545]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045033,38.912545],[-77.045064,38.912606]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045064,38.912606],[-77.045075,38.912624]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045075,38.912624],[-77.045101,38.912668]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045101,38.912668],[-77.045246,38.912916]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045246,38.912916],[-77.045737,38.913757]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045737,38.913757],[-77.045922,38.914086]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.045922,38.914086],[-77.046027,38.914276]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046027,38.914276],[-77.046091,38.914432]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046091,38.914432],[-77.04611,38.914488]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04611,38.914488],[-77.046125,38.914547]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046125,38.914547],[-77.046146,38.914641]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046146,38.914641],[-77.046162,38.914748]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046162,38.914748],[-77.046176,38.914848]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046176,38.914848],[-77.046276,38.915982]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046276,38.915982],[-77.046321,38.916099]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046321,38.916099],[-77.046355,38.916182]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046355,38.916182],[-77.04639,38.916262]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04639,38.916262],[-77.046488,38.91643]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046488,38.91643],[-77.046612,38.91664]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046612,38.91664],[-77.046737,38.916767]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046737,38.916767],[-77.046774,38.916835]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046774,38.916835],[-77.0469,38.917081]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.0469,38.917081],[-77.046981,38.91722]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046981,38.91722],[-77.046988,38.917233]]},\"properties\":{\"congestion\":\"unknown\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.046988,38.917233],[-77.047191,38.917653]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047191,38.917653],[-77.047235,38.91774]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047235,38.91774],[-77.047437,38.918138]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047437,38.918138],[-77.047452,38.918167]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047452,38.918167],[-77.047522,38.918305]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047522,38.918305],[-77.047538,38.918335]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047538,38.918335],[-77.047569,38.918391]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047569,38.918391],[-77.047597,38.918431]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047597,38.918431],[-77.047631,38.918468]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047631,38.918468],[-77.04765,38.918485]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.04765,38.918485],[-77.047691,38.918517]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047691,38.918517],[-77.047713,38.918532]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047713,38.918532],[-77.047736,38.918545]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047736,38.918545],[-77.047789,38.918571]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047789,38.918571],[-77.047842,38.91859]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047842,38.91859],[-77.047947,38.91862]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.047947,38.91862],[-77.048312,38.918726]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048312,38.918726],[-77.048563,38.9188]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048563,38.9188],[-77.048649,38.91883]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048649,38.91883],[-77.048714,38.918859]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048714,38.918859],[-77.048762,38.918881]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048762,38.918881],[-77.048796,38.918902]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048796,38.918902],[-77.048832,38.918935]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048832,38.918935],[-77.048872,38.918987]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048872,38.918987],[-77.048939,38.91911]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.048939,38.91911],[-77.049057,38.919324]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049057,38.919324],[-77.049137,38.919463]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.049137,38.919463],[-77.051162,38.922911]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051162,38.922911],[-77.051274,38.923112]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051274,38.923112],[-77.051446,38.923411]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051446,38.923411],[-77.051513,38.923529]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051513,38.923529],[-77.051589,38.92366]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051589,38.92366],[-77.052223,38.9247]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052223,38.9247],[-77.052261,38.924769]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052261,38.924769],[-77.052388,38.924982]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052388,38.924982],[-77.05268,38.925536]]},\"properties\":{\"congestion\":\"heavy\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05268,38.925536],[-77.05328,38.926569]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05328,38.926569],[-77.05381,38.92748]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05381,38.92748],[-77.054164,38.928088]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.054164,38.928088],[-77.053954,38.928051]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053954,38.928051],[-77.053569,38.927977]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053569,38.927977],[-77.053264,38.927916]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.053264,38.927916],[-77.052706,38.927805]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052706,38.927805],[-77.052355,38.927734]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052355,38.927734],[-77.052252,38.927713]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052252,38.927713],[-77.05215,38.927688]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05215,38.927688],[-77.052018,38.927647]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.052018,38.927647],[-77.051922,38.92761]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051922,38.92761],[-77.051829,38.927568]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051829,38.927568],[-77.05174,38.927522]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05174,38.927522],[-77.051682,38.927489]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051682,38.927489],[-77.051615,38.927446]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051615,38.927446],[-77.05154,38.927392]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05154,38.927392],[-77.051469,38.927335]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051469,38.927335],[-77.051436,38.927306]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051436,38.927306],[-77.05137,38.927245]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.05137,38.927245],[-77.051339,38.927214]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051339,38.927214],[-77.051293,38.927163]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051293,38.927163],[-77.051278,38.927143]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051278,38.927143],[-77.051262,38.927124]]},\"properties\":{\"congestion\":\"low\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051262,38.927124],[-77.051232,38.927084]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-77.051232,38.927084],[-77.051211,38.927055]]},\"properties\":{\"congestion\":\"moderate\",\"primary-route\":false}}]}"); - List featureCollections = new ArrayList<>(); - featureCollections.add(featureCollectionFirst); - featureCollections.add(featureCollectionSecond); - PrimaryRouteUpdateTask primaryRouteUpdateTask = new PrimaryRouteUpdateTask(0, featureCollections, primaryRouteUpdatedCallback, handler); - routeLine.injectPrimaryRouteUpdateTask(primaryRouteUpdateTask); - return primaryRouteUpdateTask; - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListenerTest.java deleted file mode 100644 index 68133e01..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/MapRouteProgressChangeListenerTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.util.Collections; - -public class MapRouteProgressChangeListenerTest { - - @Test - public void onProgressChange_newRouteWithEmptyDirectionsRouteList() { - MapRouteLine routeLine = mock(MapRouteLine.class); - when(routeLine.retrieveDirectionsRoutes()).thenReturn(Collections.emptyList()); - when(routeLine.retrievePrimaryRouteIndex()).thenReturn(0); - MapRouteArrow routeArrow = mock(MapRouteArrow.class); - MapRouteProgressChangeListener progressChangeListener = new MapRouteProgressChangeListener(routeLine, routeArrow); - RouteProgress routeProgress = mock(RouteProgress.class); - DirectionsRoute newRoute = mock(DirectionsRoute.class); - when(routeProgress.directionsRoute()).thenReturn(newRoute); - - progressChangeListener.onProgressChange(mock(Location.class), routeProgress); - - verify(routeLine).draw(eq(newRoute)); - } - - @Test - public void onProgressChange_isVisibleFalseIgnoresProgress() { - MapRouteLine routeLine = mock(MapRouteLine.class); - MapRouteArrow routeArrow = mock(MapRouteArrow.class); - MapRouteProgressChangeListener progressChangeListener = new MapRouteProgressChangeListener(routeLine, routeArrow); - progressChangeListener.updateVisibility(false); - - progressChangeListener.onProgressChange(mock(Location.class), mock(RouteProgress.class)); - - verifyNoInteractions(routeLine); - } - - @Test - public void onProgressChange_isVisibleTrueProcessesProgress() { - MapRouteLine routeLine = mock(MapRouteLine.class); - MapRouteArrow routeArrow = mock(MapRouteArrow.class); - MapRouteProgressChangeListener progressChangeListener = new MapRouteProgressChangeListener(routeLine, routeArrow); - progressChangeListener.updateVisibility(true); - - progressChangeListener.onProgressChange(mock(Location.class), mock(RouteProgress.class)); - - verify(routeLine).retrieveDirectionsRoutes(); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRouteTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRouteTest.java deleted file mode 100644 index 57d3258a..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRouteTest.java +++ /dev/null @@ -1,366 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; - -import org.junit.Test; - -import java.util.Collections; -import java.util.List; - -public class NavigationMapRouteTest { - - @Test - public void checksMapClickListenerIsAddedAtConstructionTime() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - - new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, mockedStyleRes, "", - mockedMapClickListener, mockedDidFinishLoadingStyleListener, mockedProgressChangeListener); - - verify(mockedMapboxMap, times(1)).addOnMapClickListener(eq(mockedMapClickListener)); - } - - @Test - public void checksDidFinishLoadingStyleListenerIsAddedAtConstructionTime() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - - new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, mockedStyleRes, "", - mockedMapClickListener, mockedDidFinishLoadingStyleListener, mockedProgressChangeListener); - - verify(mockedMapView, times(1)) - .addOnDidFinishLoadingStyleListener(eq(mockedDidFinishLoadingStyleListener)); - } - - @Test - public void checksMapRouteProgressChangeListenerIsAddedAtConstructionTime() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - - new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, mockedStyleRes, "", - mockedMapClickListener, mockedDidFinishLoadingStyleListener, mockedProgressChangeListener); - - verify(mockedNavigation, times(1)) - .addProgressChangeListener(eq(mockedProgressChangeListener)); - } - - @Test - public void checksMapClickListenerIsNotAddedIfIsMapClickListenerAdded() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, - mockedMapboxMap, mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener); - - theNavigationMapRoute.onStart(); - - verify(mockedMapboxMap, times(1)).addOnMapClickListener(eq(mockedMapClickListener)); - } - - @Test - public void checksDidFinishLoadingStyleListenerIsNotAddedIfIsDidFinishLoadingStyleListenerAdded() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, - mockedMapboxMap, mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener); - - theNavigationMapRoute.onStart(); - - verify(mockedMapView, times(1)) - .addOnDidFinishLoadingStyleListener(eq(mockedDidFinishLoadingStyleListener)); - } - - @Test - public void checksMapClickListenerIsRemovedInOnStop() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, - mockedMapboxMap, mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener); - - theNavigationMapRoute.onStop(); - - verify(mockedMapboxMap, times(1)).removeOnMapClickListener(eq(mockedMapClickListener)); - } - - @Test - public void checksDidFinishLoadingStyleListenerIsRemovedInOnStop() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, - mockedMapboxMap, mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener); - - theNavigationMapRoute.onStop(); - - verify(mockedMapView, times(1)) - .removeOnDidFinishLoadingStyleListener(eq(mockedDidFinishLoadingStyleListener)); - } - - @Test - public void checksMapRouteProgressChangeListenerIsRemovedInOnStop() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, - mockedMapboxMap, mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener); - - theNavigationMapRoute.onStop(); - - verify(mockedNavigation, times(1)) - .removeProgressChangeListener(eq(mockedProgressChangeListener)); - } - - @Test - public void addProgressChangeListener_mapRouteProgressChangeListenerIsAdded() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - - theNavigationMapRoute.addProgressChangeListener(mockedNavigation); - - verify(mockedNavigation, times(1)) - .addProgressChangeListener(eq(mockedProgressChangeListener)); - } - - @Test - public void removeProgressChangeListener_mapRouteProgressChangeListenerIsRemoved() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - - theNavigationMapRoute.removeProgressChangeListener(mockedNavigation); - - verify(mockedNavigation, times(1)) - .removeProgressChangeListener(eq(mockedProgressChangeListener)); - } - - @Test - public void addRoutes_mapRouteProgressChangeListenerIsAdded() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - List routes = Collections.emptyList(); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - - theNavigationMapRoute.addRoutes(routes); - - verify(mockedMapRouteLine).draw(eq(routes)); - } - - @Test - public void updateRouteVisibilityTo_routeLineVisibilityIsUpdated() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - boolean isVisible = false; - - theNavigationMapRoute.updateRouteVisibilityTo(isVisible); - - verify(mockedMapRouteLine).updateVisibilityTo(isVisible); - } - - @Test - public void removeRoute_routeLineVisibilityIsUpdated() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - - theNavigationMapRoute.removeRoute(); - - verify(mockedMapRouteLine).updateVisibilityTo(false); - } - - @Test - public void removeRoute_routeArrowVisibilityIsUpdated() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - - theNavigationMapRoute.removeRoute(); - - verify(mockedMapRouteArrow).updateVisibilityTo(false); - } - - @Test - public void updateRouteVisibilityTo_progressChangeVisibilityIsUpdated() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - boolean isVisible = false; - - theNavigationMapRoute.updateRouteVisibilityTo(isVisible); - - verify(mockedProgressChangeListener).updateVisibility(isVisible); - } - - @Test - public void updateRouteArrowVisibilityTo_routeArrowReceivesNewVisibility() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - boolean isVisible = false; - - theNavigationMapRoute.updateRouteArrowVisibilityTo(isVisible); - - verify(mockedMapRouteArrow).updateVisibilityTo(isVisible); - } - - @Test - public void showAlternativeRoutes_mapRouteProgressChangeListenerIsAdded() { - MapboxNavigation mockedNavigation = mock(MapboxNavigation.class); - MapView mockedMapView = mock(MapView.class); - MapboxMap mockedMapboxMap = mock(MapboxMap.class); - int mockedStyleRes = 0; - MapRouteClickListener mockedMapClickListener = mock(MapRouteClickListener.class); - MapView.OnDidFinishLoadingStyleListener mockedDidFinishLoadingStyleListener = - mock(MapView.OnDidFinishLoadingStyleListener.class); - MapRouteProgressChangeListener mockedProgressChangeListener = mock(MapRouteProgressChangeListener.class); - MapRouteLine mockedMapRouteLine = mock(MapRouteLine.class); - MapRouteArrow mockedMapRouteArrow = mock(MapRouteArrow.class); - NavigationMapRoute theNavigationMapRoute = new NavigationMapRoute(mockedNavigation, mockedMapView, mockedMapboxMap, - mockedStyleRes, "", mockedMapClickListener, mockedDidFinishLoadingStyleListener, - mockedProgressChangeListener, mockedMapRouteLine, mockedMapRouteArrow); - boolean isVisible = false; - - theNavigationMapRoute.showAlternativeRoutes(isVisible); - - verify(mockedMapRouteLine).toggleAlternativeVisibilityWith(isVisible); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationRouteTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationRouteTest.java deleted file mode 100644 index edaef8fa..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationRouteTest.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import android.content.Context; - -import com.mapbox.services.android.navigation.ui.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.models.DirectionsCriteria; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.utils.LocaleUtils; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import static junit.framework.Assert.assertNotNull; -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -public class NavigationRouteTest extends BaseTest { - - @Mock - private Context context; - @Mock - private LocaleUtils localeUtils; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - when(localeUtils.inferDeviceLocale(context)).thenReturn(Locale.getDefault()); - when(localeUtils.getUnitTypeForDeviceLocale(context)).thenReturn(DirectionsCriteria.IMPERIAL); - } - - @Test - public void sanityTest() throws Exception { - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .accessToken(BaseTest.ACCESS_TOKEN) - .origin(Point.fromLngLat(1.0, 2.0)) - .destination(Point.fromLngLat(1.0, 5.0)) - .build(); - assertNotNull(navigationRoute); - } - - @Test - public void changingDefaultValueToCustomWorksProperly() throws Exception { - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .accessToken(BaseTest.ACCESS_TOKEN) - .origin(Point.fromLngLat(1.0, 2.0)) - .destination(Point.fromLngLat(1.0, 5.0)) - .profile(DirectionsCriteria.PROFILE_CYCLING) - .build(); - - assertThat(navigationRoute.getCall().request().url().toString(), - containsString("/cycling/")); - } - - @Test - public void addApproachesIncludedInRequest() { - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .accessToken(BaseTest.ACCESS_TOKEN) - .origin(Point.fromLngLat(1.0, 2.0)) - .destination(Point.fromLngLat(1.0, 5.0)) - .profile(DirectionsCriteria.PROFILE_CYCLING) - .addApproaches(DirectionsCriteria.APPROACH_CURB, DirectionsCriteria.APPROACH_UNRESTRICTED) - .build(); - - assertThat(navigationRoute.getCall().request().url().toString(), - containsString("curb")); - } - - @Test - public void addWaypointNamesIncludedInRequest() { - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .accessToken(BaseTest.ACCESS_TOKEN) - .origin(Point.fromLngLat(1.0, 2.0)) - .destination(Point.fromLngLat(1.0, 5.0)) - .profile(DirectionsCriteria.PROFILE_CYCLING) - .addWaypointNames("Origin", "Destination") - .build(); - - assertThat(navigationRoute.getCall().request().url().toString(), - containsString("Destination")); - } - - @Test - public void addingPointAndBearingKeepsCorrectOrder() throws Exception { - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .accessToken(BaseTest.ACCESS_TOKEN) - .origin(Point.fromLngLat(1.0, 2.0), 90d, 90d) - .addBearing(2.0, 3.0) - .destination(Point.fromLngLat(1.0, 5.0)) - .build(); - - String requestUrl = navigationRoute.getCall().request().url().toString(); - assertThat(requestUrl, containsString("bearings=90%2C90%3B2%2C3%3B")); - } - - @Test - @Ignore - public void reverseOriginDestinationDoesntMessUpBearings() throws Exception { - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .accessToken(BaseTest.ACCESS_TOKEN) - .destination(Point.fromLngLat(1.0, 5.0), 1d, 5d) - .origin(Point.fromLngLat(1.0, 2.0), 90d, 90d) - .build(); - - assertThat(navigationRoute.getCall().request().url().toString(), - containsString("bearings=90,90;1,5")); - } - - @Test - public void addRouteOptionsIncludedInRequest() throws Exception { - List coordinates = new ArrayList<>(); - coordinates.add(Point.fromLngLat(1.0, 2.0)); - coordinates.add(Point.fromLngLat(1.0, 5.0)); - - RouteOptions routeOptions = RouteOptions.builder() - .accessToken(BaseTest.ACCESS_TOKEN) - .baseUrl("https://api-directions-traf.com") - .requestUuid("XYZ_UUID") - .alternatives(true) - .language(Locale.US.getLanguage()) - .profile(DirectionsCriteria.PROFILE_WALKING) - .coordinates(coordinates) - .voiceUnits(DirectionsCriteria.METRIC) - .user("example_user") - .geometries("mocked_geometries") - .approaches("curb;unrestricted") - .waypointNames("Origin;Destination") - .build(); - - NavigationRoute navigationRoute = NavigationRoute.builder(context, localeUtils) - .origin(coordinates.get(0)) - .destination(coordinates.get(1)) - .routeOptions(routeOptions) - .build(); - - String request = navigationRoute.getCall().request().url().toString(); - assertThat(request, containsString("https://api-directions-traf.com")); - assertThat(request, containsString("alternatives=true")); - assertThat(request, containsString(BaseTest.ACCESS_TOKEN)); - assertThat(request, containsString("voice_units=metric")); - assertThat(request, containsString("example_user")); - assertThat(request, containsString("language=en")); - assertThat(request, containsString("walking")); - assertThat(request, containsString("curb")); - assertThat(request, containsString("Origin")); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/PrimaryRouteUpdateTaskTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/PrimaryRouteUpdateTaskTest.java deleted file mode 100644 index 5891e305..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/route/PrimaryRouteUpdateTaskTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.route; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import android.os.Handler; - -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; - -import org.junit.Test; -import org.mockito.ArgumentCaptor; - -import java.util.ArrayList; -import java.util.List; - -public class PrimaryRouteUpdateTaskTest { - - @SuppressWarnings("DoNotCall") - @Test - public void run_onPrimaryRouteUpdatedIsCalled() { - int primaryRouteIndex = 0; - FeatureCollection mockedFeatureCollection = mock(FeatureCollection.class); - List routeFeatureCollections = new ArrayList<>(); - List mockedFeatures = new ArrayList<>(); - Feature mockedFeature = mock(Feature.class); - mockedFeatures.add(mockedFeature); - when(mockedFeatureCollection.features()).thenReturn(mockedFeatures); - routeFeatureCollections.add(mockedFeatureCollection); - OnPrimaryRouteUpdatedCallback callback = mock(OnPrimaryRouteUpdatedCallback.class); - Handler mockedHandler = mock(Handler.class); - ArgumentCaptor runnable = ArgumentCaptor.forClass(Runnable.class); - PrimaryRouteUpdateTask task = new PrimaryRouteUpdateTask(primaryRouteIndex, routeFeatureCollections, callback, mockedHandler); - - task.run(); - - verify(mockedHandler).post(runnable.capture()); - runnable.getValue().run(); - verify(callback).onPrimaryRouteUpdated(eq(routeFeatureCollections)); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListPresenterTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListPresenterTest.java deleted file mode 100644 index 2b61aaf3..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/summary/list/InstructionListPresenterTest.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.summary.list; - -import androidx.annotation.NonNull; -import android.text.SpannableString; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.services.android.navigation.ui.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyDouble; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class InstructionListPresenterTest extends BaseTest { - - private static final int FIRST = 0; - - @Test - public void onBindInstructionListView_distanceTextIsUpdated() throws Exception { - SpannableString spannableString = mock(SpannableString.class); - RouteProgress routeProgress = buildRouteProgress(); - InstructionListPresenter presenter = buildPresenter(spannableString, routeProgress); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(listView).updateDistanceText(spannableString); - } - - @Test - public void onBindInstructionListView_primaryTextIsUpdated() throws Exception { - SpannableString spannableString = mock(SpannableString.class); - RouteProgress routeProgress = buildRouteProgress(); - InstructionListPresenter presenter = buildPresenter(spannableString, routeProgress); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(listView).updatePrimaryText(anyString()); - } - - @Test - public void onBindInstructionListView_secondaryTextIsUpdated() throws Exception { - SpannableString spannableString = mock(SpannableString.class); - RouteProgress routeProgress = buildRouteProgress(); - InstructionListPresenter presenter = buildPresenter(spannableString, routeProgress); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(listView).updateSecondaryText(anyString()); - } - - @Test - public void onBindInstructionListView_maneuverViewTypeAndModifierAreUpdated() throws Exception { - SpannableString spannableString = mock(SpannableString.class); - RouteProgress routeProgress = buildRouteProgress(); - InstructionListPresenter presenter = buildPresenter(spannableString, routeProgress); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(listView).updateManeuverViewTypeAndModifier(anyString(), anyString()); - } - - @Test - public void onBindInstructionListView_maneuverViewDrivingSideIsUpdated() throws Exception { - SpannableString spannableString = mock(SpannableString.class); - RouteProgress routeProgress = buildRouteProgress(); - InstructionListPresenter presenter = buildPresenter(spannableString, routeProgress); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(listView).updateManeuverViewDrivingSide(anyString()); - } - - @Test - public void retrieveBannerInstructionListSize_returnsCorrectListSize() throws Exception { - RouteProgress routeProgress = buildRouteProgress(); - RouteUtils routeUtils = buildRouteUtils(routeProgress); - DistanceFormatter distanceFormatter = mock(DistanceFormatter.class); - InstructionListPresenter presenter = new InstructionListPresenter(routeUtils, distanceFormatter); - - presenter.updateBannerListWith(routeProgress); - - int expectedInstructionSize = retrieveInstructionSizeFrom(routeProgress.currentLeg()); - assertEquals(expectedInstructionSize, presenter.retrieveBannerInstructionListSize()); - } - - @Test - public void updateBannerListWith_instructionListIsPopulated() throws Exception { - RouteProgress routeProgress = buildRouteProgress(); - RouteUtils routeUtils = buildRouteUtils(routeProgress); - DistanceFormatter distanceFormatter = mock(DistanceFormatter.class); - InstructionListPresenter presenter = new InstructionListPresenter(routeUtils, distanceFormatter); - - boolean didUpdate = presenter.updateBannerListWith(routeProgress); - - assertTrue(didUpdate); - } - - @Test - public void updateBannerListWith_emptyInstructionsReturnFalse() throws Exception { - RouteProgress routeProgress = buildRouteProgress(); - RouteUtils routeUtils = buildRouteUtils(routeProgress); - clearInstructions(routeProgress); - DistanceFormatter distanceFormatter = mock(DistanceFormatter.class); - InstructionListPresenter presenter = new InstructionListPresenter(routeUtils, distanceFormatter); - - boolean didUpdate = presenter.updateBannerListWith(routeProgress); - - assertFalse(didUpdate); - } - - @Test - public void updateDistanceFormatter_newFormatterIsUsed() throws Exception { - RouteProgress routeProgress = buildRouteProgress(); - DistanceFormatter firstDistanceFormatter = buildDistanceFormatter(); - InstructionListPresenter presenter = buildPresenter(routeProgress, firstDistanceFormatter); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - DistanceFormatter secondDistanceFormatter = buildDistanceFormatter(); - presenter.updateDistanceFormatter(secondDistanceFormatter); - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(secondDistanceFormatter).formatDistance(anyDouble()); - } - - @Test - public void updateDistanceFormatter_doesNotAllowNullValues() throws Exception { - RouteProgress routeProgress = buildRouteProgress(); - DistanceFormatter distanceFormatter = buildDistanceFormatter(); - InstructionListPresenter presenter = buildPresenter(routeProgress, distanceFormatter); - presenter.updateBannerListWith(routeProgress); - InstructionListView listView = mock(InstructionListView.class); - - presenter.updateDistanceFormatter(null); - presenter.onBindInstructionListViewAtPosition(0, listView); - - verify(distanceFormatter).formatDistance(anyDouble()); - } - - - @NonNull - private RouteProgress buildRouteProgress() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - return buildRouteProgress(route, 100, 100, 100, 0, 0); - } - - @NonNull - private InstructionListPresenter buildPresenter(SpannableString spannableString, RouteProgress routeProgress) { - RouteUtils routeUtils = buildRouteUtils(routeProgress); - DistanceFormatter distanceFormatter = mock(DistanceFormatter.class); - when(distanceFormatter.formatDistance(anyDouble())).thenReturn(spannableString); - return new InstructionListPresenter(routeUtils, distanceFormatter); - } - - @NonNull - private InstructionListPresenter buildPresenter(RouteProgress routeProgress, DistanceFormatter distanceFormatter) { - RouteUtils routeUtils = buildRouteUtils(routeProgress); - return new InstructionListPresenter(routeUtils, distanceFormatter); - } - - @NonNull - private RouteUtils buildRouteUtils(RouteProgress routeProgress) { - RouteUtils routeUtils = mock(RouteUtils.class); - BannerInstructions instructions = routeProgress.currentLegProgress().currentStep().bannerInstructions().get(FIRST); - when(routeUtils.findCurrentBannerInstructions(any(LegStep.class), anyDouble())).thenReturn(instructions); - return routeUtils; - } - - @NonNull - private DistanceFormatter buildDistanceFormatter() { - SpannableString spannableString = mock(SpannableString.class); - DistanceFormatter distanceFormatter = mock(DistanceFormatter.class); - when(distanceFormatter.formatDistance(anyDouble())).thenReturn(spannableString); - return distanceFormatter; - } - - private int retrieveInstructionSizeFrom(RouteLeg routeLeg) { - List instructions = new ArrayList<>(); - List steps = routeLeg.steps(); - for (LegStep step : steps) { - List bannerInstructions = step.bannerInstructions(); - if (bannerInstructions != null) { - instructions.addAll(bannerInstructions); - } - } - return instructions.size() - 1; - } - - private void clearInstructions(RouteProgress routeProgress) { - for (LegStep step : routeProgress.currentLeg().steps()) { - List instructions = step.bannerInstructions(); - if (instructions != null) { - instructions.clear(); - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechListenerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechListenerTest.java deleted file mode 100644 index 7d855ef8..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechListenerTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.voice; - -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationSpeechListenerTest { - - @Test - public void onStart_audioFocusIsRequested() { - SpeechAudioFocusManager audioFocusManager = mock(SpeechAudioFocusManager.class); - NavigationSpeechListener navigationSpeechListener = buildSpeechListener(audioFocusManager); - - navigationSpeechListener.onStart(); - - verify(audioFocusManager).requestAudioFocus(); - } - - @Test - public void onDone_audioFocusIsAbandoned() { - SpeechAudioFocusManager audioFocusManager = mock(SpeechAudioFocusManager.class); - NavigationSpeechListener navigationSpeechListener = buildSpeechListener(audioFocusManager); - - navigationSpeechListener.onDone(); - - verify(audioFocusManager).abandonAudioFocus(); - } - - @Test - public void onError_fallbackGoesToAndroidSpeechPlayer() { - SpeechPlayerProvider provider = mock(SpeechPlayerProvider.class); - AndroidSpeechPlayer androidSpeechPlayer = mock(AndroidSpeechPlayer.class); - when(provider.retrieveAndroidSpeechPlayer()).thenReturn(androidSpeechPlayer); - NavigationSpeechListener navigationSpeechListener = buildSpeechListener(provider); - SpeechAnnouncement announcement = buildAnnouncement(); - - navigationSpeechListener.onError("Error text", announcement); - - verify(androidSpeechPlayer).play(announcement); - } - - private NavigationSpeechListener buildSpeechListener(SpeechAudioFocusManager audioFocusManager) { - SpeechPlayerProvider provider = mock(SpeechPlayerProvider.class); - return new NavigationSpeechListener(provider, audioFocusManager); - } - - private NavigationSpeechListener buildSpeechListener(SpeechPlayerProvider provider) { - SpeechAudioFocusManager audioFocusManager = mock(SpeechAudioFocusManager.class); - return new NavigationSpeechListener(provider, audioFocusManager); - } - - private SpeechAnnouncement buildAnnouncement() { - return SpeechAnnouncement.builder() - .ssmlAnnouncement("SSML announcement text") - .announcement("Announcement text") - .build(); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechPlayerTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechPlayerTest.java deleted file mode 100644 index 94db1d8b..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/NavigationSpeechPlayerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.voice; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.junit.Test; - -public class NavigationSpeechPlayerTest { - - @Test - public void onPlayAnnouncement_androidSpeechPlayerIsGivenAnnouncement() { - AndroidSpeechPlayer speechPlayer = mock(AndroidSpeechPlayer.class); - NavigationSpeechPlayer navigationSpeechPlayer = buildNavigationSpeechPlayer(speechPlayer); - SpeechAnnouncement announcement = mock(SpeechAnnouncement.class); - - navigationSpeechPlayer.play(announcement); - - verify(speechPlayer).play(announcement); - } - - @Test - public void onSetMuted_providerIsSetMuted() { - SpeechPlayerProvider provider = mock(SpeechPlayerProvider.class); - NavigationSpeechPlayer navigationSpeechPlayer = new NavigationSpeechPlayer(provider); - - navigationSpeechPlayer.setMuted(true); - - verify(provider).setMuted(true); - } - - @Test - public void onOffRoute_providerOnOffRouteIsCalled() { - SpeechPlayerProvider provider = mock(SpeechPlayerProvider.class); - NavigationSpeechPlayer navigationSpeechPlayer = new NavigationSpeechPlayer(provider); - - navigationSpeechPlayer.onOffRoute(); - - verify(provider).onOffRoute(); - } - - @Test - public void onDestroy_providerOnDestroyIsCalled() { - SpeechPlayerProvider provider = mock(SpeechPlayerProvider.class); - NavigationSpeechPlayer navigationSpeechPlayer = new NavigationSpeechPlayer(provider); - - navigationSpeechPlayer.onOffRoute(); - - verify(provider).onOffRoute(); - } - - private NavigationSpeechPlayer buildNavigationSpeechPlayer(SpeechPlayer speechPlayer) { - SpeechPlayerProvider provider = mock(SpeechPlayerProvider.class); - when(provider.retrieveSpeechPlayer()).thenReturn(speechPlayer); - return new NavigationSpeechPlayer(provider); - } -} diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncementTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncementTest.java deleted file mode 100644 index c54123d9..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechAnnouncementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.voice; - -import com.mapbox.services.android.navigation.v5.milestone.VoiceInstructionMilestone; - -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class SpeechAnnouncementTest { - - @Test - public void milestoneAnnouncement_isUsedWhenProvided() { - VoiceInstructionMilestone milestone = mock(VoiceInstructionMilestone.class); - String announcement = "Milestone announcement"; - when(milestone.getAnnouncement()).thenReturn(announcement); - - SpeechAnnouncement speechAnnouncement = SpeechAnnouncement.builder() - .voiceInstructionMilestone(milestone) - .build(); - - assertEquals(announcement, speechAnnouncement.announcement()); - } - - @Test - public void milestoneSsmlAnnouncement_isUsedWhenProvided() { - VoiceInstructionMilestone milestone = mock(VoiceInstructionMilestone.class); - String announcement = "Milestone announcement"; - when(milestone.getAnnouncement()).thenReturn(announcement); - String ssmlAnnouncement = "Milestone SSML announcement"; - when(milestone.getSsmlAnnouncement()).thenReturn(ssmlAnnouncement); - - SpeechAnnouncement speechAnnouncement = SpeechAnnouncement.builder() - .voiceInstructionMilestone(milestone) - .build(); - - assertEquals(ssmlAnnouncement, speechAnnouncement.ssmlAnnouncement()); - } -} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechPlayerProviderTest.java b/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechPlayerProviderTest.java deleted file mode 100644 index 9bccbc74..00000000 --- a/libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/voice/SpeechPlayerProviderTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.mapbox.services.android.navigation.ui.v5.voice; - -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; - -import android.content.Context; - -import com.mapbox.services.android.navigation.ui.v5.ConnectivityStatusProvider; - -import org.junit.Test; - -import java.util.Locale; - -public class SpeechPlayerProviderTest { - - @Test - public void sanity() { - SpeechPlayerProvider provider = buildSpeechPlayerProvider(true); - - assertNotNull(provider); - } - - @Test - public void voiceLanguageNotSupported_returnsAndroidSpeechPlayer() { - boolean voiceLanguageNotSupported = false; - SpeechPlayerProvider provider = buildSpeechPlayerProvider(voiceLanguageNotSupported); - - SpeechPlayer speechPlayer = provider.retrieveSpeechPlayer(); - - assertTrue(speechPlayer instanceof AndroidSpeechPlayer); - } - - @Test - public void retrieveAndroidSpeechPlayer_alwaysReturnsAndroidSpeechPlayer() { - SpeechPlayerProvider provider = buildSpeechPlayerProvider(true); - - AndroidSpeechPlayer speechPlayer = provider.retrieveAndroidSpeechPlayer(); - - assertNotNull(speechPlayer); - } - - private SpeechPlayerProvider buildSpeechPlayerProvider(boolean voiceLanguageSupported) { - Context context = mock(Context.class); - String language = Locale.US.getLanguage(); - ConnectivityStatusProvider connectivityStatus = mock(ConnectivityStatusProvider.class); - return new SpeechPlayerProvider(context, language, voiceLanguageSupported, connectivityStatus); - } -} diff --git a/libandroid-navigation-ui/src/test/resources/directions_v5_precision_6.json b/libandroid-navigation-ui/src/test/resources/directions_v5_precision_6.json deleted file mode 100644 index bf92e646..00000000 --- a/libandroid-navigation-ui/src/test/resources/directions_v5_precision_6.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"awbagAzavnhFp`@~fGr~Ya|BhcBwcYbr\\u{C`tZ~{H~vrBsge@bdo@`kc@dqpAckUbmn@sphAjnDovu@zviDgasDpa^ixsBbmy@{ubBvou@ajy@|}\\y~q@dycAcotGj{v@cdr@lyUwpC","legs":[{"summary":"Bayshore Freeway, Bayshore Freeway","weight":3999.4,"duration":3713.3,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[261],"location":[-122.416686,37.783425]},{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.417548,37.783315]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.419192,37.783106]}],"driving_side":"right","geometry":"awbagAzavnhFzEzt@|@hNbJlvA`Dbg@xA~T`@dGnBtZ","mode":"driving","maneuver":{"bearing_after":261,"bearing_before":0,"location":[-122.416686,37.783425],"type":"depart","instruction":"Head west on Eddy Street"},"weight":217.4,"duration":193,"name":"Eddy Street","distance":362.7,"voiceInstructions":[{"distanceAlongGeometry":362.7,"announcement":"Head west on Eddy Street for a quarter mile","ssmlAnnouncement":"Head west on Eddy Street for a quarter mile"},{"distanceAlongGeometry":131.5,"announcement":"In 500 feet, turn left onto Van Ness Avenue (US 101 South)","ssmlAnnouncement":"In 500 feet, turn left onto Van Ness Avenue (US 101 South)"},{"distanceAlongGeometry":28.2,"announcement":"Turn left onto Van Ness Avenue (US 101 South)","ssmlAnnouncement":"Turn left onto Van Ness Avenue (US 101 South)"}],"bannerInstructions":[{"distanceAlongGeometry":362.7,"primary":{"text":"Van Ness Avenue","components":[{"text":"Van Ness Avenue","type":"text","abbr":"Van Ness Ave","abbr_priority":0}],"type":"turn","modifier":"left"},"secondary":{"text":"US 101 South","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"turn","modifier":"left"}}]},{"intersections":[{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.42076,37.782907]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.42091,37.782888]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.420722,37.781954]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.420534,37.781023]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[90,165,255,345],"location":[-122.420342,37.780077]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419972,37.778242]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419782,37.777295]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419594,37.776367]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,255,345],"location":[-122.419398,37.775431]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[45,165,225,345],"location":[-122.41935,37.775193]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[45,165,225,345],"location":[-122.419314,37.775061]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,210,345],"location":[-122.418875,37.773667]},{"out":1,"in":4,"entry":[false,true,true,false,false],"bearings":[45,165,225,315,345],"location":[-122.418702,37.773081]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[30,165,210,345],"location":[-122.418631,37.772842]},{"out":0,"in":2,"entry":[true,false,false],"bearings":[165,270,345],"location":[-122.418498,37.772399]},{"out":1,"in":2,"entry":[true,true,false],"bearings":[75,165,345],"location":[-122.41845,37.772238]},{"out":1,"in":2,"entry":[false,true,false],"bearings":[120,165,345],"location":[-122.418146,37.771238]},{"out":1,"in":2,"entry":[true,true,false],"bearings":[135,165,345],"location":[-122.418096,37.771089]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,270,345],"location":[-122.418033,37.770901]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[0,195,210,270],"location":[-122.417742,37.770207]},{"out":2,"in":0,"entry":[false,false,true,false],"bearings":[15,105,195,285],"location":[-122.417803,37.769889]},{"out":2,"in":0,"entry":[false,true,true,false],"bearings":[15,105,180,285],"location":[-122.417834,37.769712]}],"driving_side":"right","geometry":"uvaagAn`~nhFd@jHfEg@xUsCjW{C|C_@pC]v[yDtR_CdD_@zC_@f]cEfQuBvDe@tH}@tn@sHl[wD`R{BxH}@vDe@lt@uIjb@eFxN}AxEs@n\\}D~ZcE^ExH_A`D_@vBa@zAUr@OvEc@fHuAbFiA~~@iTrc@yI|MmCtZiG`I_Bn}@_RhHcBlEcAhDy@lKiDjEgCnDyCtCgBdBk@pBGjDVfAHzRxB`J|@dIf@vO`B","mode":"driving","maneuver":{"bearing_after":260,"bearing_before":260,"location":[-122.42076,37.782907],"modifier":"left","type":"turn","instruction":"Turn left onto Van Ness Avenue (US 101 South)"},"ref":"US 101 South","weight":479.7,"duration":307.1,"name":"Van Ness Avenue (US 101 South)","distance":1559.1,"voiceInstructions":[{"distanceAlongGeometry":1559.1,"announcement":"Continue on Van Ness Avenue (US 101 South) for 1 mile","ssmlAnnouncement":"Continue on Van Ness Avenue (US 101 South) for 1 mile"},{"distanceAlongGeometry":355.4,"announcement":"In a quarter mile, take the ramp towards US 101 South: Oakland","ssmlAnnouncement":"In a quarter mile, take the ramp towards US 101 South: Oakland"},{"distanceAlongGeometry":76.2,"announcement":"Take the ramp towards US 101 South: Oakland, then merge left onto US 101 South","ssmlAnnouncement":"Take the ramp towards US 101 South: Oakland, then merge left onto US 101 South"}],"bannerInstructions":[{"distanceAlongGeometry":1559.1,"primary":{"text":"US 101 South / I-80 East","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0},{"text":"/","type":"delimiter","delimiter":true},{"text":"I-80","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/i-80"},{"text":"East","type":"text","abbr":"E","abbr_priority":0}],"type":"off ramp","modifier":"straight"},"secondary":{"text":"Oakland / San Jose","components":[{"text":"Oakland","type":"text"},{"text":"/","type":"text"},{"text":"San Jose","type":"text"}],"type":"off ramp","modifier":"straight"}},{"distanceAlongGeometry":76.2,"primary":{"text":"US 101 South / I-80 East","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0},{"text":"/","type":"delimiter","delimiter":true},{"text":"I-80","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/i-80"},{"text":"East","type":"text","abbr":"E","abbr_priority":0}],"type":"off ramp","modifier":"straight"},"secondary":{"text":"Oakland / San Jose","components":[{"text":"Oakland","type":"text"},{"text":"/","type":"text"},{"text":"San Jose","type":"text"}],"type":"off ramp","modifier":"straight"},"sub":{"text":"US 101 South","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"merge","modifier":"slight left"}}]},{"distance":379.8,"name":"US 101 South","ref":"US 101 South","maneuver":{"bearing_after":201,"bearing_before":187,"location":[-122.417903,37.769281],"modifier":"straight","type":"off ramp","instruction":"Take the ramp towards US 101 South: Oakland"},"destinations":"US 101 South, I-80 East: Oakland, San Jose","weight":49,"mode":"driving","geometry":"acg`gA|mxnhFfGdCnCpBbC`ChB|CjAlDt@vEN`FSpEu@fEiAlDcBpCyB`CeCzAkCx@kC^iC?gCe@aCy@wBsAcB_BgBaCqA{Cy@qD_@}DKqDDmETuErA}Ox@cJf@gHdAoPr@yMh@aMcBuM","intersections":[{"classes":["motorway"],"out":2,"in":0,"entry":[false,true,true,false],"bearings":[0,180,195,345],"location":[-122.417903,37.769281]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false],"bearings":[15,180],"location":[-122.419,37.769346]}],"duration":42.2,"driving_side":"right","voiceInstructions":[{"distanceAlongGeometry":354.5,"announcement":"Merge left onto US 101 South","ssmlAnnouncement":"Merge left onto US 101 South"}],"bannerInstructions":[{"distanceAlongGeometry":379.8,"primary":{"text":"US 101 South","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"merge","modifier":"slight left"},"secondary":null}]},{"intersections":[{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[90,255,285],"location":[-122.416662,37.769596]},{"classes":["motorway"],"out":1,"in":2,"entry":[true,true,false],"bearings":[102,108,282],"location":[-122.40981,37.769161]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[174,353,358],"location":[-122.405473,37.767261]},{"classes":["motorway"],"out":1,"in":2,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.405244,37.766048]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[0,180,195],"location":[-122.402999,37.752554]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[0,15,195],"location":[-122.404558,37.746941]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[7,180,187],"location":[-122.408143,37.739469]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[155,332,335],"location":[-122.406401,37.734438]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[150,180,330],"location":[-122.405674,37.733191]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[165,330,345],"location":[-122.403995,37.730114]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[163,341,346],"location":[-122.402483,37.726603]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[163,168,343],"location":[-122.401701,37.724557]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.400278,37.720955]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.397974,37.714805]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.39554,37.710237]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false],"bearings":[165,345],"location":[-122.395121,37.708328]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[170,347,350],"location":[-122.393825,37.702429]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.391826,37.693636]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[170,345,350],"location":[-122.3906,37.688244]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[30,210,225],"location":[-122.392891,37.669787]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[30,210,225],"location":[-122.395051,37.667539]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[46,50,231],"location":[-122.39982,37.663398]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[30,45,210],"location":[-122.403926,37.660623]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[15,195,210],"location":[-122.405731,37.65805]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[176,181,356],"location":[-122.406979,37.651445]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.406419,37.64457]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[0,165,195],"location":[-122.406082,37.641332]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[150,165,345],"location":[-122.405024,37.63824]},{"classes":["motorway"],"out":1,"in":2,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.402719,37.630324]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[166,341,345],"location":[-122.401464,37.62492]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[162,342,345],"location":[-122.398689,37.616736]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.394473,37.611514]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[128,308,309],"location":[-122.391675,37.609715]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[129,134,309],"location":[-122.384799,37.605291]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.378646,37.601292]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.376557,37.599922]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[130,136,309],"location":[-122.364079,37.591793]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,285,300],"location":[-122.357438,37.587965]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.325833,37.581641]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[139,314,319],"location":[-122.322934,37.578971]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.316743,37.573261]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[139,316,319],"location":[-122.310821,37.567812]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.302578,37.560185]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.293655,37.550567]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.293005,37.549875]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.292169,37.548986]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[144,149,324],"location":[-122.291949,37.548743]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.286169,37.542512]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.283856,37.53998]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.273979,37.529546]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,313,318],"location":[-122.262626,37.51954]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[138,141,318],"location":[-122.260906,37.518025]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,314,318],"location":[-122.247718,37.506343]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,315,318],"location":[-122.242977,37.502159]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[137,142,317],"location":[-122.239937,37.499488]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,284,290],"location":[-122.231907,37.495907]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,283,290],"location":[-122.228972,37.495072]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.218915,37.491223]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.205884,37.487457]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[107,110,285],"location":[-122.185632,37.484733]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[120,285,300],"location":[-122.179679,37.482856]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[126,302,307],"location":[-122.177095,37.481497]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.155045,37.468654]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[126,305,307],"location":[-122.152581,37.467179]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.144516,37.462442]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[126,304,306],"location":[-122.136462,37.457738]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[131,141,308],"location":[-122.12693,37.452112]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[140,317,320],"location":[-122.118132,37.444081]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.103307,37.429953]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.101751,37.428459]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.092643,37.42097]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.09244,37.420823]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[133,309,312],"location":[-122.089184,37.418478]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[120,285,300],"location":[-122.081848,37.413404]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.081263,37.413111]},{"classes":["motorway"],"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["right"]}],"out":1,"in":2,"entry":[true,true,false],"bearings":[105,120,300],"location":[-122.078361,37.411892]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[118,124,297],"location":[-122.076323,37.411054]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.067607,37.407809]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,110,286],"location":[-122.067189,37.407713]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.063708,37.406961]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.056615,37.405407]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.047017,37.403049]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.036066,37.400658]},{"classes":["motorway"],"out":0,"in":3,"entry":[true,true,false,false],"bearings":[105,120,270,285],"location":[-122.03242,37.39989]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,279,286],"location":[-122.027075,37.398693]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,280,285],"location":[-122.024811,37.398202]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,111,285],"location":[-122.017288,37.396552]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.012976,37.395607]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.012709,37.395542]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[107,280,285],"location":[-122.008838,37.394702]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.000135,37.392318]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[111,284,291],"location":[-121.994151,37.390522]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,282,290],"location":[-121.991164,37.389654]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.983628,37.387548]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,287,290],"location":[-121.974838,37.385032]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.972437,37.384341]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.969543,37.383509]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,284,290],"location":[-121.957291,37.380021]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.945834,37.377446]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.941787,37.376663]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.941403,37.376591]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.939052,37.376128]}],"driving_side":"right","geometry":"wvg`gAj`vnhFb@sMZeMd@cX^mX`Da~DHoIJaJNsIRqIZgI^}I`@uHj@mIt@iJ|@uJdGwq@pJ_l@xAgKnAsKjAyLn@gJj@eKb@eLj@iL`AeLtA_LnBmK|BaJrB}G|BsGtCmHxAcD|AcDlBsDdBwCbCuDrCaEfD}D|DuDrEaDrFmCzCgAnD_A~GkAvBS|c@_DzLuA~WsEzqA}FvJ]`IAtKF`K\\dKv@vJhAvJ|A`KzBbJjCnJdDzIxD|InEvIlE~\\|QhHlDhInDnHjCbIzBdI`B`IjA~Hr@dIZpIBjIWrIq@dJqA`JgBfJqCfIcDzImEzH{EhIiGdImHbHyHdHeJpG_JfGoJtN_UfF{H`GmIlF{GxFmG|FkF~F_FvGqE`HyDtIyDjIsCjIwB~IaBfJiAdK{@dKm@vJc@pbCqK~Ni@rO]rNKdN\\lOp@pNnAzOjBvLnBnL~B`nAzWlcBp^~nAbX|_Bl]rNdDrOrEbN`FlMbG~MhH`MdIfMdJz_Apu@xFhEbFvD|MxInN`IfN`HnN|FhPjFvMlDfQlDfOjCjPnBlPtApUrA`OXlOGrOWrOm@tO}@hMyAbOwBtOqCnOkDnNuDrMgE`MqEzMqFlOiHvJiEdWgM|w@{_@pYwNjr@u\\tm@w\\zQ{IfRuIxVsKrQoHhTqIl^aNhK{DvYcKxVqIzVgHl`Ag[xHaCvdAg]|hAk[|t@oSzb@eMfYyId{Age@n^{Jhf@yLdP_E`QwDnz@sOdk@wJtKoBdvAgWxMgChNgD~NeE`N}EbUaJjOyH|MkH`NyIzNmKdUoP~p@ui@jFoDxEaDxLkHbMaHvLuG|L{FfL{E~NiFhMwDtNoDdNsCzMsB~UkDd^iF`l@_Iva@qFv_@cFvEo@||@mLrcBwSbmEym@pdP}{B~oIskAddKowA|i@oIpv@sLvXkE`XkDrUeCvVeBxPc@~RO`RNjSb@xSrApS~BtRxC|P|CzQrEzTzGzSlHrP|FfR~GbQxGjRvHfQjHnChAbd@lTvSpKrMbHnMfHhMvH`MxH|LdIjMvIjLhI|LbJlL|IzLlJdLfJpLzJ`L|JpNtMnkC~eCzr@zp@b`@z^vKfKnKjK`KrKpKpLtLzMlJfLvJbM`K`NvI~L~IrMxIhNpIrN|IhOfItNtIrO|oBdoDjI~NxJzOnJhNhKnNnMvOpLfMhMrLxNvL|LhJpMlIrL~G`NdH`NfGlNzFl\\bNjlArf@|NzFxNfFhOnErOxDlO|CnPrC`NdBlOzAdNbAdOx@jN\\zNRfPAfO[`Pi@taAyDlXcAjqAeFrRu@fw@{CrSy@xyFmR`vCsLhr@mFjKaA`YuDr\\_G~YiGxRkFrVoHdYsJp[qLdyAco@hWmJhSaHjT}G~QkFzPiE~RmEvSaE~RaDdTwCpSaCdTiBx]{Bty@uEnwAqKftAsHvXuBbZeD`\\uEdU{DfWqFtaAgUbl@yNhKw@fZiG`wDy~@hqAa[~gDyw@`h@qLxF{ApUiGfXwIhZwLxXmMhZmPdWmP~XyS|VkT~SoQ`VwVnSyU|SeXne@}o@loB{mDpzAiqC~[uh@fp@qgAtiBehDhuB{uDrbCuhErtAqaCpn@mgAteAwiB~u@_sAlxEslI~o@mlA~Vkd@jk@gcA~{Bg~DbRy\\xP_\\dQa^vOo_@zMk_@jM{`@bLeb@`T_gAzHsk@~Fcj@`De_@jCkc@bB}f@r@ef@Rme@tAyqB~FgmHnDcrElDmwEjEi_Fl@yr@nB}e@tBoXxEe`@nG}^fJs_@pLy^tN{\\`OyXpPiVxPwSrk@io@~wCseDzeDetDfhDqvDrzDkjEpcAwiA~nGkfHngE_xEjlEm|Ef`@ac@|Zg]rHmI|TiUfVoT`YkVlxAwlAh^_[vn@sk@ht@_q@j^y[|a@k`@lt@ms@jZcYj\\eZpbCeyBfj@sg@pv@gs@dNwLhlDy~Cb_Au|@rh@ae@jmBudBl`@_^bNaMnN_M|x@is@fc@e`@vcCsyBrcFurEhR{PpwBqnBxTaSfTiSdW}V`UqUdSaTdT}UdSuUtl@qr@|sDwmE|oDqgEhcBspBjBwB~FaHbmBg{Bva@gf@|z@gcA|pAm{AbYw\\pc@kh@x|AciBha@me@~dBirBpjByxB~y@q`Ax{DmtE~iA}sAtlAawAxkBizBfqAc{Azn@yu@xc@aj@tPmS~O}SlO{TbOoVnMcVpM{WpCsGzBiFzEcLbM_]hJoXfIyXfIi[xGyZjGkZ`p@glDds@mvDzPq}@vGa^lHq_@~FyXbGgX~F{V|Jq`@lH}XzIw[~IsZhJgZjJiYjKk[`eBsdFvp@anBzJiZtJiZdJwZzI{ZdE{ObCgJjD{MzCmL`I_\\fGmXtGiZhHm^fEqTbGo\\pF}[lF_]|Ey\\nEy\\bEg]|Dc]hDc]`Dq]vCo]bLieBzuBa_]xB{]fCw_@`Cm]jCk]|Cy]hDc]tD_]xDi]jEy\\vEe]fEsZnFq\\rFm\\~Fo\\nGa\\tG_\\zG{[jH{[vHw[`Ia[fIwZ~I}ZlJsZ~JcZpKqYfLoYpLwXjMqXlMwWvCgDptEesJfq@}uAxxBkpEpzFijLpj@}gA|xBkpEbuAqrC`EmExiEm{If|AszCxhBuuDh~CmnGz[gp@htH{mOfGkMjPg[tOgYhSg\\dK{OfPqUpPyTbQ_TpQkS`iEksE|cByhB|}AybBbz@w|@l_EsiEhIwI`yD_bEvkHszHnG}Gx|B{bCpf@mh@xt@yv@rxBa_CjXqY~WwYlVcYzUiYtWw\\lVy\\|Zqd@h[gf@jpCafEdHuKdvAqxBjz@}pAt}B}lDhcBaiClJcObIuMjI}NlNaWzMaXjMkXnLgXzK}XlDsIjRqk@zk@akB|Jw[js@k~Bvg@gaBx_BulFxFcSxFySxFcTzEgStEoSxE{UfDqQrDySbDiSlDmV~DcYrLm~@j`@cyCfx@qcGzf@wuDxHgi@pImj@tJcj@fc@e`CnMev@~Hwg@lHwh@xGkf@hc@ycDpsBwuOhNkdApPioA~n@{bF~_As`HxHmk@t]olCbfBeuM`z@olG`CuOns@}pFhUuyAzo@iqDxlA}qGd`@arBd]}`Bzo@_`DjIga@xR{bA`WqsAdNos@nTgjAf[acBtaAerFhlBg~J|n@ceDdj@auC~r@{sDfMqp@jD_SbjAufGvkAskGnm@{bDv`@cvBpUswAvb@odDpb@amDh`@wgD|o@}{FnC_W|[}qCvj@o{ExKa}@fGyf@vGce@pL_x@tHag@","mode":"driving","maneuver":{"bearing_after":94,"bearing_before":73,"location":[-122.416662,37.769596],"modifier":"slight left","type":"merge","instruction":"Merge left onto US 101 South"},"ref":"US 101 South","weight":2842.4,"duration":2831.4,"name":"Central Freeway (US 101 South)","distance":70046.4,"voiceInstructions":[{"distanceAlongGeometry":70046.4,"announcement":"Continue on US 101 South for 44 miles","ssmlAnnouncement":"Continue on US 101 South for 44 miles"},{"distanceAlongGeometry":3219,"announcement":"In 2 miles, take exit 390 towards CA 87 South: Guadalupe Parkway","ssmlAnnouncement":"In 2 miles, take exit 390 towards CA 87 South: Guadalupe Parkway"},{"distanceAlongGeometry":804,"announcement":"In a half mile, take exit 390 towards CA 87 South: Guadalupe Parkway","ssmlAnnouncement":"In a half mile, take exit 390 towards CA 87 South: Guadalupe Parkway"},{"distanceAlongGeometry":402,"announcement":"Take exit 390 towards CA 87 South: Guadalupe Parkway","ssmlAnnouncement":"Take exit 390 towards CA 87 South: Guadalupe Parkway"}],"bannerInstructions":[{"distanceAlongGeometry":70046.4,"primary":{"text":"Exit 390 CA 87 South","components":[{"text":"Exit","type":"exit"},{"text":"390","type":"exit-number"},{"text":"CA 87","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/ca-87"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"off ramp","modifier":"right"},"secondary":{"text":"Guadalupe Parkway","components":[{"text":"Guadalupe Parkway","type":"text","abbr":"Guadalupe Pky","abbr_priority":0}],"type":"off ramp","modifier":"right"}}]},{"distance":4798.2,"name":"","maneuver":{"bearing_after":112,"bearing_before":106,"location":[-121.931731,37.374579],"modifier":"slight right","type":"off ramp","instruction":"Take exit 390 towards CA 87 South: Guadalupe Parkway"},"destinations":"CA 87 South: Guadalupe Parkway","exits":"390","intersections":[{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.931731,37.374579]},{"classes":["motorway"],"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,300,330],"location":[-121.926597,37.37012]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[128,138,308],"location":[-121.923722,37.367884]},{"classes":["motorway"],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[0,150,180,330],"location":[-121.918933,37.364245]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-121.915678,37.359877]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,330],"location":[-121.908322,37.349121]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,330,345],"location":[-121.901664,37.343143]}],"duration":192.39999999999998,"driving_side":"right","weight":206.7,"mode":"driving","geometry":"efdhfAd|bqgF|Rwy@dFyVxRu_AbLy^|GgNjGcLhSeWtLmLvLaIjFoCdFoBfIkCfHkBvo@aPnXoI~NqEfS{I~G_D|NgJrJ{HtGoGfK_L|IqKzLmQbDiGhKqQ|Vie@`X{g@dkAw{B~NcXhPoWlRmXfSeW|UcXpTcTtYmV`FsDhA{@zQ_NnWmQhbFcgDhoCqkBnbAiq@htAq~@lf@{Zzp@y`@ne@_Ujo@uYpfB}v@hMcGhMeH`P}JhOiKj`@m\\ra@}f@~JuOzI_OtJwQhJcSpIwTzSsh@nT_g@hPkZ~PuVxNmRrNwPfO}NjO{MnKcI~JaHtIaFxKuGdRcJ~^aOrh@aSj]oOlSmKxIcF~pA}v@","voiceInstructions":[{"distanceAlongGeometry":4496.4,"announcement":"Continue straight for 3 miles","ssmlAnnouncement":"Continue straight for 3 miles"},{"distanceAlongGeometry":3219,"announcement":"In 2 miles, take exit 6B towards Julian Street","ssmlAnnouncement":"In 2 miles, take exit 6B towards Julian Street"},{"distanceAlongGeometry":804,"announcement":"In a half mile, take exit 6B towards Julian Street","ssmlAnnouncement":"In a half mile, take exit 6B towards Julian Street"},{"distanceAlongGeometry":402,"announcement":"Take exit 6B towards Julian Street, then continue onto North Almaden Boulevard","ssmlAnnouncement":"Take exit 6B towards Julian Street, then continue onto North Almaden Boulevard"}],"bannerInstructions":[{"distanceAlongGeometry":4798.2,"primary":{"text":"Exit 6B Julian Street","components":[{"text":"Exit","type":"exit"},{"text":"6B","type":"exit-number"},{"text":"Julian Street","type":"text","abbr":"Julian St","abbr_priority":0}],"type":"off ramp","modifier":"right"},"secondary":{"text":"Saint James Street","components":[{"text":"Saint","type":"text","abbr":"St","abbr_priority":0},{"text":"James Street","type":"text","abbr":"James St","abbr_priority":1}],"type":"off ramp","modifier":"right"}},{"distanceAlongGeometry":623.5,"primary":{"text":"Exit 6B Julian Street","components":[{"text":"Exit","type":"exit"},{"text":"6B","type":"exit-number"},{"text":"Julian Street","type":"text","abbr":"Julian St","abbr_priority":0}],"type":"off ramp","modifier":"right"},"secondary":{"text":"Saint James Street","components":[{"text":"Saint","type":"text","abbr":"St","abbr_priority":0},{"text":"James Street","type":"text","abbr":"James St","abbr_priority":1}],"type":"off ramp","modifier":"right"},"sub":{"text":"North Almaden Boulevard","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Almaden Boulevard","type":"text","abbr":"Almaden Blvd","abbr_priority":0}],"type":"turn","modifier":"straight"}}]},{"distance":508.9,"name":"","maneuver":{"bearing_after":171,"bearing_before":150,"location":[-121.900192,37.340845],"modifier":"slight right","type":"off ramp","instruction":"Take exit 6B towards Julian Street"},"destinations":"Julian Street, Saint James Street","exits":"6B","intersections":[{"classes":["motorway"],"out":1,"in":2,"entry":[true,true,false],"bearings":[150,165,330],"location":[-121.900192,37.340845]}],"duration":44.8,"driving_side":"right","weight":57,"mode":"driving","geometry":"yibffA~heogF|Hu@lp@ca@zLsGvr@g[hF{B|GaB|HcAxKKlIp@lOzC|Dh@hKtAzFh@`FDvHy@bG{AjKaEfFuBvEiB","voiceInstructions":[{"distanceAlongGeometry":390.7,"announcement":"Continue onto North Almaden Boulevard","ssmlAnnouncement":"Continue onto North Almaden Boulevard"}],"bannerInstructions":[{"distanceAlongGeometry":508.9,"primary":{"text":"North Almaden Boulevard","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Almaden Boulevard","type":"text","abbr":"Almaden Blvd","abbr_priority":0}],"type":"turn","modifier":"straight"},"secondary":null},{"distanceAlongGeometry":284,"primary":{"text":"North Almaden Boulevard","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Almaden Boulevard","type":"text","abbr":"Almaden Blvd","abbr_priority":0}],"type":"turn","modifier":"straight"},"secondary":null,"sub":{"text":"","components":[{"text":"","type":"lane","active":true,"directions":["left"]},{"text":"","type":"lane","active":true,"directions":["straight","left"]},{"text":"","type":"lane","active":false,"directions":["right"]}]}}]},{"intersections":[{"lanes":[{"valid":true,"indications":["left"]},{"valid":true,"indications":["straight","left"]},{"valid":false,"indications":["right"]}],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[60,150,240,345],"location":[-121.898785,37.336552]},{"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight","left"]},{"valid":false,"indications":["right"]}],"out":1,"in":3,"entry":[true,true,false,false],"bearings":[60,165,240,330],"location":[-121.898691,37.336402]}],"driving_side":"right","geometry":"o}yefA`qbogFjH{DtEkBrTePj^}W|D}E","mode":"driving","maneuver":{"bearing_after":153,"bearing_before":158,"location":[-121.898785,37.336552],"modifier":"straight","type":"new name","instruction":"Continue onto North Almaden Boulevard"},"weight":75.1,"pronunciation":"ˈnoɹθ ˈɔlmədən ˈbʊləvɑɹd","duration":43.5,"name":"North Almaden Boulevard","distance":157.5,"voiceInstructions":[{"distanceAlongGeometry":157.5,"announcement":"In 600 feet, turn right onto West Saint John Street","ssmlAnnouncement":"In 600 feet, turn right onto West Saint John Street"},{"distanceAlongGeometry":54.3,"announcement":"Turn right onto West Saint John Street","ssmlAnnouncement":"Turn right onto West Saint John Street"}],"bannerInstructions":[{"distanceAlongGeometry":157.5,"primary":{"text":"West Saint John Street","components":[{"text":"West","type":"text","abbr":"W","abbr_priority":1},{"text":"Saint John Street","type":"text","abbr":"St John St","abbr_priority":0}],"type":"turn","modifier":"right"},"secondary":null}]},{"intersections":[{"out":1,"in":2,"entry":[true,true,false],"bearings":[105,240,315],"location":[-121.897852,37.335352]}],"driving_side":"right","geometry":"orwefAvv`ogFhCrF`Qtc@vDzJtFlOv@`CdJrWlCvItShi@pBfF","mode":"driving","maneuver":{"bearing_after":236,"bearing_before":136,"location":[-121.897852,37.335352],"modifier":"right","type":"turn","instruction":"Turn right onto West Saint John Street"},"weight":56.9,"duration":43.7,"name":"West Saint John Street","distance":267.1,"voiceInstructions":[{"distanceAlongGeometry":267.1,"announcement":"In 900 feet, turn left onto North Autumn Street","ssmlAnnouncement":"In 900 feet, turn left onto North Autumn Street"},{"distanceAlongGeometry":91.7,"announcement":"Turn left onto North Autumn Street, then you will arrive at your destination","ssmlAnnouncement":"Turn left onto North Autumn Street, then you will arrive at your destination"}],"bannerInstructions":[{"distanceAlongGeometry":267.1,"primary":{"text":"North Autumn Street","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Autumn Street","type":"text","abbr":"Autumn St","abbr_priority":0}],"type":"turn","modifier":"left"},"secondary":null}]},{"intersections":[{"out":1,"in":0,"entry":[false,true,true,true],"bearings":[60,165,240,315],"location":[-121.900438,37.334113]}],"driving_side":"right","geometry":"aeuefAjxeogFpFi@vFeAla@sA","mode":"driving","maneuver":{"bearing_after":171,"bearing_before":237,"location":[-121.900438,37.334113],"modifier":"left","type":"turn","instruction":"Turn left onto North Autumn Street"},"weight":15.2,"duration":15.2,"name":"North Autumn Street","distance":89.1,"voiceInstructions":[{"distanceAlongGeometry":58.6,"announcement":"You have arrived at your destination","ssmlAnnouncement":"You have arrived at your destination"}],"bannerInstructions":[{"distanceAlongGeometry":89.1,"primary":{"text":"You will arrive","components":[{"text":"You will arrive","type":"text"}],"type":"arrive","modifier":"straight"},"secondary":null},{"distanceAlongGeometry":58.6,"primary":{"text":"You have arrived","components":[{"text":"You have arrived","type":"text"}],"type":"arrive","modifier":"straight"},"secondary":null}]},{"intersections":[{"in":0,"entry":[true],"bearings":[357],"location":[-121.90034,37.333317]}],"driving_side":"right","geometry":"issefAfreogF","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":177,"location":[-121.90034,37.333317],"type":"arrive","instruction":"You have arrived at your destination"},"weight":0,"duration":0,"name":"North Autumn Street","distance":0,"voiceInstructions":[],"bannerInstructions":[]}],"distance":78168.7}],"weight_name":"routability","weight":3999.4,"duration":3713.3,"distance":78168.7,"voiceLocale":"en-US"}],"waypoints":[{"name":"Eddy Street","location":[-122.416686,37.783425]},{"name":"North Autumn Street","location":[-121.90034,37.333317]}],"code":"Ok","uuid":"cjhs6f53025wr3poa74lkjod4"} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/resources/feature_one.json b/libandroid-navigation-ui/src/test/resources/feature_one.json deleted file mode 100644 index 7c5e25f9..00000000 --- a/libandroid-navigation-ui/src/test/resources/feature_one.json +++ /dev/null @@ -1 +0,0 @@ -{"geometry":{"coordinates":[[-77.0319499,38.8994498],[-77.0319566,38.8995333],[-77.0319499,38.9002086],[-77.0319539,38.9025204],[-77.0319486,38.9026414],[-77.0319512,38.9027134],[-77.0319539,38.9033062],[-77.0319486,38.9036517],[-77.0319512,38.9037373],[-77.0319432,38.903826],[-77.0319378,38.9039919]],"type":"LineString"},"id":"4684337961","properties":{"name_zh-Hans":"14th St NW","name_ru":"14th St NW","name_zh":"14th St NW","name_ja":"14th St NW","name_pt":"14th St NW","name_es":"14th St NW","name_en":"14th St NW","name_de":"14th St NW","name_ar":"14th St NW","name_ko":"14th St NW","name":"14th St NW","localrank":1,"len":650,"iso_3166_2":"US-DC","name_fr":"14th St NW","class":"secondary"},"type":"Feature"} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/resources/feature_two.json b/libandroid-navigation-ui/src/test/resources/feature_two.json deleted file mode 100644 index ea20bd9b..00000000 --- a/libandroid-navigation-ui/src/test/resources/feature_two.json +++ /dev/null @@ -1 +0,0 @@ -{"geometry":{"coordinates":[[-77.030468,38.9013358],[-77.0336424,38.9013348]],"type":"LineString"},"id":"3470032291","properties":{"name_zh-Hans":"I St NW","name_ru":"I St NW","name_zh":"I St NW","name_ja":"I St NW","name_pt":"I St NW","name_es":"I St NW","name_en":"I St NW","name_de":"I St NW","name_ar":"I St NW","name_ko":"I St NW","name":"I St NW","localrank":1,"len":350,"iso_3166_2":"US-DC","name_fr":"I St NW","class":"secondary"},"type":"Feature"} \ No newline at end of file diff --git a/libandroid-navigation-ui/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/libandroid-navigation-ui/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker deleted file mode 100644 index ca6ee9ce..00000000 --- a/libandroid-navigation-ui/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ /dev/null @@ -1 +0,0 @@ -mock-maker-inline \ No newline at end of file diff --git a/libandroid-navigation/.gitignore b/libandroid-navigation/.gitignore deleted file mode 100644 index eab6a9e6..00000000 --- a/libandroid-navigation/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dependency-graph-mapbox-libraries.png \ No newline at end of file diff --git a/libandroid-navigation/build.gradle b/libandroid-navigation/build.gradle deleted file mode 100644 index 8a386924..00000000 --- a/libandroid-navigation/build.gradle +++ /dev/null @@ -1,80 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion androidVersions.compileSdkVersion - buildToolsVersion androidVersions.buildToolsVersion - - defaultConfig { - minSdkVersion androidVersions.minSdkVersion - targetSdkVersion androidVersions.targetSdkVersion - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - - buildConfigField('String', - "MAPBOX_NAVIGATION_SDK_IDENTIFIER", String.format("\"%s\"", "mapbox-navigation-android") - ) - buildConfigField('String', - "MAPBOX_NAVIGATION_VERSION_NAME", String.format("\"%s\"", project.VERSION_NAME) - ) - buildConfigField "String", - "MAPBOX_NAVIGATION_EVENTS_USER_AGENT", String.format("\"mapbox-navigation-android/%s\"", - project.VERSION_NAME - ) - consumerProguardFiles 'proguard-consumer.pro' - } - - configurations { - javadocDeps - } - - buildTypes { - debug { - testCoverageEnabled = true - } - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true - } -} - -dependencies { - api dependenciesList.mapLibreTurf - implementation(dependenciesList.mapLibre){ - exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-sdk-geojson' - exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-sdk-turf' - } - - compileOnly dependenciesList.gmsLocation - - // Support - implementation dependenciesList.androidxAppcompat - implementation dependenciesList.supportAnnotation - - // Logging - implementation dependenciesList.timber - - // AutoValues - annotationProcessor dependenciesList.autoValue - compileOnly dependenciesList.autoValueAnnotations - compileOnly dependenciesList.autoValueGson - annotationProcessor(dependenciesList.autoValueGson) - - // Unit testing - testImplementation dependenciesList.junit - testImplementation dependenciesList.mockito - testImplementation dependenciesList.hamcrest - testImplementation dependenciesList.commonsIO - testImplementation dependenciesList.robolectric - implementation dependenciesList.androidxCore - implementation dependenciesList.kotlinstdlib -} - -apply from: 'javadoc.gradle' -apply from: "${rootDir}/gradle/checkstyle.gradle" -apply from: "${rootDir}/gradle/dependencies-graph.gradle" -apply from: "${rootDir}/gradle/dependency-updates.gradle" -repositories { - mavenCentral() -} diff --git a/libandroid-navigation/gradle.properties b/libandroid-navigation/gradle.properties deleted file mode 100644 index 151cda1c..00000000 --- a/libandroid-navigation/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -POM_ARTIFACT_ID=mapbox-android-navigation -POM_NAME=Mapbox Android Navigation SDK -POM_DESCRIPTION=Mapbox Android Navigation SDK -POM_PACKAGING=aar \ No newline at end of file diff --git a/libandroid-navigation/javadoc.gradle b/libandroid-navigation/javadoc.gradle deleted file mode 100644 index 8cec085e..00000000 --- a/libandroid-navigation/javadoc.gradle +++ /dev/null @@ -1,19 +0,0 @@ -android.libraryVariants.all { variant -> - def name = variant.name - task "javadoc$name"(type: Javadoc) { - description = "Generates javadoc for build $name" - failOnError = false - destinationDir = new File(destinationDir, variant.baseName) - source = files(variant.javaCompile.source) - doFirst { - classpath = files(variant.javaCompile.classpath.files) + files(android.bootClasspath) + configurations.javadocDeps - } - options.windowTitle("Mapbox Android Navigation SDK $VERSION_NAME Reference") - options.docTitle("Mapbox Android Navigation SDK $VERSION_NAME") - options.header("Mapbox Android Navigation SDK $VERSION_NAME Reference") - options.bottom("© 2017 Mapbox. All rights reserved.") - options.links("http://docs.oracle.com/javase/7/docs/api/") - options.linksOffline("http://d.android.com/reference/", "$System.env.ANDROID_HOME/docs/reference") - exclude '**/R.java', '**/BuildConfig.java' - } -} \ No newline at end of file diff --git a/libandroid-navigation/proguard-consumer.pro b/libandroid-navigation/proguard-consumer.pro deleted file mode 100644 index e38b7ecd..00000000 --- a/libandroid-navigation/proguard-consumer.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Consumer proguard rules for libandroid-navigation - -# --- OkHttp --- --dontwarn okhttp3.** --dontwarn okio.** -# A resource is loaded with a relative path so the package of this class must be preserved. --keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase - -# --- Java --- --dontwarn java.awt.Color - -# --- com.mapbox.api.directions.v5.MapboxDirections --- --dontwarn com.sun.xml.internal.ws.spi.db.BindingContextFactory - -# --- AutoValue --- -# AutoValue annotations are retained but dependency is compileOnly. --dontwarn com.google.auto.value.** diff --git a/libandroid-navigation/src/main/AndroidManifest.xml b/libandroid-navigation/src/main/AndroidManifest.xml deleted file mode 100644 index 31b8d5db..00000000 --- a/libandroid-navigation/src/main/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/FileUtils.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/core/FileUtils.java deleted file mode 100644 index a91e4be7..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/FileUtils.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.mapbox.services.android.core; - -import android.content.Context; -import android.util.Log; - -import androidx.annotation.NonNull; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.StringWriter; -import java.util.Arrays; -import java.util.Comparator; - -/** - * File utility class - */ -public final class FileUtils { - private static final String LOG_TAG = "FileUtils"; - private static final int DEFAULT_BUFFER_SIZE_IN_BYTES = 4096; - - private FileUtils() { - } - - /** - * Return file from context.getFilesDir()/fileName - * - * @param context application context - * @param fileName path to the file - * @return instance of the file object. - */ - @NonNull - public static File getFile(@NonNull Context context, @NonNull String fileName) { - return new File(context.getFilesDir(), fileName); - } - - /** - * Read from file. - * - * @param file valid reference to the file. - * @return content read from the file. - */ - @NonNull - public static String readFromFile(@NonNull File file) throws FileNotFoundException { - InputStream inputStream = new FileInputStream(file); - Reader inputStreamReader = new InputStreamReader(inputStream); - StringWriter output = new StringWriter(); - try { - final char[] buffer = new char[DEFAULT_BUFFER_SIZE_IN_BYTES]; - int count; - while ((count = inputStreamReader.read(buffer)) != -1) { - output.write(buffer, 0, count); - } - } catch (IOException ioe) { - Log.w(LOG_TAG, ioe.toString()); - } finally { - try { - inputStreamReader.close(); - } catch (IOException ioe) { - Log.e(LOG_TAG, ioe.toString()); - } - } - return output.toString(); - } - - /** - * Write to file. - * - * @param file valid reference to the file. - * @param content content to write to the file. - */ - public static void writeToFile(@NonNull File file, @NonNull String content) throws IOException { - OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); - try { - writer.write(content); - writer.flush(); - } catch (IOException ioe) { - Log.e(LOG_TAG, ioe.toString()); - } finally { - try { - writer.close(); - } catch (IOException ioe) { - Log.e(LOG_TAG, ioe.toString()); - } - } - } - - /** - * Delete file. - * - * @param file to delete. - */ - public static void deleteFile(@NonNull File file) { - boolean deleted = file.delete(); - if (!deleted) { - Log.w(LOG_TAG, "Could not delete file: " + file); - } - } - - /** - * Return list of all files in the directory. - * - * @param directory target directory on file system - * @return list of files in the directory or empty list if directory is empty. - */ - @NonNull - public static File[] listAllFiles(File directory) { - if (directory == null) { - return new File[0]; - } - File[] files = directory.listFiles(); - return files != null ? files : new File[0]; - } - - /** - * Delete first n files sorted by property. - * - * @param files list of files to delete. - * @param sortedBy sorting comparator. - * @param numFiles number of files from list to delete. - */ - public static void deleteFirst(@NonNull File[] files, @NonNull Comparator sortedBy, int numFiles) { - Arrays.sort(files, sortedBy); - int size = Math.min(files.length, numFiles); - for (int i = 0; i < size; i++) { - if (!files[i].delete()) { - Log.w(LOG_TAG, "Failed to delete file: " + files[i]); - } - } - } - - /** - * Comparator for ordering files from oldest to newest, based of their modified date. - */ - public static final class LastModifiedComparator implements Comparator { - @Override - public int compare(File o1, File o2) { - long o1LastModified = o1.lastModified(); - long o2LastModified = o2.lastModified(); - return o1LastModified < o2LastModified ? -1 : (o1LastModified == o2LastModified ? 0 : 1); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityListener.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityListener.java deleted file mode 100644 index dcda5cc8..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityListener.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.mapbox.services.android.core.connectivity; - -/** - * Callback to use with the ConnectivityReceiver - */ - -interface ConnectivityListener { - - void onConnectivityChanged(boolean connected); -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityReceiver.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityReceiver.java deleted file mode 100644 index 3e881c1c..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/connectivity/ConnectivityReceiver.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.mapbox.services.android.core.connectivity; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; - -import androidx.annotation.UiThread; - -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * ConnectivityReceiver is a BroadcastReceiver that helps you keep track of the connectivity - * status. When used statically (getSystemConnectivity) the ConnectivityReceiver will always - * return the connectivity status as reported by the Android system. - *

- * When instantiating ConnectivityReceiver, you have the option to set a connectedFlag. You can - * override the connectivity value reported by the system by setting this flag to true or false. If - * left in its default value (null), ConnectivityReceiver will report the system value. - *

- * ConnectivityReceiver also lets you subscribe to connecitivity changes using a - * ConnectivityListener. - */ -public class ConnectivityReceiver extends BroadcastReceiver { - - private Context context; - private CopyOnWriteArrayList connectivityListeners; - private Boolean connectedFlag; - private int activationCounter; - - /** - * ConnectivityReceiver constructor - * - * @param context Android context. To avoid memory leaks, you might want to pass the application - * context and make sure you call removeConnectivityUpdates() when you don't need - * further updates (https://github.com/mapbox/mapbox-gl-native/issues/7176) - */ - public ConnectivityReceiver(Context context) { - this.context = context; - connectivityListeners = new CopyOnWriteArrayList<>(); - connectedFlag = null; - } - - /** - * Get the connectivity state as reported by the Android system - * - * @param context Android context - * @return the connectivity state as reported by the Android system - */ - private static boolean getSystemConnectivity(Context context) { - try { - ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - if (cm == null) { - return false; - } - - NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); - return activeNetwork.isConnectedOrConnecting(); - } catch (Exception exception) { - return false; - } - } - - /** - * Get the connectivity state. This can be overriden using the connectedFlag. - * - * @return the connectivity state - */ - private boolean getManagedConnectivity() { - if (connectedFlag == null) { - return getSystemConnectivity(context); - } - - return connectedFlag; - } - - /** - * Get the connectivity state as reported by the Android system - * - * @param context Android context - * @return the connectivity state as reported by the Android system - */ - public static boolean isConnected(Context context) { - return getSystemConnectivity(context); - } - - /** - * Get the connectivity state. This can be overriden using the connectedFlag. - * - * @return the connectivity state - */ - public boolean isConnected() { - return getManagedConnectivity(); - } - - /** - * Get the connectedFlag value - * - * @return the connectedFlag value, true/false if the connectivity state has ben overriden, - * null otherwise. - */ - public Boolean getConnectedFlag() { - return connectedFlag; - } - - /** - * Set the connectedFlag value - * - * @param connectedFlag Set it to true/false to override the connectivity state - */ - public void setConnectedFlag(Boolean connectedFlag) { - this.connectedFlag = connectedFlag; - } - - public void addConnectivityListener(ConnectivityListener listener) { - if (!connectivityListeners.contains(listener)) { - connectivityListeners.add(listener); - } - } - - public boolean removeConnectivityListener(ConnectivityListener listener) { - return connectivityListeners.remove(listener); - } - - @UiThread - public void requestConnectivityUpdates() { - if (activationCounter == 0) { - context.registerReceiver(this, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE")); - } - activationCounter++; - } - - @UiThread - public void removeConnectivityUpdates() { - activationCounter--; - if (activationCounter == 0) { - context.unregisterReceiver(this); - } - } - - @Override - public void onReceive(Context context, Intent intent) { - boolean connected = getManagedConnectivity(); - for (ConnectivityListener listener : connectivityListeners) { - listener.onConnectivityChanged(connected); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReport.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReport.java deleted file mode 100644 index 3b396689..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReport.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.mapbox.services.android.core.crashreporter; - -import android.util.Log; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Locale; - -/** - * Crash report data model - */ -public class CrashReport { - private static final String TAG = "MapboxCrashReport"; - private static final String CRASH_EVENT = "mobile.crash"; - private final JSONObject content; - - CrashReport(Calendar created) { - this.content = new JSONObject(); - put("event", CRASH_EVENT); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US); - put("created", dateFormat.format(created.getTimeInMillis())); - } - - CrashReport(@NonNull String json) throws JSONException { - this.content = new JSONObject(json); - } - - /** - * Add key value pair to report - * - * @param key valid non-empty key - * @param value valid string value or null - */ - public synchronized void put(@NonNull String key, @Nullable String value) { - if (value == null) { - putNull(key); - return; - } - - try { - this.content.put(key, value); - } catch (JSONException je) { - Log.e(TAG, "Failed json encode value: " + String.valueOf(value)); - } - } - - /** - * Return formatted date string - * - * @return date string in "yyyy-MM-dd'T'HH:mm:ss.SSSZ" format - */ - @NonNull - public String getDateString() { - return getString("created"); - } - - /** - * Return json formatted crash data - * - * @return valid json string - */ - @NonNull - public String toJson() { - return this.content.toString(); - } - - @VisibleForTesting - @NonNull - String getString(@NonNull String key) { - return this.content.optString(key); - } - - private void putNull(@NonNull String key) { - try { - this.content.put(key, "null"); - } catch (JSONException je) { - Log.e(TAG, "Failed json encode null value"); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReportBuilder.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReportBuilder.java deleted file mode 100644 index f5df8406..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/CrashReportBuilder.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.mapbox.services.android.core.crashreporter; - -import android.content.Context; -import android.os.Build; - -import androidx.annotation.NonNull; -import androidx.annotation.VisibleForTesting; - -import org.json.JSONException; - -import java.util.ArrayList; -import java.util.GregorianCalendar; -import java.util.List; -import java.util.Locale; - -/** - * Crash report builder encapsulates report generation logic. - */ -public final class CrashReportBuilder { - private static final String OS_VERSION_FORMAT = "Android-%s"; - private static final String THREAD_DETAILS_FORMAT = "tid:%s|name:%s|priority:%s"; - private static final String STACK_TRACE_ELEMENT_FORMAT = "%s.%s(%s:%d)"; - private final Context applicationContext; - private final String sdkIdentifier; - private final String sdkVersion; - private final List causalChain = new ArrayList<>(4); - - private Thread uncaughtExceptionThread; - private boolean isSilent; - - private CrashReportBuilder(Context applicationContext, String sdkIdentifier, String sdkVersion) { - this.applicationContext = applicationContext; - this.sdkIdentifier = sdkIdentifier; - this.sdkVersion = sdkVersion; - } - - /** - * Exports json encoded content to CrashReport object - * - * @param json valid json body. - * @return new instance of CrashReport - */ - public static CrashReport fromJson(String json) throws IllegalArgumentException { - try { - return new CrashReport(json); - } catch (JSONException je) { - throw new IllegalArgumentException(je.toString()); - } - } - - static CrashReportBuilder setup(Context context, String sdkIdentifier, String sdkVersion) { - return new CrashReportBuilder(context, sdkIdentifier, sdkVersion); - } - - CrashReportBuilder isSilent(boolean silent) { - this.isSilent = silent; - return this; - } - - CrashReportBuilder addCausalChain(@NonNull List causalChain) { - this.causalChain.addAll(causalChain); - return this; - } - - CrashReportBuilder addExceptionThread(@NonNull Thread thread) { - this.uncaughtExceptionThread = thread; - return this; - } - - CrashReport build() { - CrashReport report = new CrashReport(new GregorianCalendar()); - report.put("sdkIdentifier", sdkIdentifier); - report.put("sdkVersion", sdkVersion); - report.put("osVersion", String.format(OS_VERSION_FORMAT, Build.VERSION.RELEASE)); - report.put("model", Build.MODEL); - report.put("device", Build.DEVICE); - report.put("isSilent", Boolean.toString(isSilent)); - report.put("stackTraceHash", getStackTraceHash(causalChain)); - report.put("stackTrace", getStackTrace(causalChain)); - if (uncaughtExceptionThread != null) { - report.put("threadDetails", String.format(THREAD_DETAILS_FORMAT, uncaughtExceptionThread.getId(), - uncaughtExceptionThread.getName(), uncaughtExceptionThread.getPriority())); - } - report.put("appId", applicationContext.getPackageName()); - report.put("appVersion", getAppVersion(applicationContext)); - return report; - } - - @VisibleForTesting - @NonNull - String getStackTrace(@NonNull List throwables) { - StringBuilder result = new StringBuilder(); - for (Throwable throwable : throwables) { - StackTraceElement[] stackTraceElements = throwable.getStackTrace(); - for (StackTraceElement element : stackTraceElements) { - if (element.getClassName().startsWith(sdkIdentifier)) { - result.append(String.format(Locale.US, STACK_TRACE_ELEMENT_FORMAT, - element.getClassName(), element.getMethodName(), - element.getFileName(), element.getLineNumber())).append('\n'); - } - } - } - return result.toString(); - } - - @VisibleForTesting - @NonNull - static String getStackTraceHash(@NonNull List throwables) { - StringBuilder result = new StringBuilder(); - for (Throwable throwable : throwables) { - StackTraceElement[] stackTraceElements = throwable.getStackTrace(); - for (StackTraceElement element : stackTraceElements) { - result.append(element.getClassName()); - result.append(element.getMethodName()); - } - } - return Integer.toHexString(result.toString().hashCode()); - } - - @NonNull - private static String getAppVersion(Context context) { - try { - String packageName = context.getPackageName(); - return context.getPackageManager().getPackageInfo(packageName, 0).versionName; - } catch (Exception exception) { - return "unknown"; - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/MapboxUncaughtExceptionHanlder.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/MapboxUncaughtExceptionHanlder.java deleted file mode 100644 index 8ea8cb71..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/core/crashreporter/MapboxUncaughtExceptionHanlder.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.mapbox.services.android.core.crashreporter; - -import android.content.Context; -import android.content.SharedPreferences; -import android.text.TextUtils; -import android.util.Log; - -import androidx.annotation.IntRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; -import com.mapbox.services.android.core.FileUtils; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * Mapbox custom exception handler, which catches unhandled fatal exceptions - * caused by Mapbox classes. This is an attempt to capture mapbox exceptions as reliably - * as possible with minimal false positives. - *

- * Note: this handler is not capturing full application's stacktrace! - */ -public class MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler, - SharedPreferences.OnSharedPreferenceChangeListener { - public static final String MAPBOX_PREF_ENABLE_CRASH_REPORTER = "mapbox.crash.enable"; - public static final String MAPBOX_CRASH_REPORTER_PREFERENCES = "MapboxCrashReporterPrefs"; - - private static final String TAG = "MbUncaughtExcHandler"; - private static final String CRASH_FILENAME_FORMAT = "%s/%s.crash"; - private static final int DEFAULT_EXCEPTION_CHAIN_DEPTH = 2; - private static final int DEFAULT_MAX_REPORTS = 10; - - private final Thread.UncaughtExceptionHandler defaultExceptionHandler; - private final Context applicationContext; - private final AtomicBoolean isEnabled = new AtomicBoolean(true); - private final String mapboxPackage; - private final String version; - - private int exceptionChainDepth; - - @VisibleForTesting - MapboxUncaughtExceptionHanlder(@NonNull Context applicationContext, - @NonNull SharedPreferences sharedPreferences, - @NonNull String mapboxPackage, - @NonNull String version, - Thread.UncaughtExceptionHandler defaultExceptionHandler) { - if (TextUtils.isEmpty(mapboxPackage) || TextUtils.isEmpty(version)) { - throw new IllegalArgumentException("Invalid package name: " + mapboxPackage + " or version: " + version); - } - this.applicationContext = applicationContext; - this.mapboxPackage = mapboxPackage; - this.version = version; - this.exceptionChainDepth = DEFAULT_EXCEPTION_CHAIN_DEPTH; - this.defaultExceptionHandler = defaultExceptionHandler; - initializeSharedPreferences(sharedPreferences); - } - - @Override - public void uncaughtException(Thread thread, Throwable throwable) { - // If we're not enabled or crash is not in Mapbox code - // then just pass the Exception on to the defaultExceptionHandler. - List causalChain; - if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { - try { - CrashReport report = CrashReportBuilder.setup(applicationContext, mapboxPackage, version) - .addExceptionThread(thread) - .addCausalChain(causalChain) - .build(); - - ensureDirectoryWritable(applicationContext, mapboxPackage); - - File file = FileUtils.getFile(applicationContext, getReportFileName(mapboxPackage, report.getDateString())); - FileUtils.writeToFile(file, report.toJson()); - } catch (Exception ex) { - Log.e(TAG, ex.toString()); - } - } - - // Give default exception handler a chance to handle exception - if (defaultExceptionHandler != null) { - defaultExceptionHandler.uncaughtException(thread, throwable); - } else { - Log.i(TAG, "Default exception handler is null"); - } - } - - @Override - public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { - return; - } - - try { - isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); - } catch (Exception ex) { - // In case of a ClassCastException - Log.e(TAG, ex.toString()); - } - } - - @VisibleForTesting - boolean isEnabled() { - return isEnabled.get(); - } - - /** - * Set exception chain depth we're interested in to dig into backtrace data. - * - * @param depth of exception chain - */ - @VisibleForTesting - void setExceptionChainDepth(@IntRange(from = 1, to = 256) int depth) { - this.exceptionChainDepth = depth; - } - - @VisibleForTesting - boolean isMapboxCrash(List throwables) { - for (Throwable cause : throwables) { - final StackTraceElement[] stackTraceElements = cause.getStackTrace(); - for (final StackTraceElement element : stackTraceElements) { - if (isMapboxStackTraceElement(element)) { - return true; - } - } - } - return false; - } - - @VisibleForTesting - List getCausalChain(@Nullable Throwable throwable) { - List causes = new ArrayList<>(4); - int level = 0; - while (throwable != null) { - if (isMidOrLowLevelException(++level)) { - causes.add(throwable); - } - throwable = throwable.getCause(); - } - return Collections.unmodifiableList(causes); - } - - private boolean isMapboxStackTraceElement(@NonNull StackTraceElement element) { - return element.getClassName().startsWith(mapboxPackage); - } - - private boolean isMidOrLowLevelException(int level) { - return level >= exceptionChainDepth; - } - - @VisibleForTesting - static void ensureDirectoryWritable(@NonNull Context context, @NonNull String dirPath) { - File directory = FileUtils.getFile(context, dirPath); - if (!directory.exists()) { - directory.mkdir(); - } - - // Cleanup directory if we've reached our max limit - File[] allFiles = FileUtils.listAllFiles(directory); - if (allFiles.length >= DEFAULT_MAX_REPORTS) { - FileUtils.deleteFirst(allFiles, new FileUtils.LastModifiedComparator(), DEFAULT_MAX_REPORTS - 1); - } - } - - @VisibleForTesting - @NonNull - static String getReportFileName(@NonNull String mapboxPackage, - @NonNull String timestamp) { - return String.format(CRASH_FILENAME_FORMAT, mapboxPackage, timestamp); - } - - private void initializeSharedPreferences(SharedPreferences sharedPreferences) { - try { - isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, true)); - } catch (Exception ex) { - // In case of a ClassCastException - Log.e(TAG, ex.toString()); - } - sharedPreferences.registerOnSharedPreferenceChangeListener(this); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/NavigationException.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/NavigationException.java deleted file mode 100644 index 8bda9013..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/NavigationException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mapbox.services.android.navigation.v5.exception; - -/** - * Generic Exception for all things Mapbox Navigation. - * - * @since 0.2.0 - */ -public class NavigationException extends RuntimeException { - - /** - * A form of {@code Throwable} that indicates conditions that a reasonable application might - * want to catch. - * - * @param message the detail message (which is saved for later retrieval by the - * {@link #getMessage()} method). - * @since 0.2.0 - */ - public NavigationException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/package-info.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/package-info.java deleted file mode 100644 index b55c5548..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/exception/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This contains a runtime exception to be thrown during the normal operation and does not need to - * be declared in a method or constructor. - */ -package com.mapbox.services.android.navigation.v5.exception; \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/Instruction.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/Instruction.java deleted file mode 100644 index 9a0502f9..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/Instruction.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mapbox.services.android.navigation.v5.instruction; - -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -/** - * Base Instruction. Subclassed to provide concrete instructions. - * - * @since 0.4.0 - */ -public abstract class Instruction { - - /** - * Will provide an instruction based on your specifications - * - * @return {@link String} instruction that will be voiced on the client - * @since 0.4.0 - */ - public abstract String buildInstruction(RouteProgress routeProgress); -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/package-info.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/package-info.java deleted file mode 100644 index f3904b84..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/instruction/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains instruction logic for providing turn by turn navigation instructions. - */ -package com.mapbox.services.android.navigation.v5.instruction; \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/LocationValidator.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/LocationValidator.java deleted file mode 100644 index 52d49a92..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/LocationValidator.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location; - -import android.location.Location; - -import androidx.annotation.NonNull; - -public class LocationValidator { - - private Location lastValidLocation; - private final int accuracyThreshold; - - public LocationValidator(int accuracyThreshold) { - this.accuracyThreshold = accuracyThreshold; - } - - public boolean isValidUpdate(@NonNull Location location) { - return checkLastValidLocation(location) || location.getAccuracy() < accuracyThreshold; - } - - /** - * On the first location update, the last valid location will be null. - *

- * So set the last valid location and return true. On the next update, there - * will be a last update to compare against. - * - * @param location new location update - * @return true if last valid location null, false otherwise - */ - private boolean checkLastValidLocation(@NonNull Location location) { - if (lastValidLocation == null) { - lastValidLocation = location; - return true; - } - return false; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/MetricsLocation.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/MetricsLocation.java deleted file mode 100644 index 95e733bf..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/MetricsLocation.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location; - -import android.location.Location; - -public class MetricsLocation { - private Location location; - - public MetricsLocation(Location location) { - this.location = location; - } - - public Location getLocation() { - if (location != null) { - return location; - } - - Location metricLocation = new Location("MetricsLocation"); - metricLocation.setLatitude(0.0); - metricLocation.setLongitude(0.0); - - return metricLocation; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/GoogleLocationEngineImpl.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/GoogleLocationEngineImpl.java deleted file mode 100644 index 521aba29..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/GoogleLocationEngineImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.engine; - -import android.annotation.SuppressLint; -import android.app.PendingIntent; -import android.content.Context; -import android.location.Location; -import android.os.Looper; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; - -import com.google.android.gms.location.FusedLocationProviderClient; -import com.google.android.gms.location.LocationCallback; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationResult; -import com.google.android.gms.location.LocationServices; -import com.google.android.gms.location.Priority; -import com.google.android.gms.tasks.OnFailureListener; -import com.google.android.gms.tasks.OnSuccessListener; -import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback; -import com.mapbox.mapboxsdk.location.engine.LocationEngineImpl; -import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest; -import com.mapbox.mapboxsdk.location.engine.LocationEngineResult; - -import java.util.Collections; -import java.util.List; - -/** - * Wraps implementation of Fused Location Provider - */ -public class GoogleLocationEngineImpl implements LocationEngineImpl { - private final FusedLocationProviderClient fusedLocationProviderClient; - - @VisibleForTesting - GoogleLocationEngineImpl(FusedLocationProviderClient fusedLocationProviderClient) { - this.fusedLocationProviderClient = fusedLocationProviderClient; - } - - public GoogleLocationEngineImpl(@NonNull Context context) { - this.fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(context); - } - - @NonNull - @Override - public LocationCallback createListener(LocationEngineCallback callback) { - return new GoogleLocationEngineCallbackTransport(callback); - } - - @SuppressLint("MissingPermission") - @Override - public void getLastLocation(@NonNull LocationEngineCallback callback) - throws SecurityException { - GoogleLastLocationEngineCallbackTransport transport = - new GoogleLastLocationEngineCallbackTransport(callback); - fusedLocationProviderClient.getLastLocation().addOnSuccessListener(transport).addOnFailureListener(transport); - } - - @SuppressLint("MissingPermission") - @Override - public void requestLocationUpdates(@NonNull LocationEngineRequest request, - @NonNull LocationCallback listener, - @Nullable Looper looper) throws SecurityException { - fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), listener, looper); - } - - @SuppressLint("MissingPermission") - @Override - public void requestLocationUpdates(@NonNull LocationEngineRequest request, - @NonNull PendingIntent pendingIntent) throws SecurityException { - fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), pendingIntent); - } - - @Override - public void removeLocationUpdates(@NonNull LocationCallback listener) { - // The listener is annotated with @NonNull, but there seems to be cases where a null - // listener is somehow passed into this method. - if (listener != null) { - fusedLocationProviderClient.removeLocationUpdates(listener); - } - } - - @Override - public void removeLocationUpdates(PendingIntent pendingIntent) { - if (pendingIntent != null) { - fusedLocationProviderClient.removeLocationUpdates(pendingIntent); - } - } - - private static LocationRequest toGMSLocationRequest(LocationEngineRequest request) { - LocationRequest.Builder builder = new LocationRequest.Builder(request.getInterval()); - builder.setMinUpdateIntervalMillis(request.getFastestInterval()); - builder.setMinUpdateDistanceMeters(request.getDisplacement()); - builder.setMaxUpdateDelayMillis(request.getMaxWaitTime()); - builder.setPriority(toGMSLocationPriority(request.getPriority())); - return builder.build(); - } - - private static int toGMSLocationPriority(int enginePriority) { - switch (enginePriority) { - case LocationEngineRequest.PRIORITY_BALANCED_POWER_ACCURACY: - return Priority.PRIORITY_BALANCED_POWER_ACCURACY; - case LocationEngineRequest.PRIORITY_LOW_POWER: - return Priority.PRIORITY_LOW_POWER; - case LocationEngineRequest.PRIORITY_NO_POWER: - return Priority.PRIORITY_PASSIVE; - case LocationEngineRequest.PRIORITY_HIGH_ACCURACY: - default: - return Priority.PRIORITY_HIGH_ACCURACY; - } - } - - private static final class GoogleLocationEngineCallbackTransport extends LocationCallback { - private final LocationEngineCallback callback; - - GoogleLocationEngineCallbackTransport(LocationEngineCallback callback) { - this.callback = callback; - } - - @Override - public void onLocationResult(LocationResult locationResult) { - super.onLocationResult(locationResult); - List locations = locationResult.getLocations(); - if (!locations.isEmpty()) { - callback.onSuccess(LocationEngineResult.create(locations)); - } else { - callback.onFailure(new Exception("Unavailable location")); - } - } - } - - @VisibleForTesting - static final class GoogleLastLocationEngineCallbackTransport - implements OnSuccessListener, OnFailureListener { - private final LocationEngineCallback callback; - - GoogleLastLocationEngineCallbackTransport(LocationEngineCallback callback) { - this.callback = callback; - } - - @Override - public void onSuccess(Location location) { - callback.onSuccess(location != null ? LocationEngineResult.create(location) : - LocationEngineResult.create(Collections.emptyList())); - } - - @Override - public void onFailure(@NonNull Exception e) { - callback.onFailure(e); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/LocationEngineProvider.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/LocationEngineProvider.java deleted file mode 100644 index 325f37c9..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/LocationEngineProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.engine; - -import static com.mapbox.services.android.navigation.v5.location.engine.Utils.checkNotNull; -import static com.mapbox.services.android.navigation.v5.location.engine.Utils.isOnClasspath; - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.mapboxsdk.location.engine.LocationEngineProxy; -import com.mapbox.mapboxsdk.location.engine.MapboxFusedLocationEngineImpl; - - -/** - * The main entry point for location engine integration. - */ -public final class LocationEngineProvider { - private static final String GOOGLE_LOCATION_SERVICES = "com.google.android.gms.location.LocationServices"; - private static final String GOOGLE_API_AVAILABILITY = "com.google.android.gms.common.GoogleApiAvailability"; - - private LocationEngineProvider() { - // prevent instantiation - } - - /** - * Returns instance to the best location engine, given the included libraries. - * - * @param context {@link Context}. - * @param background true if background optimized engine is desired (note: parameter deprecated) - * @return a unique instance of {@link LocationEngine} every time method is called. - * @since 1.0.0 - */ - @NonNull - @Deprecated - public static LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) { - return getBestLocationEngine(context); - } - - /** - * Returns instance to the best location engine, given the included libraries. - * - * @param context {@link Context}. - * @return a unique instance of {@link LocationEngine} every time method is called. - * @since 1.1.0 - */ - @NonNull - public static LocationEngine getBestLocationEngine(@NonNull Context context) { - checkNotNull(context, "context == null"); - - boolean hasGoogleLocationServices = isOnClasspath(GOOGLE_LOCATION_SERVICES); - if (isOnClasspath(GOOGLE_API_AVAILABILITY)) { - // Check Google Play services APK is available and up-to-date on this device - hasGoogleLocationServices &= GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) - == ConnectionResult.SUCCESS; - } - return getLocationEngine(context, hasGoogleLocationServices); - } - - private static LocationEngine getLocationEngine(Context context, boolean isGoogle) { - return isGoogle ? new LocationEngineProxy<>(new GoogleLocationEngineImpl(context.getApplicationContext())) : - new LocationEngineProxy<>(new MapboxFusedLocationEngineImpl(context.getApplicationContext())); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/Utils.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/Utils.java deleted file mode 100644 index c0ef0b98..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/engine/Utils.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.engine; - -import android.location.Location; - -import androidx.annotation.Nullable; - -final class Utils { - private static final int TWO_MINUTES = 1000 * 60 * 2; - private static final int ACCURACY_THRESHOLD_METERS = 200; - - private Utils() { - // Prevent instantiation - } - - /** - * Ensures that an object reference passed as a parameter to the calling method is not null. - * - * @param reference object reference. - * @param message exception message to use if check fails. - * @param object type. - * @return validated non-null reference. - */ - static T checkNotNull(@Nullable T reference, String message) { - if (reference == null) { - throw new NullPointerException(message); - } - return reference; - } - - /** - * Checks if class is on class path - * - * @param className of the class to check. - * @return true if class in on class path, false otherwise. - */ - static boolean isOnClasspath(String className) { - boolean isOnClassPath = true; - try { - Class.forName(className); - } catch (ClassNotFoundException exception) { - isOnClassPath = false; - } - return isOnClassPath; - } - - /** - * Determines whether one Location reading is better than the current Location fix - *

- * (c) https://developer.android.com/guide/topics/location/strategies - * - * @param location The new Location that you want to evaluate - * @param currentBestLocation The current Location fix, to which you want to compare the new one - */ - static boolean isBetterLocation(Location location, Location currentBestLocation) { - if (currentBestLocation == null) { - // A new location is always better than no location - return true; - } - - // Check whether the new location fix is newer or older - long timeDelta = location.getTime() - currentBestLocation.getTime(); - boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; - boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; - boolean isNewer = timeDelta > 0; - - // If it's been more than two minutes since the current location, use the new location - // because the user has likely moved - if (isSignificantlyNewer) { - return true; - // If the new location is more than two minutes older, it must be worse - } else if (isSignificantlyOlder) { - return false; - } - - // Check whether the new location fix is more or less accurate - int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy()); - boolean isLessAccurate = accuracyDelta > 0; - boolean isMoreAccurate = accuracyDelta < 0; - boolean isSignificantlyLessAccurate = accuracyDelta > ACCURACY_THRESHOLD_METERS; - - // Check if the old and new location are from the same provider - boolean isFromSameProvider = isSameProvider(location.getProvider(), - currentBestLocation.getProvider()); - - // Determine location quality using a combination of timeliness and accuracy - if (isMoreAccurate) { - return true; - } else if (isNewer && !isLessAccurate) { - return true; - } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { - return true; - } - return false; - } - - /** - * Checks whether two providers are the same - *

- * (c) https://developer.android.com/guide/topics/location/strategies - */ - private static boolean isSameProvider(String provider1, String provider2) { - if (provider1 == null) { - return provider2 == null; - } - return provider1.equals(provider2); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParser.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParser.java deleted file mode 100644 index 76cabd86..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParser.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.TimeZone; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -class GpxParser { - - private static final String TAG_TRACK_POINT = "trkpt"; - private static final String TAG_TIME = "time"; - private static final String ATTR_LATITUDE = "lat"; - private static final String ATTR_LONGITUDE = "lon"; - private static final String GPX_LOCATION_NAME = "GPX Generated Location"; - private static final String DATE_FORMAT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'"; - - private SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_PATTERN); - - @Nullable - List parseGpx(InputStream inputStream) throws ParserConfigurationException, - SAXException, IOException, ParseException { - - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - Document document = documentBuilder.parse(inputStream); - Element elementRoot = document.getDocumentElement(); - - NodeList trackPointNodes = elementRoot.getElementsByTagName(TAG_TRACK_POINT); - if (trackPointNodes == null || trackPointNodes.getLength() == 0) { - return null; // Gpx trace did not contain correct tagging - } - return createGpxLocationList(trackPointNodes); - } - - @NonNull - private List createGpxLocationList(NodeList trackPointNodes) throws ParseException { - List gpxLocations = new ArrayList<>(); - - for (int i = 0; i < trackPointNodes.getLength(); i++) { - Node node = trackPointNodes.item(i); - NamedNodeMap attributes = node.getAttributes(); - - Double latitude = createCoordinate(attributes, ATTR_LATITUDE); - Double longitude = createCoordinate(attributes, ATTR_LONGITUDE); - Long time = createTime(node); - - gpxLocations.add(buildGpxLocation(latitude, longitude, time)); - } - return gpxLocations; - } - - @NonNull - private Double createCoordinate(NamedNodeMap attributes, String attributeName) { - String coordinateTextContent = attributes.getNamedItem(attributeName).getTextContent(); - return Double.parseDouble(coordinateTextContent); - } - - @NonNull - private Long createTime(Node trackPoint) throws ParseException { - dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - NodeList trackPointChildren = trackPoint.getChildNodes(); - for (int i = 0; i < trackPointChildren.getLength(); i++) { - Node node = trackPointChildren.item(i); - if (node.getNodeName().contains(TAG_TIME)) { - Date date = dateFormat.parse(node.getTextContent()); - return date.getTime(); - } - } - return 0L; - } - - @NonNull - private Location buildGpxLocation(Double latitude, Double longitude, Long time) { - Location gpxLocation = new Location(GPX_LOCATION_NAME); - gpxLocation.setTime(time); - gpxLocation.setLatitude(latitude); - gpxLocation.setLongitude(longitude); - return gpxLocation; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ParseGpxTask.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ParseGpxTask.java deleted file mode 100644 index 60d3a169..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ParseGpxTask.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; -import android.os.AsyncTask; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; - -class ParseGpxTask extends AsyncTask> { - - private static final int FIRST_INPUT_STREAM = 0; - - private Listener listener; - private GpxParser parser; - - ParseGpxTask(GpxParser parser, Listener listener) { - this.parser = parser; - this.listener = listener; - } - - @Override - protected List doInBackground(InputStream... inputStreams) { - InputStream inputStream = inputStreams[FIRST_INPUT_STREAM]; - try { - return parseGpxStream(inputStream); - } catch (IOException exception) { - listener.onParseError(exception); - return null; - } - } - - @Override - protected void onPostExecute(List locationList) { - if (locationList != null && !locationList.isEmpty()) { - listener.onParseComplete(locationList); - } else { - listener.onParseError(new RuntimeException("An error occurred parsing the GPX Xml.")); - } - } - - @Nullable - private List parseGpxStream(InputStream inputStream) throws IOException { - try { - return parser.parseGpx(inputStream); - } catch (ParserConfigurationException | ParseException | SAXException | IOException exception) { - exception.printStackTrace(); - listener.onParseError(exception); - return null; - } finally { - inputStream.close(); - } - } - - public interface Listener { - - void onParseComplete(@NonNull List gpxLocationList); - - void onParseError(Exception exception); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteDto.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteDto.java deleted file mode 100644 index 0cd2dac7..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteDto.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -class ReplayJsonRouteDto { - - private List locations; - @SerializedName("route") - private String routeRequest; - - List getLocations() { - return locations; - } - - void setLocations(List locations) { - this.locations = locations; - } - - String getRouteRequest() { - return routeRequest; - } - - void setRouteRequest(String routeRequest) { - this.routeRequest = routeRequest; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapper.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapper.java deleted file mode 100644 index a7d98b63..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; -import android.os.Build; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -class ReplayJsonRouteLocationMapper { - - private static final String NON_NULL_AND_NON_EMPTY_REPLAY_LOCATION_LIST_REQUIRED = "Non-null and non-empty replay " - + "location list required."; - private static final String REPLAY = "ReplayLocation"; - private final List replayLocations; - - ReplayJsonRouteLocationMapper(List replayLocations) { - checkValidInput(replayLocations); - this.replayLocations = replayLocations; - } - - List toLocations() { - List mappedLocations = mapReplayLocations(); - return mappedLocations; - } - - private void checkValidInput(List locations) { - boolean isValidInput = locations == null || locations.isEmpty(); - if (isValidInput) { - throw new IllegalArgumentException(NON_NULL_AND_NON_EMPTY_REPLAY_LOCATION_LIST_REQUIRED); - } - } - - private List mapReplayLocations() { - List locations = new ArrayList<>(replayLocations.size()); - for (ReplayLocationDto sample : replayLocations) { - Location location = new Location(REPLAY); - location.setLongitude(sample.getLongitude()); - location.setAccuracy(sample.getHorizontalAccuracyMeters()); - location.setBearing((float) sample.getBearing()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - location.setVerticalAccuracyMeters(sample.getVerticalAccuracyMeters()); - } - location.setSpeed((float) sample.getSpeed()); - location.setLatitude(sample.getLatitude()); - location.setAltitude(sample.getAltitude()); - Date date = sample.getDate(); - if (date != null) { - location.setTime(date.getTime()); - } - locations.add(location); - } - return locations; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcher.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcher.java deleted file mode 100644 index 26b6e27d..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcher.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; -import android.os.Handler; - -import androidx.annotation.NonNull; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CopyOnWriteArraySet; - -class ReplayLocationDispatcher implements Runnable { - - private static final String NON_NULL_AND_NON_EMPTY_LOCATION_LIST_REQUIRED = "Non-null and non-empty location list " - + "required."; - private static final int HEAD = 0; - private List locationsToReplay; - private Location current; - private Handler handler; - private CopyOnWriteArraySet replayLocationListeners; - - ReplayLocationDispatcher(@NonNull List locationsToReplay) { - checkValidInput(locationsToReplay); - this.locationsToReplay = new CopyOnWriteArrayList<>(locationsToReplay); - initialize(); - this.replayLocationListeners = new CopyOnWriteArraySet<>(); - this.handler = new Handler(); - } - - // For testing only - ReplayLocationDispatcher(List locationsToReplay, Handler handler) { - checkValidInput(locationsToReplay); - this.locationsToReplay = locationsToReplay; - initialize(); - this.replayLocationListeners = new CopyOnWriteArraySet<>(); - this.handler = handler; - } - - @Override - public void run() { - dispatchLocation(current); - scheduleNextDispatch(); - } - - void stop() { - clearLocations(); - stopDispatching(); - } - - void pause() { - stopDispatching(); - } - - void update(@NonNull List locationsToReplay) { - checkValidInput(locationsToReplay); - this.locationsToReplay = new CopyOnWriteArrayList<>(locationsToReplay); - initialize(); - } - - void add(@NonNull List toReplay) { - boolean shouldRedispatch = locationsToReplay.isEmpty(); - addLocations(toReplay); - if (shouldRedispatch) { - stopDispatching(); - scheduleNextDispatch(); - } - } - - void addReplayLocationListener(ReplayLocationListener listener) { - replayLocationListeners.add(listener); - } - - void removeReplayLocationListener(ReplayLocationListener listener) { - replayLocationListeners.remove(listener); - } - - private void checkValidInput(List locations) { - boolean isValidInput = locations == null || locations.isEmpty(); - if (isValidInput) { - throw new IllegalArgumentException(NON_NULL_AND_NON_EMPTY_LOCATION_LIST_REQUIRED); - } - } - - private void initialize() { - current = locationsToReplay.remove(HEAD); - } - - private void addLocations(List toReplay) { - locationsToReplay.addAll(toReplay); - } - - private void dispatchLocation(Location location) { - for (ReplayLocationListener listener : replayLocationListeners) { - listener.onLocationReplay(location); - } - } - - private void scheduleNextDispatch() { - if (locationsToReplay.isEmpty()) { - stopDispatching(); - return; - } - long currentTime = current.getTime(); - current = locationsToReplay.remove(HEAD); - long nextTime = current.getTime(); - long diff = nextTime - currentTime; - handler.postDelayed(this, diff); - } - - private void clearLocations() { - locationsToReplay.clear(); - } - - private void stopDispatching() { - handler.removeCallbacks(this); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDto.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDto.java deleted file mode 100644 index 1fb9ee9b..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDto.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; - -import java.util.Date; - -class ReplayLocationDto { - - @SerializedName("lng") - private double longitude; - @SerializedName("horizontalAccuracy") - private float horizontalAccuracyMeters; - @SerializedName("course") - private double bearing; - @SerializedName("verticalAccuracy") - private float verticalAccuracyMeters; - private double speed; - @SerializedName("lat") - private double latitude; - @SerializedName("altitude") - private double altitude; - @SerializedName("timestamp") - @JsonAdapter(TimestampAdapter.class) - private Date date; - - double getLongitude() { - return longitude; - } - - void setLongitude(double longitude) { - this.longitude = longitude; - } - - float getHorizontalAccuracyMeters() { - return horizontalAccuracyMeters; - } - - void setHorizontalAccuracyMeters(float horizontalAccuracyMeters) { - this.horizontalAccuracyMeters = horizontalAccuracyMeters; - } - - double getBearing() { - return bearing; - } - - void setBearing(double bearing) { - this.bearing = bearing; - } - - float getVerticalAccuracyMeters() { - return verticalAccuracyMeters; - } - - void setVerticalAccuracyMeters(float verticalAccuracyMeters) { - this.verticalAccuracyMeters = verticalAccuracyMeters; - } - - double getSpeed() { - return speed; - } - - void setSpeed(double speed) { - this.speed = speed; - } - - double getLatitude() { - return latitude; - } - - void setLatitude(double latitude) { - this.latitude = latitude; - } - - double getAltitude() { - return altitude; - } - - void setAltitude(double altitude) { - this.altitude = altitude; - } - - Date getDate() { - return date; - } - - void setDate(Date date) { - this.date = date; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationListener.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationListener.java deleted file mode 100644 index 8815132a..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationListener.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; - - -interface ReplayLocationListener { - - void onLocationReplay(Location location); -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverter.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverter.java deleted file mode 100644 index 43b17485..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverter.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; - -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.utils.Constants; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class ReplayRouteLocationConverter { - - private static final int ONE_SECOND_IN_MILLISECONDS = 1000; - private static final double ONE_KM_IN_METERS = 1000d; - private static final int ONE_HOUR_IN_SECONDS = 3600; - private static final String REPLAY_ROUTE = "ReplayRouteLocation"; - private DirectionsRoute route; - private int speed; - private int delay; - private double distance; - private int currentLeg; - private int currentStep; - private long time; - - ReplayRouteLocationConverter(DirectionsRoute route, int speed, int delay) { - initialize(); - update(route); - this.speed = speed; - this.delay = delay; - this.distance = calculateDistancePerSec(); - } - - void updateSpeed(int customSpeedInKmPerHour) { - this.speed = customSpeedInKmPerHour; - } - - void updateDelay(int customDelayInSeconds) { - this.delay = customDelayInSeconds; - } - - List toLocations() { - List stepPoints = calculateStepPoints(); - List mockedLocations = calculateMockLocations(stepPoints); - - return mockedLocations; - } - - boolean isMultiLegRoute() { - return route.legs().size() > 1; - } - - void initializeTime() { - time = System.currentTimeMillis(); - } - - /** - * Interpolates the route into even points along the route and adds these to the points list. - * - * @param lineString our route geometry. - * @return list of sliced {@link Point}s. - */ - List sliceRoute(LineString lineString) { - if (lineString == null || lineString.coordinates().isEmpty()) { - return Collections.emptyList(); - } - - double distanceMeters = TurfMeasurement.length(lineString, TurfConstants.UNIT_METERS); - if (distanceMeters <= 0) { - return Collections.emptyList(); - } - - List points = new ArrayList<>(); - for (double i = 0; i < distanceMeters; i += distance) { - Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); - points.add(point); - } - return points; - } - - List calculateMockLocations(List points) { - List mockedLocations = new ArrayList<>(); - for(int i = 0; i < points.size(); i++){ - Location mockedLocation = createMockLocationFrom(points.get(i)); - - if (i - 1 >= 0) { - double bearing = TurfMeasurement.bearing(points.get(i - 1), points.get(i)); - mockedLocation.setBearing((float) bearing); - }else{ - mockedLocation.setBearing(0); - } - time += delay * ONE_SECOND_IN_MILLISECONDS; - mockedLocations.add(mockedLocation); - } - - return mockedLocations; - } - - private void update(DirectionsRoute route) { - this.route = route; - } - - /** - * Converts the speed value to m/s and delay to seconds. Then the distance is calculated and returned. - * - * @return a double value representing the distance given a speed and time. - */ - private double calculateDistancePerSec() { - double distance = (speed * ONE_KM_IN_METERS * delay) / ONE_HOUR_IN_SECONDS; - return distance; - } - - private void initialize() { - this.currentLeg = 0; - this.currentStep = 0; - } - - private List calculateStepPoints() { - List stepPoints = new ArrayList<>(); - - LineString line = LineString.fromPolyline( - route.legs().get(currentLeg).steps().get(currentStep).geometry(), Constants.PRECISION_6); - stepPoints.addAll(sliceRoute(line)); - increaseIndex(); - - return stepPoints; - } - - private void increaseIndex() { - if (currentStep < route.legs().get(currentLeg).steps().size() - 1) { - currentStep++; - } else if (currentLeg < route.legs().size() - 1) { - currentLeg++; - currentStep = 0; - } - } - - private Location createMockLocationFrom(Point point) { - Location mockedLocation = new Location(REPLAY_ROUTE); - mockedLocation.setLatitude(point.latitude()); - mockedLocation.setLongitude(point.longitude()); - float speedInMetersPerSec = (float) ((speed * ONE_KM_IN_METERS) / ONE_HOUR_IN_SECONDS); - mockedLocation.setSpeed(speedInMetersPerSec); - mockedLocation.setAccuracy(3f); - mockedLocation.setTime(time); - return mockedLocation; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationEngine.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationEngine.java deleted file mode 100644 index 8f56b979..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationEngine.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.annotation.SuppressLint; -import android.app.PendingIntent; -import android.location.Location; -import android.os.Handler; -import android.os.Looper; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback; -import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest; -import com.mapbox.mapboxsdk.location.engine.LocationEngineResult; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - - -public class ReplayRouteLocationEngine implements LocationEngine, Runnable { - private static final int HEAD = 0; - private static final int MOCKED_POINTS_LEFT_THRESHOLD = 5; - private static final int ONE_SECOND_IN_MILLISECONDS = 1000; - private static final int FORTY_FIVE_KM_PER_HOUR = 45; - private static final int DEFAULT_SPEED = FORTY_FIVE_KM_PER_HOUR; - private static final int ONE_SECOND = 1; - private static final int DEFAULT_DELAY = ONE_SECOND; - private static final int DO_NOT_DELAY = 0; - private static final int ZERO = 0; - private static final String SPEED_MUST_BE_GREATER_THAN_ZERO_KM_H = "Speed must be greater than 0 km/h."; - private static final String DELAY_MUST_BE_GREATER_THAN_ZERO_SECONDS = "Delay must be greater than 0 seconds."; - private static final String REPLAY_ROUTE = "ReplayRouteLocation"; - private ReplayRouteLocationConverter converter; - private int speed = DEFAULT_SPEED; - private int delay = DEFAULT_DELAY; - private Handler handler; - private List mockedLocations; - private ReplayLocationDispatcher dispatcher; - private Location lastLocation = null; - private CopyOnWriteArrayList> callbackList = new CopyOnWriteArrayList<>(); - private final ReplayLocationListener replayLocationListener = new ReplayLocationListener() { - @Override - public void onLocationReplay(Location location) { - lastLocation = location; - for (LocationEngineCallback result : callbackList) { - result.onSuccess(LocationEngineResult.create(location)); - } - lastLocation = location; - if (!mockedLocations.isEmpty()) { - mockedLocations.remove(HEAD); - } - } - }; - - public ReplayRouteLocationEngine() { - this.handler = new Handler(); - } - - @SuppressLint("MissingPermission") - public void assign(DirectionsRoute route) { - start(route); - } - - @SuppressLint("MissingPermission") - public void moveTo(Point point) { - Location lastLocation = getLastLocation(); - if (lastLocation == null) { - return; - } - - startRoute(point, lastLocation); - } - - public void assignLastLocation(Point currentPosition) { - initializeLastLocation(); - lastLocation.setLongitude(currentPosition.longitude()); - lastLocation.setLatitude(currentPosition.latitude()); - } - - public void updateSpeed(int customSpeedInKmPerHour) { - if (customSpeedInKmPerHour <= 0) { - throw new IllegalArgumentException(SPEED_MUST_BE_GREATER_THAN_ZERO_KM_H); - } - this.speed = customSpeedInKmPerHour; - } - - public void updateDelay(int customDelayInSeconds) { - if (customDelayInSeconds <= 0) { - throw new IllegalArgumentException(DELAY_MUST_BE_GREATER_THAN_ZERO_SECONDS); - } - this.delay = customDelayInSeconds; - } - - @Override - public void run() { - List nextMockedLocations = converter.toLocations(); - if (nextMockedLocations.isEmpty()) { - if (converter.isMultiLegRoute()) { - nextMockedLocations = converter.toLocations(); - } else { - handler.removeCallbacks(this); - return; - } - } - dispatcher.add(nextMockedLocations); - mockedLocations.addAll(nextMockedLocations); - scheduleNextDispatch(); - } - - private void start(DirectionsRoute route) { - handler.removeCallbacks(this); - converter = new ReplayRouteLocationConverter(route, speed, delay); - converter.initializeTime(); - mockedLocations = converter.toLocations(); - dispatcher = obtainDispatcher(); - dispatcher.run(); - scheduleNextDispatch(); - } - - private ReplayLocationDispatcher obtainDispatcher() { - if (dispatcher != null) { - dispatcher.stop(); - dispatcher.removeReplayLocationListener(replayLocationListener); - } - dispatcher = new ReplayLocationDispatcher(mockedLocations); - dispatcher.addReplayLocationListener(replayLocationListener); - - return dispatcher; - } - - private void startRoute(Point point, Location lastLocation) { - handler.removeCallbacks(this); - converter.updateSpeed(speed); - converter.updateDelay(delay); - converter.initializeTime(); - LineString route = obtainRoute(point, lastLocation); - mockedLocations = converter.calculateMockLocations(converter.sliceRoute(route)); - dispatcher = obtainDispatcher(); - dispatcher.run(); - } - - @NonNull - private LineString obtainRoute(Point point, Location lastLocation) { - List pointList = new ArrayList<>(); - pointList.add(Point.fromLngLat(lastLocation.getLongitude(), lastLocation.getLatitude())); - pointList.add(point); - return LineString.fromLngLats(pointList); - } - - private void scheduleNextDispatch() { - int currentMockedPoints = mockedLocations.size(); - if (currentMockedPoints == ZERO) { - handler.postDelayed(this, DO_NOT_DELAY); - } else if (currentMockedPoints <= MOCKED_POINTS_LEFT_THRESHOLD) { - handler.postDelayed(this, ONE_SECOND_IN_MILLISECONDS); - } else { - handler.postDelayed(this, (currentMockedPoints - MOCKED_POINTS_LEFT_THRESHOLD) * ONE_SECOND_IN_MILLISECONDS); - } - } - - private void initializeLastLocation() { - if (lastLocation == null) { - lastLocation = new Location(REPLAY_ROUTE); - } - } - - @SuppressLint("MissingPermission") - @Nullable - public Location getLastLocation() { - return lastLocation; - } - - public void onStop() { - if (dispatcher != null) { - dispatcher.stop(); - } - handler.removeCallbacks(this); - for (LocationEngineCallback callback : callbackList) { - callbackList.remove(callback); - } - if (dispatcher != null) { - dispatcher.removeReplayLocationListener(replayLocationListener); - } - } - - @Override - public void getLastLocation(@NonNull LocationEngineCallback callback) throws SecurityException { - if (lastLocation != null) { - callback.onSuccess(LocationEngineResult.create(lastLocation)); - } else { - callback.onFailure(new Exception("No last location")); - } - } - - @Override - public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationEngineCallback callback, @Nullable Looper looper) throws SecurityException { - callbackList.add(callback); - } - - @Override - public void requestLocationUpdates(@NonNull LocationEngineRequest request, PendingIntent pendingIntent) throws SecurityException { - } - - @Override - public void removeLocationUpdates(@NonNull LocationEngineCallback callback) { - callbackList.remove(callback); - } - - @Override - public void removeLocationUpdates(PendingIntent pendingIntent) { - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/TimestampAdapter.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/TimestampAdapter.java deleted file mode 100644 index a821c941..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/TimestampAdapter.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -class TimestampAdapter extends TypeAdapter { - private static final String DATE_FORMAT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_PATTERN); - private static final String UTC = "UTC"; - - @Override - public void write(JsonWriter out, Date value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - DATE_FORMAT.setTimeZone(TimeZone.getTimeZone(UTC)); - String date = DATE_FORMAT.format(value); - out.value(date); - } - } - - @Override - public Date read(JsonReader reader) throws IOException { - if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); - return null; - } - - String dateAsString = reader.nextString(); - try { - return DATE_FORMAT.parse(dateAsString); - } catch (ParseException exception) { - exception.printStackTrace(); - } - return null; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestone.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestone.java deleted file mode 100644 index 68512f9f..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestone.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteLegProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -/** - * A default milestone that is added to {@link com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation} - * when default milestones are enabled. - *

- * Please note, this milestone has a custom trigger based on location progress along a route. If you - * set custom triggers, they will be ignored in favor of this logic. - */ -public class BannerInstructionMilestone extends Milestone { - - private BannerInstructions instructions; - private RouteUtils routeUtils; - - BannerInstructionMilestone(Builder builder) { - super(builder); - routeUtils = new RouteUtils(); - } - - @Override - public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) { - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - LegStep currentStep = legProgress.currentStep(); - double stepDistanceRemaining = legProgress.currentStepProgress().distanceRemaining(); - BannerInstructions instructions = routeUtils.findCurrentBannerInstructions(currentStep, stepDistanceRemaining); - if (shouldBeShown(instructions, stepDistanceRemaining)) { - this.instructions = instructions; - return true; - } - return false; - } - - /** - * Returns the given {@link BannerInstructions} for the time that the milestone is triggered. - * - * @return current banner instructions based on distance along the current step - * @since 0.13.0 - */ - public BannerInstructions getBannerInstructions() { - return instructions; - } - - /** - * Uses the current step distance remaining to check against banner instructions distance. - * - * @param instructions given banner instructions from the list of step instructions - * @param stepDistanceRemaining distance remaining along the current step - * @return true if time to show the instructions, false if not - */ - private boolean shouldBeShown(BannerInstructions instructions, double stepDistanceRemaining) { - boolean isNewInstruction = this.instructions == null || !this.instructions.equals(instructions); - boolean isValidNewInstruction = instructions != null && isNewInstruction; - boolean withinDistanceAlongGeometry = isValidNewInstruction - && instructions.distanceAlongGeometry() >= stepDistanceRemaining; - boolean isFirstInstruction = this.instructions == null && instructions != null; - return isFirstInstruction || withinDistanceAlongGeometry; - } - - public static final class Builder extends Milestone.Builder { - - private Trigger.Statement trigger; - - public Builder() { - super(); - } - - @Override - Trigger.Statement getTrigger() { - return trigger; - } - - @Override - public Builder setTrigger(Trigger.Statement trigger) { - this.trigger = trigger; - return this; - } - - @Override - public BannerInstructionMilestone build() { - return new BannerInstructionMilestone(this); - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Milestone.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Milestone.java deleted file mode 100644 index 98a575c9..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Milestone.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.exception.NavigationException; -import com.mapbox.services.android.navigation.v5.instruction.Instruction; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -/** - * Base Milestone statement. Subclassed to provide concrete statements. - * - * @since 0.4.0 - */ -@SuppressWarnings("WeakerAccess") // Public exposed for creation of milestone classes outside SDK -public abstract class Milestone { - - private Builder builder; - - public Milestone(Builder builder) { - this.builder = builder; - } - - /** - * Milestone specific identifier as an {@code int} value, useful for deciphering which milestone - * invoked {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)}. - * - * @return {@code int} representing the identifier - * @since 0.4.0 - */ - public int getIdentifier() { - return builder.getIdentifier(); - } - - /** - * Milestone specific {@link Instruction}, which can be used to build a {@link String} - * instruction specified by the superclass. - * - * @return {@link Instruction} to be used to build the {@link String} passed to - * {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)} - * @since 0.4.0 - */ - public Instruction getInstruction() { - return builder.getInstruction(); - } - - /** - * A milestone can either be passed in to the - * {@link com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation} object - * (recommended) or validated directly inside your activity. - * - * @param previousRouteProgress last locations generated {@link RouteProgress} object used to - * determine certain {@link TriggerProperty}s - * @param routeProgress used to determine certain {@link TriggerProperty}s - * @return true if the milestone trigger's valid, else false - * @since 0.4.0 - */ - public abstract boolean isOccurring(RouteProgress previousRouteProgress, - RouteProgress routeProgress); - - /** - * Build a new {@link Milestone} - * - * @since 0.4.0 - */ - public abstract static class Builder { - - private int identifier; - private Instruction instruction; - - public Builder() { - } - - /** - * Milestone specific identifier as an {@code int} value, useful for deciphering which milestone - * invoked {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)}. - * - * @return {@code int} representing the identifier - * @since 0.4.0 - */ - public int getIdentifier() { - return identifier; - } - - /** - * Milestone specific identifier as an {@code int} value, useful for deciphering which milestone - * invoked {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)}. - * - * @param identifier an {@code int} used to identify this milestone instance - * @return this builder - * @since 0.4.0 - */ - public Builder setIdentifier(int identifier) { - this.identifier = identifier; - return this; - } - - /** - * Milestone specific {@link Instruction}, which can be used to build a {@link String} - * instruction specified by the superclass - * - * @return this builder - * @since 0.4.0 - */ - public Instruction getInstruction() { - return instruction; - } - - public Builder setInstruction(Instruction instruction) { - this.instruction = instruction; - return this; - } - - /** - * The list of triggers that are used to determine whether this milestone should invoke - * {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)} - * - * @param trigger a single simple statement or compound statement found in {@link Trigger} - * @return this builder - * @since 0.4.0 - */ - public abstract Builder setTrigger(Trigger.Statement trigger); - - abstract Trigger.Statement getTrigger(); - - /** - * Build a new milestone - * - * @return A new {@link Milestone} object - * @throws NavigationException if an invalid value has been set on the milestone - * @since 0.4.0 - */ - public abstract Milestone build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/MilestoneEventListener.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/MilestoneEventListener.java deleted file mode 100644 index 92903043..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/MilestoneEventListener.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -public interface MilestoneEventListener { - - void onMilestoneEvent(RouteProgress routeProgress, String instruction, Milestone milestone); - -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Operation.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Operation.java deleted file mode 100644 index 545befc4..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Operation.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -/** - * Extracted operation methods are found in this class and are fundamental to how Triggers work. - * - * @since 0.4.0 - */ -class Operation { - - private Operation() { - // Private constructor to prevent initialization of class. - } - - static boolean greaterThan(Number[] valueOne, Number valueTwo) { - if (valueOne.length > 1) { - if (valueTwo.equals(TriggerProperty.TRUE)) { - return valueOne[0].doubleValue() > valueOne[1].doubleValue(); - } else { - return valueOne[0].doubleValue() <= valueOne[1].doubleValue(); - } - } - return valueOne[0].doubleValue() > valueTwo.doubleValue(); - } - - static boolean lessThan(Number[] valueOne, Number valueTwo) { - if (valueOne.length > 1) { - if (valueTwo.equals(TriggerProperty.TRUE)) { - return valueOne[0].doubleValue() < valueOne[1].doubleValue(); - } else { - return valueOne[0].doubleValue() >= valueOne[1].doubleValue(); - } - } - return valueOne[0].doubleValue() < valueTwo.doubleValue(); - } - - static boolean notEqual(Number[] valueOne, Number valueTwo) { - if (valueOne.length > 1) { - if (valueTwo.equals(TriggerProperty.TRUE)) { - return !valueOne[0].equals(valueOne[1]); - } else { - return valueOne[0].equals(valueOne[1]); - } - } - return !valueOne[0].equals(valueTwo); - } - - static boolean equal(Number[] valueOne, Number valueTwo) { - if (valueOne.length > 1) { - if (valueTwo.equals(TriggerProperty.TRUE)) { - return valueOne[0].equals(valueOne[1]); - } else { - return !valueOne[0].equals(valueOne[1]); - } - } - return valueOne[0].equals(valueTwo); - } - - static boolean greaterThanEqual(Number[] valueOne, Number valueTwo) { - if (valueOne.length > 1) { - if (valueTwo.equals(TriggerProperty.TRUE)) { - return valueOne[0].doubleValue() >= valueOne[1].doubleValue(); - } else { - return valueOne[0].doubleValue() < valueOne[1].doubleValue(); - } - } - return valueOne[0].doubleValue() >= valueTwo.doubleValue(); - } - - static boolean lessThanEqual(Number[] valueOne, Number valueTwo) { - if (valueOne.length > 1) { - if (valueTwo.equals(TriggerProperty.TRUE)) { - return valueOne[0].doubleValue() <= valueOne[1].doubleValue(); - } else { - return valueOne[0].doubleValue() > valueOne[1].doubleValue(); - } - } - return valueOne[0].doubleValue() <= valueTwo.doubleValue(); - } - -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/RouteMilestone.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/RouteMilestone.java deleted file mode 100644 index 115cdd31..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/RouteMilestone.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -/** - * Using a Route Milestone will result in - * {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)} being invoked only - * once during a navigation session. - * - * @since 0.4.0 - */ -public class RouteMilestone extends Milestone { - - private Builder builder; - private boolean called; - - private RouteMilestone(Builder builder) { - super(builder); - this.builder = builder; - } - - @Override - public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) { - - if (builder.getTrigger().isOccurring( - TriggerProperty.getSparseArray(previousRouteProgress, routeProgress)) && !called) { - called = true; - return true; - } - return false; - } - - /** - * Build a new {@link RouteMilestone} - * - * @since 0.4.0 - */ - public static final class Builder extends Milestone.Builder { - - private Trigger.Statement trigger; - - public Builder() { - super(); - } - - @Override - public Builder setTrigger(Trigger.Statement trigger) { - this.trigger = trigger; - return this; - } - - @Override - Trigger.Statement getTrigger() { - return trigger; - } - - @Override - public RouteMilestone build() { - return new RouteMilestone(this); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestone.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestone.java deleted file mode 100644 index f7d2cb9d..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestone.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.exception.NavigationException; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -/** - * Using a Step Milestone will result in - * {@link MilestoneEventListener#onMilestoneEvent(RouteProgress, String, Milestone)} - * being invoked every step if the condition validation returns true. - * - * @since 0.4.0 - */ -public class StepMilestone extends Milestone { - - private Builder builder; - private boolean called; - - private StepMilestone(Builder builder) { - super(builder); - this.builder = builder; - } - - @Override - public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) { - - // Determine if the step index has changed and set called accordingly. This prevents multiple calls to - // onMilestoneEvent per Step. - if (previousRouteProgress.currentLegProgress().stepIndex() - != routeProgress.currentLegProgress().stepIndex()) { - called = false; - } - // If milestone's been called already on current step, no need to check triggers. - if (called) { - return false; - } - if (builder.getTrigger().isOccurring( - TriggerProperty.getSparseArray(previousRouteProgress, routeProgress))) { - called = true; - return true; - } - return false; - } - - /** - * Build a new {@link StepMilestone} - * - * @since 0.4.0 - */ - public static final class Builder extends Milestone.Builder { - - private Trigger.Statement trigger; - - public Builder() { - super(); - } - - @Override - public Builder setTrigger(Trigger.Statement trigger) { - this.trigger = trigger; - return this; - } - - @Override - Trigger.Statement getTrigger() { - return trigger; - } - - @Override - public StepMilestone build() throws NavigationException { - return new StepMilestone(this); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Trigger.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Trigger.java deleted file mode 100644 index b53b0219..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/Trigger.java +++ /dev/null @@ -1,344 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import android.util.SparseArray; - -import java.util.Map; - -/** - * Utility to build Trigger expressions more easily. - * - * @since 0.4.0 - */ -public class Trigger { - - private Trigger() { - // Empty private constructor to prevent users creating an instance of this class. - } - - /** - * Base Trigger statement. Subclassed to provide concrete statements. - * - * @since 0.4.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for creation of compound statements outside SDK - public abstract static class Statement { - - public Statement() { - } - - /** - * Validates whether the statement meets the specified trigger criteria. - * - * @param statementObjects a {@link Map} that contains all the trigger statements to determine - * @return true if the statement is valid, otherwise false - * @since 0.4.0 - */ - public abstract boolean isOccurring(SparseArray statementObjects); - } - - /* - * Compound statements - */ - - /** - * All class used to determine that all of the statements are valid. - * - * @since 0.4.0 - */ - private static class AllStatement extends Statement { - private final Statement[] statements; - - AllStatement(Statement... statements) { - this.statements = statements; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - boolean all = true; - for (Statement statement : statements) { - if (!statement.isOccurring(statementObjects)) { - all = false; - } - } - return all; - } - } - - /** - * None class used to determine that none of the statements are valid. - * - * @since 0.4.0 - */ - private static class NoneStatement extends Statement { - private final Statement[] statements; - - NoneStatement(Statement... statements) { - this.statements = statements; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - for (Statement statement : statements) { - if (statement.isOccurring(statementObjects)) { - return false; - } - } - return true; - } - } - - /** - * Any class used to determine that any of the statements are valid. - * - * @since 0.4.0 - */ - private static class AnyStatement extends Statement { - private final Statement[] statements; - - AnyStatement(Statement... statements) { - this.statements = statements; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - for (Statement statement : statements) { - if (statement.isOccurring(statementObjects)) { - return true; - } - } - return false; - } - } - - /* - * Simple statement - */ - - /** - * Greater than class used to determine that the {@code RouteProgress} key property is greater than the specified - * value. - * - * @since 0.4.0 - */ - private static class GreaterThanStatement extends Statement { - private final int key; - private final Object value; - - GreaterThanStatement(int key, Object value) { - this.key = key; - this.value = value; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - return Operation.greaterThan(statementObjects.get(key), (Number) value); - } - } - - /** - * Greater than equal class used to determine that the {@code RouteProgress} key property is greater than or equal - * to the specified value. - * - * @since 0.4.0 - */ - private static class GreaterThanEqualStatement extends Statement { - private final int key; - private final Object value; - - GreaterThanEqualStatement(int key, Object value) { - this.key = key; - this.value = value; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - return Operation.greaterThanEqual(statementObjects.get(key), (Number) value); - } - } - - /** - * Less than class used to determine that the {@code RouteProgress} key property is less than the specified value. - * - * @since 0.4.0 - */ - private static class LessThanStatement extends Statement { - private final int key; - private final Object value; - - LessThanStatement(int key, Object value) { - this.key = key; - this.value = value; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - return Operation.lessThan(statementObjects.get(key), (Number) value); - } - } - - /** - * Less than equal class used to determine that the {@code RouteProgress} key property is less than or equal to the - * specified value. - * - * @since 0.4.0 - */ - private static class LessThanEqualStatement extends Statement { - private final int key; - private final Object value; - - LessThanEqualStatement(int key, Object value) { - this.key = key; - this.value = value; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - return Operation.lessThanEqual(statementObjects.get(key), (Number) value); - } - } - - /** - * Not equals class used to determine that the {@code RouteProgress} key property does not equal the specified value. - * - * @since 0.4.0 - */ - private static class NotEqualStatement extends Statement { - private final int key; - private final Object[] values; - - NotEqualStatement(int key, Object... values) { - this.key = key; - this.values = values; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - return Operation.notEqual(statementObjects.get(key), (Number) values[0]); - } - } - - /** - * Equals class used to determine that the {@code RouteProgress} key property equals the specified value. - * - * @since 0.4.0 - */ - private static class EqualStatement extends Statement { - private final int key; - private final Object value; - - EqualStatement(int key, Object value) { - this.key = key; - this.value = value; - } - - @Override - public boolean isOccurring(SparseArray statementObjects) { - return Operation.equal(statementObjects.get(key), (Number) value); - } - } - - /** - * Groups a collection of statements in an {@code all} relationship. - * - * @param statements the collection of statements - * @return the statements compounded - * @since 0.4.0 - */ - public static Statement all(Statement... statements) { - return new AllStatement(statements); - } - - /** - * Groups a collection of statements in an {@code any} relationship. - * - * @param statements the collection of statements - * @return the statements compounded - * @since 0.4.0 - */ - public static Statement any(Statement... statements) { - return new AnyStatement(statements); - } - - /** - * Groups a collection of statements in an {@code none} relationship. - * - * @param statements the collection of statements - * @return the statements compounded - * @since 0.4.0 - */ - public static Statement none(Statement... statements) { - return new NoneStatement(statements); - } - - /** - * Check the property equals the given value. - * - * @param key the property key which must be one of the constants found in {@link TriggerProperty} - * @param value the value to check against - * @return the statement - * @since 0.4.0 - */ - public static Statement eq(int key, Object value) { - return new EqualStatement(key, value); - } - - /** - * Check the property does not equals the given value. - * - * @param key the property key which must be one of the constants found in {@link TriggerProperty} - * @param value the value to check against - * @return the statement - * @since 0.4.0 - */ - public static Statement neq(int key, Object value) { - return new NotEqualStatement(key, value); - } - - /** - * Check the property exceeds the given value. - * - * @param key the property key which must be one of the constants found in {@link TriggerProperty} - * @param value the value to check against - * @return the statement - * @since 0.4.0 - */ - public static Statement gt(int key, Object value) { - return new GreaterThanStatement(key, value); - } - - /** - * Check the property does not exceeds the given value. - * - * @param key the property key which must be one of the constants found in {@link TriggerProperty} - * @param value the value to check against - * @return the statement - * @since 0.4.0 - */ - public static Statement lt(int key, Object value) { - return new LessThanStatement(key, value); - } - - /** - * Check the property equals or does not exceeds the given value. - * - * @param key the property key which must be one of the constants found in {@link TriggerProperty} - * @param value the value to check against - * @return the statement - * @since 0.4.0 - */ - public static Statement lte(int key, Object value) { - return new LessThanEqualStatement(key, value); - } - - /** - * Check the property exceeds or equals the given value. - * - * @param key the property key which must be one of the constants found in {@link TriggerProperty} - * @param value the value to check against - * @return the statement - * @since 0.4.0 - */ - public static Statement gte(int key, Object value) { - return new GreaterThanEqualStatement(key, value); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/TriggerProperty.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/TriggerProperty.java deleted file mode 100644 index 1233f6f0..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/TriggerProperty.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import android.util.SparseArray; - -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -/** - * The currently support properties used for triggering a milestone. - * - * @since 0.4.0 - */ -@SuppressWarnings("WeakerAccess") // Public exposed for creation of compound statements outside SDK -public final class TriggerProperty { - - /** - * The Milestone will be triggered based on the duration remaining. - * - * @since 0.4.0 - */ - public static final int STEP_DURATION_REMAINING_SECONDS = 0x00000000; - - /** - * The Milestone will be triggered based on the distance remaining. - * - * @since 0.4.0 - */ - public static final int STEP_DISTANCE_REMAINING_METERS = 0x00000001; - - /** - * The Milestone will be triggered based on the total step distance. - * - * @since 0.4.0 - */ - public static final int STEP_DISTANCE_TOTAL_METERS = 0x00000002; - - /** - * The Milestone will be triggered based on the total step duration. - * - * @since 0.4.0 - */ - public static final int STEP_DURATION_TOTAL_SECONDS = 0x00000003; - - public static final int STEP_DISTANCE_TRAVELED_METERS = 0x00000009; - - /** - * The Milestone will be triggered based on the current step index. - * - * @since 0.4.0 - */ - public static final int STEP_INDEX = 0x00000004; - - public static final int NEW_STEP = 0x00000005; - - public static final int FIRST_STEP = 0x00000008; - - public static final int LAST_STEP = 0x00000006; - - public static final int NEXT_STEP_DISTANCE_METERS = 0x00000007; - - public static final int NEXT_STEP_DURATION_SECONDS = 0x00000011; - - public static final int FIRST_LEG = 0x00000009; - - public static final int LAST_LEG = 0x000000010; - - - public static final int TRUE = 0x00000124; - - public static final int FALSE = 0x00000100; - - static SparseArray getSparseArray(RouteProgress previousRouteProgress, RouteProgress routeProgress) { - // Build hashMap matching the trigger properties to their corresponding current values. - SparseArray statementObjects = new SparseArray<>(13); - statementObjects.put(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, - new Number[] {routeProgress.currentLegProgress().currentStep().distance()}); - statementObjects.put(TriggerProperty.STEP_DURATION_TOTAL_SECONDS, - new Number[] {routeProgress.currentLegProgress().currentStep().duration()}); - statementObjects.put(TriggerProperty.STEP_DISTANCE_REMAINING_METERS, - new Number[] {routeProgress.currentLegProgress().currentStepProgress().distanceRemaining()}); - statementObjects.put(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, - new Number[] {routeProgress.currentLegProgress().currentStepProgress().durationRemaining()}); - statementObjects.put(TriggerProperty.STEP_DISTANCE_TRAVELED_METERS, - new Number[] {routeProgress.currentLegProgress().currentStepProgress().distanceTraveled()}); - statementObjects.put(TriggerProperty.STEP_INDEX, - new Number[] {routeProgress.currentLegProgress().stepIndex()}); - statementObjects.put(TriggerProperty.NEW_STEP, - new Number[] { - previousRouteProgress.currentLegProgress().stepIndex(), - routeProgress.currentLegProgress().stepIndex()}); - statementObjects.put(TriggerProperty.LAST_STEP, - new Number[] {routeProgress.currentLegProgress().stepIndex(), - (routeProgress.currentLeg().steps().size() - 2)}); - statementObjects.put(TriggerProperty.FIRST_STEP, - new Number[] {routeProgress.currentLegProgress().stepIndex(), 0}); - statementObjects.put(TriggerProperty.NEXT_STEP_DURATION_SECONDS, - new Number[] { - routeProgress.currentLegProgress().upComingStep() != null - ? routeProgress.currentLegProgress().upComingStep().duration() : 0}); - statementObjects.put(TriggerProperty.NEXT_STEP_DISTANCE_METERS, - new Number[] { - routeProgress.currentLegProgress().upComingStep() != null - ? routeProgress.currentLegProgress().upComingStep().distance() : 0}); - statementObjects.put(TriggerProperty.FIRST_LEG, new Number[] {routeProgress.legIndex(), 0}); - statementObjects.put(TriggerProperty.LAST_LEG, new Number[] {routeProgress.legIndex(), - (routeProgress.directionsRoute().legs().size() - 1)}); - return statementObjects; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestone.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestone.java deleted file mode 100644 index 52a839f4..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestone.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.instruction.Instruction; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.VoiceInstructions; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -/** - * A default milestone that is added to {@link com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation} - * when default milestones are enabled. - *

- * Please note, this milestone has a custom trigger based on location progress along a route. If you - * set custom triggers, they will be ignored in favor of this logic. - */ -public class VoiceInstructionMilestone extends Milestone { - - private static final String EMPTY_STRING = ""; - - private VoiceInstructions instructions; - private DirectionsRoute currentRoute; - private RouteUtils routeUtils; - - VoiceInstructionMilestone(Builder builder) { - super(builder); - routeUtils = new RouteUtils(); - } - - @Override - public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) { - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - VoiceInstructions instructions = routeUtils.findCurrentVoiceInstructions(currentStep, stepDistanceRemaining); - if (shouldBeVoiced(instructions, stepDistanceRemaining)) { - return updateInstructions(routeProgress, instructions); - } - return false; - } - - @Override - public Instruction getInstruction() { - return new Instruction() { - @Override - public String buildInstruction(RouteProgress routeProgress) { - if (instructions == null) { - return routeProgress.currentLegProgress().currentStep().name(); - } - return instructions.announcement(); - } - }; - } - - /** - * Provide the SSML instruction that can be used with Mapbox's API Voice. - *

- * This String will provide special markup denoting how certain portions of the announcement - * should be pronounced. - * - * @return announcement with SSML markup - * @since 0.8.0 - */ - public String getSsmlAnnouncement() { - if (instructions == null) { - return EMPTY_STRING; - } - return instructions.ssmlAnnouncement(); - } - - /** - * Provide the instruction that can be used with Android's TextToSpeech. - *

- * This string will be in plain text. - * - * @return announcement in plain text - * @since 0.12.0 - */ - public String getAnnouncement() { - if (instructions == null) { - return EMPTY_STRING; - } - return instructions.announcement(); - } - - /** - * Looks to see if we have a new route. - * - * @param routeProgress provides updated route information - * @return true if new route, false if not - */ - private boolean isNewRoute(RouteProgress routeProgress) { - boolean newRoute = currentRoute == null || !currentRoute.equals(routeProgress.directionsRoute()); - currentRoute = routeProgress.directionsRoute(); - return newRoute; - } - - /** - * Checks if the current instructions are different from the instructions - * determined by the step distance remaining. - * - * @param instructions the current voice instructions from the list of step instructions - * @param stepDistanceRemaining the current step distance remaining - * @return true if time to voice the announcement, false if not - */ - private boolean shouldBeVoiced(VoiceInstructions instructions, double stepDistanceRemaining) { - boolean isNewInstruction = this.instructions == null || !this.instructions.equals(instructions); - boolean isValidNewInstruction = instructions != null && isNewInstruction; - return isValidNewInstruction && instructions.distanceAlongGeometry() >= stepDistanceRemaining; - } - - private boolean updateInstructions(RouteProgress routeProgress, VoiceInstructions instructions) { - this.instructions = instructions; - return true; - } - - - public static final class Builder extends Milestone.Builder { - - private Trigger.Statement trigger; - - public Builder() { - super(); - } - - @Override - Trigger.Statement getTrigger() { - return trigger; - } - - @Override - public Builder setTrigger(Trigger.Statement trigger) { - this.trigger = trigger; - return this; - } - - @Override - public VoiceInstructionMilestone build() { - return new VoiceInstructionMilestone(this); - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/package-info.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/package-info.java deleted file mode 100644 index 248ac7fb..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/milestone/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Contains navigation milestone classes for receiving information when the user reaches a defined - * point along the route. - */ -package com.mapbox.services.android.navigation.v5.milestone; \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Admin.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Admin.java deleted file mode 100644 index b9fd8365..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Admin.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -/** - * An objects describing the administrative boundaries the route leg travels through. - */ -@AutoValue -public abstract class Admin extends DirectionsJsonObject { - - /** - * Contains the 2 character ISO 3166-1 alpha-2 code that applies to a country boundary. - * Example: `"US"`. - */ - @Nullable - @SerializedName("iso_3166_1") - public abstract String countryCode(); - - /** - * Contains the 3 character ISO 3166-1 alpha-3 code that applies to a country boundary. - * Example: `"USA"`. - */ - @Nullable - @SerializedName("iso_3166_1_alpha3") - public abstract String countryCodeAlpha3(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_Admin.Builder(); - } - - /** - * Convert the current {@link Admin} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link Admin}. - * - * @return a {@link Builder} with the same values set to match the ones defined in this {@link - * Admin} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_Admin.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Incident - * @return a new instance of this class defined by the values passed in the method - */ - public static Admin fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, Admin.class); - } - - /** - * This builder can be used to set the values describing the {@link Admin}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The 2 character ISO 3166-1 alpha-2 code that applies to a country boundary. - * Example: `"US"`. - * - * @param countryCode 2 character ISO 3166-1 alpha-2 code - */ - public abstract Builder countryCode(@Nullable String countryCode); - - /** - * The 3 character ISO 3166-1 alpha-3 code that applies to a country boundary. - * Example: `"USA"`. - * - * @param countryCodeAlpha3 3 character ISO 3166-1 alpha-3 code - */ - public abstract Builder countryCodeAlpha3(@Nullable String countryCodeAlpha3); - - /** - * Build a new {@link Admin} object. - * - * @return a new {@link Admin} using the provided values in this builder - */ - public abstract Admin build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerComponents.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerComponents.java deleted file mode 100644 index bb888f05..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerComponents.java +++ /dev/null @@ -1,452 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringDef; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.List; - -/** - * A part of the {@link BannerText} which includes a snippet of the full banner text instruction. In - * cases where data is available, an image url will be provided to visually include a road shield. - * To receive this information, your request must have - * MapboxDirections.Builder#bannerInstructions() set to true. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class BannerComponents extends DirectionsJsonObject - implements Comparable { - - /** - * Default. Indicates the text is part of the instructions and no other type. - * - * @since 3.0.0 - */ - public static final String TEXT = "text"; - - /** - * This is text that can be replaced by an imageBaseURL icon. - * - * @since 3.0.0 - */ - public static final String ICON = "icon"; - - /** - * This is text that can be dropped, and should be dropped if you are rendering icons. - * - * @since 3.0.0 - */ - public static final String DELIMITER = "delimiter"; - - /** - * Indicates the exit number for the maneuver. - * - * @since 3.0.0 - */ - public static final String EXIT_NUMBER = "exit-number"; - - /** - * Provides the the word for exit in the local language. - * - * @since 3.0.0 - */ - public static final String EXIT = "exit"; - - /** - * Indicates which lanes can be used to complete the maneuver. - * - * @since 3.0.0 - */ - public static final String LANE = "lane"; - - /** - * This view gives guidance through junctions and is used to complete maneuvers. - */ - public static final String GUIDANCE_VIEW = "guidance-view"; - - /** - * This view gives guidance through signboards and is used to complete maneuvers. - */ - public static final String SIGNBOARD = "signboard"; - - /** - * This view gives guidance through junctions and is used to complete maneuvers. - */ - public static final String JCT = "jct"; - - /** - * Banner component types. - * https://docs.mapbox.com/api/navigation/#banner-instruction-object - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - TEXT, - ICON, - DELIMITER, - EXIT_NUMBER, - EXIT, - LANE, - GUIDANCE_VIEW - }) - public @interface BannerComponentsType { - } - - /** - * Banner component types. - * https://docs.mapbox.com/api/navigation/#banner-instruction-object - * - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - JCT, - SIGNBOARD - }) - public @interface BannerComponentsSubType { - } - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_BannerComponents.Builder(); - } - - /** - * A snippet of the full {@link BannerText#text()} which can be used for visually altering parts - * of the full string. - * - * @return a single snippet of the full text instruction - * @since 3.0.0 - */ - @NonNull - public abstract String text(); - - /** - * String giving you more context about the component which may help in visual markup/display - * choices. If the type of the components is unknown it should be treated as text. - *

- * Possible values: - *

    - *
  • text (default): indicates the text is part of - * the instructions and no other type
  • - *
  • icon: this is text that can be replaced by an icon, see imageBaseURL
  • - *
  • delimiter: this is text that can be dropped and - * should be dropped if you are rendering icons
  • - *
  • exit-number: the exit number for the maneuver
  • - *
  • exit: the word for exit in the local language
  • - *
- * - * @return String type from above list - * @since 3.0.0 - */ - @NonNull - @BannerComponentsType - public abstract String type(); - - /** - * String giving you more context about {@link BannerComponentsType} which - * may help in visual markup/display choices. - *

- * Possible values: - *

    - *
  • jct: indicates a junction guidance view.
  • - *
  • signboard: indicates a signboard guidance view.
  • - *
- * - * @return String type from above list - */ - @Nullable - @BannerComponentsType - public abstract String subType(); - - /** - * The abbreviated form of text. - *

- * If this is present, there will also be an abbr_priority value. - * - * @return abbreviated form of {@link BannerComponents#text()}. - * @since 3.0.0 - */ - @Nullable - @SerializedName("abbr") - public abstract String abbreviation(); - - /** - * An integer indicating the order in which the abbreviation abbr should be used in - * place of text. The highest priority is 0 and a higher integer value indicates a lower - * priority. There are no gaps in integer values. - *

- * Multiple components can have the same abbreviationPriority and when this happens all - * components with the same abbr_priority should be abbreviated at the same time. - * Finding no larger values of abbreviationPriority indicates that the string is - * fully abbreviated. - * - * @return Integer indicating the order of the abbreviation - * @since 3.0.0 - */ - @Nullable - @SerializedName("abbr_priority") - public abstract Integer abbreviationPriority(); - - /** - * In some cases when the {@link LegStep} is a highway or major roadway, there might be a shield - * icon that's included to better identify to your user to roadway. Note that this doesn't - * return the image itself but rather the url which can be used to download the file. - * - * @return the url which can be used to download the shield icon if one is available - * @since 3.0.0 - */ - @Nullable - @SerializedName("imageBaseURL") - public abstract String imageBaseUrl(); - - /** - * In some cases when the {@link StepManeuver} will be difficult to navigate, an image - * can describe how to proceed. The domain name for this image is a Junction View. - * Unlike the imageBaseUrl, this image url does not include image density encodings. - * - * @return the url which can be used to download the image. - * @since 5.0.0 - */ - @Nullable - @SerializedName("imageURL") - public abstract String imageUrl(); - - /** - * A List of directions indicating which way you can go from a lane - * (left, right, or straight). If the value is ['left', 'straight'], - * the driver can go straight or left from that lane. - * Present if this is a lane component. - * - * @return List of allowed directions from that lane. - * @since 3.2.0 - */ - @Nullable - public abstract List directions(); - - /** - * A boolean telling you if that lane can be used to complete the upcoming maneuver. - * If multiple lanes are active, then they can all be used to complete the upcoming maneuver. - * Present if this is a lane component. - * - * @return List of allowed directions from that lane. - * @since 3.2.0 - */ - @Nullable - public abstract Boolean active(); - - /** - * Convert the current {@link BannerComponents} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link BannerComponents}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link BannerComponents} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_BannerComponents.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a BannerComponents - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static BannerComponents fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, BannerComponents.class); - } - - /** - * Allows ability to sort/compare by abbreviation priority. This is null-safe for values of - * abbreviationPriority, and treats BannerComponents with a null abreviationPriority as having an - * abbreviationPriority of infinity. This method returns a negative integer, zero, or a positive - * integer as this object is less than, equal to, or greater than the specified object. - * - * @param bannerComponents to compare to - * @return the compareTo int value - * @since 3.0.0 - */ - @Override - public int compareTo(BannerComponents bannerComponents) { - Integer ab1 = this.abbreviationPriority(); - Integer ab2 = bannerComponents.abbreviationPriority(); - - if (ab1 == null && ab2 == null) { - return 0; - } else if (ab1 == null) { - return 1; - } else if (ab2 == null) { - return -1; - } else { - return ab1.compareTo(ab2); - } - } - - /** - * This builder can be used to set the values describing the {@link BannerComponents}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * A snippet of the full {@link BannerText#text()} which can be used for visually altering parts - * of the full string. - * - * @param text a single snippet of the full text instruction - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder text(@NonNull String text); - - /** - * String giving you more context about the component which may help in visual markup/display - * choices. If the type of the components is unknown it should be treated as text. - *

- * Possible values: - *

    - *
  • text (default): indicates the text is part of the instructions - * and no other type
  • - *
  • icon: this is text that can be replaced by an icon, - * see imageBaseURL
  • - *
  • delimiter: this is text that can be dropped and should be dropped - * if you are rendering icons
  • - *
  • exit-number: the exit number for the maneuver
  • - *
  • exit: the word for exit in the local language
  • - *
- * - * @param type String type from above list - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder type(@NonNull @BannerComponentsType String type); - - - - /** - * String giving you more context about {@link BannerComponentsType} - * which may help in visual markup/display choices. - *

- * Possible values: - *

    - *
  • jct: indicates a junction guidance view.
  • - *
  • signboard: indicates a signboard guidance view.
  • - *
- * - * @param subType String subType from above list - * @return String type from above list - */ - @NonNull - @BannerComponentsType - public abstract Builder subType(@Nullable @BannerComponentsSubType String subType); - - - /** - * The abbreviated form of text. - * - * @param abbreviation for the given text of this component - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder abbreviation(@Nullable String abbreviation); - - /** - * An integer indicating the order in which the abbreviation abbr should be used in - * place of text. The highest priority is 0 and a higher integer value indicates a lower - * priority. There are no gaps in integer values. - *

- * Multiple components can have the same abbreviationPriority and when this happens all - * components with the same abbr_priority should be abbreviated at the same time. - * Finding no larger values of abbreviationPriority indicates that the string is - * fully abbreviated. - * - * @param abbreviationPriority Integer indicating the order of the abbreviation - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder abbreviationPriority(@Nullable Integer abbreviationPriority); - - /** - * In some cases when the {@link LegStep} is a highway or major roadway, there might be a shield - * icon that's included to better identify to your user to roadway. Note that this doesn't - * return the image itself but rather the url which can be used to download the file. - * - * @param imageBaseUrl the url which can be used to download the shield icon if one is avaliable - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder imageBaseUrl(@Nullable String imageBaseUrl); - - /** - * In some cases when the {@link StepManeuver} will be difficult to navigate, an image - * can describe how to proceed. The domain name for this image is a Junction View. - * Unlike the imageBaseUrl, this image url does not include image density encodings. - * - * @param imageUrl the url which can be used to download the image - * @return this builder for chaining options together - * @since 5.0.0 - */ - public abstract Builder imageUrl(@Nullable String imageUrl); - - /** - * A List of directions indicating which way you can go from a lane - * (left, right, or straight). If the value is ['left', 'straight'], - * the driver can go straight or left from that lane. - * Present if this is a lane component. - * - * @param directions List of allowed directions from that lane - * @return this builder for chaining options together - * @since 3.2.0 - */ - public abstract Builder directions(List directions); - - /** - * A boolean telling you if that lane can be used to complete the upcoming maneuver. - * If multiple lanes are active, then they can all be used to complete the upcoming maneuver. - * Present if this is a lane component. - * - * @param activeState true, if the lane could be used for upcoming maneuver, false - otherwise - * @return this builder for chaining options together - * @since 3.2.0 - */ - public abstract Builder active(Boolean activeState); - - /** - * Build a new {@link BannerComponents} object. - * - * @return a new {@link BannerComponents} using the provided values in this builder - * @since 3.0.0 - */ - public abstract BannerComponents build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerInstructions.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerInstructions.java deleted file mode 100644 index c9020144..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerInstructions.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -/** - * Visual instruction information related to a particular {@link LegStep} useful for making UI - * elements inside your application such as banners. To receive this information, your request must - * MapboxDirections.Builder#bannerInstructions() have set to true. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class BannerInstructions extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_BannerInstructions.Builder(); - } - - /** - * Distance in meters from the beginning of the step at which the visual instruction should be - * visible. - * - * @return double value representing the length from the steps first point to where the banner - * instruction should be displayed - * @since 3.0.0 - */ - public abstract double distanceAlongGeometry(); - - /** - * A plain text representation stored inside a {@link BannerText} object. - * - * @return a {@link BannerText} object which includes text for visually displaying current step - * information to the user - * @since 3.0.0 - */ - @NonNull - public abstract BannerText primary(); - - /** - * Ancillary visual information about the {@link LegStep}. - * - * @return {@link BannerText} representing the secondary visual information - * @since 3.0.0 - */ - @Nullable - public abstract BannerText secondary(); - - - /** - * Additional information that is included if we feel the driver needs a heads up about something. - * Can include information about the next maneuver (the one after the upcoming one), - * if the step is short - can be null, or can be lane information. - * If we have lane information, that trumps information about the next maneuver. - * - * @return {@link BannerText} representing the sub visual information - * @since 3.2.0 - */ - @Nullable - public abstract BannerText sub(); - - /** - * Optional image to display for an upcoming maneuver. Used to provide a visual - * for complex junctions and maneuver. If the step is short the image should be displayed - * for the duration of the step, otherwise it is shown as you approach the maneuver. - * - * @return {@link BannerView} representing the secondary visual information - * @since 5.0.0 - */ - @Nullable - public abstract BannerView view(); - - /** - * Convert the current {@link BannerInstructions} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link BannerInstructions}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link BannerInstructions} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_BannerInstructions.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a BannerInstructions - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static BannerInstructions fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, BannerInstructions.class); - } - - /** - * This builder can be used to set the values describing the {@link BannerInstructions}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Distance in meters from the beginning of the step at which the visual instruction should be - * visible. - * - * @param distanceAlongGeometry double value representing the length from the steps first point - * to where the banner instruction should be displayed - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder distanceAlongGeometry(double distanceAlongGeometry); - - /** - * Main visual information about the {@link LegStep}. - * - * @param primary {@link BannerText} representing the primary visual information - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder primary(@NonNull BannerText primary); - - /** - * Ancillary visual information about the {@link LegStep}. - * - * @param secondary {@link BannerText} representing the secondary visual information - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder secondary(@Nullable BannerText secondary); - - /** - * Additional information that is included - * if we feel the driver needs a heads up about something. - * Can include information about the next maneuver (the one after the upcoming one), - * if the step is short - can be null, or can be lane information. - * If we have lane information, that trumps information about the next maneuver. - * - * @param sub {@link BannerText} representing the sub visual information - * @return {@link BannerText} representing the sub visual information - * @since 3.2.0 - */ - public abstract Builder sub(@Nullable BannerText sub); - - /** - * Optional image to display for an upcoming maneuver. Used to provide a visual - * for complex junctions and maneuver. If the step is short the image should be displayed - * for the duration of the step, otherwise it is shown as you approach the maneuver. - * - * @param view {@link BannerView} representing the sub visual information - * @return this builder for chaining options together - * @since 5.0.0 - */ - public abstract Builder view(@Nullable BannerView view); - - /** - * Build a new {@link BannerInstructions} object. - * - * @return a new {@link BannerInstructions} using the provided values in this builder - * @since 3.0.0 - */ - public abstract BannerInstructions build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerText.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerText.java deleted file mode 100644 index 5179cb8c..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerText.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -/** - * Includes both plain text information that can be visualized inside your navigation application - * along with the text string broken down into {@link BannerComponents} which may or may not - * include a image url. To receive this information, your request must have - * MapboxDirections.Builder#bannerInstructions() set to true. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class BannerText extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_BannerText.Builder(); - } - - /** - * Plain text with all the {@link BannerComponents} text combined. - * - * @return plain text with all the {@link BannerComponents} text items combined - * @since 3.0.0 - */ - @NonNull - public abstract String text(); - - /** - * A part or element of the {@link com.mapbox.api.directions.v5.models.BannerInstructions}. - * - * @return a {@link BannerComponents} specific to a {@link LegStep} - * @since 3.0.0 - */ - @Nullable - public abstract List components(); - - /** - * This indicates the type of maneuver. - * - * @return String with type of maneuver - * @see StepManeuver.StepManeuverType - * @since 3.0.0 - */ - @Nullable - @StepManeuver.StepManeuverType - public abstract String type(); - - /** - * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the - * change in direction accomplished through the turn. If the type is of depart/arrive, the - * modifier indicates the position of waypoint from the current direction of travel. - * - * @return String with modifier - * @since 3.0.0 - */ - @Nullable - @ManeuverModifier.Type - public abstract String modifier(); - - - /** - * The degrees at which you will be exiting a roundabout, assuming `180` indicates - * going straight through the roundabout. - * - * @return at which you will be exiting a roundabout - * @since 3.0.0 - */ - @Nullable - public abstract Double degrees(); - - /** - * A string representing which side the of the street people drive on - * in that location. Can be 'left' or 'right'. - * - * @return String either `left` or `right` - * @since 3.0.0 - */ - @Nullable - @SerializedName("driving_side") - public abstract String drivingSide(); - - /** - * Convert the current {@link BannerText} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link BannerText}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link BannerText} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_BannerText.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a BannerText - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static BannerText fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, BannerText.class); - } - - /** - * This builder can be used to set the values describing the {@link BannerText}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Plain text with all the {@link BannerComponents} text combined. - * - * @param text plain text with all the {@link BannerComponents} text items combined - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder text(@NonNull String text); - - /** - * A part or element of the {@link BannerInstructions}. - * - * @param components a {@link BannerComponents} specific to a {@link LegStep} - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder components(List components); - - /** - * This indicates the type of maneuver. See {@link BannerText#type()} for a full list of - * options. - * - * @param type String with type of maneuver - * @return this builder for chaining options together - * @see StepManeuver.StepManeuverType - * @since 3.0.0 - */ - public abstract Builder type(@Nullable @StepManeuver.StepManeuverType String type); - - /** - * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the - * change in direction accomplished through the turn. If the type is of depart/arrive, the - * modifier indicates the position of waypoint from the current direction of travel. - * - * @param modifier String with modifier - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder modifier(@Nullable String modifier); - - /** - * The degrees at which you will be exiting a roundabout, assuming `180` indicates - * going straight through the roundabout. - * - * @param degrees at which you will be exiting a roundabout - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder degrees(Double degrees); - - /** - * A string representing which side the of the street people drive on in - * that location. Can be 'left' or 'right'. - * - * @param drivingSide either `left` or `right` - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder drivingSide(@Nullable String drivingSide); - - /** - * Build a new {@link BannerText} object. - * - * @return a new {@link BannerText} using the provided values in this builder - * @since 3.0.0 - */ - public abstract BannerText build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerView.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerView.java deleted file mode 100644 index 01c18060..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/BannerView.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -import java.util.List; - -/** - * Includes both plain text information that can be visualized inside your navigation application - * along with the text string broken down into {@link BannerComponents} which may or may not - * include a image url. To receive this information, your request must have - * MapboxDirections.Builder#bannerInstructions() set to true. - * - * @since 5.0.0 - */ -@AutoValue -public abstract class BannerView extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 5.0.0 - */ - public static Builder builder() { - return new AutoValue_BannerView.Builder(); - } - - /** - * Plain text with all the {@link BannerComponents} text combined. - * - * @return plain text with all the {@link BannerComponents} text items combined - * @since 5.0.0 - */ - @NonNull - public abstract String text(); - - /** - * A part or element of the {@link BannerInstructions}. - * - * @return a {@link BannerComponents} specific to a {@link LegStep} - * @since 5.0.0 - */ - @Nullable - public abstract List components(); - - /** - * This indicates the type of maneuver. - * - * @return String with type of maneuver - * @see StepManeuver.StepManeuverType - * @since 5.0.0 - */ - @Nullable - @StepManeuver.StepManeuverType - public abstract String type(); - - /** - * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the - * change in direction accomplished through the turn. If the type is of depart/arrive, the - * modifier indicates the position of waypoint from the current direction of travel. - * - * @return String with modifier - * @since 5.0.0 - */ - @Nullable - @ManeuverModifier.Type - public abstract String modifier(); - - /** - * Convert the current {@link BannerView} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link BannerView}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link BannerView} - * @since 5.0.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 5.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_BannerView.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a BannerText - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 5.0.0 - */ - public static BannerView fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, BannerView.class); - } - - /** - * This builder can be used to set the values describing the {@link BannerView}. - * - * @since 5.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Plain text with all the {@link BannerComponents} text combined. - * - * @param text plain text with all the {@link BannerComponents} text items combined - * @return this builder for chaining options together - * @since 5.0.0 - */ - public abstract Builder text(@NonNull String text); - - /** - * A part or element of the {@link BannerInstructions}. - * - * @param components a {@link BannerComponents} specific to a {@link LegStep} - * @return this builder for chaining options together - * @since 5.0.0 - */ - public abstract Builder components(List components); - - /** - * This indicates the type of maneuver. See {@link BannerView#type()} for a full list of - * options. - * - * @param type String with type of maneuver - * @return this builder for chaining options together - * @see StepManeuver.StepManeuverType - * @since 5.0.0 - */ - public abstract Builder type(@Nullable @StepManeuver.StepManeuverType String type); - - /** - * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the - * change in direction accomplished through the turn. If the type is of depart/arrive, the - * modifier indicates the position of waypoint from the current direction of travel. - * - * @param modifier String with modifier - * @return this builder for chaining options together - * @since 5.0.0 - */ - public abstract Builder modifier(@Nullable String modifier); - - /** - * Build a new {@link BannerView} object. - * - * @return a new {@link BannerView} using the provided values in this builder - * @since 5.0.0 - */ - public abstract BannerView build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Closure.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Closure.java deleted file mode 100644 index 6bd43298..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Closure.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -/** - * An object indicating the geometry indexes defining a road closure. - */ -@AutoValue -public abstract class Closure extends DirectionsJsonObject { - - /** - * Closure's geometry index start point. - */ - @Nullable - @SerializedName("geometry_index_start") - public abstract Integer geometryIndexStart(); - - /** - * Closure's geometry index end point. - */ - @Nullable - @SerializedName("geometry_index_end") - public abstract Integer geometryIndexEnd(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_Closure.Builder(); - } - - /** - * Convert the current {@link Closure} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link Closure}. - * - * @return a {@link Builder} with the same values set to match the ones - * defined in this {@link Closure} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_Closure.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Incident - * @return a new instance of this class defined by the values passed in the method - */ - public static Closure fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, Closure.class); - } - - /** - * This builder can be used to set the values describing the {@link Closure}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Closure's geometry index start point. - * - * @param geometryIndexStart start index - */ - public abstract Builder geometryIndexStart(@Nullable Integer geometryIndexStart); - - /** - * Closure's geometry index end point. - * - * @param geometryIndexEnd end index - */ - public abstract Builder geometryIndexEnd(@Nullable Integer geometryIndexEnd); - - /** - * Build a new {@link Closure} object. - * - * @return a new {@link Closure} using the provided values in this builder - */ - public abstract Closure build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Congestion.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Congestion.java deleted file mode 100644 index ab6a7d98..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Congestion.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -/** - * Quantitative descriptor of congestion. - */ -@AutoValue -public abstract class Congestion extends DirectionsJsonObject { - - /** - * Quantitative descriptor of congestion. 0 to 100. - */ - public abstract int value(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_Congestion.Builder(); - } - - /** - * Convert the current {@link Congestion} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link Congestion}. - * - * @return a {@link Builder} with the same values set to match the ones defined in this - * {@link Congestion} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_Congestion.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Congestion - * @return a new instance of this class defined by the values passed in the method - */ - public static Congestion fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, Congestion.class); - } - - /** - * This builder can be used to set the values describing the {@link Congestion}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Quantitative descriptor of congestion. 0 to 100. - * @param value 0 to 100 - */ - public abstract Builder value(int value); - - /** - * Build a new instance of {@link Congestion}. - * @return a new instance of {@link Congestion}. - */ - public abstract Congestion build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsAdapterFactory.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsAdapterFactory.java deleted file mode 100644 index d288477b..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsAdapterFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import com.google.gson.TypeAdapterFactory; -import com.ryanharter.auto.value.gson.GsonTypeAdapterFactory; - -/** - * Required so that AutoValue can generate specific type adapters when needed inside the direction - * packages. - * - * @since 3.0.0 - */ -@GsonTypeAdapterFactory -public abstract class DirectionsAdapterFactory implements TypeAdapterFactory { - - /** - * Creates a TypeAdapter that AutoValues uses to generate specific type adapters when needed - * inside the direction package classes. - * - * @return 3.0.0 - */ - public static TypeAdapterFactory create() { - return new AutoValueGson_DirectionsAdapterFactory(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsCriteria.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsCriteria.java deleted file mode 100644 index eb043989..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsCriteria.java +++ /dev/null @@ -1,364 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Constants and properties used to customize the directions request. - * - * @since 1.0.0 - */ -public final class DirectionsCriteria { - - /** - * Mapbox default username. - * - * @since 1.0.0 - */ - public static final String PROFILE_DEFAULT_USER = "mapbox"; - - /** - * For car and motorcycle routing. This profile factors in current and historic traffic - * conditions to avoid slowdowns. - * - * @since 2.0.0 - */ - public static final String PROFILE_DRIVING_TRAFFIC = "driving-traffic"; - - /** - * For car and motorcycle routing. This profile shows the fastest routes by preferring - * high-speed roads like highways. - * - * @since 1.0.0 - */ - public static final String PROFILE_DRIVING = "driving"; - - /** - * For pedestrian and hiking routing. This profile shows the shortest path by using sidewalks - * and trails. - * - * @since 1.0.0 - */ - public static final String PROFILE_WALKING = "walking"; - - /** - * For bicycle routing. This profile shows routes that are short and safe for cyclist, avoiding - * highways and preferring streets with bike lanes. - * - * @since 1.0.0 - */ - public static final String PROFILE_CYCLING = "cycling"; - - /** - * Format to return route geometry will be an encoded polyline. - * - * @since 1.0.0 - */ - public static final String GEOMETRY_POLYLINE = "polyline"; - - /** - * Format to return route geometry will be an encoded polyline with precision 6. - * - * @since 2.0.0 - */ - public static final String GEOMETRY_POLYLINE6 = "polyline6"; - - /** - * A simplified version of the {@link #OVERVIEW_FULL} geometry. If not specified simplified is - * the default. - * - * @since 1.0.0 - */ - public static final String OVERVIEW_SIMPLIFIED = "simplified"; - - /** - * The most detailed geometry available. - * - * @since 1.0.0 - */ - public static final String OVERVIEW_FULL = "full"; - - /** - * No overview geometry. - * - * @since 1.0.0 - */ - public static final String OVERVIEW_FALSE = "false"; - - /** - * The duration, in seconds, between each pair of coordinates. - * - * @since 2.1.0 - */ - public static final String ANNOTATION_DURATION = "duration"; - - /** - * The distance, in meters, between each pair of coordinates. - * - * @since 2.1.0 - */ - public static final String ANNOTATION_DISTANCE = "distance"; - - /** - * The speed, in km/h, between each pair of coordinates. - * - * @since 2.1.0 - */ - public static final String ANNOTATION_SPEED = "speed"; - - /** - * The congestion, provided as a String, between each pair of coordinates. - * - * @since 2.2.0 - */ - public static final String ANNOTATION_CONGESTION = "congestion"; - - /** - * The posted speed limit, between each pair of coordinates. - * - * @since 2.1.0 - */ - public static final String ANNOTATION_MAXSPEED = "maxspeed"; - - /** - * The closure of sections of a route. - */ - public static final String ANNOTATION_CLOSURE = "closure"; - - /** - * Exclude all tolls along the returned directions route. - * - * @since 3.0.0 - */ - public static final String EXCLUDE_TOLL = "toll"; - - /** - * Exclude all motorways along the returned directions route. - * - * @since 3.0.0 - */ - public static final String EXCLUDE_MOTORWAY = "motorway"; - - /** - * Exclude all ferries along the returned directions route. - * - * @since 3.0.0 - */ - public static final String EXCLUDE_FERRY = "ferry"; - - /** - * Exclude all tunnels along the returned directions route. - * - * @since 3.0.0 - */ - public static final String EXCLUDE_TUNNEL = "tunnel"; - - /** - * Exclude all roads with access restrictions along the returned directions route. - * - * @since 3.0.0 - */ - public static final String EXCLUDE_RESTRICTED = "restricted"; - - /** - * Change the units to imperial for voice and visual information. Note that this won't change - * other results such as raw distance measurements which will always be returned in meters. - * - * @since 3.0.0 - */ - public static final String IMPERIAL = "imperial"; - - /** - * Change the units to metric for voice and visual information. Note that this won't change - * other results such as raw distance measurements which will always be returned in meters. - * - * @since 3.0.0 - */ - public static final String METRIC = "metric"; - - /** - * Returned route starts at the first provided coordinate in the list. Used specifically for the - * Optimization API. - * - * @since 2.1.0 - */ - public static final String SOURCE_FIRST = "first"; - - /** - * Returned route starts at any of the provided coordinate in the list. Used specifically for the - * Optimization API. - * - * @since 2.1.0 - */ - public static final String SOURCE_ANY = "any"; - - - /** - * Returned route ends at any of the provided coordinate in the list. Used specifically for the - * Optimization API. - * - * @since 3.0.0 - */ - public static final String DESTINATION_ANY = "any"; - - /** - * Returned route ends at the last provided coordinate in the list. Used specifically for the - * Optimization API. - * - * @since 3.0.0 - */ - public static final String DESTINATION_LAST = "last"; - - /** - * The routes can approach waypoints from either side of the road.

- * - * Used in MapMatching and Directions API. - * - * @since 3.2.0 - */ - public static final String APPROACH_UNRESTRICTED = "unrestricted"; - - /** - * The route will be returned so that on arrival, - * the waypoint will be found on the side that corresponds with the driving_side of - * the region in which the returned route is located.

- * - * Used in MapMatching and Directions API. - * - * @since 3.2.0 - */ - public static final String APPROACH_CURB = "curb"; - - private DirectionsCriteria() { - //not called - } - - /** - * Retention policy for the various direction profiles. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - PROFILE_DRIVING_TRAFFIC, - PROFILE_DRIVING, - PROFILE_WALKING, - PROFILE_CYCLING - }) - public @interface ProfileCriteria { - } - - /** - * Retention policy for the various direction geometries. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - GEOMETRY_POLYLINE, - GEOMETRY_POLYLINE6 - }) - public @interface GeometriesCriteria { - } - - /** - * Retention policy for the various direction overviews. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - OVERVIEW_FALSE, - OVERVIEW_FULL, - OVERVIEW_SIMPLIFIED - }) - public @interface OverviewCriteria { - } - - /** - * Retention policy for the various direction annotations. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - ANNOTATION_CONGESTION, - ANNOTATION_DISTANCE, - ANNOTATION_DURATION, - ANNOTATION_SPEED, - ANNOTATION_MAXSPEED - }) - public @interface AnnotationCriteria { - } - - /** - * Retention policy for the various direction exclusions. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - EXCLUDE_FERRY, - EXCLUDE_MOTORWAY, - EXCLUDE_TOLL, - EXCLUDE_TUNNEL, - EXCLUDE_RESTRICTED - }) - public @interface ExcludeCriteria { - } - - /** - * Retention policy for the various units of measurements. - * - * @since 0.3.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - IMPERIAL, - METRIC - }) - public @interface VoiceUnitCriteria { - } - - /** - * Retention policy for the source parameter in the Optimization API. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - SOURCE_ANY, - SOURCE_FIRST - }) - public @interface SourceCriteria { - } - - /** - * Retention policy for the destination parameter in the Optimization API. - * - * @since 3.0.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - DESTINATION_ANY, - DESTINATION_LAST - }) - public @interface DestinationCriteria { - } - - - /** - * Retention policy for the approaches parameter in the MapMatching and Directions API. - * - * @since 3.2.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - APPROACH_UNRESTRICTED, - APPROACH_CURB - }) - public @interface ApproachesCriteria { - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsError.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsError.java deleted file mode 100644 index 5f434d6d..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsError.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; - -import java.io.Serializable; - -/** - * If an InvalidInput error is thrown, this class can be used to get both the code and the message - * which holds an explanation of the invalid input. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class DirectionsError implements Serializable { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_DirectionsError.Builder(); - } - - /** - * String indicating the state of the response. This is a separate code than the HTTP status code. - * On normal valid responses, the value will be Ok. The possible responses are listed below: - *

    - *
  • Ok:200 Normal success case
  • - *
  • NoRoute: 200 There was no route found for the given coordinates. Check - * for impossible routes (e.g. routes over oceans without ferry connections).
  • - *
  • NoSegment: 200 No road segment could be matched for coordinates. Check for - * coordinates too far away from a road.
  • - *
  • ProfileNotFound: 404 Use a valid profile as described above
  • - *
  • InvalidInput: 422
  • - *
- * - * @return a string with one of the given values described in the list above - * @since 3.0.0 - */ - @Nullable - public abstract String code(); - - /** - * Provides a short message with the explanation of the invalid input. - * - * @return a string containing the message API Directions response - * @since 3.0.0 - */ - @Nullable - public abstract String message(); - - /** - * Convert the current {@link DirectionsError} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link DirectionsError}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link DirectionsError} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_DirectionsError.GsonTypeAdapter(gson); - } - - /** - * This builder can be used to set the values describing the {@link DirectionsError}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * String indicating the state of the response. This is a separate code than the HTTP status - * code. On normal valid responses, the value will be Ok. The possible responses are listed - * below: - *
    - *
  • Ok:200 Normal success case
  • - *
  • NoRoute: 200 There was no route found for the given coordinates. Check - * for impossible routes (e.g. routes over oceans without ferry connections).
  • - *
  • NoSegment: 200 No road segment could be matched for coordinates. Check - * for coordinates too far away from a road.
  • - *
  • ProfileNotFound: 404 Use a valid profile as described above
  • - *
  • InvalidInput: 422
  • - *
- * - * @param code a string with one of the given values described in the list above - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder code(String code); - - /** - * Provides a short message with the explanation of the invalid input. - * - * @param message a string containing the message API Directions response - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder message(String message); - - /** - * Build a new {@link DirectionsError} object. - * - * @return a new {@link DirectionsError} using the provided values in this builder - * @since 3.0.0 - */ - public abstract DirectionsError build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsJsonObject.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsJsonObject.java deleted file mode 100644 index 9011f402..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsJsonObject.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import com.google.gson.GsonBuilder; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.PointAsCoordinatesTypeAdapter; - -import java.io.Serializable; - -/** - * Provides a base class for Directions model classes. - * - * @since 3.4.0 - */ -public class DirectionsJsonObject implements Serializable { - - /** - * This takes the currently defined values found inside this instance and converts it to a json - * string. - * - * @return a JSON string which represents this DirectionsJsonObject - * @since 3.4.0 - */ - public String toJson() { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter()); - gson.registerTypeAdapterFactory(WalkingOptionsAdapterFactory.create()); - return gson.create().toJson(this); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsResponse.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsResponse.java deleted file mode 100644 index f350e49d..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsResponse.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.PointAsCoordinatesTypeAdapter; - -import java.util.List; - -/** - * This is the root Mapbox Directions API response. Inside this class are several nested classes - * chained together to make up a similar structure to the original APIs JSON response. - * - * @see Direction - * Response Object - * @since 1.0.0 - */ -@AutoValue -public abstract class DirectionsResponse extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - @NonNull - public static Builder builder() { - return new AutoValue_DirectionsResponse.Builder(); - } - - /** - * String indicating the state of the response. This is a separate code than the HTTP status code. - * On normal valid responses, the value will be Ok. The possible responses are listed below: - *
    - *
  • Ok:200 Normal success case
  • - *
  • NoRoute: 200 There was no route found for the given coordinates. Check - * for impossible routes (e.g. routes over oceans without ferry connections).
  • - *
  • NoSegment: 200 No road segment could be matched for coordinates. Check for - * coordinates too far away from a road.
  • - *
  • ProfileNotFound: 404 Use a valid profile as described above
  • - *
  • InvalidInput: 422
  • - *
- * - * @return a string with one of the given values described in the list above - * @since 1.0.0 - */ - @NonNull - public abstract String code(); - - /** - * Optionally shows up in a directions response if an error or something unexpected occurred. - * - * @return a string containing the message API Directions response with if an error occurred - * @since 3.0.0 - */ - @Nullable - public abstract String message(); - - /** - * List of {@link DirectionsWaypoint} objects. Each {@code waypoint} is an input coordinate - * snapped to the road and path network. The {@code waypoint} appear in the list in the order of - * the input coordinates. - * - * @return list of {@link DirectionsWaypoint} objects ordered from start of route till the end - * @since 1.0.0 - */ - @Nullable - public abstract List waypoints(); - - /** - * List containing all the different route options. It's ordered by descending recommendation - * rank. In other words, object 0 in the List is the highest recommended route. if you don't - * setAlternatives to true (default is false) in your builder this should always be a List of - * size 1. At most this will return 2 {@link DirectionsRoute} objects. - * - * @return list of {@link DirectionsRoute} objects - * @since 1.0.0 - */ - @NonNull - public abstract List routes(); - - /** - * A universally unique identifier (UUID) for identifying and executing a similar specific route - * in the future. - * - * @return a String representing the UUID given by the directions request - * @since 3.0.0 - */ - @Nullable - public abstract String uuid(); - - /** - * Convert the current {@link DirectionsResponse} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link DirectionsResponse}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link DirectionsResponse} - * @since 3.0.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_DirectionsResponse.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a GeoJson Directions Response - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.0.0 - */ - public static DirectionsResponse fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter()); - return gson.create().fromJson(json, DirectionsResponse.class); - } - - /** - * This builder can be used to set the values describing the {@link DirectionsResponse}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * String indicating the state of the response. This is a separate code than the HTTP status - * code. On normal valid responses, the value will be Ok. For a full list of possible responses, - * see {@link DirectionsResponse#code()}. - * - * @param code a string with one of the given values described in the list above - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder code(@NonNull String code); - - /** - * Optionally shows up in a directions response if an error or something unexpected occurred. - * - * @param message a string containing the message API Directions response with if an error - * occurred - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder message(@Nullable String message); - - /** - * List of {@link DirectionsWaypoint} objects. Each {@code waypoint} is an input coordinate - * snapped to the road and path network. The {@code waypoint} appear in the list in the order of - * the input coordinates. - * - * @param waypoints list of {@link DirectionsWaypoint} objects ordered from start of route till - * the end - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder waypoints(@Nullable List waypoints); - - /** - * List containing all the different route options. It's ordered by descending recommendation - * rank. In other words, object 0 in the List is the highest recommended route. if you don't - * setAlternatives to true (default is false) in your builder this should always be a List of - * size 1. At most this will return 2 {@link DirectionsRoute} objects. - * - * @param routes list of {@link DirectionsRoute} objects - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder routes(@NonNull List routes); - - abstract List routes(); - - /** - * A universally unique identifier (UUID) for identifying and executing a similar specific route - * in the future. - * - * @param uuid a String representing the UUID given by the directions request - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder uuid(@Nullable String uuid); - - abstract DirectionsResponse autoBuild(); - - /** - * Build a new {@link DirectionsResponse} object. - * - * @return a new {@link DirectionsResponse} using the provided values in this builder - * @since 3.0.0 - */ - public DirectionsResponse build() { - for (int i = 0; i < routes().size(); i++) { - routes().set(i, routes().get(i).toBuilder().routeIndex(String.valueOf(i)).build()); - } - - return autoBuild(); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsRoute.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsRoute.java deleted file mode 100644 index 13a09555..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsRoute.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.PointAsCoordinatesTypeAdapter; - -import java.util.List; - -/** - * Detailed information about an individual route such as the duration, distance and geometry. - * - * @since 1.0.0 - */ -@AutoValue -public abstract class DirectionsRoute extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_DirectionsRoute.Builder(); - } - - /** - * The index of this route in the original network response. - * - * @return string of an int value representing the index - * @since 4.4.0 - */ - @Nullable - public abstract String routeIndex(); - - /** - * The distance traveled from origin to destination. - * - * @return a double number with unit meters - * @since 1.0.0 - */ - @NonNull - public abstract Double distance(); - - /** - * The estimated travel time from origin to destination. - * - * @return a double number with unit seconds - * @since 1.0.0 - */ - @NonNull - public abstract Double duration(); - - /** - * The typical travel time from this route's origin to destination. There's a delay along - * this route if you subtract this durationTypical() value from the route's duration() - * value and the resulting difference is greater than 0. The delay is because of any - * number of real-world situations (road repair, traffic jam, etc). - * - * @return a double number with unit seconds - * @since 5.5.0 - */ - @Nullable - @SerializedName("duration_typical") - public abstract Double durationTypical(); - - /** - * Gives the geometry of the route. Commonly used to draw the route on the map view. - * - * @return an encoded polyline string - * @since 1.0.0 - */ - @Nullable - public abstract String geometry(); - - /** - * The calculated weight of the route. - * - * @return the weight value provided from the API as a {@code double} value - * @since 2.1.0 - */ - @Nullable - public abstract Double weight(); - - /** - * The name of the weight profile used while calculating during extraction phase. The default is - * {@code routability} which is duration based, with additional penalties for less desirable - * maneuvers. - * - * @return a String representing the weight profile used while calculating the route - * @since 2.1.0 - */ - @Nullable - @SerializedName("weight_name") - public abstract String weightName(); - - /** - * A Leg is a route between only two waypoints. - * - * @return list of {@link RouteLeg} objects - * @since 1.0.0 - */ - @Nullable - public abstract List legs(); - - /** - * Holds onto the parameter information used when making the directions request. Useful for - * re-requesting a directions route using the same information previously used. - * - * @return a {@link RouteOptions}s object which holds onto critical information from the request - * that cannot be derived directly from the directions route - * @since 3.0.0 - */ - @Nullable - public abstract RouteOptions routeOptions(); - - - /** - * String of the language to be used for voice instructions. Defaults to en, and - * can be any accepted instruction language. Will be null when the language provided - * MapboxDirections.Builder#language() via is not compatible with API Voice. - * - * @return String compatible with voice instructions, null otherwise - * @since 3.1.0 - */ - @Nullable - @SerializedName("voiceLocale") - public abstract String voiceLanguage(); - - /** - * Convert the current {@link DirectionsRoute} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link DirectionsRoute}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link DirectionsRoute} - * @since 3.0.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_DirectionsRoute.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a GeoJson Directions Route - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.0.0 - */ - public static DirectionsRoute fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter()); - return gson.create().fromJson(json, DirectionsRoute.class); - } - - /** - * This builder can be used to set the values describing the {@link DirectionsRoute}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The distance traveled from origin to destination. - * - * @param distance a double number with unit meters - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder distance(@NonNull Double distance); - - /** - * The estimated travel time from origin to destination. - * - * @param duration a double number with unit seconds - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder duration(@NonNull Double duration); - - /** - * The typical travel time from this route's origin to destination. There's a delay along - * this route if you subtract this durationTypical() value from the route's duration() - * value and the resulting difference is greater than 0. The delay is because of any - * number of real-world situations (road repair, traffic jam, etc). - * - * @param durationTypical a double number with unit seconds - * @return this builder for chaining options together - * @since 5.5.0 - */ - public abstract Builder durationTypical(@Nullable Double durationTypical); - - /** - * Gives the geometry of the route. Commonly used to draw the route on the map view. - * - * @param geometry an encoded polyline string - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder geometry(@Nullable String geometry); - - /** - * The calculated weight of the route. - * - * @param weight the weight value provided from the API as a {@code double} value - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder weight(@Nullable Double weight); - - /** - * The name of the weight profile used while calculating during extraction phase. The default is - * {@code routability} which is duration based, with additional penalties for less desirable - * maneuvers. - * - * @param weightName a String representing the weight profile used while calculating the route - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder weightName(@Nullable String weightName); - - /** - * A Leg is a route between only two waypoints. - * - * @param legs list of {@link RouteLeg} objects - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder legs(@Nullable List legs); - - /** - * Holds onto the parameter information used when making the directions request. - * - * @param routeOptions a {@link RouteOptions}s object which holds onto critical information from - * the request that cannot be derived directly from the directions route - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder routeOptions(@Nullable RouteOptions routeOptions); - - /** - * String of the language to be used for voice instructions. Defaults to en, and - * can be any accepted instruction language. - * - * @param voiceLanguage String compatible with voice instructions, null otherwise - * @return this builder for chaining options together - * @since 3.1.0 - */ - public abstract Builder voiceLanguage(@Nullable String voiceLanguage); - - abstract Builder routeIndex(String routeIndex); - - /** - * Build a new {@link DirectionsRoute} object. - * - * @return a new {@link DirectionsRoute} using the provided values in this builder - * @since 3.0.0 - */ - public abstract DirectionsRoute build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsWaypoint.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsWaypoint.java deleted file mode 100644 index 82b4988a..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/DirectionsWaypoint.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.mapbox.geojson.Point; - -/** - * An input coordinate snapped to the roads network. - * - * @since 1.0.0 - */ -@AutoValue -public abstract class DirectionsWaypoint extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_DirectionsWaypoint.Builder(); - } - - /** - * Provides the way name which the waypoint's coordinate is snapped to. - * - * @return string with the name of the way the coordinate snapped to - * @since 1.0.0 - */ - @Nullable - public abstract String name(); - - /** - * A {@link Point} representing this waypoint location. - * - * @return GeoJson Point representing this waypoint location - * @since 3.0.0 - */ - @Nullable - public Point location() { - return Point.fromLngLat(rawLocation()[0], rawLocation()[1]); - } - - /** - * A {@link Point} representing this waypoint location. - * - * @return GeoJson Point representing this waypoint location - * @since 3.0.0 - */ - @Nullable - @SerializedName("location") - @SuppressWarnings("mutable") - abstract double[] rawLocation(); - - /** - * Convert the current {@link DirectionsWaypoint} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link DirectionsWaypoint}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link DirectionsWaypoint} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_DirectionsWaypoint.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a DirectionsWaypoint - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static DirectionsWaypoint fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, DirectionsWaypoint.class); - } - - /** - * This builder can be used to set the values describing the {@link DirectionsWaypoint}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Provides the way name which the waypoint's coordinate is snapped to. - * - * @param name string with the name of the way the coordinate snapped to - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder name(@Nullable String name); - - /** - * The rawLocation as a double array. Once the {@link DirectionsWaypoint} objects created, - * this raw location gets converted into a {@link Point} object and is public exposed as such. - * The double array should have a length of two, index 0 being the longitude and index 1 being - * latitude. - * - * @param rawLocation a double array with a length of two, index 0 being the longitude and - * index 1 being latitude. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder rawLocation(@Nullable double[] rawLocation); - - /** - * Build a new {@link DirectionsWaypoint} object. - * - * @return a new {@link DirectionsWaypoint} using the provided values in this builder - * @since 3.0.0 - */ - public abstract DirectionsWaypoint build(); - - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Incident.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Incident.java deleted file mode 100644 index 7dc30071..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/Incident.java +++ /dev/null @@ -1,416 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringDef; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.List; - -/** - * Reproduces one of road incidents type ({@link IncidentType}) that might be on the way. - */ -@AutoValue -public abstract class Incident extends DirectionsJsonObject { - - /** - * {@link IncidentType} accident. - */ - public static final String INCIDENT_ACCIDENT = "accident"; - - /** - * {@link IncidentType} congestion. - */ - public static final String INCIDENT_CONGESTION = "congestion"; - - /** - * {@link IncidentType} construction. - */ - public static final String INCIDENT_CONSTRUCTION = "construction"; - - /** - * {@link IncidentType} disabled vehicle. ? - */ - public static final String INCIDENT_DISABLED_VEHICLE = "disabled_vehicle"; - - /** - * {@link IncidentType} lane restriction. - */ - public static final String INCIDENT_LANE_RESTRICTION = "lane_restriction"; - - /** - * {@link IncidentType} mass transit. - */ - public static final String INCIDENT_MASS_TRANSIT = "mass_transit"; - - /** - * {@link IncidentType} miscellaneous. - */ - public static final String INCIDENT_MISCELLANEOUS = "miscellaneous"; - - /** - * {@link IncidentType} other news. - */ - public static final String INCIDENT_OTHER_NEWS = "other_news"; - - /** - * {@link IncidentType} planned event. - */ - public static final String INCIDENT_PLANNED_EVENT = "planned_event"; - - /** - * {@link IncidentType} road closure. - */ - public static final String INCIDENT_ROAD_CLOSURE = "road_closure"; - - /** - * {@link IncidentType} road hazard. - */ - public static final String INCIDENT_ROAD_HAZARD = "road_hazard"; - - /** - * {@link IncidentType} weather. - */ - public static final String INCIDENT_WEATHER = "weather"; - - /** - * Incident type. - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef({ - INCIDENT_ACCIDENT, - INCIDENT_CONGESTION, - INCIDENT_CONSTRUCTION, - INCIDENT_DISABLED_VEHICLE, - INCIDENT_LANE_RESTRICTION, - INCIDENT_MASS_TRANSIT, - INCIDENT_MISCELLANEOUS, - INCIDENT_OTHER_NEWS, - INCIDENT_PLANNED_EVENT, - INCIDENT_ROAD_CLOSURE, - INCIDENT_ROAD_HAZARD, - INCIDENT_WEATHER - }) - public @interface IncidentType { - } - - /** - * {@link ImpactType} unknown. - */ - public static final String IMPACT_UNKNOWN = "unknown"; - - /** - * {@link ImpactType} critical. - */ - public static final String IMPACT_CRITICAL = "critical"; - - /** - * {@link ImpactType} major. - */ - public static final String IMPACT_MAJOR = "major"; - - /** - * {@link ImpactType} minor. - */ - public static final String IMPACT_MINOR = "minor"; - - /** - * {@link ImpactType} low. - */ - public static final String IMPACT_LOW = "low"; - - /** - * Impact type. - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef({ - IMPACT_UNKNOWN, - IMPACT_CRITICAL, - IMPACT_MAJOR, - IMPACT_MINOR, - IMPACT_LOW - }) - public @interface ImpactType { - } - - /** - * Unique identifier for incident. It might be the only one non-null filed which meant - * that incident started on previous leg and one has an incident with the same id. - */ - @NonNull - public abstract String id(); - - /** - * One of incident types. - * - * @see IncidentType - */ - @Nullable - @IncidentType - public abstract String type(); - - /** - * True if road is closed and no possibility to pass through there. False - * otherwise. - */ - @Nullable - public abstract Boolean closed(); - - /** - * Quantitative descriptor of congestion. - */ - @Nullable - public abstract Congestion congestion(); - - /** - * Human-readable description of the incident suitable for displaying to the users. - */ - @Nullable - public abstract String description(); - - /** - * Human-readable long description of the incident suitable for displaying to the users. - */ - @Nullable - @SerializedName("long_description") - public abstract String longDescription(); - - /** - * Severity level of incident. - * - * @see ImpactType - */ - @Nullable - @ImpactType - public abstract String impact(); - - /** - * Sub-type of the incident. - */ - @Nullable - @SerializedName("sub_type") - public abstract String subType(); - - /** - * Sub-type-specific description. - */ - @Nullable - @SerializedName("sub_type_description") - public abstract String subTypeDescription(); - - /** - * AlertC codes. - * - * @see AlertC - */ - @Nullable - @SerializedName("alertc_codes") - public abstract List alertcCodes(); - - /** - * Incident's geometry index start point. - */ - @Nullable - @SerializedName("geometry_index_start") - public abstract Integer geometryIndexStart(); - - /** - * Incident's geometry index end point. - */ - @Nullable - @SerializedName("geometry_index_end") - public abstract Integer geometryIndexEnd(); - - /** - * Time the incident was created/updated in ISO8601 format. Not the same - * {@link #startTime()}/{@link #endTime()}, incident can be created/updated before the incident. - */ - @Nullable - @SerializedName("creation_time") - public abstract String creationTime(); - - /** - * Start time of the incident in ISO8601 format. - */ - @Nullable - @SerializedName("start_time") - public abstract String startTime(); - - /** - * End time of the incident in ISO8601 format. - */ - @Nullable - @SerializedName("end_time") - public abstract String endTime(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_Incident.Builder(); - } - - /** - * Convert the current {@link Incident} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link Incident}. - * - * @return a {@link Builder} with the same values set to match the ones defined in this - * {@link Incident} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_Incident.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Incident - * @return a new instance of this class defined by the values passed in the method - */ - public static Incident fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, Incident.class); - } - - /** - * This builder can be used to set the values describing the {@link Incident}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Unique identifier for incident. It might be the only one non-null filed which meant - * that incident started on previous leg and one has an incident with the same id. - * - * @param id String - */ - public abstract Builder id(@NonNull String id); - - /** - * One of incident types. - * - * @param type incident type - * @see IncidentType - */ - public abstract Builder type(@Nullable @IncidentType String type); - - /** - * True if road is closed and no possibility to pass through there. False - * otherwise. - * - * @param closed is way closed - */ - public abstract Builder closed(@Nullable Boolean closed); - - /** - * Quantitative descriptor of congestion. - * - * @param congestion congestion - */ - public abstract Builder congestion(@Nullable Congestion congestion); - - /** - * Human-readable description of the incident suitable for displaying to the users. - * - * @param description incident description - */ - public abstract Builder description(@Nullable String description); - - /** - * Human-readable long description of the incident suitable for displaying to the users. - * - * @param longDescription incident long description - */ - public abstract Builder longDescription(@Nullable String longDescription); - - /** - * Severity level of incident. - * - * @param impact impact type - * @see ImpactType - */ - public abstract Builder impact(@Nullable @ImpactType String impact); - - /** - * Sub-type of the incident. - * - * @param subType syp-type - */ - public abstract Builder subType(@Nullable String subType); - - /** - * Sub-type-specific description. - * - * @param subTypeDescription sub-type description - */ - public abstract Builder subTypeDescription(@Nullable String subTypeDescription); - - /** - * AlertC codes. - * - * @param alertcCodes list of alert codes - * @see AlertC - */ - public abstract Builder alertcCodes(@Nullable List alertcCodes); - - /** - * Incident's geometry index start point. - * - * @param geometryIndexStart start index - */ - public abstract Builder geometryIndexStart(@Nullable Integer geometryIndexStart); - - /** - * Incident's geometry index end point. - * - * @param geometryIndexEnd end index - */ - public abstract Builder geometryIndexEnd(@Nullable Integer geometryIndexEnd); - - /** - * Time the incident was created/updated in ISO8601 format. - * - * @param creationTime ISO8601 format - */ - public abstract Builder creationTime(@Nullable String creationTime); - - /** - * Start time in ISO8601 format. - * - * @param startTime ISO8601 format - */ - public abstract Builder startTime(@Nullable String startTime); - - /** - * End time in ISO8601 format. - * - * @param endTime ISO8601 format - */ - public abstract Builder endTime(@Nullable String endTime); - - /** - * Build a new instance of {@link Incident}. - * - * @return a new instance of {@link Incident}. - */ - public abstract Incident build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/IntersectionLanes.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/IntersectionLanes.java deleted file mode 100644 index eaea02d7..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/IntersectionLanes.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -/** - * Object representing lanes in an intersection. - * - * @since 2.0.0 - */ -@AutoValue -public abstract class IntersectionLanes extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_IntersectionLanes.Builder(); - } - - /** - * Provides a boolean value you can use to determine if the given lane is valid for the user to - * complete the maneuver. - * - * @return Boolean value for whether this lane can be taken to complete the maneuver. For - * instance, if the lane array has four objects and the first two are marked as valid, then the - * driver can take either of the left lanes and stay on the route. - * @since 2.0.0 - */ - @Nullable - public abstract Boolean valid(); - - /** - * Indicates whether this lane is a preferred lane (true) or not (false). - * A preferred lane is a lane that is recommended if there are multiple lanes available. - * For example, if guidance indicates that the driver must turn left at an intersection - * and there are multiple left turn lanes, the left turn lane that will better prepare - * the driver for the next maneuver will be marked as active. - * Only available on the mapbox/driving profile. - * - * @return Indicates whether this lane is a preferred lane (true) or not (false). - */ - @Nullable - public abstract Boolean active(); - - /** - * When either valid or active is set to true, this property shows which of the lane indications - * is applicable to the current route, when there is more than one. For example, if a lane allows - * you to go left or straight but your current route is guiding you to the left, - * then this value will be set to left. - * See indications for possible values. - * When both active and valid are false, this property will not be included in the response. - * Only available on the mapbox/driving profile. - * - * @return which of the lane indications is applicable to the current route, - * when there is more than one - */ - @Nullable - @SerializedName("valid_indication") - public abstract String validIndication(); - - /** - * Array that can be made up of multiple signs such as {@code left}, {@code right}, etc. - * - * @return Array of signs for each turn lane. There can be multiple signs. For example, a turning - * lane can have a sign with an arrow pointing left and another sign with an arrow pointing - * straight. - * @since 2.0.0 - */ - @Nullable - public abstract List indications(); - - /** - * Convert the current {@link IntersectionLanes} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link IntersectionLanes}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link IntersectionLanes} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_IntersectionLanes.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an IntersectionLanes - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static IntersectionLanes fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, IntersectionLanes.class); - } - - /** - * This builder can be used to set the values describing the {@link IntersectionLanes}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Provide a boolean value you can use to determine if the given lane is valid for the user to - * complete the maneuver. - * - * @param valid Boolean value for whether this lane can be taken to complete the maneuver. For - * instance, if the lane array has four objects and the first two are marked as - * valid, then the driver can take either of the left lanes and stay on the route. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder valid(@Nullable Boolean valid); - - /** - * Indicates whether this lane is a preferred lane (true) or not (false). - * - * @param active Boolean value that indicates whether this lane is a preferred lane (true) - * or not (false). - * @return this builder for chaining options together - */ - public abstract Builder active(@Nullable Boolean active); - - /** - * Shows which of the lane indications is applicable to the current route, - * when there is more than one. - * - * @param validIndication lane indications applicable to the current route, - * when there is more than one. - * @return this builder for chaining options together - */ - public abstract Builder validIndication(@Nullable String validIndication); - - /** - * list that can be made up of multiple signs such as {@code left}, {@code right}, etc. - * - * @param indications list of signs for each turn lane. There can be multiple signs. For - * example, a turning lane can have a sign with an arrow pointing left and - * another sign with an arrow pointing straight. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder indications(@Nullable List indications); - - /** - * Build a new {@link IntersectionLanes} object. - * - * @return a new {@link IntersectionLanes} using the provided values in this builder - * @since 3.0.0 - */ - public abstract IntersectionLanes build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegAnnotation.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegAnnotation.java deleted file mode 100644 index 80036689..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegAnnotation.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -import java.util.List; - -/** - * An annotations object that contains additional details about each line segment along the route - * geometry. Each entry in an annotations field corresponds to a coordinate along the route - * geometry. - * - * @since 2.1.0 - */ -@AutoValue -public abstract class LegAnnotation extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_LegAnnotation.Builder(); - } - - /** - * The distance, in meters, between each pair of coordinates. - * - * @return a list with each entry being a distance value between two of the routeLeg geometry - * coordinates - * @since 2.1.0 - */ - @Nullable - public abstract List distance(); - - /** - * The speed, in meters per second, between each pair of coordinates. - * - * @return a list with each entry being a speed value between two of the routeLeg geometry - * coordinates - * @since 2.1.0 - */ - @Nullable - public abstract List duration(); - - /** - * The speed, in meters per second, between each pair of coordinates. - * - * @return a list with each entry being a speed value between two of the routeLeg geometry - * coordinates - * @since 2.1.0 - */ - @Nullable - public abstract List speed(); - - /** - * The posted speed limit, between each pair of coordinates. - * Maxspeed is only available for the `mapbox/driving` and `mapbox/driving-traffic` - * profiles, other profiles will return `unknown`s only. - * - * @return a list with each entry being a {@link MaxSpeed} value between two of - * the routeLeg geometry coordinates - * @since 3.0.0 - */ - @Nullable - public abstract List maxspeed(); - - /** - * The congestion between each pair of coordinates. - * - * @return a list of Strings with each entry being a congestion value between two of the routeLeg - * geometry coordinates - * @since 2.2.0 - */ - @Nullable - public abstract List congestion(); - - /** - * Convert the current {@link LegAnnotation} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link LegAnnotation}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link LegAnnotation} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_LegAnnotation.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a LegAnnotation - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static LegAnnotation fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, LegAnnotation.class); - } - - /** - * This builder can be used to set the values describing the {@link LegAnnotation}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The distance, in meters, between each pair of coordinates. - * - * @param distance a list with each entry being a distance value between two of the routeLeg - * geometry coordinates - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder distance(@Nullable List distance); - - /** - * The speed, in meters per second, between each pair of coordinates. - * - * @param duration a list with each entry being a speed value between two of the routeLeg - * geometry coordinates - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder duration(@Nullable List duration); - - /** - * The speed, in meters per second, between each pair of coordinates. - * - * @param speed a list with each entry being a speed value between two of the routeLeg geometry - * coordinates - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder speed(@Nullable List speed); - - /** - * The posted speed limit, between each pair of coordinates. - * Maxspeed is only available for the `mapbox/driving` and `mapbox/driving-traffic` - * profiles, other profiles will return `unknown`s only. - * - * @param maxspeed list of speeds between each pair of coordinates - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder maxspeed(@Nullable List maxspeed); - - /** - * The congestion between each pair of coordinates. - * - * @param congestion a list of Strings with each entry being a congestion value between two of - * the routeLeg geometry coordinates - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder congestion(@Nullable List congestion); - - /** - * Build a new {@link LegAnnotation} object. - * - * @return a new {@link LegAnnotation} using the provided values in this builder - * @since 3.0.0 - */ - public abstract LegAnnotation build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegStep.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegStep.java deleted file mode 100644 index 15283d20..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/LegStep.java +++ /dev/null @@ -1,507 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import androidx.annotation.StringDef; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.List; - -/** - * Includes one {@link StepManeuver} object and travel to the following {@link LegStep}. - * - * @since 1.0.0 - */ -@AutoValue -public abstract class LegStep extends DirectionsJsonObject { - - /** - * {@link SpeedLimitSign} accident. - */ - public static final String MUTCD = "mutcd"; - - /** - * {@link SpeedLimitSign} congestion. - */ - public static final String VIENNA = "vienna"; - - /** - * Speed limit sign. - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef({ - MUTCD, - VIENNA - }) - public @interface SpeedLimitSign { - } - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_LegStep.Builder(); - } - - /** - * The distance traveled from the maneuver to the next {@link LegStep}. - * - * @return a double number with unit meters - * @since 1.0.0 - */ - public abstract double distance(); - - /** - * The estimated travel time from the maneuver to the next {@link LegStep}. - * - * @return a double number with unit seconds - * @since 1.0.0 - */ - public abstract double duration(); - - /** - * The typical travel time for traversing this LegStep. There's a delay along the LegStep - * if you subtract this durationTypical() value from the LegStep duration() value and - * the resulting difference is greater than 0. The delay is because of any number - * of real-world situations (road repair, traffic jam, etc). - * - * @return a double number with unit seconds - * @since 5.5.0 - */ - @Nullable - @SerializedName("duration_typical") - public abstract Double durationTypical(); - - /** - * Speed limit unit as per the locale. - * - * @return unit of the speed limit - */ - @Nullable - @SpeedLimit.Unit - public abstract String speedLimitUnit(); - - /** - * Speed limit sign type. - * - * @see SpeedLimitSign - */ - @Nullable - @SpeedLimitSign - public abstract String speedLimitSign(); - - /** - * Gives the geometry of the leg step. - * - * @return an encoded polyline string - * @since 1.0.0 - */ - @Nullable - public abstract String geometry(); - - /** - * String with the name of the way along which the travel proceeds. - * - * @return a {@code String} representing the way along which the travel proceeds - * @since 1.0.0 - */ - @Nullable - public abstract String name(); - - /** - * Any road designations associated with the road or path leading from this step's - * maneuver to the next step's maneuver. Optionally included, if data is available. - * If multiple road designations are associated with the road, they are separated by semicolons. - * A road designation typically consists of an alphabetic network code (identifying the road type - * or numbering system), a space or hyphen, and a route number. You should not assume that - * the network code is globally unique: for example, a network code of "NH" may appear - * on a "National Highway" or "New Hampshire". Moreover, a route number may - * not even uniquely identify a road within a given network. - * - * @return String with reference number or code of the way along which the travel proceeds. - * Optionally included, if data is available. - * @since 2.0.0 - */ - @Nullable - public abstract String ref(); - - /** - * String with the destinations of the way along which the travel proceeds. - * - * @return String with the destinations of the way along which the travel proceeds. Optionally - * included, if data is available - * @since 2.0.0 - */ - @Nullable - public abstract String destinations(); - - /** - * indicates the mode of transportation in the step. - * - * @return String indicating the mode of transportation. - * @since 1.0.0 - */ - @NonNull - public abstract String mode(); - - /** - * The pronunciation hint of the way name. Will be undefined if no pronunciation is hit. - * - * @return String with the pronunciation - * @since 2.0.0 - */ - @Nullable - public abstract String pronunciation(); - - /** - * An optional string indicating the name of the rotary. This will only be a nonnull when the - * maneuver type equals {@code rotary}. - * - * @return String with the rotary name - * @since 2.0.0 - */ - @Nullable - @SerializedName("rotary_name") - public abstract String rotaryName(); - - /** - * An optional string indicating the pronunciation of the name of the rotary. This will only be a - * nonnull when the maneuver type equals {@code rotary}. - * - * @return String in IPA with the rotary name's pronunciation. - * @since 2.0.0 - */ - @Nullable - @SerializedName("rotary_pronunciation") - public abstract String rotaryPronunciation(); - - /** - * A {@link StepManeuver} object that typically represents the first coordinate making up the - * {@link LegStep#geometry()}. - * - * @return new {@link StepManeuver} object - * @since 1.0.0 - */ - @NonNull - public abstract StepManeuver maneuver(); - - /** - * The voice instructions object is useful for navigation sessions providing well spoken text - * instructions along with the distance from the maneuver the instructions should be said. - * - * @return a list of voice instructions which can be triggered on this current step - * @since 3.0.0 - */ - @Nullable - public abstract List voiceInstructions(); - - /** - * If in your request you set MapboxDirections.Builder#bannerInstructions() to true, - * you'll receive a list of {@link BannerInstructions} which encompasses all information necessary - * for creating a visual cue about a given {@link LegStep}. - * - * @return a list of {@link BannerInstructions}s which help display visual cues - * inside your application - * @since 3.0.0 - */ - @Nullable - public abstract List bannerInstructions(); - - /** - * The legal driving side at the location for this step. Result will either be {@code left} or - * {@code right}. - * - * @return a string with either a left or right value - * @since 3.0.0 - */ - @Nullable - @SerializedName("driving_side") - public abstract String drivingSide(); - - /** - * Specifies a decimal precision of edge weights, default value 1. - * - * @return a decimal precision double value - * @since 2.1.0 - */ - public abstract double weight(); - - /** - * Provides a list of all the intersections connected to the current way the user is traveling - * along. - * - * @return list of {@link StepIntersection} representing all intersections along the step - * @since 1.3.0 - */ - @Nullable - public abstract List intersections(); - - /** - * String with the exit numbers or names of the way. Optionally included, if data is available. - * - * @return a String identifying the exit number or name - * @since 3.0.0 - */ - @Nullable - public abstract String exits(); - - /** - * Convert the current {@link LegStep} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link LegStep}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link LegStep} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_LegStep.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a LegStep - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static LegStep fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, LegStep.class); - } - - /** - * This builder can be used to set the values describing the {@link LegStep}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The distance traveled from the maneuver to the next {@link LegStep}. - * - * @param distance a double number with unit meters - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder distance(double distance); - - /** - * The estimated travel time from the maneuver to the next {@link LegStep}. - * - * @param duration a double number with unit seconds - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder duration(double duration); - - /** - * The typical travel time for traversing this LegStep. There's a delay along the LegStep - * if you subtract this durationTypical() value from the LegStep duration() value and - * the resulting difference is greater than 0. The delay is because of any number - * of real-world situations (road repair, traffic jam, etc). - * - * @param durationTypical a double number with unit seconds - * @return this builder for chaining options together - * @since 5.5.0 - */ - public abstract Builder durationTypical(@Nullable Double durationTypical); - - /** - * Speed limit unit as per the locale. - * - * @param speedLimitUnit speed limit unit - * @return this builder for chaining options together - * @see SpeedLimit.Unit - */ - public abstract Builder speedLimitUnit(@Nullable @SpeedLimit.Unit String speedLimitUnit); - - /** - * Speed limit sign type. - * - * @param speedLimitSign speed limit sign - * @return this builder for chaining options together - * @see SpeedLimitSign - */ - public abstract Builder speedLimitSign(@Nullable @SpeedLimitSign String speedLimitSign); - - /** - * Gives the geometry of the leg step. - * - * @param geometry an encoded polyline string - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder geometry(@Nullable String geometry); - - /** - * String with the name of the way along which the travel proceeds. - * - * @param name a {@code String} representing the way along which the travel proceeds - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder name(@Nullable String name); - - /** - * String with reference number or code of the way along which the travel proceeds. - * - * @param ref String with reference number or code of the way along which the travel proceeds. - * Optionally included, if data is available - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder ref(@Nullable String ref); - - /** - * String with the destinations of the way along which the travel proceeds. - * - * @param destinations String with the destinations of the way along which the travel proceeds. - * Optionally included, if data is available - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder destinations(@Nullable String destinations); - - /** - * Indicates the mode of transportation in the step. - * - * @param mode String indicating the mode of transportation - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder mode(@NonNull String mode); - - /** - * The pronunciation hint of the way name. Will be undefined if no pronunciation is hit. - * - * @param pronunciation String with the pronunciation - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder pronunciation(@Nullable String pronunciation); - - /** - * An optional string indicating the name of the rotary. This will only be a nonnull when the - * maneuver type equals {@code rotary}. - * - * @param rotaryName String with the rotary name - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder rotaryName(@Nullable String rotaryName); - - /** - * An optional string indicating the pronunciation of the name of the rotary. This will only be - * a nonnull when the maneuver type equals {@code rotary}. - * - * @param rotaryPronunciation String in IPA with the rotary name's pronunciation. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder rotaryPronunciation(@Nullable String rotaryPronunciation); - - /** - * A {@link StepManeuver} object that typically represents the first coordinate making up the - * {@link LegStep#geometry()}. - * - * @param maneuver new {@link StepManeuver} object - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder maneuver(@NonNull StepManeuver maneuver); - - /** - * The voice instructions object is useful for navigation sessions providing well spoken text - * instructions along with the distance from the maneuver the instructions should be said. - * - * @param voiceInstructions a list of voice instructions which can be triggered on this current - * step - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder voiceInstructions(@NonNull List voiceInstructions); - - /** - * If in your request you set MapboxDirections.Builder#bannerInstructions() to true, - * you'll receive a list of {@link BannerInstructions} which encompasses all information - * necessary for creating a visual cue about a given {@link LegStep}. - * - * @param bannerInstructions a list of {@link BannerInstructions}s which help display visual - * cues inside your application - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder bannerInstructions( - @NonNull List bannerInstructions); - - /** - * The legal driving side at the location for this step. Result will either be {@code left} or - * {@code right}. - * - * @param drivingSide a string with either a left or right value - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder drivingSide(@Nullable String drivingSide); - - /** - * Specifies a decimal precision of edge weights, default value 1. - * - * @param weight a decimal precision double value - * @return this builder for chaining options together - * @since 2.1.0 - */ - public abstract Builder weight(double weight); - - /** - * Provide a list of all the intersections connected to the current way the user is traveling - * along. - * - * @param intersections list of {@link StepIntersection} representing all intersections along - * the step - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder intersections(@NonNull List intersections); - - /** - * String with the exit numbers or names of the way. Optionally included, if data is available. - * - * @param exits a String identifying the exit number or name - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder exits(@Nullable String exits); - - /** - * Build a new {@link LegStep} object. - * - * @return a new {@link LegStep} using the provided values in this builder - * @since 3.0.0 - */ - public abstract LegStep build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/ManeuverModifier.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/ManeuverModifier.java deleted file mode 100644 index 96c7c8c5..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/ManeuverModifier.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Constants for the {@link StepManeuver#modifier()}. - * - * @since 5.2.0 - */ -public final class ManeuverModifier { - - /** - * Indicates "uturn" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String UTURN = "uturn"; - - /** - * Indicates "sharp right" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String SHARP_RIGHT = "sharp right"; - - /** - * Indicates "right" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String RIGHT = "right"; - - /** - * Indicates "slight right" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String SLIGHT_RIGHT = "slight right"; - - /** - * Indicates "straight" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String STRAIGHT = "straight"; - - /** - * Indicates "slight left" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String SLIGHT_LEFT = "slight left"; - - /** - * Indicates "left" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String LEFT = "left"; - - /** - * Indicates "sharp left" maneuver modifier. - * - * @since 5.2.0 - */ - public static final String SHARP_LEFT = "sharp left"; - - /** - * Representation of ManeuverModifier in form of logical types. - * - * @since 5.2.1 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef({ - ManeuverModifier.UTURN, - ManeuverModifier.SHARP_RIGHT, - ManeuverModifier.RIGHT, - ManeuverModifier.SLIGHT_RIGHT, - ManeuverModifier.STRAIGHT, - ManeuverModifier.SLIGHT_LEFT, - ManeuverModifier.LEFT, - ManeuverModifier.SHARP_LEFT - }) - public @interface Type { - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MapboxStreetsV8.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MapboxStreetsV8.java deleted file mode 100644 index 12abcbb9..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MapboxStreetsV8.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -/** - * An object containing detailed information about the road exiting the intersection along the - * route. - * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - */ -@AutoValue -public abstract class MapboxStreetsV8 extends DirectionsJsonObject { - - /** - * The road class of the road exiting the intersection as defined by the - * - * Mapbox Streets v8 road class specification. - * Valid values are the same as those supported by Mapbox Streets v8. - * Examples include: `motorway`, `motorway_link`, `primary`, and `street`. - * Note that adding new possible values is not considered a breaking change. - * - * @return class of the road. - */ - @Nullable - @SerializedName("class") - public abstract String roadClass(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_MapboxStreetsV8.Builder(); - } - - /** - * Convert the current {@link MapboxStreetsV8} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link MapboxStreetsV8}. - * - * @return a {@link Builder} with the same values set to match the ones defined in this {@link - * MapboxStreetsV8} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_MapboxStreetsV8.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Incident - * @return a new instance of this class defined by the values passed in the method - */ - public static MapboxStreetsV8 fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, MapboxStreetsV8.class); - } - - /** - * This builder can be used to set the values describing the {@link MapboxStreetsV8}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Class of the road exiting the intersection. - * - * @param roadClass class of the road exiting the intersection. - * @return this builder for chaining options together - */ - public abstract Builder roadClass(@Nullable String roadClass); - - /** - * Build a new {@link MapboxStreetsV8} object. - * - * @return a new {@link MapboxStreetsV8} using the provided values in this builder - */ - public abstract MapboxStreetsV8 build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MaxSpeed.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MaxSpeed.java deleted file mode 100644 index 81fbe63d..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/MaxSpeed.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -/** - * Object representing max speeds along a route. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class MaxSpeed extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_MaxSpeed.Builder(); - } - - /** - * Number indicating the posted speed limit. - * - * @return number indicating the posted speed limit - * @since 3.0.0 - */ - @Nullable - public abstract Integer speed(); - - /** - * String indicating the unit of speed, either as `km/h` or `mph`. - * - * @return String unit either as `km/h` or `mph` - * @since 3.0.0 - */ - @Nullable - @SpeedLimit.Unit - public abstract String unit(); - - /** - * Boolean is true if the speed limit is not known, otherwise null. - * - * @return Boolean true if speed limit is not known, otherwise null - * @since 3.0.0 - */ - @Nullable - public abstract Boolean unknown(); - - /** - * Boolean is `true` if the speed limit is unlimited, otherwise null. - * - * @return Boolean true if speed limit is unlimited, otherwise null - * @since 3.0.0 - */ - @Nullable - public abstract Boolean none(); - - /** - * Convert the current {@link MaxSpeed} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link MaxSpeed}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link MaxSpeed} - * @since 3.1.0 - */ - - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_MaxSpeed.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a MaxSpeed - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static MaxSpeed fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, MaxSpeed.class); - } - - /** - * This builder can be used to set the values describing the {@link MaxSpeed}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Number indicating the posted speed limit. - * - * @param speed indicating the posted speed limit - * @return a {@link Builder} object - * @since 3.0.0 - */ - public abstract Builder speed(@Nullable Integer speed); - - /** - * String indicating the unit of speed, either as `km/h` or `mph`. - * - * @param unit either as `km/h` or `mph` - * @return a {@link Builder} object - * @since 3.0.0 - */ - public abstract Builder unit(@Nullable @SpeedLimit.Unit String unit); - - /** - * Boolean is true if the speed limit is not known, otherwise null. - * - * @param unknown true if speed limit is not known, otherwise null - * @return a {@link Builder} object - * @since 3.0.0 - */ - public abstract Builder unknown(@Nullable Boolean unknown); - - /** - * Boolean is `true` if the speed limit is unlimited, otherwise null. - * - * @param none true if speed limit is unlimited, otherwise null - * @return a {@link Builder} object - * @since 3.0.0 - */ - public abstract Builder none(@Nullable Boolean none); - - /** - * Build a new {@link MaxSpeed} object. - * - * @return a new {@link MaxSpeed} using the provided values in this builder - * @since 3.0.0 - */ - public abstract MaxSpeed build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RestStop.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RestStop.java deleted file mode 100644 index 2ca2e69f..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RestStop.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -/** - * An object containing information about passing rest stops along the route. - * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - */ -@AutoValue -public abstract class RestStop extends DirectionsJsonObject { - - /** - * The type of rest stop, either `rest_area` (includes parking only) or `service_area` - * (includes amenities such as gas or restaurants). - * Note that adding new possible types is not considered a breaking change. - */ - @Nullable - public abstract String type(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_RestStop.Builder(); - } - - /** - * Convert the current {@link RestStop} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link RestStop}. - * - * @return a {@link Builder} with the same values set to match the ones defined in this {@link - * RestStop} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_RestStop.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Incident - * @return a new instance of this class defined by the values passed in the method - */ - public static RestStop fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, RestStop.class); - } - - /** - * This builder can be used to set the values describing the {@link RestStop}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The type of rest stop, either `rest_area` (includes parking only) or `service_area` - * (includes amenities such as gas or restaurants). - * Note that adding new possible types is not considered a breaking change. - * - * @param type rest stop type - */ - public abstract Builder type(@Nullable String type); - - /** - * Build a new {@link RestStop} object. - * - * @return a new {@link RestStop} using the provided values in this builder - */ - public abstract RestStop build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteLeg.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteLeg.java deleted file mode 100644 index 45ae627b..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteLeg.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -/** - * A route between only two {@link DirectionsWaypoint}. - * - * @since 1.0.0 - */ -@AutoValue -public abstract class RouteLeg extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_RouteLeg.Builder(); - } - - /** - * The distance traveled from one waypoint to another. - * - * @return a double number with unit meters - * @since 1.0.0 - */ - @Nullable - public abstract Double distance(); - - /** - * The estimated travel time from one waypoint to another. - * - * @return a double number with unit seconds - * @since 1.0.0 - */ - @Nullable - public abstract Double duration(); - - /** - * The typical travel time for traversing this RouteLeg. There's a delay along the RouteLeg - * if you subtract this durationTypical() value from the RouteLeg duration() value and - * the resulting difference is greater than 0. The delay is because of any number - * of real-world situations (road repair, traffic jam, etc). - * - * @return a double number with unit seconds - * @since 5.5.0 - */ - @Nullable - @SerializedName("duration_typical") - public abstract Double durationTypical(); - - /** - * A short human-readable summary of major roads traversed. Useful to distinguish alternatives. - * - * @return String with summary - * @since 1.0.0 - */ - @Nullable - public abstract String summary(); - - /** - * An array of objects describing the administrative boundaries the route leg travels through. - * Use {@link StepIntersection#adminIndex()} on the intersection object - * to look up the admin for each intersection in this array. - */ - @Nullable - public abstract List admins(); - - /** - * Gives a List including all the steps to get from one waypoint to another. - * - * @return List of {@link LegStep} - * @since 1.0.0 - */ - @Nullable - public abstract List steps(); - - /** - * A list of incidents that occur on this leg. - * - * @return a list of {@link Incident} - */ - @Nullable - public abstract List incidents(); - - /** - * A {@link LegAnnotation} that contains additional details about each line segment along the - * route geometry. If you'd like to receiving this, you must request it inside your Directions - * request before executing the call. - * - * @return a {@link LegAnnotation} object - * @since 2.1.0 - */ - @Nullable - public abstract LegAnnotation annotation(); - - /** - * A list of closures that occur on this leg. - * - * @return a list of {@link Incident} - */ - @Nullable - public abstract List closures(); - - /** - * Convert the current {@link RouteLeg} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link RouteLeg}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link RouteLeg} - * @since 3.1.0 - */ - - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_RouteLeg.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a RouteLeg - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static RouteLeg fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, RouteLeg.class); - } - - /** - * This builder can be used to set the values describing the {@link RouteLeg}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The distance traveled from one waypoint to another. - * - * @param distance a double number with unit meters - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder distance(@Nullable Double distance); - - /** - * The estimated travel time from one waypoint to another. - * - * @param duration a double number with unit seconds - * @return this builder for chaining options together - * @since 1.0.0 - */ - public abstract Builder duration(@Nullable Double duration); - - /** - * The typical travel time for traversing this RouteLeg. There's a delay along the RouteLeg - * if you subtract this durationTypical() value from the RouteLeg duration() value and - * the resulting difference is greater than 0. The delay is because of any number - * of real-world situations (road repair, traffic jam, etc). - * - * @param durationTypical a double number with unit seconds - * @return this builder for chaining options together - * @since 5.5.0 - */ - public abstract Builder durationTypical(@Nullable Double durationTypical); - - /** - * A short human-readable summary of major roads traversed. Useful to distinguish alternatives. - * - * @param summary String with summary - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder summary(@Nullable String summary); - - /** - * An array of objects describing the administrative boundaries the route leg travels through. - * Use {@link StepIntersection#adminIndex()} on the intersection object - * to look up the admin for each intersection in this array. - * - * @param admins Array with admins - * @return this builder for chaining options together - */ - public abstract Builder admins(@Nullable List admins); - - /** - * Gives a List including all the steps to get from one waypoint to another. - * - * @param steps List of {@link LegStep} - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder steps(@Nullable List steps); - - /** - * A list of incidents that occur on this leg. - * - * @param incidents a list of {@link Incident} - * @return this builder for chaining options together - */ - public abstract Builder incidents(@Nullable List incidents); - - /** - * A {@link LegAnnotation} that contains additional details about each line segment along the - * route geometry. If you'd like to receiving this, you must request it inside your Directions - * request before executing the call. - * - * @param annotation a {@link LegAnnotation} object - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder annotation(@Nullable LegAnnotation annotation); - - /** - * A list of closures that occur on this leg. - * - * @param closures a list of {@link Closure} - * @return this builder for chaining options together - */ - public abstract Builder closures(@Nullable List closures); - - /** - * Build a new {@link RouteLeg} object. - * - * @return a new {@link RouteLeg} using the provided values in this builder - * @since 3.0.0 - */ - public abstract RouteLeg build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteOptions.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteOptions.java deleted file mode 100644 index 148877e0..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/RouteOptions.java +++ /dev/null @@ -1,1106 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.PointAsCoordinatesTypeAdapter; -import com.mapbox.services.android.navigation.v5.models.utils.FormatUtils; -import com.mapbox.services.android.navigation.v5.models.utils.ParseUtils; - -import java.util.List; - -/** - * Provides information connected to your request that help when a new directions request is needing - * using the identical parameters as the original request. - *

- * For example, if I request a driving (profile) with alternatives and continueStraight set to true. - * I make the request but loose reference and information which built the original request. Thus, If - * I only want to change a single variable such as the destination coordinate, i'd have to have all - * the other route information stores so the request was made identical to the previous but only now - * using this new destination point. - *

- * Using this class can provide you wth the information used when the {@link DirectionsRoute} was - * made. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class RouteOptions extends DirectionsJsonObject { - - /** - * Build a new instance of this RouteOptions class optionally settling values. - * - * @return {@link Builder} - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_RouteOptions.Builder(); - } - - /** - * The same base URL which was used during the request that resulted in this root directions - * response. - * - * @return string value representing the base URL - * @since 3.0.0 - */ - @NonNull - public abstract String baseUrl(); - - /** - * The same user which was used during the request that resulted in this root directions response. - * - * @return string value representing the user - * @since 3.0.0 - */ - @NonNull - public abstract String user(); - - /** - * The routing profile to use. Possible values are - * {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}, {@link DirectionsCriteria#PROFILE_DRIVING}, - * {@link DirectionsCriteria#PROFILE_WALKING}, or {@link DirectionsCriteria#PROFILE_CYCLING}. - * The same profile which was used during the request that resulted in this root directions - * response. MapboxDirections.Builder ensures that a profile is always set even if the - * MapboxDirections requesting object doesn't specifically set a profile. - * - * @return string value representing the profile defined in - * {@link DirectionsCriteria.ProfileCriteria} - * @since 3.0.0 - */ - @NonNull - public abstract String profile(); - - /** - * A list of Points to visit in order. - * There can be between two and 25 coordinates for most requests, or up to three coordinates for - * {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC} requests. - * Note that these coordinates are different than the direction responses - * {@link com.mapbox.api.directions.v5.models.DirectionsWaypoint}s that these are the non-snapped coordinates. - * - * @return a list of {@link Point}s which represent the route origin, destination, - * and optionally, waypoints - * @since 3.0.0 - */ - @NonNull - public abstract List coordinates(); - - /** - * Whether to try to return alternative routes (true) or not (false, default). An alternative - * route is a route that is significantly different than the fastest route, but also still - * reasonably fast. Such a route does not exist in all circumstances. Up to two alternatives may - * be returned. This is available for {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}, - * {@link DirectionsCriteria#PROFILE_DRIVING}, {@link DirectionsCriteria#PROFILE_CYCLING}. - * - * @return boolean object representing the setting for alternatives - * @since 3.0.0 - */ - @Nullable - public abstract Boolean alternatives(); - - /** - * The language of returned turn-by-turn text instructions. The default is en (English). - * Must be used in conjunction with {@link Builder#steps(Boolean)}. - * - * @return the language as a string used during the request, - * if english, this will most likely be empty - * @since 3.0.0 - */ - @Nullable - public abstract String language(); - - /** - * The maximum distance a coordinate can be moved to snap to the road network in meters. There - * must be as many radiuses as there are coordinates in the request, each separated by ;. - * Values can be any number greater than 0, the string unlimited or empty string. - * - * @return a string representing the radiuses separated by ;. - * @since 3.0.0 - */ - @Nullable - public abstract String radiuses(); - - /** - * The maximum distance a coordinate can be moved to snap to the road network in meters. There - * must be as many radiuses as there are coordinates in the request. - * Values can be any number greater than 0, the string unlimited, or null. - * - * @return a list of radiuses - */ - @Nullable - public List radiusesList() { - return ParseUtils.parseToDoubles(radiuses()); - } - - /** - * Influences the direction in which a route starts from a waypoint. Used to filter the road - * segment the waypoint will be placed on by direction. This is useful for making sure the new - * routes of rerouted vehicles continue traveling in their current direction. A request that does - * this would provide bearing and radius values for the first waypoint and leave the remaining - * values empty. Returns two comma-separated values per waypoint: an angle clockwise from true - * north between 0 and 360, and the range of degrees by which the angle can deviate (recommended - * value is 45° or 90°), formatted as {angle, degrees}. If provided, the list of bearings must be - * the same length as the list of coordinates. - * - * @return a string representing the bearings with the ; separator. Angle and degrees for every - * bearing value are comma-separated. - * @since 3.0.0 - */ - @Nullable - public abstract String bearings(); - - /** - * Influences the direction in which a route starts from a waypoint. Used to filter the road - * segment the waypoint will be placed on by direction. This is useful for making sure the new - * routes of rerouted vehicles continue traveling in their current direction. A request that does - * this would provide bearing and radius values for the first waypoint and leave the remaining - * values empty. Returns a list of values, each value is a list of an angle clockwise from true - * north between 0 and 360, and the range of degrees by which the angle can deviate (recommended - * value is 45° or 90°). - * If provided, the list of bearings must be the same length as the list of coordinates. - * - * @return a List of list of doubles representing the bearings used in the original request. - * The first value in the list is the angle, the second one is the degrees. - */ - @Nullable - public List> bearingsList() { - return ParseUtils.parseToListOfListOfDoubles(bearings()); - } - - /** - * The allowed direction of travel when departing intermediate waypoints. If true, the route - * will continue in the same direction of travel. If false, the route may continue in the opposite - * direction of travel. Defaults to true for {@link DirectionsCriteria#PROFILE_DRIVING} and false - * for {@link DirectionsCriteria#PROFILE_WALKING} and {@link DirectionsCriteria#PROFILE_CYCLING}. - * - * @return a boolean value representing whether or not continueStraight was enabled or - * not during the initial request - * @since 3.0.0 - */ - @SerializedName("continue_straight") - @Nullable - public abstract Boolean continueStraight(); - - /** - * Whether to emit instructions at roundabout exits (true) or not (false, default). Without - * this parameter, roundabout maneuvers are given as a single instruction that includes both - * entering and exiting the roundabout. With roundabout_exits=true, this maneuver becomes two - * instructions, one for entering the roundabout and one for exiting it. Must be used in - * conjunction with {@link RouteOptions#steps()}=true. - * - * @return a boolean value representing whether or not roundaboutExits was enabled or disabled - * during the initial route request - * @since 3.1.0 - */ - @SerializedName("roundabout_exits") - @Nullable - public abstract Boolean roundaboutExits(); - - /** - * The format of the returned geometry. Allowed values are: - * {@link DirectionsCriteria#GEOMETRY_POLYLINE} (default, a polyline with a precision of five - * decimal places), {@link DirectionsCriteria#GEOMETRY_POLYLINE6} (a polyline with a precision - * of six decimal places). - * - * @return String geometry type from {@link DirectionsCriteria.GeometriesCriteria}. - * @since 3.1.0 - */ - @Nullable - public abstract String geometries(); - - /** - * Displays the requested type of overview geometry. Can be - * {@link DirectionsCriteria#OVERVIEW_FULL} (the most detailed geometry - * available), {@link DirectionsCriteria#OVERVIEW_SIMPLIFIED} (default, a simplified version of - * the full geometry), or {@link DirectionsCriteria#OVERVIEW_FALSE} (no overview geometry). - * - * @return null or one of the options found in {@link DirectionsCriteria.OverviewCriteria} - * @since 3.1.0 - */ - @Nullable - public abstract String overview(); - - /** - * Whether to return steps and turn-by-turn instructions (true) or not (false, default). - * If steps is set to true, the following guidance-related parameters will be available: - * {@link RouteOptions#bannerInstructions()}, {@link RouteOptions#language()}, - * {@link RouteOptions#roundaboutExits()}, {@link RouteOptions#voiceInstructions()}, - * {@link RouteOptions#voiceUnits()}, {@link RouteOptions#waypointNamesList()}, - * {@link RouteOptions#waypointTargetsList()}, waypoints from {@link RouteOptions#coordinates()} - * - * @return true if you'd like step information, false otherwise - * @since 3.1.0 - */ - @Nullable - public abstract Boolean steps(); - - /** - * A comma-separated list of annotations. Defines whether to return additional metadata along the - * route. Possible values are: - * {@link DirectionsCriteria#ANNOTATION_DURATION} - * {@link DirectionsCriteria#ANNOTATION_DISTANCE} - * {@link DirectionsCriteria#ANNOTATION_SPEED} - * {@link DirectionsCriteria#ANNOTATION_CONGESTION} - * {@link DirectionsCriteria#ANNOTATION_MAXSPEED} - * See the {@link com.mapbox.api.directions.v5.models.RouteLeg} object for more details on what is included with annotations. - * Must be used in conjunction with overview=full. - * - * @return a string containing any of the annotations that were used during the request - * @since 3.0.0 - */ - @Nullable - public abstract String annotations(); - - /** - * A list of annotations. Defines whether to return additional metadata along the - * route. Possible values are: - * {@link DirectionsCriteria#ANNOTATION_DURATION} - * {@link DirectionsCriteria#ANNOTATION_DISTANCE} - * {@link DirectionsCriteria#ANNOTATION_SPEED} - * {@link DirectionsCriteria#ANNOTATION_CONGESTION} - * {@link DirectionsCriteria#ANNOTATION_MAXSPEED} - * See the {@link com.mapbox.api.directions.v5.models.RouteLeg} object for more details on what is included with annotations. - * Must be used in conjunction with overview=full. - * - * @return a list of annotations that were used during the request - */ - @Nullable - public List annotationsList() { - return ParseUtils.parseToStrings(annotations(), ","); - } - - /** - * Exclude certain road types from routing. The default is to not exclude anything from the - * profile selected. The following exclude flags are available for each profile: - * - * {@link DirectionsCriteria#PROFILE_DRIVING}: One of {@link DirectionsCriteria#EXCLUDE_TOLL}, - * {@link DirectionsCriteria#EXCLUDE_MOTORWAY}, or {@link DirectionsCriteria#EXCLUDE_FERRY}. - * - * {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}: One of - * {@link DirectionsCriteria#EXCLUDE_TOLL}, {@link DirectionsCriteria#EXCLUDE_MOTORWAY}, or - * {@link DirectionsCriteria#EXCLUDE_FERRY}. - * - * {@link DirectionsCriteria#PROFILE_WALKING}: No excludes supported - * - * {@link DirectionsCriteria#PROFILE_CYCLING}: {@link DirectionsCriteria#EXCLUDE_FERRY} - * - * @return a string matching one of the {@link DirectionsCriteria.ExcludeCriteria} exclusions - * @since 3.0.0 - */ - @Nullable - public abstract String exclude(); - - /** - * Whether to return SSML marked-up text for voice guidance along the route (true) or not - * (false, default). - * Must be used in conjunction with {@link RouteOptions#steps()}=true. - * - * @return true if the original request included voice instructions - * @since 3.0.0 - */ - @SerializedName("voice_instructions") - @Nullable - public abstract Boolean voiceInstructions(); - - /** - * Whether to return banner objects associated with the route steps (true) or not - * (false, default). Must be used in conjunction with {@link RouteOptions#steps()}=true - * - * @return true if the original request included banner instructions - * @since 3.0.0 - */ - @SerializedName("banner_instructions") - @Nullable - public abstract Boolean bannerInstructions(); - - /** - * A type of units to return in the text for voice instructions. - * Can be {@link DirectionsCriteria#IMPERIAL} (default) or {@link DirectionsCriteria#METRIC}. - * Must be used in conjunction with {@link RouteOptions#steps()}=true and - * {@link RouteOptions#voiceInstructions()} ()}=true. - * - * @return a string matching either imperial or metric - * @since 3.0.0 - */ - @SerializedName("voice_units") - @Nullable - public abstract String voiceUnits(); - - /** - * A valid Mapbox access token used to making the request. - * - * @return a string representing the Mapbox access token - * @since 3.0.0 - */ - @SerializedName("access_token") - @NonNull - public abstract String accessToken(); - - /** - * A universally unique identifier (UUID) for identifying and executing a similar specific route - * in the future. MapboxDirections always waits for the response object which ensures - * this value will never be null. - * - * @return a string containing the request UUID - * @since 3.0.0 - */ - @SerializedName("uuid") - @NonNull - public abstract String requestUuid(); - - /** - * Indicates from which side of the road to approach a waypoint. - * Accepts {@link DirectionsCriteria#APPROACH_UNRESTRICTED} (default) or - * {@link DirectionsCriteria#APPROACH_CURB} . - * If set to {@link DirectionsCriteria#APPROACH_UNRESTRICTED}, the route can approach waypoints - * from either side of the road. - * If set to {@link DirectionsCriteria#APPROACH_CURB}, the route will be returned so that on - * arrival, the waypoint will be found on the side that corresponds with the driving_side of the - * region in which the returned route is located. - * If provided, the list of approaches must be the same length as the list of waypoints. - * - * @return a string representing approaches for each waypoint - * @since 3.2.0 - */ - @Nullable - public abstract String approaches(); - - /** - * Indicates from which side of the road to approach a waypoint. - * Accepts {@link DirectionsCriteria#APPROACH_UNRESTRICTED} (default) or - * {@link DirectionsCriteria#APPROACH_CURB} . - * If set to {@link DirectionsCriteria#APPROACH_UNRESTRICTED}, the route can approach waypoints - * from either side of the road. - * If set to {@link DirectionsCriteria#APPROACH_CURB}, the route will be returned so that on - * arrival, the waypoint will be found on the side that corresponds with the driving_side of the - * region in which the returned route is located. - * If provided, the list of approaches must be the same length as the list of waypoints. - * - * @return a list of strings representing approaches for each waypoint - */ - @Nullable - public List approachesList() { - return ParseUtils.parseToStrings(approaches()); - } - - /** - * Indicates which input coordinates should be treated as waypoints. - *

- * Most useful in combination with steps=true and requests based on traces - * with high sample rates. Can be an index corresponding to any of the input coordinates, - * but must contain the first ( 0 ) and last coordinates' index separated by ; . - * {@link #steps()} - *

- * - * @return a string representing indices to be used as waypoints - * @since 4.4.0 - */ - @SerializedName("waypoints") - @Nullable - public abstract String waypointIndices(); - - /** - * Indicates which input coordinates should be treated as waypoints. - *

- * Most useful in combination with steps=true and requests based on traces - * with high sample rates. Can be an index corresponding to any of the input coordinates, - * but must contain the first ( 0 ) and last coordinates' index. - * {@link #steps()} - *

- * - * @return a List of Integers representing indices to be used as waypoints - */ - @Nullable - public List waypointIndicesList() { - return ParseUtils.parseToIntegers(waypointIndices()); - } - - /** - * A semicolon-separated list of custom names for entries in the list of - * {@link RouteOptions#coordinates()}, used for the arrival instruction in banners and voice - * instructions. Values can be any string, and the total number of all characters cannot exceed - * 500. If provided, the list of waypoint_names must be the same length as the list of - * coordinates. The first value in the list corresponds to the route origin, not the first - * destination. - * Must be used in conjunction with {@link RouteOptions#steps()} = true. - * @return a string representing names for each waypoint - * @since 3.3.0 - */ - @SerializedName("waypoint_names") - @Nullable - public abstract String waypointNames(); - - /** - * A semicolon-separated list of custom names for entries in the list of - * {@link RouteOptions#coordinates()}, used for the arrival instruction in banners and voice - * instructions. Values can be any string, and the total number of all characters cannot exceed - * 500. If provided, the list of waypoint_names must be the same length as the list of - * coordinates. The first value in the list corresponds to the route origin, not the first - * destination. - * Must be used in conjunction with {@link RouteOptions#steps()} = true. - * - * @return a list of strings representing names for each waypoint - */ - @Nullable - public List waypointNamesList() { - return ParseUtils.parseToStrings(waypointNames()); - } - - /** - * A semicolon-separated list of coordinate pairs used to specify drop-off - * locations that are distinct from the locations specified in coordinates. - * If this parameter is provided, the Directions API will compute the side of the street, - * left or right, for each target based on the waypoint_targets and the driving direction. - * The maneuver.modifier, banner and voice instructions will be updated with the computed - * side of street. The number of waypoint targets must be the same as the number of coordinates. - * Must be used with {@link RouteOptions#steps()} = true. - * @return a list of Points representing coordinate pairs for drop-off locations - * @since 4.3.0 - */ - @SerializedName("waypoint_targets") - @Nullable - public abstract String waypointTargets(); - - /** - * A list of points used to specify drop-off - * locations that are distinct from the locations specified in coordinates. - * If this parameter is provided, the Directions API will compute the side of the street, - * left or right, for each target based on the waypoint_targets and the driving direction. - * The maneuver.modifier, banner and voice instructions will be updated with the computed - * side of street. The number of waypoint targets must be the same as the number of coordinates. - * Must be used with {@link RouteOptions#steps()} = true. - * @return a list of Points representing coordinate pairs for drop-off locations - */ - @Nullable - public List waypointTargetsList() { - return ParseUtils.parseToPoints(waypointTargets()); - } - - /** - * To be used to specify settings for use with the walking profile. - * - * @return options to use for walking profile - * @since 4.8.0 - */ - @Nullable - public abstract WalkingOptions walkingOptions(); - - /** - * A semicolon-separated list of booleans affecting snapping of waypoint locations to road - * segments. - * If true, road segments closed due to live-traffic closures will be considered for snapping. - * If false, they will not be considered for snapping. - * If provided, the number of snappingClosures must be the same as the number of - * coordinates. - * Must be used with {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC} - * - * @return a String representing a list of booleans - */ - @SerializedName("snapping_closures") - @Nullable - public abstract String snappingClosures(); - - /** - * A list of booleans affecting snapping of waypoint locations to road segments. - * If true, road segments closed due to live-traffic closures will be considered for snapping. - * If false, they will not be considered for snapping. - * If provided, the number of snappingClosures must be the same as the number of - * coordinates. - * Must be used with {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC} - * - * @return a list of booleans - */ - @Nullable - public List snappingClosuresList() { - return ParseUtils.parseToBooleans(snappingClosures()); - } - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_RouteOptions.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a RouteOptions - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - @NonNull - public static RouteOptions fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter()); - gson.registerTypeAdapterFactory(WalkingOptionsAdapterFactory.create()); - return gson.create().fromJson(json, RouteOptions.class); - } - - /** - * Convert the current {@link RouteOptions} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link RouteOptions}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link RouteOptions} - */ - @NonNull - public abstract Builder toBuilder(); - - /** - * This builder can be used to set the values describing the {@link RouteOptions}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The base URL that was used during the request time and resulted in this responses - * result. - * - * @param baseUrl base URL used for original request - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder baseUrl(@NonNull String baseUrl); - - /** - * The user value that was used during the request. - * - * @param user string representing the user field in the calling url - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder user(@NonNull String user); - - /** - * The routing profile to use. Possible values are - * {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}, - * {@link DirectionsCriteria#PROFILE_DRIVING}, {@link DirectionsCriteria#PROFILE_WALKING}, or - * {@link DirectionsCriteria#PROFILE_CYCLING}. - * The same profile which was used during the request that resulted in this root directions - * response. MapboxDirections.Builder ensures that a profile is always set even if the - * MapboxDirections requesting object doesn't specifically set a profile. - * - * @param profile One of the direction profiles defined in - * {@link DirectionsCriteria.ProfileCriteria} - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder profile(@NonNull @DirectionsCriteria.ProfileCriteria String profile); - - /** - * A list of Points to visit in order. - * There can be between two and 25 coordinates for most requests, or up to three coordinates for - * {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC} requests. - * Note that these coordinates are different than the direction responses - * {@link DirectionsWaypoint}s that these are the non-snapped coordinates. - * - * @param coordinates a list of {@link Point}s which represent the route origin, destination, - * and optionally, waypoints - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder coordinates(@NonNull List coordinates); - - /** - * Whether to try to return alternative routes (true) or not (false, default). An alternative - * route is a route that is significantly different than the fastest route, but also still - * reasonably fast. Such a route does not exist in all circumstances. Up to two alternatives may - * be returned. This is available for{@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}, - * {@link DirectionsCriteria#PROFILE_DRIVING}, {@link DirectionsCriteria#PROFILE_CYCLING}. - * - * @param alternatives true if the request contained additional route request, otherwise false - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder alternatives(@NonNull Boolean alternatives); - - /** - * The language of returned turn-by-turn text instructions. The default is en (English). - * Must be used in conjunction with {@link RouteOptions#steps()} = true. - * - * @param language a string with the language which was requested in the url - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder language(@NonNull String language); - - /** - * The maximum distance a coordinate can be moved to snap to the road network in meters. There - * must be as many radiuses as there are coordinates in the request, each separated by ;. - * Values can be any number greater than 0 or the string unlimited. - * - * @param radiuses a String of radius values, each separated by ;. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder radiuses(@NonNull String radiuses); - - /** - * The maximum distance a coordinate can be moved to snap to the road network in meters. There - * must be as many radiuses as there are coordinates in the request. - * Values can be any number greater than 0 or {@link Double#POSITIVE_INFINITY}. - * - * @param radiuses a list of radius values - * @return this builder for chaining options together - */ - public Builder radiusesList(@NonNull List radiuses) { - String result = FormatUtils.formatRadiuses(radiuses); - if (result != null) { - radiuses(result); - } - return this; - } - - /** - * Influences the direction in which a route starts from a waypoint. Used to filter the road - * segment the waypoint will be placed on by direction. This is useful for making sure the new - * routes of rerouted vehicles continue traveling in their current direction. A request that - * does this would provide bearing and radius values for the first waypoint and leave the - * remaining values empty. Takes two comma-separated values per waypoint: an angle clockwise - * from true north between 0 and 360, and the range of degrees by which the angle can deviate - * (recommended value is 45° or 90°), formatted as {angle, degrees}. If provided, the list of - * bearings must be the same length as the list of coordinates. However, you can skip a - * coordinate and show its position in the list with the ; separator. - * - * @param bearings a string representing the bearings with the ; separator. Angle and degrees - * for every bearing value are comma-separated. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder bearings(@NonNull String bearings); - - /** - * Influences the direction in which a route starts from a waypoint. Used to filter the road - * segment the waypoint will be placed on by direction. This is useful for making sure the new - * routes of rerouted vehicles continue traveling in their current direction. A request that - * does this would provide bearing and radius values for the first waypoint and leave the - * remaining values empty. Takes a List of list of doubles: the first value in the list is an - * angle clockwise from true north between 0 and 360, the second value is the range of degrees - * by which the angle can deviate (recommended value is 45° or 90°). - * If provided, the list of bearings must be the same length as the list of coordinates. - * However, you can skip a coordinate and show its position in the list with the null value. - * - * @param bearings a List of list of doubles representing the bearings used in the original - * request. The first value in the list is the angle, the second one is the - * degrees. - * @return this builder for chaining options together - */ - public Builder bearingsList(@NonNull List> bearings) { - String result = FormatUtils.formatBearings(bearings); - if (result != null) { - bearings(result); - } - return this; - } - - /** - * Sets the allowed direction of travel when departing intermediate waypoints. If true, the - * route will continue in the same direction of travel. If false, the route may continue in the - * opposite direction of travel. Defaults to true for {@link DirectionsCriteria#PROFILE_DRIVING} - * and false for {@link DirectionsCriteria#PROFILE_WALKING} and - * {@link DirectionsCriteria#PROFILE_CYCLING}. - * - * @param continueStraight true if you'd like the user to continue straight from the starting - * point - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder continueStraight(@NonNull Boolean continueStraight); - - /** - * Whether to emit instructions at roundabout exits (true) or not (false, default). Without - * this parameter, roundabout maneuvers are given as a single instruction that includes both - * entering and exiting the roundabout. With roundabout_exits=true, this maneuver becomes two - * instructions, one for entering the roundabout and one for exiting it. Must be used in - * conjunction with {@link Builder#steps(Boolean)} - * - * @param roundaboutExits true if you'd like extra roundabout instructions - * @return this builder for chaining options together - * @since 3.1.0 - */ - public abstract Builder roundaboutExits(@NonNull Boolean roundaboutExits); - - /** - * The format of the returned geometry. Allowed values are: - * {@link DirectionsCriteria#GEOMETRY_POLYLINE} (default, a polyline with a precision of five - * decimal places), {@link DirectionsCriteria#GEOMETRY_POLYLINE6} (a polyline with a precision - * of six decimal places). - * A null value will reset this field to the APIs default value vs this SDKs default value of - * {@link DirectionsCriteria#GEOMETRY_POLYLINE6}. - * - * @param geometries one of the options found in {@link DirectionsCriteria.GeometriesCriteria}. - * @return this builder for chaining options together - * @since 3.1.0 - */ - public abstract Builder geometries( - @NonNull @DirectionsCriteria.GeometriesCriteria String geometries); - - /** - * Displays the requested type of overview geometry. Can be - * {@link DirectionsCriteria#OVERVIEW_FULL} (the most detailed geometry - * available), {@link DirectionsCriteria#OVERVIEW_SIMPLIFIED} (default, a simplified version of - * the full geometry), or {@link DirectionsCriteria#OVERVIEW_FALSE} (no overview geometry). - * - * @param overview one of the options found in {@link DirectionsCriteria.OverviewCriteria} - * @return this builder for chaining options together - * @since 3.1.0 - */ - public abstract Builder overview( - @NonNull @DirectionsCriteria.OverviewCriteria String overview - ); - - /** - * Whether to return steps and turn-by-turn instructions (true) or not (false, default). - * If steps is set to true, the following guidance-related parameters will be available: - * {@link RouteOptions#bannerInstructions()}, {@link RouteOptions#language()}, - * {@link RouteOptions#roundaboutExits()}, {@link RouteOptions#voiceInstructions()}, - * {@link RouteOptions#voiceUnits()}, {@link RouteOptions#waypointNamesList()}, - * {@link RouteOptions#waypointTargetsList()}, waypoints from {@link RouteOptions#coordinates()} - * - * @param steps true if you'd like step information, false otherwise - * @return this builder for chaining options together - * @since 3.1.0 - */ - public abstract Builder steps(@NonNull Boolean steps); - - /** - * Whether to return additional metadata along the route. Possible values are: - * {@link DirectionsCriteria#ANNOTATION_DURATION} - * {@link DirectionsCriteria#ANNOTATION_DISTANCE} - * {@link DirectionsCriteria#ANNOTATION_SPEED} - * {@link DirectionsCriteria#ANNOTATION_CONGESTION} - * {@link DirectionsCriteria#ANNOTATION_MAXSPEED} - * You can include several annotations as a comma-separated list. See the - * {@link com.mapbox.api.directions.v5.models.RouteLeg} object for more details on what is included with annotations. - * Must be used in conjunction with overview=full. - * - * @param annotations in string format and separated by commas if more than one annotation was - * requested - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder annotations(@NonNull String annotations); - - /** - * Whether to return additional metadata along the route. Possible values are: - * {@link DirectionsCriteria#ANNOTATION_DURATION} - * {@link DirectionsCriteria#ANNOTATION_DISTANCE} - * {@link DirectionsCriteria#ANNOTATION_SPEED} - * {@link DirectionsCriteria#ANNOTATION_CONGESTION} - * {@link DirectionsCriteria#ANNOTATION_MAXSPEED} - * - * See the {@link RouteLeg} object for more details on what is included with - * annotations. - * Must be used in conjunction with overview=full. - * - * @param annotations a list of annotations - * @return this builder for chaining options together - */ - public Builder annotationsList(@NonNull List annotations) { - String result = FormatUtils.join(",", annotations); - if (result != null) { - annotations(result); - } - return this; - } - - /** - * Whether to return SSML marked-up text for voice guidance along the route (true) or not - * (false, default). - * Must be used in conjunction with {@link Builder#steps(Boolean)}. - * - * @param voiceInstructions true if the original request included voice instructions - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder voiceInstructions(@NonNull Boolean voiceInstructions); - - /** - * Whether to return banner objects associated with the route steps (true) or not - * (false, default). Must be used in conjunction with - * {@link Builder#steps(Boolean)} - * - * @param bannerInstructions true if the original request included banner instructions - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder bannerInstructions(@NonNull Boolean bannerInstructions); - - /** - * Specify which type of units to return in the text for voice instructions. - * Can be {@link DirectionsCriteria#IMPERIAL} (default) or {@link DirectionsCriteria#METRIC}. - * Must be used in conjunction with {@link Builder#steps(Boolean)}=true and - * {@link Builder#voiceInstructions(Boolean)}=true. - * - * @param voiceUnits string matching either imperial or metric - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder voiceUnits(@NonNull String voiceUnits); - - /** - * A valid Mapbox access token used to making the request. - * - * @param accessToken a string containing a valid Mapbox access token - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder accessToken(@NonNull String accessToken); - - /** - * A universally unique identifier (UUID) for identifying and executing a similar specific route - * in the future. - * - * @param requestUuid a string containing the request UUID - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder requestUuid(@NonNull String requestUuid); - - /** - * Exclude certain road types from routing. The default is to not exclude anything from the - * profile selected. The following exclude flags are available for each profile: - * - * {@link DirectionsCriteria#PROFILE_DRIVING}: One of {@link DirectionsCriteria#EXCLUDE_TOLL}, - * {@link DirectionsCriteria#EXCLUDE_MOTORWAY}, or {@link DirectionsCriteria#EXCLUDE_FERRY}. - * - * {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}: One of - * {@link DirectionsCriteria#EXCLUDE_TOLL}, {@link DirectionsCriteria#EXCLUDE_MOTORWAY}, or - * {@link DirectionsCriteria#EXCLUDE_FERRY}. - * - * {@link DirectionsCriteria#PROFILE_WALKING}: No excludes supported - * - * {@link DirectionsCriteria#PROFILE_CYCLING}: {@link DirectionsCriteria#EXCLUDE_FERRY} - * - * @param exclude a string matching one of the {@link DirectionsCriteria.ExcludeCriteria} - * exclusions - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder exclude(@NonNull String exclude); - - /** - * Indicates from which side of the road to approach a waypoint. - * Accepts {@link DirectionsCriteria#APPROACH_UNRESTRICTED} (default) or - * {@link DirectionsCriteria#APPROACH_CURB} . - * If set to {@link DirectionsCriteria#APPROACH_UNRESTRICTED}, the route can approach waypoints - * from either side of the road. - * If set to {@link DirectionsCriteria#APPROACH_CURB}, the route will be returned so that on - * arrival, the waypoint will be found on the side that corresponds with the driving_side of the - * region in which the returned route is located. - * If provided, the list of approaches must be the same length as the list of waypoints. - * However, you can skip a coordinate and show its position in the list with the ; separator. - * The same approaches the user originally made when the request was made. - * - * @param approaches unrestricted, curb or omitted (;) - * @return this builder for chaining options together - * @since 3.2.0 - */ - public abstract Builder approaches(@NonNull String approaches); - - /** - * Indicates from which side of the road to approach a waypoint. - * Accepts {@link DirectionsCriteria#APPROACH_UNRESTRICTED} (default) or - * {@link DirectionsCriteria#APPROACH_CURB} . - * If set to {@link DirectionsCriteria#APPROACH_UNRESTRICTED}, the route can approach waypoints - * from either side of the road. - * If set to {@link DirectionsCriteria#APPROACH_CURB}, the route will be returned so that on - * arrival, the waypoint will be found on the side that corresponds with the driving_side of the - * region in which the returned route is located. - * If provided, the list of approaches must be the same length as the list of waypoints. - * However, you can skip a coordinate and show its position in the list with null value. - * The same approaches the user originally made when the request was made. - * - * @param approaches a list of Strings - * @return this builder for chaining options together - */ - public Builder approachesList(@NonNull List approaches) { - String result = FormatUtils.formatApproaches(approaches); - if (result != null) { - approaches(result); - } - return this; - } - - /** - * Indicates which input coordinates should be treated as waypoints. - *

- * Most useful in combination with steps=true and requests based on traces - * with high sample rates. Can be an index corresponding to any of the input coordinates, - * but must contain the first ( 0 ) and last coordinates' index separated by ; . - * {@link #steps()} - *

- * The same waypoint indices the user originally made when the request was made. - * - * @param waypointIndices to be used as waypoints - * @return this builder for chaining options together - * @since 4.4.0 - */ - public abstract Builder waypointIndices(@NonNull String waypointIndices); - - /** - * Indicates which input coordinates should be treated as waypoints. - *

- * Most useful in combination with steps=true and requests based on traces - * with high sample rates. Can be an index corresponding to any of the input coordinates, - * but must contain the first ( 0 ) and last coordinates'. - * {@link #steps()} - *

- * The same waypoint indices the user originally made when the request was made. - * - * @param indices a list to be used as waypoints - * @return this builder for chaining options together - */ - public Builder waypointIndicesList(@NonNull List indices) { - String result = FormatUtils.join(";", indices); - if (result != null) { - waypointIndices(result); - } - return this; - } - - /** - * A semicolon-separated list of custom names for entries in the list of - * {@link RouteOptions#coordinates()}, used for the arrival instruction in banners and voice - * instructions. Values can be any string, and the total number of all characters cannot exceed - * 500. If provided, the list of waypoint_names must be the same length as the list of - * coordinates, but you can skip a coordinate pair and show its position in the list with the ; - * separator. The first value in the list corresponds to the route origin, not the first - * destination. To leave the origin unnamed, begin the list with a semicolon. - * Must be used in conjunction with {@link Builder#steps(Boolean)} = true. - * - * @param waypointNames unrestricted, curb or omitted (;) - * @return this builder for chaining options together - * @since 3.3.0 - */ - public abstract Builder waypointNames(@NonNull String waypointNames); - - /** - * A semicolon-separated list of custom names for entries in the list of - * {@link RouteOptions#coordinates()}, used for the arrival instruction in banners and voice - * instructions. Values can be any string, and the total number of all characters cannot exceed - * 500. If provided, the list of waypoint_names must be the same length as the list of - * coordinates, but you can skip a coordinate pair and show its position in the list with the - * null value. The first value in the list corresponds to the route origin, not the first - * destination. To leave the origin unnamed, begin the list with a null value. - * Must be used in conjunction with {@link Builder#steps(Boolean)} = true. - * - * @param waypointNames a list of Strings - * @return this builder for chaining options together - */ - public Builder waypointNamesList(@NonNull List waypointNames) { - String result = FormatUtils.formatWaypointNames(waypointNames); - if (result != null) { - waypointNames(result); - } - return this; - } - - /** - * A semicolon-separated list of coordinate pairs used to specify drop-off - * locations that are distinct from the locations specified in coordinates. - * If this parameter is provided, the Directions API will compute the side of the street, - * left or right, for each target based on the waypoint_targets and the driving direction. - * The maneuver.modifier, banner and voice instructions will be updated with the computed - * side of street. The number of waypoint targets must be the same as the number of coordinates, - * but you can skip a coordinate pair and show its position in the list with the ; separator. - * Must be used with {@link Builder#steps(Boolean)} = true. - * The same waypoint targets the user originally made when the request was made. - * - * @param waypointTargets list of coordinate pairs for drop-off locations (;) - * @return this builder for chaining options together - * @since 4.3.0 - */ - public abstract Builder waypointTargets(@NonNull String waypointTargets); - - /** - * A list of coordinate pairs used to specify drop-off - * locations that are distinct from the locations specified in coordinates. - * If this parameter is provided, the Directions API will compute the side of the street, - * left or right, for each target based on the waypoint_targets and the driving direction. - * The maneuver.modifier, banner and voice instructions will be updated with the computed - * side of street. The number of waypoint targets must be the same as the number of coordinates, - * but you can skip a coordinate pair and show its position in the list with the null value. - * Must be used with {@link Builder#steps(Boolean)} = true. - * The same waypoint targets the user originally made when the request was made. - * - * @param waypointTargets list of Points for drop-off locations - * @return this builder for chaining options together - */ - public Builder waypointTargetsList(@NonNull List waypointTargets) { - waypointTargets(FormatUtils.formatPointsList(waypointTargets)); - return this; - } - - /** - * To be used to specify settings for use with the walking profile. - * - * @param walkingOptions options to use for walking profile - * @return this builder for chaining options together - * @since 4.8.0 - */ - public abstract Builder walkingOptions(@NonNull WalkingOptions walkingOptions); - - /** - * A semicolon-separated list of booleans affecting snapping of waypoint locations to road - * segments. - * If true, road segments closed due to live-traffic closures will be considered for snapping. - * If false, they will not be considered for snapping. - * If provided, the number of snappingClosures must be the same as the number of - * coordinates. - * You can skip a coordinate and show its position in the list with the ; separator. - * If unspecified, this parameter defaults to false. - * Must be used with {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC} - * - * @param snappingClosures a semicolon-separated list of booleans - * @return this builder for chaining options together - */ - public abstract Builder snappingClosures(@NonNull String snappingClosures); - - /** - * A list of booleans affecting snapping of waypoint locations to road segments. - * If true, road segments closed due to live-traffic closures will be considered for snapping. - * If false, they will not be considered for snapping. - * If provided, the number of snappingClosures must be the same as the number of - * coordinates. - * You can skip a coordinate and show its position in the list with null value. - * If unspecified, this parameter defaults to false. - * Must be used with {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC} - * - * @param snappingClosures a list of booleans - * @return this builder for chaining options together - */ - public Builder snappingClosures(@NonNull List snappingClosures) { - String result = FormatUtils.join(";", snappingClosures); - if (result != null) { - snappingClosures(result); - } else { - snappingClosures(""); - } - return this; - } - - /** - * Builds a new instance of the {@link RouteOptions} object. - * - * @return a new {@link RouteOptions} instance - * @since 3.0.0 - */ - public abstract RouteOptions build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/SpeedLimit.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/SpeedLimit.java deleted file mode 100644 index bc9e5f57..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/SpeedLimit.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * The file exposes speed limit annotations. - */ -public class SpeedLimit { - /** - * Speed limit unit in km/h. - */ - public static final String KMPH = "km/h"; - - /** - * Speed limit unit in mph. - */ - public static final String MPH = "mph"; - - /** - * Speed limit unit. - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef({ - MPH, - KMPH - }) - public @interface Unit { - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepIntersection.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepIntersection.java deleted file mode 100644 index 07d3b1d7..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepIntersection.java +++ /dev/null @@ -1,422 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.mapbox.geojson.Point; - -import java.util.List; - -/** - * Object representing an intersection along the step. - * - * @since 1.3.0 - */ -@AutoValue -public abstract class StepIntersection extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_StepIntersection.Builder(); - } - - /** - * A {@link Point} representing this intersection location. - * - * @return GeoJson Point representing this intersection location - * @since 3.0.0 - */ - @NonNull - public Point location() { - return Point.fromLngLat(rawLocation()[0], rawLocation()[1]); - } - - /** - * A {@link Point} representing this intersection location. Since the rawLocation isn't public, - * it's okay to be mutable as long as nothing in this SDK changes values. - * - * @return GeoJson Point representing this intersection location - * @since 3.0.0 - */ - @NonNull - @SerializedName("location") - @SuppressWarnings( {"mutable", "WeakerAccess"}) - protected abstract double[] rawLocation(); - - /** - * An integer list of bearing values available at the step intersection. - * - * @return An array of bearing values (for example [0,90,180,270]) that are available at the - * intersection. The bearings describe all available roads at the intersection. - * @since 1.3.0 - */ - @Nullable - public abstract List bearings(); - - /** - * A list of strings signifying the classes of the road exiting the intersection. Possible - * values: - *
    - *
  • toll: the road continues on a toll road
  • - *
  • ferry: the road continues on a ferry
  • - *
  • restricted: the road continues on with access restrictions
  • - *
  • motorway: the road continues on a motorway
  • - *
  • tunnel: the road continues on a tunnel
  • - *
- * - * @return a string list containing the classes of the road exiting the intersection - * @since 3.0.0 - */ - @Nullable - public abstract List classes(); - - /** - * A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of true - * indicates that the respective road could be entered on a valid route. false indicates that the - * turn onto the respective road would violate a restriction. - * - * @return a list of entry flags, corresponding in a 1:1 relationship to the bearings - * @since 1.3.0 - */ - @Nullable - public abstract List entry(); - - /** - * Index into bearings/entry array. Used to calculate the bearing before the turn. Namely, the - * clockwise angle from true north to the direction of travel before the maneuver/passing the - * intersection. To get the bearing in the direction of driving, the bearing has to be rotated by - * a value of 180. The value is not supplied for departure - * maneuvers. - * - * @return index into bearings/entry array - * @since 1.3.0 - */ - @Nullable - public abstract Integer in(); - - /** - * Index out of the bearings/entry array. Used to extract the bearing after the turn. Namely, The - * clockwise angle from true north to the direction of travel after the maneuver/passing the - * intersection. The value is not supplied for arrive maneuvers. - * - * @return index out of the bearings/entry array - * @since 1.3.0 - */ - @Nullable - public abstract Integer out(); - - /** - * Array of lane objects that represent the available turn lanes at the intersection. If no lane - * information is available for an intersection, the lanes property will not be present. Lanes are - * provided in their order on the street, from left to right. - * - * @return array of lane objects that represent the available turn lanes at the intersection - * @since 2.0.0 - */ - @Nullable - public abstract List lanes(); - - /** - * The zero-based index for the intersection. - * This value can be used to apply the duration annotation that corresponds with the intersection. - * Only available on the driving profile. - * - * @return index for the intersection - */ - @Nullable - @SerializedName("geometry_index") - public abstract Integer geometryIndex(); - - /** - * A boolean indicating whether the road exiting the intersection is considered to be in an urban - * area. This value is determined by the density of the surrounding road network. - * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - * - * @return a value indicating whether the road exiting the intersection is in an urban area - */ - @Nullable - @SerializedName("is_urban") - public abstract Boolean isUrban(); - - /** - * The zero-based index into the admin list on the route leg for this intersection. - * Use this field to look up the ISO-3166-1 country code for this point on the route. - * Only available on the `driving` profile. - * - * @return a zero-based index into the admin list on the route leg. - * @see RouteLeg#admins() - */ - @Nullable - @SerializedName("admin_index") - public abstract Integer adminIndex(); - - /** - * An object containing information about passing rest stops along the route. - * Only available on the `driving` profile. - * - * @return an object containing information about passing rest stops along the route. - */ - @Nullable - @SerializedName("rest_stop") - public abstract RestStop restStop(); - - /** - * An object containing information about a toll collection point along the route. - * This is a payment booth or overhead electronic gantry - * - * payment booth or overhead electronic gantry - * where toll charge is collected. - * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - * - * @return an object containing information about a toll collection point along the route. - */ - @Nullable - @SerializedName("toll_collection") - public abstract TollCollection tollCollection(); - - /** - * An object containing detailed information about the road exiting the intersection along the - * route. Properties in this object correspond to properties in the {@link #classes()} - * specification. Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - * - * @return an object containing detailed road information. - */ - @Nullable - @SerializedName("mapbox_streets_v8") - public abstract MapboxStreetsV8 mapboxStreetsV8(); - - /** - * Name of the tunnel. Value may be present if {@link #classes} contains "tunnel". - * - * @return name of the tunnel - */ - @Nullable - @SerializedName("tunnel_name") - public abstract String tunnelName(); - - /** - * Convert the current {@link StepIntersection} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link StepIntersection}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link StepIntersection} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_StepIntersection.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a StepIntersection - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static StepIntersection fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, StepIntersection.class); - } - - /** - * This builder can be used to set the values describing the {@link StepIntersection}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * An integer array of bearing values available at the step intersection. - * - * @param bearing An array of bearing values (for example [0,90,180,270]) that are available at - * the intersection. The bearings describe all available roads at the - * intersection. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder bearings(@Nullable List bearing); - - /** - * A list of strings signifying the classes of the road exiting the intersection. Possible - * values: - *
    - *
  • toll: the road continues on a toll road
  • - *
  • ferry: the road continues on a ferry
  • - *
  • restricted: the road continues on with access restrictions
  • - *
  • motorway: the road continues on a motorway
  • - *
- * - * @param classes a list of strings containing the classes of the road exiting the intersection - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder classes(@Nullable List classes); - - /** - * A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of true - * indicates that the respective road could be entered on a valid route. false indicates that - * the turn onto the respective road would violate a restriction. - * - * @param entry a {@link Boolean} list of entry flags, corresponding in a 1:1 relationship to - * the bearings - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder entry(@Nullable List entry); - - /** - * Index into bearings/entry array. Used to calculate the bearing before the turn. Namely, the - * clockwise angle from true north to the direction of travel before the maneuver/passing the - * intersection. To get the bearing in the direction of driving, the bearing has to be rotated - * by a value of 180. The value is not supplied for departure - * maneuvers. - * - * @param in index into bearings/entry array - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder in(@Nullable Integer in); - - /** - * Index out of the bearings/entry array. Used to extract the bearing after the turn. Namely, - * The clockwise angle from true north to the direction of travel after the maneuver/passing the - * intersection. The value is not supplied for arrive maneuvers. - * - * @param out index out of the bearings/entry array - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder out(@Nullable Integer out); - - /** - * Array of lane objects that represent the available turn lanes at the intersection. If no lane - * information is available for an intersection, the lanes property will not be present. Lanes - * are provided in their order on the street, from left to right. - * - * @param lanes array of lane objects that represent the available turn lanes at the - * intersection - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder lanes(@Nullable List lanes); - - /** - * The zero-based index for the intersection. - * This value can be used to apply the duration annotation - * that corresponds with the intersection. - * Only available on the driving profile. - * - * @param geometryIndex index for the intersection - * @return this builder for chaining options together - */ - public abstract Builder geometryIndex(@Nullable Integer geometryIndex); - - /** - * A boolean indicating whether the road exiting the intersection is considered to be in an - * urban area. This value is determined by the density of the surrounding road network. - * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - * - * @param isUrban indicating whether the road exiting the intersection is in an urban area - * @return this builder for chaining options together - */ - @Nullable - public abstract Builder isUrban(@Nullable Boolean isUrban); - - /** - * The zero-based index into the admin list on the route leg for this intersection. - * Use this field to look up the ISO-3166-1 country code for this point on the route. - * Only available on the `driving` profile. - * - * @param adminIndex zero-based index into the admin list on the route leg for this intersection - * @return this builder for chaining options together - */ - @Nullable - public abstract Builder adminIndex(@Nullable Integer adminIndex); - - /** - * An object containing information about passing rest stops along the route. - * Only available on the `driving` profile. - * - * @param restStop object containing information about passing rest stops along the route. - * @return this builder for chaining options together - */ - @Nullable - public abstract Builder restStop(@Nullable RestStop restStop); - - /** - * An object containing information about a toll collection point along the route. - * This is a payment booth or overhead electronic gantry - * - * payment booth or overhead electronic gantry - * where toll charge is collected. - * - * @param tollCollection object containing information about - * a toll collection point along the route. - * @return this builder for chaining options together - */ - @Nullable - public abstract Builder tollCollection(@Nullable TollCollection tollCollection); - - /** - * An object containing detailed information about the road exiting the intersection along the - * route. Properties in this object correspond to properties in the {@link #classes()} - * specification. Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - * - * @param street an object containing detailed road information. - * @return this builder for chaining options together - */ - @Nullable - public abstract Builder mapboxStreetsV8(@Nullable MapboxStreetsV8 street); - - /** - * Name of the tunnel. Value is present only if class is tunnel. - * - * @param tunnelName name of the tunnel - * @return this builder for chaining options together - */ - public abstract Builder tunnelName(@Nullable String tunnelName); - - /** - * The rawLocation as a double array. Once the {@link StepIntersection} object's created, - * this raw location gets converted into a {@link Point} object and is public exposed as such. - * The double array should have a length of two, index 0 being the longitude and index 1 being - * latitude. - * - * @param rawLocation a double array with a length of two, index 0 being the longitude and - * index 1 being latitude. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder rawLocation(@NonNull double[] rawLocation); - - /** - * Build a new {@link StepIntersection} object. - * - * @return a new {@link StepIntersection} using the provided values in this builder - * @since 3.0.0 - */ - public abstract StepIntersection build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepManeuver.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepManeuver.java deleted file mode 100644 index 2a1b95e3..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/StepManeuver.java +++ /dev/null @@ -1,420 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.FloatRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringDef; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.mapbox.geojson.Point; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Gives maneuver information about one {@link com.mapbox.api.directions.v5.models.LegStep}. - * - * @since 1.0.0 - */ -@AutoValue -public abstract class StepManeuver extends DirectionsJsonObject { - - /** - * A basic turn in the direction of the modifier. - * - * @since 4.1.0 - */ - public static final String TURN = "turn"; - - /** - * The road name changes (after a mandatory turn). - * - * @since 4.1.0 - */ - public static final String NEW_NAME = "new name"; - - /** - * Indicates departure from a leg. - * The modifier value indicates the position of the departure point - * in relation to the current direction of travel. - * - * @since 4.1.0 - */ - public static final String DEPART = "depart"; - - /** - * Indicates arrival to a destination of a leg. - * The modifier value indicates the position of the arrival point - * in relation to the current direction of travel. - * - * @since 4.1.0 - */ - public static final String ARRIVE = "arrive"; - - /** - * Merge onto a street. - * - * @since 4.1.0 - */ - public static final String MERGE = "merge"; - - /** - * Take a ramp to enter a highway. - * @since 4.1.0 - */ - public static final String ON_RAMP = "on ramp"; - - /** - * Take a ramp to exit a highway. - * - * @since 4.1.0 - */ - public static final String OFF_RAMP = "off ramp"; - - /** - * Take the left or right side of a fork. - * - * @since 4.1.0 - */ - public static final String FORK = "fork"; - - /** - * Road ends in a T intersection. - * - * @since 4.1.0 - */ - public static final String END_OF_ROAD = "end of road"; - - /** - * Continue on a street after a turn. - * - * @since 4.1.0 - */ - public static final String CONTINUE = "continue"; - - /** - * Traverse roundabout. - * Has an additional property exit in the route step that contains - * the exit number. The modifier specifies the direction of entering the roundabout. - * - * @since 4.1.0 - */ - public static final String ROUNDABOUT = "roundabout"; - - /** - * A traffic circle. While very similar to a larger version of a roundabout, - * it does not necessarily follow roundabout rules for right of way. - * It can offer {@link com.mapbox.api.directions.v5.models.LegStep#rotaryName()} parameters, - * {@link LegStep#rotaryPronunciation()} ()} parameters, or both, - * in addition to the {@link #exit()} property. - * - * @since 4.1.0 - */ - public static final String ROTARY = "rotary"; - - /** - * A small roundabout that is treated as an intersection. - * - * @since 4.1.0 - */ - public static final String ROUNDABOUT_TURN = "roundabout turn"; - - /** - * Indicates a change of driving conditions, for example changing the mode - * from driving to ferry. - * - * @since 4.1.0 - */ - public static final String NOTIFICATION = "notification"; - - /** - * Indicates the exit maneuver from a roundabout. - * Will not appear in results unless you supply true to the {@link #exit()} query - * parameter in the request. - * - * @since 4.1.0 - */ - public static final String EXIT_ROUNDABOUT = "exit roundabout"; - - /** - * Indicates the exit maneuver from a rotary. - * Will not appear in results unless you supply true - * to the MapboxDirections.Builder#roundaboutExits() query parameter in the request. - * - * @since 4.1.0 - */ - public static final String EXIT_ROTARY = "exit rotary"; - - /** - * Maneuver types. - * - * @since 4.1.0 - */ - @Retention(RetentionPolicy.SOURCE) - @StringDef( { - TURN, - NEW_NAME, - DEPART, - ARRIVE, - MERGE, - ON_RAMP, - OFF_RAMP, - FORK, - END_OF_ROAD, - CONTINUE, - ROUNDABOUT, - ROTARY, - ROUNDABOUT_TURN, - NOTIFICATION, - EXIT_ROUNDABOUT, - EXIT_ROTARY - }) - public @interface StepManeuverType { - } - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_StepManeuver.Builder(); - } - - /** - * A {@link Point} representing this intersection location. - * - * @return GeoJson Point representing this intersection location - * @since 3.0.0 - */ - @NonNull - public Point location() { - return Point.fromLngLat(rawLocation()[0], rawLocation()[1]); - } - - /** - * A {@link Point} representing this intersection location. Since the rawLocation isn't public, - * it's okay to be mutable as long as nothing in this SDK changes values. - * - * @return GeoJson Point representing this intersection location - * @since 3.0.0 - */ - @NonNull - @SerializedName("location") - @SuppressWarnings( {"mutable", "WeakerAccess"}) - protected abstract double[] rawLocation(); - - /** - * Number between 0 and 360 indicating the clockwise angle from true north to the direction of - * travel right before the maneuver. - * - * @return double with value from 0 to 360 - * @since 1.0.0 - */ - @Nullable - @SerializedName("bearing_before") - public abstract Double bearingBefore(); - - /** - * Number between 0 and 360 indicating the clockwise angle from true north to the direction of - * travel right after the maneuver. - * - * @return double with value from 0 to 360 - * @since 1.0.0 - */ - @Nullable - @SerializedName("bearing_after") - public abstract Double bearingAfter(); - - /** - * A human-readable instruction of how to execute the returned maneuver. This String is built - * using OSRM-Text-Instructions and can be further customized inside either the Mapbox Navigation - * SDK for Android or using the OSRM-Text-Instructions.java project in Project-OSRM. - * - * @return String with instruction - * @see Navigation SDK - * @see - * OSRM-Text-Instructions.java - * @since 1.0.0 - */ - @Nullable - public abstract String instruction(); - - /** - * This indicates the type of maneuver. - * @see StepManeuverType - * @return String with type of maneuver - * @since 1.0.0 - */ - @Nullable - @StepManeuverType - public abstract String type(); - - /** - * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the - * change in direction accomplished through the turn. If the type is of depart/arrive, the - * modifier indicates the position of waypoint from the current direction of travel. - * - * @return String with modifier - * @since 1.0.0 - */ - @Nullable - public abstract String modifier(); - - /** - * An optional integer indicating number of the exit to take. If exit is undefined the destination - * is on the roundabout. The property exists for the following type properties: - *

- * else - indicates the number of intersections passed until the turn. - * roundabout - traverse roundabout - * rotary - a traffic circle - *

- * - * @return an integer indicating number of the exit to take - * @since 2.0.0 - */ - @Nullable - public abstract Integer exit(); - - /** - * Convert the current {@link StepManeuver} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link StepManeuver}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link StepManeuver} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_StepManeuver.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a StepManeuver - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static StepManeuver fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, StepManeuver.class); - } - - /** - * This builder can be used to set the values describing the {@link StepManeuver}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The rawLocation as a double array. Once the {@link StepManeuver} object's created, this raw - * location gets converted into a {@link Point} object and is public exposed as such. The double - * array should have a length of two, index 0 being the longitude and index 1 being latitude. - * - * @param rawLocation a double array with a length of two, index 0 being the longitude and - * index 1 being latitude. - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder rawLocation(@NonNull double[] rawLocation); - - /** - * Number between 0 and 360 indicating the clockwise angle from true north to the direction of - * travel right before the maneuver. - * - * @param bearingBefore double with value from 0 to 360 - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder bearingBefore( - @Nullable @FloatRange(from = 0, to = 360) Double bearingBefore); - - /** - * Number between 0 and 360 indicating the clockwise angle from true north to the direction of - * travel right after the maneuver. - * - * @param bearingAfter double with value from 0 to 360 - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder bearingAfter( - @Nullable @FloatRange(from = 0, to = 360) Double bearingAfter); - - /** - * A human-readable instruction of how to execute the returned maneuver. This String is built - * using OSRM-Text-Instructions and can be further customized inside either the Mapbox - * Navigation SDK for Android or using the OSRM-Text-Instructions.java project in Project-OSRM. - * - * @param instruction String with instruction - * @return this builder for chaining options together - * @see Navigation SDK - * @see OSRM-Text-Instructions.java - * @since 3.0.0 - */ - public abstract Builder instruction(@Nullable String instruction); - - /** - * This indicates the type of maneuver. See {@link StepManeuver#type()} for a full list of - * options. - * - * @param type String with type of maneuver - * @see StepManeuverType - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder type(@Nullable @StepManeuverType String type); - - /** - * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the - * change in direction accomplished through the turn. If the type is of depart/arrive, the - * modifier indicates the position of waypoint from the current direction of travel. - * - * @param modifier String with modifier - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder modifier(@Nullable @ManeuverModifier.Type String modifier); - - /** - * An optional integer indicating number of the exit to take. If exit is undefined the - * destination is on the roundabout. The property exists for the following type properties: - *

- * else - indicates the number of intersections passed until the turn. - * roundabout - traverse roundabout - * rotary - a traffic circle - *

- * - * @param exit an integer indicating number of the exit to take - * @return this builder for chaining options together - * @since 2.0.0 - */ - public abstract Builder exit(@Nullable Integer exit); - - /** - * Build a new {@link StepManeuver} object. - * - * @return a new {@link StepManeuver} using the provided values in this builder - * @since 3.0.0 - */ - public abstract StepManeuver build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/TollCollection.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/TollCollection.java deleted file mode 100644 index e64fa8ee..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/TollCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -/** - * An object containing information about a toll collection point along the route. - * This is a payment booth or overhead electronic gantry - * - * payment booth or overhead electronic gantry - * where toll charge is collected. - * Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile. - */ -@AutoValue -public abstract class TollCollection extends DirectionsJsonObject { - - /** - * The type of toll collection point, either `toll_booth` or `toll_gantry`. - * Note that adding new possible types is not considered a breaking change. - */ - @Nullable - public abstract String type(); - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - */ - public static Builder builder() { - return new AutoValue_TollCollection.Builder(); - } - - /** - * Convert the current {@link TollCollection} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link TollCollection}. - * - * @return a {@link Builder} with the same values set to match the ones defined in this {@link - * TollCollection} - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_TollCollection.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining an Incident - * @return a new instance of this class defined by the values passed in the method - */ - public static TollCollection fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, TollCollection.class); - } - - /** - * This builder can be used to set the values describing the {@link TollCollection}. - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * The type of toll collection point, either `toll_booth` or `toll_gantry`. - * Note that adding new possible types is not considered a breaking change. - * - * @param type toll collection type - */ - public abstract Builder type(@Nullable String type); - - /** - * Build a new {@link TollCollection} object. - * - * @return a new {@link TollCollection} using the provided values in this builder - */ - public abstract TollCollection build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/VoiceInstructions.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/VoiceInstructions.java deleted file mode 100644 index cbbea657..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/VoiceInstructions.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.Nullable; -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; - -/** - * This class provides information thats useful for properly making navigation announcements at the - * correct time. Essentially, a distance and a string are given, using Turf Distance measurement - * methods you can measure the users current location to the next steps maneuver point and if the - * measured distance is less than the one the API provides, the announcement should be made. - * - * @since 3.0.0 - */ -@AutoValue -public abstract class VoiceInstructions extends DirectionsJsonObject { - - /** - * Create a new instance of this class by using the {@link Builder} class. - * - * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 - */ - public static Builder builder() { - return new AutoValue_VoiceInstructions.Builder(); - } - - /** - * This provides the missing piece in which is needed to announce instructions at accurate - * times. If the user is less distance away from the maneuver than what this - * {@code distanceAlongGeometry()} than, the announcement should be called. - * - * @return double value representing the distance to next maneuver in unit meters - * @since 3.0.0 - */ - @Nullable - public abstract Double distanceAlongGeometry(); - - /** - * Provides the instruction string which was build on the server-side and can sometimes - * concatenate instructions together if maneuver instructions are too close to each other. - * - * @return a string with the readable instructions ready to be read or displayed to a user - * @since 3.0.0 - */ - @Nullable - public abstract String announcement(); - - /** - * Get the same instruction string you'd get from {@link #announcement()} but this one includes - * Speech Synthesis Markup Language which helps voice synthesiser read information more humanely. - * - * @return a string with the SSML instructions - * @since 3.0.0 - */ - @Nullable - public abstract String ssmlAnnouncement(); - - /** - * Convert the current {@link VoiceInstructions} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link VoiceInstructions}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link VoiceInstructions} - * @since 3.1.0 - */ - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 3.0.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_VoiceInstructions.GsonTypeAdapter(gson); - } - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a VoiceInstructions - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 3.4.0 - */ - public static VoiceInstructions fromJson(String json) { - GsonBuilder gson = new GsonBuilder(); - gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); - return gson.create().fromJson(json, VoiceInstructions.class); - } - - /** - * This builder can be used to set the values describing the {@link VoiceInstructions}. - * - * @since 3.0.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Returns the missing piece in which is needed to announce instructions at accurate - * times. If the user is less distance away from the maneuver than what this - * {@code distanceAlongGeometry()} than, the announcement should be called. - * - * @param distanceAlongGeometry double value representing the distance to next maneuver in unit - * meters - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder distanceAlongGeometry(Double distanceAlongGeometry); - - /** - * Provides the instruction string which was build on the server-side and can sometimes - * concatenate instructions together if maneuver instructions are too close to each other. - * - * @param announcement a string with the readable instructions ready to be read or displayed to - * a user - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder announcement(String announcement); - - /** - * Get the same instruction string you'd get from {@link #announcement()} but this one includes - * Speech Synthesis Markup Language which helps voice synthesiser read information more - * humanely. - * - * @param ssmlAnnouncement a string with the SSML instructions - * @return this builder for chaining options together - * @since 3.0.0 - */ - public abstract Builder ssmlAnnouncement(String ssmlAnnouncement); - - /** - * This uses the provided parameters set using the {@link Builder} and creates a new instance of - * {@link VoiceInstructions}. - * - * @return a new instance of Voice Instructions - * @since 3.0.0 - */ - public abstract VoiceInstructions build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptions.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptions.java deleted file mode 100644 index 62026d47..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptions.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import androidx.annotation.FloatRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; - -/** - * Class for specifying options for use with the walking profile. - * @since 4.8.0 - */ -@AutoValue -public abstract class WalkingOptions { - - /** - * Walking speed in meters per second. Must be between 0.14 and 6.94 meters per second. - * Defaults to 1.42 meters per second - * - * @return walkingSpeed in meters per second - * @since 4.8.0 - */ - @SerializedName("walking_speed") - @Nullable - public abstract Double walkingSpeed(); - - /** - * A bias which determines whether the route should prefer or avoid the use of roads or paths - * that are set aside for pedestrian-only use (walkways). The allowed range of values is from - * -1 to 1, where -1 indicates indicates preference to avoid walkways, 1 indicates preference - * to favor walkways, and 0 indicates no preference (the default). - * - * @return walkwayBias bias to prefer or avoid walkways - * @since 4.8.0 - */ - @SerializedName("walkway_bias") - @Nullable - public abstract Double walkwayBias(); - - /** - * A bias which determines whether the route should prefer or avoid the use of alleys. The - * allowed range of values is from -1 to 1, where -1 indicates indicates preference to avoid - * alleys, 1 indicates preference to favor alleys, and 0 indicates no preference (the default). - * - * @return alleyBias bias to prefer or avoid alleys - * @since 4.8.0 - */ - @SerializedName("alley_bias") - @Nullable - public abstract Double alleyBias(); - - /** - * Create a new instance of this class by passing in a formatted valid JSON String. - * - * @param json a formatted valid JSON string defining a WalkingOptions object - * @return a new instance of this class defined by the values passed inside this static factory - * method - * @since 4.8.0 - */ - public static WalkingOptions fromJson(String json) { - GsonBuilder gsonBuilder = new GsonBuilder() - .registerTypeAdapterFactory(WalkingOptionsAdapterFactory.create()); - return gsonBuilder.create().fromJson(json, WalkingOptions.class); - } - - /** - * This takes the currently defined values found inside this instance and converts it to a json - * string. - * - * @return a Json string which represents this WalkingOptions object - * @since 4.8.0 - */ - public final String toJson() { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(WalkingOptionsAdapterFactory.create()) - .create(); - return gson.toJson(this, WalkingOptions.class); - } - - /** - * Convert the current {@link WalkingOptions} to its builder holding the currently assigned - * values. This allows you to modify a single property and then rebuild the object resulting in - * an updated and modified {@link WalkingOptions}. - * - * @return a {@link Builder} with the same values set to match the ones defined - * in this {@link WalkingOptions} - */ - @NonNull - public abstract Builder toBuilder(); - - /** - * Gson type adapter for parsing Gson to this class. - * - * @param gson the built {@link Gson} object - * @return the type adapter for this class - * @since 4.8.0 - */ - public static TypeAdapter typeAdapter(Gson gson) { - return new AutoValue_WalkingOptions.GsonTypeAdapter(gson); - } - - /** - * Build a new {@link WalkingOptions} object with no defaults. - * - * @return a {@link Builder} object for creating a {@link WalkingOptions} object - * @since 4.8.0 - */ - public static Builder builder() { - return new AutoValue_WalkingOptions.Builder(); - } - - /** - * This builder is used to create a new object with specifications relating to walking directions. - * - * @since 4.8.0 - */ - @AutoValue.Builder - public abstract static class Builder { - - /** - * Walking speed in meters per second. Must be between 0.14 and 6.94 meters per second. - * Defaults to 1.42 meters per second - * - * @param walkingSpeed in meters per second - * @return this builder - * @since 4.8.0 - */ - public abstract Builder walkingSpeed( - @Nullable @FloatRange(from = 0.14, to = 6.94) Double walkingSpeed); - - /** - * A bias which determines whether the route should prefer or avoid the use of roads or paths - * that are set aside for pedestrian-only use (walkways). The allowed range of values is from - * -1 to 1, where -1 indicates indicates preference to avoid walkways, 1 indicates preference - * to favor walkways, and 0 indicates no preference (the default). - * - * @param walkwayBias bias to prefer or avoid walkways - * @return this builder - * @since 4.8.0 - */ - public abstract Builder walkwayBias( - @Nullable @FloatRange(from = -1, to = 1) Double walkwayBias); - - /** - * A bias which determines whether the route should prefer or avoid the use of alleys. The - * allowed range of values is from -1 to 1, where -1 indicates indicates preference to avoid - * alleys, 1 indicates preference to favor alleys, and 0 indicates no preference (the default). - * - * @param alleyBias bias to prefer or avoid alleys - * @return this builder - * @since 4.8.0 - */ - public abstract Builder alleyBias( - @Nullable @FloatRange(from = -1, to = 1) Double alleyBias); - - /** - * Builds a WalkingOptions object with specified configurations. - * - * @return WalkingOptions object - * @since 4.8.0 - */ - public abstract WalkingOptions build(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptionsAdapterFactory.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptionsAdapterFactory.java deleted file mode 100644 index 582f8b44..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/WalkingOptionsAdapterFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models; - -import com.google.gson.TypeAdapterFactory; -import com.ryanharter.auto.value.gson.GsonTypeAdapterFactory; - -/** - * Required so that AutoValue can generate specific type adapters when needed inside the direction - * packages. - * - * @since 4.8.0 - */ -@GsonTypeAdapterFactory -public abstract class WalkingOptionsAdapterFactory implements TypeAdapterFactory { - - /** - * Create a new instance of this WalkingOptions type adapter factory. This is passed into the Gson - * Builder. - * - * @return a new GSON TypeAdapterFactory - * @since 4.8.0 - */ - public static TypeAdapterFactory create() { - return new AutoValueGson_WalkingOptionsAdapterFactory(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/package-info.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/package-info.java deleted file mode 100644 index caa24b71..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains models mapping to Mapbox Directions API. - */ -package com.mapbox.services.android.navigation.v5.models; diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/FormatUtils.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/FormatUtils.java deleted file mode 100644 index e421c264..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/FormatUtils.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models.utils; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.mapbox.geojson.Point; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -/** - * Methods to convert models to Strings. - */ -public class FormatUtils { - /** - * Returns a string containing the tokens joined by delimiters. Doesn't remove trailing nulls. - * - * @param delimiter the delimiter on which to split. - * @param tokens A list of objects to be joined. Strings will be formed from the objects by - * calling object.toString(). - * @return {@link String} - */ - @Nullable - public static String join(@NonNull CharSequence delimiter, @Nullable List tokens) { - return join(delimiter, tokens, false); - } - - /** - * Returns a string containing the tokens joined by delimiters. - * - * @param delimiter the delimiter on which to split. - * @param tokens A list of objects to be joined. Strings will be formed from the objects by - * calling object.toString(). - * @param removeTrailingNulls true if trailing nulls should be removed. - * @return {@link String} - */ - @Nullable - public static String join(@NonNull CharSequence delimiter, @Nullable List tokens, - boolean removeTrailingNulls) { - if (tokens == null || tokens.size() < 1) { - return null; - } - - int lastNonNullToken = tokens.size() - 1; - if (removeTrailingNulls) { - for (int i = tokens.size() - 1; i >= 0; i--) { - Object token = tokens.get(i); - if (token != null) { - break; - } else { - lastNonNullToken--; - } - } - } - - StringBuilder sb = new StringBuilder(); - boolean firstTime = true; - for (int i = 0; i <= lastNonNullToken; i++) { - if (firstTime) { - firstTime = false; - } else { - sb.append(delimiter); - } - Object token = tokens.get(i); - if (token != null) { - sb.append(token); - } - } - return sb.toString(); - } - - /** - * Useful to remove any trailing zeros and prevent a coordinate being over 7 significant figures. - * - * @param coordinate a double value representing a coordinate. - * @return a formatted string. - */ - @NonNull - public static String formatCoordinate(double coordinate) { - DecimalFormat decimalFormat = new DecimalFormat("0.######", - new DecimalFormatSymbols(Locale.US)); - return String.format(Locale.US, "%s", - decimalFormat.format(coordinate)); - } - - /** - * Used in various APIs to format the user provided radiuses to a String matching the APIs - * format. - * - * @param radiuses a list of doubles represents the radius values - * @return a String ready for being passed into the Retrofit call - */ - @Nullable - public static String formatRadiuses(@Nullable List radiuses) { - if (radiuses == null || radiuses.size() == 0) { - return null; - } - - List radiusesToJoin = new ArrayList<>(); - for (Double radius : radiuses) { - if (radius == null) { - radiusesToJoin.add(null); - } else if (radius == Double.POSITIVE_INFINITY) { - radiusesToJoin.add("unlimited"); - } else { - radiusesToJoin.add(String.format(Locale.US, "%s", formatCoordinate(radius))); - } - } - return join(";", radiusesToJoin); - } - - /** - * Formats the bearing variables from the raw values to a string which can than be used for the - * request URL. - * - * @param bearings a List of list of doubles representing bearing values - * @return a string with the bearing values - */ - @Nullable - public static String formatBearings(@Nullable List> bearings) { - if (bearings == null || bearings.isEmpty()) { - return null; - } - - List bearingsToJoin = new ArrayList<>(); - for (List bearing : bearings) { - if (bearing == null) { - bearingsToJoin.add(null); - } else { - if (bearing.size() != 2) { - throw new RuntimeException("Bearing size should be 2."); - } - - Double angle = bearing.get(0); - Double tolerance = bearing.get(1); - if (angle == null || tolerance == null) { - bearingsToJoin.add(null); - } else { - if (angle < 0 || angle > 360 || tolerance < 0 || tolerance > 360) { - throw new RuntimeException("Angle and tolerance have to be from 0 to 360."); - } - - bearingsToJoin.add(String.format(Locale.US, "%s,%s", - formatCoordinate(angle), - formatCoordinate(tolerance))); - } - } - } - return join(";", bearingsToJoin); - } - - /** - * Converts the list of integer arrays to a string ready for API consumption. - * - * @param distributions the list of integer arrays representing the distribution - * @return a string with the distribution values - */ - @Nullable - public static String formatDistributions(@Nullable List distributions) { - if (distributions == null || distributions.isEmpty()) { - return null; - } - - List distributionsToJoin = new ArrayList<>(); - for (Integer[] array : distributions) { - if (array.length == 0) { - distributionsToJoin.add(null); - } else { - distributionsToJoin.add(String.format(Locale.US, "%s,%s", - formatCoordinate(array[0]), - formatCoordinate(array[1]))); - } - } - return join(";", distributionsToJoin); - } - - /** - * Converts String list with approaches values to a string ready for API consumption. An approach - * could be unrestricted, curb or null. - * - * @param approaches a list representing approaches to each coordinate. - * @return a formatted string. - */ - @Nullable - public static String formatApproaches(@Nullable List approaches) { - if (approaches == null || approaches.isEmpty()) { - return null; - } - - for (String approach : approaches) { - if (approach != null && !approach.equals("unrestricted") && !approach.equals("curb") - && !approach.isEmpty()) { - return null; - } - } - return join(";", approaches); - } - - /** - * Converts String list with waypoint_names values to a string ready for API consumption. - * - * @param waypointNames a string representing approaches to each coordinate. - * @return a formatted string. - */ - @Nullable - public static String formatWaypointNames(@Nullable List waypointNames) { - if (waypointNames == null || waypointNames.isEmpty()) { - return null; - } - - return join(";", waypointNames); - } - - /** - * Converts a list of Points to String. - * - * @param coordinates a list of coordinates. - * @return a formatted string. - */ - @Nullable - public static String formatCoordinates(@NonNull List coordinates) { - List coordinatesToJoin = new ArrayList<>(); - for (Point point : coordinates) { - coordinatesToJoin.add(String.format(Locale.US, "%s,%s", - formatCoordinate(point.longitude()), - formatCoordinate(point.latitude()))); - } - - return join(";", coordinatesToJoin); - } - - /** - * Converts array of Points with waypoint_targets values to a string ready for API consumption. - * - * @param points a list representing approaches to each coordinate. - * @return a formatted string. - */ - @Nullable - public static String formatPointsList(@Nullable List points) { - if (points == null || points.isEmpty()) { - return null; - } - - List coordinatesToJoin = new ArrayList<>(); - for (Point point : points) { - if (point == null) { - coordinatesToJoin.add(null); - } else { - coordinatesToJoin.add(String.format(Locale.US, "%s,%s", - formatCoordinate(point.longitude()), - formatCoordinate(point.latitude()))); - } - } - return join(";", coordinatesToJoin); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/ParseUtils.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/ParseUtils.java deleted file mode 100644 index fb7b0bf8..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/models/utils/ParseUtils.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.mapbox.services.android.navigation.v5.models.utils; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.mapbox.geojson.Point; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Methods to convert Strings to Lists of objects. - */ -public class ParseUtils { - private static final String SEMICOLON = ";"; - private static final String COMMA = ","; - private static final String UNLIMITED = "unlimited"; - private static final String TRUE = "true"; - private static final String FALSE = "false"; - - /** - * Parse a String to a list of Integers. - * - * @param original an original String. - * @return List of Integers - */ - @Nullable - public static List parseToIntegers(@Nullable String original) { - if (original == null) { - return null; - } - - List integers = new ArrayList<>(); - String[] strings = original.split(SEMICOLON); - for (String index : strings) { - if (index != null) { - if (index.isEmpty()) { - integers.add(null); - } else { - integers.add(Integer.valueOf(index)); - } - } - } - - return integers; - } - - /** - * Parse a String to a list of Strings using ";" as a separator. - * - * @param original an original String. - * @return List of Strings - */ - @Nullable - public static List parseToStrings(@Nullable String original) { - return parseToStrings(original, SEMICOLON); - } - - /** - * Parse a String to a list of Strings. - * - * @param original an original String. - * @param separator a String used as a separator. - * @return List of Strings - */ - @Nullable - public static List parseToStrings(@Nullable String original, @NonNull String separator) { - if (original == null) { - return null; - } - - List result = new ArrayList<>(); - String[] strings = original.split(separator, -1); - for (String str : strings) { - if (str != null) { - if (str.isEmpty()) { - result.add(null); - } else { - result.add(str); - } - } - } - - return result; - } - - /** - * Parse a String to a list of Points. - * - * @param original an original String. - * @return List of Points - */ - @Nullable - public static List parseToPoints(@Nullable String original) { - if (original == null) { - return null; - } - - List points = new ArrayList<>(); - String[] targets = original.split(SEMICOLON, -1); - for (String target : targets) { - if (target != null) { - if (target.isEmpty()) { - points.add(null); - } else { - String[] point = target.split(COMMA); - points.add(Point.fromLngLat(Double.valueOf(point[0]), Double.valueOf(point[1]))); - } - } - } - - return points; - } - - /** - * Parse a String to a list of Points. - * - * @param original an original String. - * @return List of Doubles - */ - @Nullable - public static List parseToDoubles(@Nullable String original) { - if (original == null) { - return null; - } - - List doubles = new ArrayList<>(); - String[] strings = original.split(SEMICOLON, -1); - for (String str : strings) { - if (str != null) { - if (str.isEmpty()) { - doubles.add(null); - } else if (str.equals(UNLIMITED)) { - doubles.add(Double.POSITIVE_INFINITY); - } else { - doubles.add(Double.valueOf(str)); - } - } - } - - return doubles; - } - - /** - * Parse a String to a list of list of Doubles. - * - * @param original an original String. - * @return List of List of Doubles - */ - @Nullable - public static List> parseToListOfListOfDoubles(@Nullable String original) { - if (original == null) { - return null; - } - - List> result = new ArrayList<>(); - String[] pairs = original.split(SEMICOLON, -1); - for (String pair : pairs) { - if (pair.isEmpty()) { - result.add(null); - } else { - String[] values = pair.split(COMMA); - if (values.length == 2) { - result.add(Arrays.asList(Double.valueOf(values[0]), Double.valueOf(values[1]))); - } - } - } - - return result; - } - - /** - * Parse a String to a list of Boolean. - * - * @param original an original String. - * @return List of Booleans - */ - @Nullable - public static List parseToBooleans(@Nullable String original) { - if (original == null) { - return null; - } - - List booleans = new ArrayList<>(); - if (original.isEmpty()) { - return booleans; - } - - String[] strings = original.split(SEMICOLON, -1); - for (String str : strings) { - if (str != null) { - if (str.isEmpty()) { - booleans.add(null); - } else if (str.equalsIgnoreCase(TRUE)) { - booleans.add(true); - } else if (str.equalsIgnoreCase(FALSE)) { - booleans.add(false); - } else { - booleans.add(null); - } - } - } - - return booleans; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java deleted file mode 100644 index 31145c4f..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java +++ /dev/null @@ -1,734 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.os.Build; -import android.os.IBinder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.milestone.VoiceInstructionMilestone; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.navigation.camera.Camera; -import com.mapbox.services.android.navigation.v5.navigation.camera.SimpleCamera; -import com.mapbox.services.android.navigation.v5.offroute.OffRoute; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener; -import com.mapbox.services.android.navigation.v5.route.FasterRoute; -import com.mapbox.services.android.navigation.v5.route.FasterRouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.snap.Snap; -import com.mapbox.services.android.navigation.v5.utils.ValidationUtils; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import timber.log.Timber; - -import static com.mapbox.services.android.navigation.v5.location.engine.LocationEngineProvider.getBestLocationEngine; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.BANNER_INSTRUCTION_MILESTONE_ID; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NON_NULL_APPLICATION_CONTEXT_REQUIRED; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.VOICE_INSTRUCTION_MILESTONE_ID; - -/** - * A MapboxNavigation class for interacting with and customizing a navigation session. - *

- * Instance of this class are used to setup, customize, start, and end a navigation session. - * - * @see Navigation documentation - * @since 0.1.0 - */ -public class MapboxNavigation implements ServiceConnection { - - private NavigationEventDispatcher navigationEventDispatcher; - private NavigationEngineFactory navigationEngineFactory; - private NavigationService navigationService; - private DirectionsRoute directionsRoute; - private MapboxNavigationOptions options; - private LocationEngine locationEngine = null; - private Set milestones; - private Context applicationContext; - private boolean isBound; - - /** - * Constructs a new instance of this class using the default options. This should be used over - * {@link #MapboxNavigation(Context, String, MapboxNavigationOptions)} if all the default options - * fit your needs. - *

- * Initialization will also add the default milestones and create a new location engine - * which will be used during navigation unless a different engine gets passed in through - * {@link #setLocationEngine(LocationEngine)}. - *

- * - * @param context required in order to create and bind the navigation service - * @since 0.5.0 - */ - public MapboxNavigation(@NonNull Context context) { - this(context, MapboxNavigationOptions.builder().build()); - } - - /** - * Constructs a new instance of this class using a custom built options class. Building a custom - * {@link MapboxNavigationOptions} object and passing it in allows you to further customize the - * user experience. While many of the default values have been tested thoroughly, you might find - * that your app requires special tweaking. Once this class is initialized, the options specified - * through the options class cannot be modified. - *

- * Initialization will also add the default milestones and create a new location engine - * which will be used during navigation unless a different engine gets passed in through - * {@link #setLocationEngine(LocationEngine)}. - *

- * - * @param context required in order to create and bind the navigation service - * @param options a custom built {@code MapboxNavigationOptions} class - * @see MapboxNavigationOptions - * @since 0.5.0 - */ - public MapboxNavigation(@NonNull Context context, @NonNull MapboxNavigationOptions options) { - initializeContext(context); - this.options = options; - initialize(); - } - - /** - * Constructs a new instance of this class using a custom built options class. Building a custom - * {@link MapboxNavigationOptions} object and passing it in allows you to further customize the - * user experience. Once this class is initialized, the options specified - * through the options class cannot be modified. - * - * @param context required in order to create and bind the navigation service - * @param options a custom built {@code MapboxNavigationOptions} class - * @param locationEngine a LocationEngine to provide Location updates - * @see MapboxNavigationOptions - * @since 0.19.0 - */ - public MapboxNavigation(@NonNull Context context, @NonNull MapboxNavigationOptions options, @NonNull LocationEngine locationEngine) { - initializeContext(context); - this.options = options; - this.locationEngine = locationEngine; - initialize(); - } - - // Package private (no modifier) for testing purposes - MapboxNavigation(@NonNull Context context, LocationEngine locationEngine) { - initializeContext(context); - this.options = MapboxNavigationOptions.builder().build(); - this.locationEngine = locationEngine; - initialize(); - } - - /** - * In-charge of initializing all variables needed to begin a navigation session. Many values can - * be changed later on using their corresponding setter. An internal progressChangeListeners used - * to prevent users from removing it. - */ - private void initialize() { - // Initialize event dispatcher and add internal listeners - navigationEventDispatcher = new NavigationEventDispatcher(); - navigationEngineFactory = new NavigationEngineFactory(); - initializeDefaultLocationEngine(); - - // Create and add default milestones if enabled. - milestones = new HashSet<>(); - if (options.defaultMilestonesEnabled()) { - addMilestone(new VoiceInstructionMilestone.Builder().setIdentifier(VOICE_INSTRUCTION_MILESTONE_ID).build()); - addMilestone(new BannerInstructionMilestone.Builder().setIdentifier(BANNER_INSTRUCTION_MILESTONE_ID).build()); - } - } - - private void initializeContext(Context context) { - if (context == null || context.getApplicationContext() == null) { - throw new IllegalArgumentException(NON_NULL_APPLICATION_CONTEXT_REQUIRED); - } - applicationContext = context.getApplicationContext(); - } - - /** - * Since navigation requires location information there should always be a valid location engine - * which we can use to get information. Therefore, by default we build one. - */ - private void initializeDefaultLocationEngine() { - locationEngine = obtainLocationEngine(); - } - - private LocationEngine obtainLocationEngine() { - if (locationEngine == null) { - return getBestLocationEngine(applicationContext); - } - - return locationEngine; - } - - /** - * Critical to place inside your navigation activity so that when your application gets destroyed - * the navigation service unbinds and gets destroyed, preventing any memory leaks. Calling this - * also removes all listeners that have been attached. - */ - public void onDestroy() { - stopNavigation(); - removeOffRouteListener(null); - removeProgressChangeListener(null); - removeMilestoneEventListener(null); - removeNavigationEventListener(null); - } - - // Public APIs - - /** - * Navigation {@link Milestone}s provide a powerful way to give your user instructions at custom - * defined locations along their route. Default milestones are automatically added unless - * {@link MapboxNavigationOptions#defaultMilestonesEnabled()} is set to false but they can also - * be individually removed using the {@link #removeMilestone(Milestone)} API. Once a custom - * milestone is built, it will need to be passed into the navigation SDK through this method. - *

- * Milestones can only be added once and must be removed and added back if any changes are - * desired. - *

- * - * @param milestone a custom built milestone - * @since 0.4.0 - */ - public void addMilestone(@NonNull Milestone milestone) { - boolean milestoneAdded = milestones.add(milestone); - if (!milestoneAdded) { - Timber.w("Milestone has already been added to the stack."); - } - } - - /** - * Adds the given list of {@link Milestone} to be triggered during navigation. - *

- * Milestones can only be added once and must be removed and added back if any changes are - * desired. - *

- * - * @param milestones a list of custom built milestone - * @since 0.14.0 - */ - public void addMilestones(@NonNull List milestones) { - boolean milestonesAdded = this.milestones.addAll(milestones); - if (!milestonesAdded) { - Timber.w("These milestones have already been added to the stack."); - } - } - - /** - * Remove a specific milestone by passing in the instance of it. Removal of all the milestones can - * be achieved by passing in null rather than a specific milestone. - * - * @param milestone a milestone you'd like to have removed or null if you'd like to remove all - * milestones - * @since 0.4.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void removeMilestone(@Nullable Milestone milestone) { - if (milestone == null) { - milestones.clear(); - return; - } else if (!milestones.contains(milestone)) { - Timber.w("Milestone attempting to remove does not exist in stack."); - return; - } - milestones.remove(milestone); - } - - /** - * Remove a specific milestone by passing in the identifier associated with the milestone you'd - * like to remove. If the identifier passed in does not match one of the milestones in the list, - * a warning will return in the log. - * - * @param milestoneIdentifier identifier matching one of the milestones - * @since 0.5.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void removeMilestone(int milestoneIdentifier) { - for (Milestone milestone : milestones) { - if (milestoneIdentifier == milestone.getIdentifier()) { - removeMilestone(milestone); - return; - } - } - Timber.w("No milestone found with the specified identifier."); - } - - /** - * Navigation needs an instance of location engine in order to acquire user location information - * and handle events based off of the current information. By default, a LOST location engine is - * created with the optimal navigation settings. Passing in a custom location engine using this - * API assumes you have set it to the ideal parameters which are specified below. - *

- * Although it is not required to set your location engine to these parameters, these values are - * what we found works best. Note that this also depends on which underlying location service you - * are using. Reference the corresponding location service documentation for more information and - * way's you could improve the performance. - *

- * An ideal conditions, the Navigation SDK will receive location updates once every second with - * mild to high horizontal accuracy. The location update must also contain all information an - * Android location object would expect including bearing, speed, timestamp, and - * latitude/longitude. - *

- * Listed below are the ideal conditions for both a LOST location engine and a Google Play - * Services Location engine. - *

    - *
  • Set the location priority to {@code HIGH_ACCURACY}.
  • - *
  • The fastest interval should be set around 1 second (1000ms). Note that the interval isn't - * a guaranteed to match this value exactly and is only an estimate.
  • - *
  • Setting the location engine interval to 0 will result in location updates occurring as - * quickly as possible within the fastest interval limit placed on it.
  • - *
- * - * @param locationEngine a {@link LocationEngine} used for the navigation session - * @since 0.1.0 - */ - public void setLocationEngine(@NonNull LocationEngine locationEngine) { - this.locationEngine = locationEngine; - // Notify service to get new location engine. - if (isServiceAvailable()) { - navigationService.updateLocationEngine(locationEngine); - } - } - - /** - * Will return the currently set location engine. By default, the LOST location engine that's - * created on initialization of this class. If a custom location engine is preferred to be used, - * {@link #setLocationEngine(LocationEngine)} is offered which will replace the default. - * - * @return the location engine which is will or currently is being used during the navigation - * session - * @since 0.5.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - @NonNull - public LocationEngine getLocationEngine() { - return locationEngine; - } - - /** - * Calling This begins a new navigation session using the provided directions route. this API is - * also intended to be used when a reroute occurs passing in the updated directions route. - *

- * On initial start of the navigation session, the navigation services gets created and bound to - * your activity. Unless disabled, a notification will be displayed to the user and will remain - * until the service stops running in the background. - *

- * The directions route should be acquired by building a {@link NavigationRoute} object and - * calling {@link NavigationRoute#getRoute(Callback)} on it. Using navigation route request a - * route with the required parameters needed while at the same time, allowing for flexibility in - * other parts of the request. - *

- * - * @param directionsRoute a {@link DirectionsRoute} that makes up the path your user should - * traverse along - * @since 0.1.0 - */ - public void startNavigation(@NonNull DirectionsRoute directionsRoute) { - ValidationUtils.validDirectionsRoute(directionsRoute, options.defaultMilestonesEnabled()); - this.directionsRoute = directionsRoute; - Timber.d("MapboxNavigation startNavigation called."); - if (!isBound) { - // Start the NavigationService - Intent intent = getServiceIntent(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - applicationContext.startForegroundService(intent); - } else { - applicationContext.startService(intent); - } - applicationContext.bindService(intent, this, Context.BIND_AUTO_CREATE); - - // Send navigation event running: true - navigationEventDispatcher.onNavigationEvent(true); - } - } - - /** - * Call this when the navigation session needs to end before the user reaches their final - * destination. There isn't a need to manually end the navigation session using this API when the - * user arrives unless you set {@link MapboxNavigationOptions#manuallyEndNavigationUponCompletion()} - * to true. - *

- * Ending the navigation session ends and unbinds the navigation service meaning any milestone, - * progress change, or off-route listeners will not be invoked anymore. A call returning false - * will occur to {@link NavigationEventListener#onRunning(boolean)} to notify you when the service - * ends. - *

- * - * @since 0.1.0 - */ - public void stopNavigation() { - Timber.d("MapboxNavigation stopNavigation called"); - if (isServiceAvailable()) { - applicationContext.unbindService(this); - isBound = false; - navigationService.endNavigation(); - navigationService.stopSelf(); - navigationEventDispatcher.onNavigationEvent(false); - } - } - - // Listeners - - /** - * This adds a new milestone event listener which is invoked when a milestone gets triggered. If - * more then one milestone gets triggered on a location update, each milestone event listener will - * be invoked for each of those milestones. This is important to consider if you are using voice - * instructions since this would cause multiple instructions to be said at once. Ideally the - * milestones setup should avoid triggering too close to each other. - *

- * It is not possible to add the same listener implementation more then once and a warning will be - * printed in the log if attempted. - *

- * - * @param milestoneEventListener an implementation of {@code MilestoneEventListener} which hasn't - * already been added - * @see MilestoneEventListener - * @since 0.4.0 - */ - public void addMilestoneEventListener(@NonNull MilestoneEventListener milestoneEventListener) { - navigationEventDispatcher.addMilestoneEventListener(milestoneEventListener); - } - - /** - * This removes a specific milestone event listener by passing in the instance of it or you can - * pass in null to remove all the listeners. When {@link #onDestroy()} is called, all listeners - * get removed automatically, removing the requirement for developers to manually handle this. - *

- * If the listener you are trying to remove does not exist in the list, a warning will be printed - * in the log. - *

- * - * @param milestoneEventListener an implementation of {@code MilestoneEventListener} which - * currently exist in the milestoneEventListener list - * @see MilestoneEventListener - * @since 0.4.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void removeMilestoneEventListener(@Nullable MilestoneEventListener milestoneEventListener) { - navigationEventDispatcher.removeMilestoneEventListener(milestoneEventListener); - } - - /** - * This adds a new progress change listener which is invoked when a location change occurs and the - * navigation engine successfully runs it's calculations on it. - *

- * It is not possible to add the same listener implementation more then once and a warning will be - * printed in the log if attempted. - *

- * - * @param progressChangeListener an implementation of {@code ProgressChangeListener} which hasn't - * already been added - * @see ProgressChangeListener - * @since 0.1.0 - */ - public void addProgressChangeListener(@NonNull ProgressChangeListener progressChangeListener) { - navigationEventDispatcher.addProgressChangeListener(progressChangeListener); - } - - /** - * This removes a specific progress change listener by passing in the instance of it or you can - * pass in null to remove all the listeners. When {@link #onDestroy()} is called, all listeners - * get removed automatically, removing the requirement for developers to manually handle this. - *

- * If the listener you are trying to remove does not exist in the list, a warning will be printed - * in the log. - *

- * - * @param progressChangeListener an implementation of {@code ProgressChangeListener} which - * currently exist in the progressChangeListener list - * @see ProgressChangeListener - * @since 0.1.0 - */ - public void removeProgressChangeListener(@Nullable ProgressChangeListener progressChangeListener) { - navigationEventDispatcher.removeProgressChangeListener(progressChangeListener); - } - - /** - * This adds a new off route listener which is invoked when the devices location veers off the - * route and the specified criteria's in {@link MapboxNavigationOptions} have been met. - *

- * The behavior that causes this listeners callback to get invoked vary depending on whether a - * custom off route engine has been set using {@link #setOffRouteEngine(OffRoute)}. - *

- * It is not possible to add the same listener implementation more then once and a warning will be - * printed in the log if attempted. - *

- * - * @param offRouteListener an implementation of {@code OffRouteListener} which hasn't already been - * added - * @see OffRouteListener - * @since 0.2.0 - */ - public void addOffRouteListener(@NonNull OffRouteListener offRouteListener) { - navigationEventDispatcher.addOffRouteListener(offRouteListener); - } - - /** - * This removes a specific off route listener by passing in the instance of it or you can pass in - * null to remove all the listeners. When {@link #onDestroy()} is called, all listeners - * get removed automatically, removing the requirement for developers to manually handle this. - *

- * If the listener you are trying to remove does not exist in the list, a warning will be printed - * in the log. - *

- * - * @param offRouteListener an implementation of {@code OffRouteListener} which currently exist in - * the offRouteListener list - * @see OffRouteListener - * @since 0.2.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void removeOffRouteListener(@Nullable OffRouteListener offRouteListener) { - navigationEventDispatcher.removeOffRouteListener(offRouteListener); - } - - /** - * This adds a new navigation event listener which is invoked when navigation service begins - * running in the background and again when the service gets destroyed. - *

- * It is not possible to add the same listener implementation more then once and a warning will be - * printed in the log if attempted. - *

- * - * @param navigationEventListener an implementation of {@code NavigationEventListener} which - * hasn't already been added - * @see NavigationEventListener - * @since 0.1.0 - */ - public void addNavigationEventListener(@NonNull NavigationEventListener navigationEventListener) { - navigationEventDispatcher.addNavigationEventListener(navigationEventListener); - } - - /** - * This removes a specific navigation event listener by passing in the instance of it or you can - * pass in null to remove all the listeners. When {@link #onDestroy()} is called, all listeners - * get removed automatically, removing the requirement for developers to manually handle this. - *

- * If the listener you are trying to remove does not exist in the list, a warning will be printed - * in the log. - *

- * - * @param navigationEventListener an implementation of {@code NavigationEventListener} which - * currently exist in the navigationEventListener list - * @see NavigationEventListener - * @since 0.1.0 - */ - public void removeNavigationEventListener(@Nullable NavigationEventListener navigationEventListener) { - navigationEventDispatcher.removeNavigationEventListener(navigationEventListener); - } - - /** - * This adds a new faster route listener which is invoked when a new, faster {@link DirectionsRoute} - * has been retrieved by the specified criteria in {@link FasterRoute}. - *

- * The behavior that causes this listeners callback to get invoked vary depending on whether a - * custom faster route engine has been set using {@link #setFasterRouteEngine(FasterRoute)}. - *

- * It is not possible to add the same listener implementation more then once and a warning will be - * printed in the log if attempted. - *

- * - * @param fasterRouteListener an implementation of {@code FasterRouteListener} - * @see FasterRouteListener - * @since 0.9.0 - */ - public void addFasterRouteListener(@NonNull FasterRouteListener fasterRouteListener) { - navigationEventDispatcher.addFasterRouteListener(fasterRouteListener); - } - - /** - * This removes a specific faster route listener by passing in the instance of it or you can pass in - * null to remove all the listeners. When {@link #onDestroy()} is called, all listeners - * get removed automatically, removing the requirement for developers to manually handle this. - *

- * If the listener you are trying to remove does not exist in the list, a warning will be printed - * in the log. - *

- * - * @param fasterRouteListener an implementation of {@code FasterRouteListener} which currently exist in - * the fasterRouteListeners list - * @see FasterRouteListener - * @since 0.9.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void removeFasterRouteListener(@Nullable FasterRouteListener fasterRouteListener) { - navigationEventDispatcher.removeFasterRouteListener(fasterRouteListener); - } - - // Custom engines - - /** - * Navigation uses a camera engine to determine the camera position while routing. - * By default, it uses a {@link SimpleCamera}. If you would like to customize how the camera is - * positioned, create a new {@link Camera} and set it here. - * - * @param cameraEngine camera engine used to configure camera position while routing - * @since 0.10.0 - */ - public void setCameraEngine(@NonNull Camera cameraEngine) { - navigationEngineFactory.updateCameraEngine(cameraEngine); - } - - /** - * Returns the current camera engine used to configure the camera position while routing. By default, - * a {@link SimpleCamera} is used. - * - * @return camera engine used to configure camera position while routing - * @since 0.10.0 - */ - @NonNull - public Camera getCameraEngine() { - return navigationEngineFactory.retrieveCameraEngine(); - } - - /** - * This API is used to pass in a custom implementation of the snapping logic, A default - * snap-to-route engine is attached when this class is first initialized; setting a custom one - * will replace it with your own implementation. - *

- * In general, snap logic can be anything that modifies the device's true location. For more - * information see the implementation notes in {@link Snap}. - *

- * The engine can be changed at anytime, even during a navigation session. - *

- * - * @param snapEngine a custom implementation of the {@code Snap} class - * @see Snap - * @since 0.5.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void setSnapEngine(@NonNull Snap snapEngine) { - navigationEngineFactory.updateSnapEngine(snapEngine); - } - - /** - * This will return the currently set snap engine which will or is being used during the - * navigation session. If no snap engine has been set yet, the default engine will be returned. - * - * @return the snap engine currently set and will/is being used for the navigation session - * @see Snap - * @since 0.5.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public Snap getSnapEngine() { - return navigationEngineFactory.retrieveSnapEngine(); - } - - /** - * This API is used to pass in a custom implementation of the off-route logic, A default - * off-route detection engine is attached when this class is first initialized; setting a custom - * one will replace it with your own implementation. - *

- * The engine can be changed at anytime, even during a navigation session. - *

- * - * @param offRouteEngine a custom implementation of the {@code OffRoute} class - * @see OffRoute - * @since 0.5.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void setOffRouteEngine(@NonNull OffRoute offRouteEngine) { - navigationEngineFactory.updateOffRouteEngine(offRouteEngine); - } - - /** - * This will return the currently set off-route engine which will or is being used during the - * navigation session. If no off-route engine has been set yet, the default engine will be - * returned. - * - * @return the off-route engine currently set and will/is being used for the navigation session - * @see OffRoute - * @since 0.5.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - @NonNull - public OffRoute getOffRouteEngine() { - return navigationEngineFactory.retrieveOffRouteEngine(); - } - - /** - * This API is used to pass in a custom implementation of the faster-route detection logic, A default - * faster-route detection engine is attached when this class is first initialized; setting a custom - * one will replace it with your own implementation. - *

- * The engine can be changed at anytime, even during a navigation session. - *

- * - * @param fasterRouteEngine a custom implementation of the {@link FasterRoute} class - * @see FasterRoute - * @since 0.9.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - public void setFasterRouteEngine(@NonNull FasterRoute fasterRouteEngine) { - navigationEngineFactory.updateFasterRouteEngine(fasterRouteEngine); - } - - /** - * This will return the currently set faster-route engine which will or is being used during the - * navigation session. If no faster-route engine has been set yet, the default engine will be - * returned. - * - * @return the faster-route engine currently set and will/is being used for the navigation session - * @see FasterRoute - * @since 0.9.0 - */ - @SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK - @NonNull - public FasterRoute getFasterRouteEngine() { - return navigationEngineFactory.retrieveFasterRouteEngine(); - } - - DirectionsRoute getRoute() { - return directionsRoute; - } - - List getMilestones() { - return new ArrayList<>(milestones); - } - - MapboxNavigationOptions options() { - return options; - } - - NavigationEventDispatcher getEventDispatcher() { - return navigationEventDispatcher; - } - - NavigationEngineFactory retrieveEngineProvider() { - return navigationEngineFactory; - } - - private Intent getServiceIntent() { - return new Intent(applicationContext, NavigationService.class); - } - - private boolean isServiceAvailable() { - return navigationService != null && isBound; - } - - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - Timber.d("Connected to service."); - NavigationService.LocalBinder binder = (NavigationService.LocalBinder) service; - navigationService = binder.getService(); - if(navigationService == null){ - //Since this is called when the Service is ready, the binder should always return a valid Service. - throw new IllegalStateException("NavigationService must not be null"); - } - navigationService.startNavigation(this); - isBound = true; - } - - @Override - public void onServiceDisconnected(ComponentName name) { - Timber.d("Disconnected from service."); - navigationService = null; - isBound = false; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotification.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotification.java deleted file mode 100644 index cf9f6397..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotification.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.PackageManager; -import android.os.Build; -import android.text.SpannableString; -import android.text.format.DateFormat; -import android.widget.RemoteViews; - -import androidx.core.app.NotificationCompat; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.services.android.navigation.R; -import com.mapbox.services.android.navigation.v5.navigation.notification.NavigationNotification; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.DistanceFormatter; -import com.mapbox.services.android.navigation.v5.utils.LocaleUtils; -import com.mapbox.services.android.navigation.v5.utils.ManeuverUtils; - -import java.util.Calendar; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NAVIGATION_NOTIFICATION_CHANNEL; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.NAVIGATION_NOTIFICATION_ID; -import static com.mapbox.services.android.navigation.v5.utils.time.TimeFormatter.formatTime; - -/** - * This is in charge of creating the persistent navigation session notification and updating it. - */ -class MapboxNavigationNotification implements NavigationNotification { - - private static final int INTENT_FLAGS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? - PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : - PendingIntent.FLAG_UPDATE_CURRENT; - - private NotificationCompat.Builder notificationBuilder; - private NotificationManager notificationManager; - private Notification notification; - private RemoteViews collapsedNotificationRemoteViews; - private RemoteViews expandedNotificationRemoteViews; - private MapboxNavigation mapboxNavigation; - private SpannableString currentDistanceText; - private DistanceFormatter distanceFormatter; - private String instructionText; - private int currentManeuverId; - private boolean isTwentyFourHourFormat; - private String etaFormat; - - private BroadcastReceiver endNavigationBtnReceiver = new BroadcastReceiver() { - @Override - public void onReceive(final Context context, final Intent intent) { - MapboxNavigationNotification.this.onEndNavigationBtnClick(); - } - }; - - MapboxNavigationNotification(Context context, MapboxNavigation mapboxNavigation) { - initialize(context, mapboxNavigation); - } - - @Override - public Notification getNotification() { - return notification; - } - - @Override - public int getNotificationId() { - return NAVIGATION_NOTIFICATION_ID; - } - - @Override - public void updateNotification(RouteProgress routeProgress) { - updateNotificationViews(routeProgress); - } - - @Override - public void onNavigationStopped(Context context) { - unregisterReceiver(context); - } - - private void initialize(Context context, MapboxNavigation mapboxNavigation) { - this.mapboxNavigation = mapboxNavigation; - etaFormat = context.getString(R.string.eta_format); - initializeDistanceFormatter(context, mapboxNavigation); - notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - isTwentyFourHourFormat = DateFormat.is24HourFormat(context); - createNotificationChannel(context); - buildNotification(context); - registerReceiver(context); - } - - private void initializeDistanceFormatter(Context context, MapboxNavigation mapboxNavigation) { - RouteOptions routeOptions = mapboxNavigation.getRoute().routeOptions(); - LocaleUtils localeUtils = new LocaleUtils(); - String language = localeUtils.inferDeviceLanguage(context); - String unitType = localeUtils.getUnitTypeForDeviceLocale(context); - if (routeOptions != null) { - language = routeOptions.language(); - unitType = routeOptions.voiceUnits(); - } - MapboxNavigationOptions mapboxNavigationOptions = mapboxNavigation.options(); - distanceFormatter = new DistanceFormatter(context, language, unitType, mapboxNavigationOptions.roundingIncrement()); - } - - private void createNotificationChannel(Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel notificationChannel = new NotificationChannel( - NAVIGATION_NOTIFICATION_CHANNEL, context.getString(R.string.channel_name), - NotificationManager.IMPORTANCE_LOW); - notificationManager.createNotificationChannel(notificationChannel); - } - } - - private void buildNotification(Context context) { - collapsedNotificationRemoteViews = new RemoteViews(context.getPackageName(), - R.layout.collapsed_navigation_notification_layout); - expandedNotificationRemoteViews = new RemoteViews(context.getPackageName(), - R.layout.expanded_navigation_notification_layout); - - PendingIntent pendingOpenIntent = createPendingOpenIntent(context); - // Will trigger endNavigationBtnReceiver when clicked - PendingIntent pendingCloseIntent = createPendingCloseIntent(context); - expandedNotificationRemoteViews.setOnClickPendingIntent(R.id.endNavigationBtn, pendingCloseIntent); - - // Sets up the top bar notification - notificationBuilder = new NotificationCompat.Builder(context, NAVIGATION_NOTIFICATION_CHANNEL) - .setContentIntent(pendingOpenIntent) - .setCategory(NotificationCompat.CATEGORY_SERVICE) - .setPriority(NotificationCompat.PRIORITY_MAX) - .setSmallIcon(R.drawable.ic_navigation) - .setCustomContentView(collapsedNotificationRemoteViews) - .setCustomBigContentView(expandedNotificationRemoteViews) - .setOngoing(true); - - notification = notificationBuilder.build(); - } - - private PendingIntent createPendingOpenIntent(Context context) { - PackageManager pm = context.getPackageManager(); - Intent intent = pm.getLaunchIntentForPackage(context.getPackageName()); - intent.setPackage(null); - intent.setAction(OPEN_NAVIGATION_ACTION); - return PendingIntent.getActivity(context, 0, intent, INTENT_FLAGS); - } - - private void registerReceiver(Context context) { - if (context != null) { - context.registerReceiver(endNavigationBtnReceiver, new IntentFilter(END_NAVIGATION_ACTION), Context.RECEIVER_NOT_EXPORTED); - } - } - - /** - * With each location update and new routeProgress, the notification is checked and updated if any - * information has changed. - * - * @param routeProgress the latest RouteProgress object - */ - private void updateNotificationViews(RouteProgress routeProgress) { - updateInstructionText(routeProgress.currentLegProgress().currentStep()); - updateDistanceText(routeProgress); - updateArrivalTime(routeProgress); - LegStep step = routeProgress.currentLegProgress().upComingStep() != null - ? routeProgress.currentLegProgress().upComingStep() - : routeProgress.currentLegProgress().currentStep(); - updateManeuverImage(step); - - notificationManager.notify(NAVIGATION_NOTIFICATION_ID, notificationBuilder.build()); - } - - private void unregisterReceiver(Context context) { - if (context != null) { - context.unregisterReceiver(endNavigationBtnReceiver); - } - if (notificationManager != null) { - notificationManager.cancel(NAVIGATION_NOTIFICATION_ID); - } - } - - private void updateInstructionText(LegStep step) { - if (hasInstructions(step) && (instructionText == null || newInstructionText(step))) { - instructionText = step.bannerInstructions().get(0).primary().text(); - collapsedNotificationRemoteViews.setTextViewText(R.id.notificationInstructionText, instructionText); - expandedNotificationRemoteViews.setTextViewText(R.id.notificationInstructionText, instructionText); - } - } - - private boolean hasInstructions(LegStep step) { - return step.bannerInstructions() != null && !step.bannerInstructions().isEmpty(); - } - - private boolean newInstructionText(LegStep step) { - return !instructionText.equals(step.bannerInstructions().get(0).primary().text()); - } - - private void updateDistanceText(RouteProgress routeProgress) { - if (currentDistanceText == null || newDistanceText(routeProgress)) { - currentDistanceText = distanceFormatter.formatDistance( - routeProgress.currentLegProgress().currentStepProgress().distanceRemaining()); - collapsedNotificationRemoteViews.setTextViewText(R.id.notificationDistanceText, currentDistanceText); - expandedNotificationRemoteViews.setTextViewText(R.id.notificationDistanceText, currentDistanceText); - } - } - - private boolean newDistanceText(RouteProgress routeProgress) { - return currentDistanceText != null - && !currentDistanceText.toString().equals(distanceFormatter.formatDistance( - routeProgress.currentLegProgress().currentStepProgress().distanceRemaining()).toString()); - } - - private void updateArrivalTime(RouteProgress routeProgress) { - MapboxNavigationOptions options = mapboxNavigation.options(); - Calendar time = Calendar.getInstance(); - double durationRemaining = routeProgress.durationRemaining(); - int timeFormatType = options.timeFormatType(); - String arrivalTime = formatTime(time, durationRemaining, timeFormatType, isTwentyFourHourFormat); - String formattedArrivalTime = String.format(etaFormat, arrivalTime); - collapsedNotificationRemoteViews.setTextViewText(R.id.notificationArrivalText, formattedArrivalTime); - expandedNotificationRemoteViews.setTextViewText(R.id.notificationArrivalText, formattedArrivalTime); - } - - private void updateManeuverImage(LegStep step) { - if (newManeuverId(step)) { - int maneuverResource = ManeuverUtils.getManeuverResource(step); - currentManeuverId = maneuverResource; - collapsedNotificationRemoteViews.setImageViewResource(R.id.maneuverImage, maneuverResource); - expandedNotificationRemoteViews.setImageViewResource(R.id.maneuverImage, maneuverResource); - } - } - - private boolean newManeuverId(LegStep step) { - return currentManeuverId != ManeuverUtils.getManeuverResource(step); - } - - private PendingIntent createPendingCloseIntent(Context context) { - Intent endNavigationBtn = new Intent(END_NAVIGATION_ACTION); - return PendingIntent.getBroadcast(context, 0, endNavigationBtn, INTENT_FLAGS); - } - - private void onEndNavigationBtnClick() { - if (mapboxNavigation != null) { - mapboxNavigation.stopNavigation(); - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationOptions.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationOptions.java deleted file mode 100644 index 348a04d5..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationOptions.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; -import com.mapbox.services.android.navigation.v5.navigation.notification.NavigationNotification; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.ROUNDING_INCREMENT_FIFTY; - -/** - * Immutable and can't be changed after passing into {@link MapboxNavigation}. - */ -@AutoValue -public abstract class MapboxNavigationOptions { - - public abstract double maxTurnCompletionOffset(); - - public abstract double maneuverZoneRadius(); - - /** - * @deprecated has no effect and will be removed in a future release. Use {@link #minimumDistanceBeforeRerouting()} instead. - */ - @Deprecated - public abstract double maximumDistanceOffRoute(); - - public abstract double deadReckoningTimeInterval(); - - public abstract double maxManipulatedCourseAngle(); - - public abstract double userLocationSnapDistance(); - - public abstract int secondsBeforeReroute(); - - public abstract boolean defaultMilestonesEnabled(); - - public abstract boolean snapToRoute(); - - public abstract boolean enableOffRouteDetection(); - - public abstract boolean enableFasterRouteDetection(); - - public abstract boolean manuallyEndNavigationUponCompletion(); - - public abstract double metersRemainingTillArrival(); - - public abstract boolean isFromNavigationUi(); - - public abstract double minimumDistanceBeforeRerouting(); - - /** - * Minimum distance in meters that the user must travel in the wrong direction before the - * off-route logic recognizes the user is moving away from upcoming maneuver - */ - public abstract double offRouteMinimumDistanceMetersBeforeWrongDirection(); - - /** - * Minimum distance in meters that the user must travel in the correct direction before the - * off-route logic recognizes the user is back on the right direction - */ - public abstract double offRouteMinimumDistanceMetersBeforeRightDirection(); - - public abstract boolean isDebugLoggingEnabled(); - - @Nullable - public abstract NavigationNotification navigationNotification(); - - @NavigationConstants.RoundingIncrement - public abstract int roundingIncrement(); - - @NavigationTimeFormat.Type - public abstract int timeFormatType(); - - public abstract int locationAcceptableAccuracyInMetersThreshold(); - - public abstract Builder toBuilder(); - - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder maxTurnCompletionOffset(double maxTurnCompletionOffset); - - public abstract Builder maneuverZoneRadius(double maneuverZoneRadius); - - /** - * @deprecated has no effect and will be removed in a future release. Use {@link #minimumDistanceBeforeRerouting()} instead. - */ - @Deprecated - public abstract Builder maximumDistanceOffRoute(double maximumDistanceOffRoute); - - public abstract Builder deadReckoningTimeInterval(double deadReckoningTimeInterval); - - public abstract Builder maxManipulatedCourseAngle(double maxManipulatedCourseAngle); - - public abstract Builder userLocationSnapDistance(double userLocationSnapDistance); - - public abstract Builder secondsBeforeReroute(int secondsBeforeReroute); - - public abstract Builder defaultMilestonesEnabled(boolean defaultMilestonesEnabled); - - public abstract Builder snapToRoute(boolean snapToRoute); - - public abstract Builder enableOffRouteDetection(boolean enableOffRouteDetection); - - public abstract Builder enableFasterRouteDetection(boolean enableFasterRouteDetection); - - public abstract Builder manuallyEndNavigationUponCompletion(boolean manuallyEndNavigation); - - public abstract Builder metersRemainingTillArrival(double metersRemainingTillArrival); - - public abstract Builder isFromNavigationUi(boolean isFromNavigationUi); - - public abstract Builder minimumDistanceBeforeRerouting(double distanceInMeters); - - /** - * Minimum distance in meters that the user must travel in the wrong direction before the - * off-route logic recognizes the user is moving away from upcoming maneuver - */ - public abstract Builder offRouteMinimumDistanceMetersBeforeWrongDirection(double distanceInMeters); - - /** - * Minimum distance in meters that the user must travel in the correct direction before the - * off-route logic recognizes the user is back on the right direction - */ - public abstract Builder offRouteMinimumDistanceMetersBeforeRightDirection(double distanceInMeters); - - public abstract Builder isDebugLoggingEnabled(boolean debugLoggingEnabled); - - public abstract Builder navigationNotification(NavigationNotification notification); - - public abstract Builder roundingIncrement(@NavigationConstants.RoundingIncrement int roundingIncrement); - - public abstract Builder timeFormatType(@NavigationTimeFormat.Type int type); - - public abstract Builder locationAcceptableAccuracyInMetersThreshold(int accuracyInMetersThreshold); - - public abstract MapboxNavigationOptions build(); - } - - public static Builder builder() { - return new AutoValue_MapboxNavigationOptions.Builder() - .maxTurnCompletionOffset(NavigationConstants.MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION) - .maneuverZoneRadius(NavigationConstants.MANEUVER_ZONE_RADIUS) - .maximumDistanceOffRoute(NavigationConstants.MAXIMUM_DISTANCE_BEFORE_OFF_ROUTE) - .deadReckoningTimeInterval(NavigationConstants.DEAD_RECKONING_TIME_INTERVAL) - .maxManipulatedCourseAngle(NavigationConstants.MAX_MANIPULATED_COURSE_ANGLE) - .userLocationSnapDistance(NavigationConstants.USER_LOCATION_SNAPPING_DISTANCE) - .secondsBeforeReroute(NavigationConstants.SECONDS_BEFORE_REROUTE) - .enableOffRouteDetection(true) - .enableFasterRouteDetection(false) - .snapToRoute(true) - .manuallyEndNavigationUponCompletion(false) - .defaultMilestonesEnabled(true) - .minimumDistanceBeforeRerouting(NavigationConstants.MINIMUM_DISTANCE_BEFORE_REROUTING) - .offRouteMinimumDistanceMetersBeforeWrongDirection(NavigationConstants.OFF_ROUTE_MINIMUM_DISTANCE_METERS_BEFORE_WRONG_DIRECTION) - .offRouteMinimumDistanceMetersBeforeRightDirection(NavigationConstants.OFF_ROUTE_MINIMUM_DISTANCE_METERS_BEFORE_RIGHT_DIRECTION) - .metersRemainingTillArrival(NavigationConstants.METERS_REMAINING_TILL_ARRIVAL) - .isFromNavigationUi(false) - .isDebugLoggingEnabled(false) - .roundingIncrement(ROUNDING_INCREMENT_FIFTY) - .timeFormatType(NavigationTimeFormat.NONE_SPECIFIED) - .locationAcceptableAccuracyInMetersThreshold(NavigationConstants.ONE_HUNDRED_METER_ACCEPTABLE_ACCURACY_THRESHOLD); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java deleted file mode 100644 index 02b0569f..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java +++ /dev/null @@ -1,328 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import androidx.annotation.IntDef; -import androidx.annotation.StringDef; - -import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener; - -/** - * Navigation constants - * - * @since 0.1.0 - */ -public final class NavigationConstants { - - private NavigationConstants() { - // Empty private constructor to prevent users creating an instance of this class. - } - - /** - * If default voice instructions are enabled, this identifier will be used to differentiate them - * from custom milestones in the - * {@link com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener}. - * - * @since 0.7.0 - */ - public static final int VOICE_INSTRUCTION_MILESTONE_ID = 1; - - - /** - * String channel used to post the navigation notification (custom or default). - *

- * If > Android O, a notification channel needs to be created to properly post the notification. - * - * @since 0.8.0 - */ - public static final String NAVIGATION_NOTIFICATION_CHANNEL = "NAVIGATION_NOTIFICATION_CHANNEL"; - - /** - * This identifier will be used to - * differentiate the {@link com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone} - * from custom milestones in the {@link com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener}. - * - * @since 0.8.0 - */ - public static final int BANNER_INSTRUCTION_MILESTONE_ID = 2; - - /** - * Random integer value used for identifying the navigation notification. - * - * @since 0.5.0 - */ - public static final int NAVIGATION_NOTIFICATION_ID = 5678; - - - /** - * NavigationLauncher key for storing initial map position in Intent - */ - public static final String NAVIGATION_VIEW_INITIAL_MAP_POSITION = "navigation_view_initial_map_position"; - - /** - * Threshold user must be within to count as completing a step. One of two heuristics used to know - * when a user completes a step, see {@link #MANEUVER_ZONE_RADIUS}. The users heading and the - * finalHeading are compared. If this number is within this defined constant, the user has - * completed the step. - * - * @since 0.1.0 - */ - static final int MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION = 30; - - /** - * Radius in meters the user must enter to count as completing a step. One of two heuristics used - * to know when a user completes a step, see - * {@link #MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION}. - * - * @since 0.1.0 - */ - public static final int MANEUVER_ZONE_RADIUS = 40; - - /** - * Maximum number of meters the user can travel away from step before the - * {@link OffRouteListener}'s called. - * - * @deprecated has no effect and will be removed in a future release. - * @since 0.2.0 - */ - @Deprecated - static final double MAXIMUM_DISTANCE_BEFORE_OFF_ROUTE = 20; - - /** - * Seconds used before a reroute occurs. - * - * @since 0.2.0 - */ - static final int SECONDS_BEFORE_REROUTE = 3; - - /** - * Accepted deviation excluding horizontal accuracy before the user is considered to be off route. - * - * @since 0.1.0 - */ - static final double USER_LOCATION_SNAPPING_DISTANCE = 10; - - /** - * When calculating whether or not the user is on the route, we look where the user will be given - * their speed and this variable. - * - * @since 0.2.0 - */ - static final double DEAD_RECKONING_TIME_INTERVAL = 1.0; - - /** - * Maximum angle the user puck will be rotated when snapping the user's course to the route line. - * - * @since 0.3.0 - */ - static final int MAX_MANIPULATED_COURSE_ANGLE = 25; - - /** - * Meter radius which the user must be inside for an arrival milestone to be triggered and - * navigation to end. - */ - public static final double METERS_REMAINING_TILL_ARRIVAL = 40; - - /** - * Minimum distance in meters that the user must travel in the wrong direction before the - * off-route logic recognizes the user is moving away from upcoming maneuver - */ - public static final double OFF_ROUTE_MINIMUM_DISTANCE_METERS_BEFORE_WRONG_DIRECTION = 50; - - /** - * Minimum distance in meters that the user must travel in the correct direction before the - * off-route logic recognizes the user is back on the right direction - */ - public static final double OFF_ROUTE_MINIMUM_DISTANCE_METERS_BEFORE_RIGHT_DIRECTION = 20; - - public static final double MINIMUM_DISTANCE_BEFORE_REROUTING = 50; - - /** - * Text to be shown in AlertView during off-route scenario. - */ - public static final String REPORT_PROBLEM = "Report Problem"; - - /** - * Duration in which the AlertView is shown with the "Report Problem" text. - */ - public static final long ALERT_VIEW_PROBLEM_DURATION = 10000; - - /** - * If a set of light / dark themes been set in {@link android.content.SharedPreferences} - */ - public static final String NAVIGATION_VIEW_PREFERENCE_SET_THEME = "navigation_view_theme_preference"; - - /** - * Key for the set light theme in preferences - */ - public static final String NAVIGATION_VIEW_LIGHT_THEME = "navigation_view_light_theme"; - - /** - * Key for the set dark theme in preferences - */ - public static final String NAVIGATION_VIEW_DARK_THEME = "navigation_view_dark_theme"; - - - /** - * Defines the minimum zoom level of the displayed map. - */ - public static final double NAVIGATION_MINIMUM_MAP_ZOOM = 7d; - - /** - * Maximum duration of the zoom/tilt adjustment animation while tracking. - */ - public static final long NAVIGATION_MAX_CAMERA_ADJUSTMENT_ANIMATION_DURATION = 1500L; - - /** - * Minimum duration of the zoom adjustment animation while tracking. - */ - public static final long NAVIGATION_MIN_CAMERA_ZOOM_ADJUSTMENT_ANIMATION_DURATION = 300L; - - /** - * Minimum duration of the tilt adjustment animation while tracking. - */ - public static final long NAVIGATION_MIN_CAMERA_TILT_ADJUSTMENT_ANIMATION_DURATION = 750L; - - /** - * In seconds, how quickly {@link com.mapbox.services.android.navigation.v5.route.FasterRouteDetector} - * will tell {@link RouteProcessorBackgroundThread} to check - * for a faster {@link com.mapbox.api.directions.v5.models.DirectionsRoute}. - * - * @since 0.9.0 - */ - public static final int NAVIGATION_CHECK_FASTER_ROUTE_INTERVAL = 120; - - /** - * 125 seconds remaining is considered a low alert level when - * navigating along a {@link com.mapbox.api.directions.v5.models.LegStep}. - * - * @since 0.9.0 - */ - public static final int NAVIGATION_LOW_ALERT_DURATION = 125; - - /** - * 70 seconds remaining is considered a medium alert level when - * navigating along a {@link com.mapbox.api.directions.v5.models.LegStep}. - * - * @since 0.9.0 - */ - public static final int NAVIGATION_MEDIUM_ALERT_DURATION = 70; - - /** - * 15 seconds remaining is considered a high alert level when - * navigating along a {@link com.mapbox.api.directions.v5.models.LegStep}. - * - * @since 0.10.1 - */ - public static final int NAVIGATION_HIGH_ALERT_DURATION = 15; - - /** - * Default location acceptable accuracy threshold - * used in {@link com.mapbox.services.android.navigation.v5.location.LocationValidator}. - *

- * If a new {@link android.location.Location} update is received from the LocationEngine that has - * an accuracy less than this threshold, the update will be considered valid and all other validation - * is not considered. - * - * @since 0.17.0 - */ - static final int ONE_HUNDRED_METER_ACCEPTABLE_ACCURACY_THRESHOLD = 100; - - static final String NON_NULL_APPLICATION_CONTEXT_REQUIRED = "Non-null application context required."; - - public static final Float[] WAYNAME_OFFSET = {0.0f, 40.0f}; - public static final String MAPBOX_LOCATION_SOURCE = "mapbox-location-source"; - public static final String MAPBOX_WAYNAME_LAYER = "mapbox-wayname-layer"; - public static final String MAPBOX_WAYNAME_ICON = "mapbox-wayname-icon"; - - // Bundle variable keys - public static final String NAVIGATION_VIEW_ROUTE_KEY = "route_json"; - public static final String NAVIGATION_VIEW_SIMULATE_ROUTE = "navigation_view_simulate_route"; - public static final String NAVIGATION_VIEW_ROUTE_PROFILE_KEY = "navigation_view_route_profile"; - public static final String NAVIGATION_VIEW_OFF_ROUTE_ENABLED_KEY = "navigation_view_off_route_enabled"; - public static final String NAVIGATION_VIEW_SNAP_ENABLED_KEY = "navigation_view_snap_enabled"; - - // Step Maneuver Types - public static final String STEP_MANEUVER_TYPE_TURN = "turn"; - public static final String STEP_MANEUVER_TYPE_NEW_NAME = "new name"; - public static final String STEP_MANEUVER_TYPE_DEPART = "depart"; - public static final String STEP_MANEUVER_TYPE_ARRIVE = "arrive"; - public static final String STEP_MANEUVER_TYPE_MERGE = "merge"; - public static final String STEP_MANEUVER_TYPE_ON_RAMP = "on ramp"; - public static final String STEP_MANEUVER_TYPE_OFF_RAMP = "off ramp"; - public static final String STEP_MANEUVER_TYPE_FORK = "fork"; - public static final String STEP_MANEUVER_TYPE_END_OF_ROAD = "end of road"; - public static final String STEP_MANEUVER_TYPE_CONTINUE = "continue"; - public static final String STEP_MANEUVER_TYPE_ROUNDABOUT = "roundabout"; - public static final String STEP_MANEUVER_TYPE_ROTARY = "rotary"; - public static final String STEP_MANEUVER_TYPE_EXIT_ROTARY = "exit rotary"; - public static final String STEP_MANEUVER_TYPE_ROUNDABOUT_TURN = "roundabout turn"; - public static final String STEP_MANEUVER_TYPE_NOTIFICATION = "notification"; - public static final String STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT = "exit roundabout"; - - @StringDef({ - STEP_MANEUVER_TYPE_TURN, - STEP_MANEUVER_TYPE_NEW_NAME, - STEP_MANEUVER_TYPE_DEPART, - STEP_MANEUVER_TYPE_ARRIVE, - STEP_MANEUVER_TYPE_MERGE, - STEP_MANEUVER_TYPE_ON_RAMP, - STEP_MANEUVER_TYPE_OFF_RAMP, - STEP_MANEUVER_TYPE_FORK, - STEP_MANEUVER_TYPE_END_OF_ROAD, - STEP_MANEUVER_TYPE_CONTINUE, - STEP_MANEUVER_TYPE_ROUNDABOUT, - STEP_MANEUVER_TYPE_EXIT_ROUNDABOUT, - STEP_MANEUVER_TYPE_ROTARY, - STEP_MANEUVER_TYPE_ROUNDABOUT_TURN, - STEP_MANEUVER_TYPE_NOTIFICATION - }) - public @interface ManeuverType { - } - - // Step Maneuver Modifiers - public static final String STEP_MANEUVER_MODIFIER_UTURN = "uturn"; - public static final String STEP_MANEUVER_MODIFIER_SHARP_RIGHT = "sharp right"; - public static final String STEP_MANEUVER_MODIFIER_RIGHT = "right"; - public static final String STEP_MANEUVER_MODIFIER_SLIGHT_RIGHT = "slight right"; - public static final String STEP_MANEUVER_MODIFIER_STRAIGHT = "straight"; - public static final String STEP_MANEUVER_MODIFIER_SLIGHT_LEFT = "slight left"; - public static final String STEP_MANEUVER_MODIFIER_LEFT = "left"; - public static final String STEP_MANEUVER_MODIFIER_SHARP_LEFT = "sharp left"; - - @StringDef({ - STEP_MANEUVER_MODIFIER_UTURN, - STEP_MANEUVER_MODIFIER_SHARP_RIGHT, - STEP_MANEUVER_MODIFIER_RIGHT, - STEP_MANEUVER_MODIFIER_SLIGHT_RIGHT, - STEP_MANEUVER_MODIFIER_STRAIGHT, - STEP_MANEUVER_MODIFIER_SLIGHT_LEFT, - STEP_MANEUVER_MODIFIER_LEFT, - STEP_MANEUVER_MODIFIER_SHARP_LEFT - }) - public @interface ManeuverModifier { - } - - // Turn Lane Indication - public static final String TURN_LANE_INDICATION_LEFT = "left"; - public static final String TURN_LANE_INDICATION_SLIGHT_LEFT = "slight left"; - public static final String TURN_LANE_INDICATION_STRAIGHT = "straight"; - public static final String TURN_LANE_INDICATION_RIGHT = "right"; - public static final String TURN_LANE_INDICATION_SLIGHT_RIGHT = "slight right"; - public static final String TURN_LANE_INDICATION_UTURN = "uturn"; - - // Distance Rounding Increments - public static final int ROUNDING_INCREMENT_FIVE = 5; - public static final int ROUNDING_INCREMENT_TEN = 10; - public static final int ROUNDING_INCREMENT_TWENTY_FIVE = 25; - public static final int ROUNDING_INCREMENT_FIFTY = 50; - public static final int ROUNDING_INCREMENT_ONE_HUNDRED = 100; - - @IntDef({ - ROUNDING_INCREMENT_FIVE, - ROUNDING_INCREMENT_TEN, - ROUNDING_INCREMENT_TWENTY_FIVE, - ROUNDING_INCREMENT_FIFTY, - ROUNDING_INCREMENT_ONE_HUNDRED - }) - public @interface RoundingIncrement { - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactory.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactory.java deleted file mode 100644 index f86c0baf..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import com.mapbox.services.android.navigation.v5.navigation.camera.Camera; -import com.mapbox.services.android.navigation.v5.navigation.camera.SimpleCamera; -import com.mapbox.services.android.navigation.v5.offroute.OffRoute; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector; -import com.mapbox.services.android.navigation.v5.route.FasterRoute; -import com.mapbox.services.android.navigation.v5.route.FasterRouteDetector; -import com.mapbox.services.android.navigation.v5.snap.Snap; -import com.mapbox.services.android.navigation.v5.snap.SnapToRoute; - -class NavigationEngineFactory { - - private OffRoute offRouteEngine; - private FasterRoute fasterRouteEngine; - private Snap snapEngine; - private Camera cameraEngine; - - NavigationEngineFactory() { - initializeDefaultEngines(); - } - - OffRoute retrieveOffRouteEngine() { - return offRouteEngine; - } - - void updateOffRouteEngine(OffRoute offRouteEngine) { - if (offRouteEngine == null) { - return; - } - this.offRouteEngine = offRouteEngine; - } - - FasterRoute retrieveFasterRouteEngine() { - return fasterRouteEngine; - } - - void updateFasterRouteEngine(FasterRoute fasterRouteEngine) { - if (fasterRouteEngine == null) { - return; - } - this.fasterRouteEngine = fasterRouteEngine; - } - - Snap retrieveSnapEngine() { - return snapEngine; - } - - void updateSnapEngine(Snap snapEngine) { - if (snapEngine == null) { - return; - } - this.snapEngine = snapEngine; - } - - Camera retrieveCameraEngine() { - return cameraEngine; - } - - void updateCameraEngine(Camera cameraEngine) { - if (cameraEngine == null) { - return; - } - this.cameraEngine = cameraEngine; - } - - private void initializeDefaultEngines() { - cameraEngine = new SimpleCamera(); - snapEngine = new SnapToRoute(); - offRouteEngine = new OffRouteDetector(); - fasterRouteEngine = new FasterRouteDetector(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcher.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcher.java deleted file mode 100644 index 318bb666..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcher.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.location.Location; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener; -import com.mapbox.services.android.navigation.v5.route.FasterRouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -import java.util.concurrent.CopyOnWriteArrayList; - -import timber.log.Timber; - -class NavigationEventDispatcher { - - private CopyOnWriteArrayList navigationEventListeners; - private CopyOnWriteArrayList milestoneEventListeners; - private CopyOnWriteArrayList progressChangeListeners; - private CopyOnWriteArrayList offRouteListeners; - private CopyOnWriteArrayList fasterRouteListeners; - private RouteUtils routeUtils; - - NavigationEventDispatcher() { - this(new RouteUtils()); - } - - NavigationEventDispatcher(RouteUtils routeUtils) { - navigationEventListeners = new CopyOnWriteArrayList<>(); - milestoneEventListeners = new CopyOnWriteArrayList<>(); - progressChangeListeners = new CopyOnWriteArrayList<>(); - offRouteListeners = new CopyOnWriteArrayList<>(); - fasterRouteListeners = new CopyOnWriteArrayList<>(); - this.routeUtils = routeUtils; - } - - void addMilestoneEventListener(@NonNull MilestoneEventListener milestoneEventListener) { - if (milestoneEventListeners.contains(milestoneEventListener)) { - Timber.w("The specified MilestoneEventListener has already been added to the stack."); - return; - } - milestoneEventListeners.add(milestoneEventListener); - } - - void removeMilestoneEventListener(@Nullable MilestoneEventListener milestoneEventListener) { - if (milestoneEventListener == null) { - milestoneEventListeners.clear(); - } else if (!milestoneEventListeners.contains(milestoneEventListener)) { - Timber.w("The specified MilestoneEventListener isn't found in stack, therefore, cannot be removed."); - } else { - milestoneEventListeners.remove(milestoneEventListener); - } - } - - void addProgressChangeListener(@NonNull ProgressChangeListener progressChangeListener) { - if (progressChangeListeners.contains(progressChangeListener)) { - Timber.w("The specified ProgressChangeListener has already been added to the stack."); - return; - } - progressChangeListeners.add(progressChangeListener); - } - - void removeProgressChangeListener(@Nullable ProgressChangeListener progressChangeListener) { - if (progressChangeListener == null) { - progressChangeListeners.clear(); - } else if (!progressChangeListeners.contains(progressChangeListener)) { - Timber.w("The specified ProgressChangeListener isn't found in stack, therefore, cannot be removed."); - } else { - progressChangeListeners.remove(progressChangeListener); - } - } - - void addOffRouteListener(@NonNull OffRouteListener offRouteListener) { - if (offRouteListeners.contains(offRouteListener)) { - Timber.w("The specified OffRouteListener has already been added to the stack."); - return; - } - offRouteListeners.add(offRouteListener); - } - - void removeOffRouteListener(@Nullable OffRouteListener offRouteListener) { - if (offRouteListener == null) { - offRouteListeners.clear(); - } else if (!offRouteListeners.contains(offRouteListener)) { - Timber.w("The specified OffRouteListener isn't found in stack, therefore, cannot be removed."); - } else { - offRouteListeners.remove(offRouteListener); - } - } - - void addNavigationEventListener(@NonNull NavigationEventListener navigationEventListener) { - if (navigationEventListeners.contains(navigationEventListener)) { - Timber.w("The specified NavigationEventListener has already been added to the stack."); - return; - } - this.navigationEventListeners.add(navigationEventListener); - } - - void removeNavigationEventListener(@Nullable NavigationEventListener navigationEventListener) { - if (navigationEventListener == null) { - navigationEventListeners.clear(); - } else if (!navigationEventListeners.contains(navigationEventListener)) { - Timber.w("The specified NavigationEventListener isn't found in stack, therefore, cannot be removed."); - } else { - navigationEventListeners.remove(navigationEventListener); - } - } - - void addFasterRouteListener(@NonNull FasterRouteListener fasterRouteListener) { - if (fasterRouteListeners.contains(fasterRouteListener)) { - Timber.w("The specified FasterRouteListener has already been added to the stack."); - return; - } - fasterRouteListeners.add(fasterRouteListener); - } - - void removeFasterRouteListener(@Nullable FasterRouteListener fasterRouteListener) { - if (fasterRouteListener == null) { - fasterRouteListeners.clear(); - } else if (!fasterRouteListeners.contains(fasterRouteListener)) { - Timber.w("The specified FasterRouteListener isn't found in stack, therefore, cannot be removed."); - } else { - fasterRouteListeners.remove(fasterRouteListener); - } - } - - void onMilestoneEvent(RouteProgress routeProgress, String instruction, Milestone milestone) { - for (MilestoneEventListener milestoneEventListener : milestoneEventListeners) { - milestoneEventListener.onMilestoneEvent(routeProgress, instruction, milestone); - } - } - - void onProgressChange(Location location, RouteProgress routeProgress) { - for (ProgressChangeListener progressChangeListener : progressChangeListeners) { - progressChangeListener.onProgressChange(location, routeProgress); - } - } - - void onUserOffRoute(Location location) { - for (OffRouteListener offRouteListener : offRouteListeners) { - offRouteListener.userOffRoute(location); - } - } - - void onNavigationEvent(boolean isRunning) { - for (NavigationEventListener navigationEventListener : navigationEventListeners) { - navigationEventListener.onRunning(isRunning); - } - } - - void onFasterRouteEvent(DirectionsRoute directionsRoute) { - for (FasterRouteListener fasterRouteListener : fasterRouteListeners) { - fasterRouteListener.fasterRouteFound(directionsRoute); - } - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventListener.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventListener.java deleted file mode 100644 index 91a9be7b..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventListener.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -public interface NavigationEventListener { - void onRunning(boolean running); -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListener.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListener.java deleted file mode 100644 index 2e16fba8..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListener.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.route.FasterRoute; -import com.mapbox.services.android.navigation.v5.route.RouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import timber.log.Timber; - -class NavigationFasterRouteListener implements RouteListener { - - private static final int FIRST_ROUTE = 0; - - private final NavigationEventDispatcher eventDispatcher; - private final FasterRoute fasterRouteEngine; - - NavigationFasterRouteListener(NavigationEventDispatcher eventDispatcher, FasterRoute fasterRouteEngine) { - this.eventDispatcher = eventDispatcher; - this.fasterRouteEngine = fasterRouteEngine; - } - - @Override - public void onResponseReceived(DirectionsResponse response, @Nullable RouteProgress routeProgress) { - if (fasterRouteEngine.isFasterRoute(response, routeProgress)) { - eventDispatcher.onFasterRouteEvent(response.routes().get(FIRST_ROUTE)); - } - } - - @Override - public void onErrorReceived(Throwable throwable) { - Timber.e(throwable); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java deleted file mode 100644 index 4e46e59f..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java +++ /dev/null @@ -1,557 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import static com.mapbox.services.android.navigation.v5.utils.Constants.PRECISION_6; - -import android.location.Location; -import android.util.Pair; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegAnnotation; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.MaxSpeed; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.services.android.navigation.v5.models.StepIntersection; -import com.mapbox.services.android.navigation.v5.models.StepManeuver; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.offroute.OffRoute; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteCallback; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector; -import com.mapbox.services.android.navigation.v5.route.FasterRoute; -import com.mapbox.services.android.navigation.v5.routeprogress.CurrentLegAnnotation; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.snap.Snap; -import com.mapbox.services.android.navigation.v5.utils.MathUtils; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; -import com.mapbox.turf.TurfMisc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import timber.log.Timber; - -/** - * This contains several single purpose methods that help out when a new location update occurs and - * calculations need to be performed on it. - */ -public class NavigationHelper { - - private static final int FIRST_POINT = 0; - private static final int FIRST_INTERSECTION = 0; - private static final int ONE_INDEX = 1; - private static final int INDEX_ZERO = 0; - private static final String EMPTY_STRING = ""; - private static final double ZERO_METERS = 0d; - private static final int TWO_POINTS = 2; - - private NavigationHelper() { - // Empty private constructor to prevent users creating an instance of this class. - } - - static Location buildSnappedLocation(MapboxNavigation mapboxNavigation, boolean snapToRouteEnabled, - Location rawLocation, RouteProgress routeProgress, boolean userOffRoute) { - final Location location; - if (!userOffRoute && snapToRouteEnabled) { - location = getSnappedLocation(mapboxNavigation, rawLocation, routeProgress); - } else { - location = rawLocation; - } - return location; - } - - /** - * When a milestones triggered, it's instruction needs to be built either using the provided - * string or an empty string. - */ - static String buildInstructionString(RouteProgress routeProgress, Milestone milestone) { - if (milestone.getInstruction() != null) { - // Create a new custom instruction based on the Instruction packaged with the Milestone - return milestone.getInstruction().buildInstruction(routeProgress); - } - return EMPTY_STRING; - } - - /** - * Calculates the distance remaining in the step from the current users snapped position, to the - * next maneuver position. - * - * If the user is more than 1km away from the route, we are returning the total step distance. - */ - static double stepDistanceRemaining(Location location, int legIndex, int stepIndex, - DirectionsRoute directionsRoute, List stepPoints) { - // If the linestring coordinate size is less than 2,the distance remaining is zero. - if (stepPoints.size() < 2) { - return 0; - } - - Point locationToPoint = Point.fromLngLat(location.getLongitude(), location.getLatitude()); - - // Uses Turf's pointOnLine, which takes a Point and a LineString to calculate the closest - // Point on the LineString. - Feature feature = TurfMisc.nearestPointOnLine(locationToPoint, stepPoints, TurfConstants.UNIT_KILOMETERS); - - // Check distance to route line, if it's too high, it makes no sense to snap and we assume the step distance is the whole distance of the step - Number distance = feature.getNumberProperty("dist"); - if(distance != null && distance.doubleValue() > 1){ - Timber.i("Distance to step is larger than 1km, so we won't advance the step, distance: %s km",distance.doubleValue()); - return TurfMeasurement.length(stepPoints, TurfConstants.UNIT_METERS); - } - - Point snappedPosition = ((Point) feature.geometry()); - - List steps = directionsRoute.legs().get(legIndex).steps(); - Point nextManeuverPosition = nextManeuverPosition(stepIndex, steps, stepPoints); - - // When the coordinates are empty, no distance can be calculated - if(nextManeuverPosition == null) { - return 0; - } - - // If the users snapped position equals the next maneuver position - if (snappedPosition.equals(nextManeuverPosition)) { - return 0; - } - - LineString slicedLine = TurfMisc.lineSlice(snappedPosition, nextManeuverPosition, LineString.fromLngLats(stepPoints)); - return TurfMeasurement.length(slicedLine, TurfConstants.UNIT_METERS); - } - - /** - * Takes in the already calculated step distance and iterates through the step list from the - * step index value plus one till the end of the leg. - */ - static double legDistanceRemaining(double stepDistanceRemaining, int legIndex, int stepIndex, - DirectionsRoute directionsRoute) { - List steps = directionsRoute.legs().get(legIndex).steps(); - if ((steps.size() < stepIndex + 1)) { - return stepDistanceRemaining; - } - for (int i = stepIndex + 1; i < steps.size(); i++) { - stepDistanceRemaining += steps.get(i).distance(); - } - return stepDistanceRemaining; - } - - /** - * Takes in the leg distance remaining value already calculated and if additional legs need to be - * traversed along after the current one, adds those distances and returns the new distance. - * Otherwise, if the route only contains one leg or the users on the last leg, this value will - * equal the leg distance remaining. - */ - static double routeDistanceRemaining(double legDistanceRemaining, int legIndex, - DirectionsRoute directionsRoute) { - if (directionsRoute.legs().size() < 2) { - return legDistanceRemaining; - } - - for (int i = legIndex + 1; i < directionsRoute.legs().size(); i++) { - legDistanceRemaining += directionsRoute.legs().get(i).distance(); - } - return legDistanceRemaining; - } - - /** - * Checks whether the user's bearing matches the next step's maneuver provided bearingAfter - * variable. This is one of the criteria's required for the user location to be recognized as - * being on the next step or potentially arriving. - *

- * If the expected turn angle is less than the max turn completion offset, this method will - * wait for the step distance remaining to be 0. This way, the step index does not increase - * prematurely. - * - * @param userLocation the location of the user - * @param previousRouteProgress used for getting the most recent route information - * @return boolean true if the user location matches (using a tolerance) the final heading - * @since 0.2.0 - */ - static boolean checkBearingForStepCompletion(Location userLocation, RouteProgress previousRouteProgress, - double stepDistanceRemaining, double maxTurnCompletionOffset) { - if (previousRouteProgress.currentLegProgress().upComingStep() == null) { - return false; - } - - // Bearings need to be normalized so when the bearingAfter is 359 and the user heading is 1, we - // count this as within the MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION. - StepManeuver maneuver = previousRouteProgress.currentLegProgress().upComingStep().maneuver(); - double initialBearing = maneuver.bearingBefore(); - double initialBearingNormalized = MathUtils.wrap(initialBearing, 0, 360); - double finalBearing = maneuver.bearingAfter(); - double finalBearingNormalized = MathUtils.wrap(finalBearing, 0, 360); - - double expectedTurnAngle = MathUtils.differenceBetweenAngles(initialBearingNormalized, finalBearingNormalized); - - double userBearingNormalized = MathUtils.wrap(userLocation.getBearing(), 0, 360); - double userAngleFromFinalBearing = MathUtils.differenceBetweenAngles(finalBearingNormalized, userBearingNormalized); - - if (expectedTurnAngle <= maxTurnCompletionOffset) { - return stepDistanceRemaining == 0; - } else { - return userAngleFromFinalBearing <= maxTurnCompletionOffset; - } - } - - /** - * This is used when a user has completed a step maneuver and the indices need to be incremented. - * The main purpose of this class is to determine if an additional leg exist and the step index - * has met the first legs total size, a leg index needs to occur and step index should be reset. - * Otherwise, the step index is incremented while the leg index remains the same. - *

- * Rather than returning an int array, a new instance of Navigation Indices gets returned. This - * provides type safety and making the code a bit more readable. - *

- * - * @param routeProgress need a routeProgress in order to get the directions route leg list size - * @param previousIndices used for adjusting the indices - * @return a {@link NavigationIndices} object which contains the new leg and step indices - */ - static NavigationIndices increaseIndex(RouteProgress routeProgress, - NavigationIndices previousIndices) { - DirectionsRoute route = routeProgress.directionsRoute(); - int previousStepIndex = previousIndices.stepIndex(); - int previousLegIndex = previousIndices.legIndex(); - int routeLegSize = route.legs().size(); - int legStepSize = route.legs().get(routeProgress.legIndex()).steps().size(); - - boolean isOnLastLeg = previousLegIndex == routeLegSize - 1; - boolean isOnLastStep = previousStepIndex == legStepSize - 1; - - if (isOnLastStep && !isOnLastLeg) { - return NavigationIndices.create((previousLegIndex + 1), 0); - } - - if (isOnLastStep) { - return previousIndices; - } - return NavigationIndices.create(previousLegIndex, (previousStepIndex + 1)); - } - - /** - * Given the current {@link DirectionsRoute} and leg / step index, - * return a list of {@link Point} representing the current step. - *

- * This method is only used on a per-step basis as {@link PolylineUtils#decode(String, int)} - * can be a heavy operation based on the length of the step. - *

- * Returns null if index is invalid. - * - * @param directionsRoute for list of steps - * @param legIndex to get current step list - * @param stepIndex to get current step - * @return list of {@link Point} representing the current step - */ - static List decodeStepPoints(DirectionsRoute directionsRoute, List currentPoints, - int legIndex, int stepIndex) { - List legs = directionsRoute.legs(); - if (hasInvalidLegs(legs)) { - return currentPoints; - } - List steps = legs.get(legIndex).steps(); - if (hasInvalidSteps(steps)) { - return currentPoints; - } - boolean invalidStepIndex = stepIndex < 0 || stepIndex > steps.size() - 1; - if (invalidStepIndex) { - return currentPoints; - } - LegStep step = steps.get(stepIndex); - if (step == null) { - return currentPoints; - } - String stepGeometry = step.geometry(); - if (stepGeometry != null) { - return PolylineUtils.decode(stepGeometry, PRECISION_6); - } - return currentPoints; - } - - /** - * Given a current and upcoming step, this method assembles a list of {@link StepIntersection} - * consisting of all of the current step intersections, as well as the first intersection of - * the upcoming step (if the upcoming step isn't null). - * - * @param currentStep for intersections list - * @param upcomingStep for first intersection, if not null - * @return complete list of intersections - * @since 0.13.0 - */ - @NonNull - public static List createIntersectionsList(@NonNull LegStep currentStep, LegStep upcomingStep) { - List intersectionsWithNextManeuver = new ArrayList<>(); - intersectionsWithNextManeuver.addAll(currentStep.intersections()); - if (upcomingStep != null && !upcomingStep.intersections().isEmpty()) { - intersectionsWithNextManeuver.add(upcomingStep.intersections().get(FIRST_POINT)); - } - return intersectionsWithNextManeuver; - } - - /** - * Creates a list of pairs {@link StepIntersection} and double distance in meters along a step. - *

- * Each pair represents an intersection on the given step and its distance along the step geometry. - *

- * The first intersection is the same point as the first point of the list of step points, so will - * always be zero meters. - * - * @param stepPoints representing the step geometry - * @param intersections along the step to be measured - * @return list of measured intersection pairs - * @since 0.13.0 - */ - @NonNull - public static List> createDistancesToIntersections(List stepPoints, - List intersections) { - boolean lessThanTwoStepPoints = stepPoints.size() < TWO_POINTS; - boolean noIntersections = intersections.isEmpty(); - if (lessThanTwoStepPoints || noIntersections) { - return Collections.emptyList(); - } - - LineString stepLineString = LineString.fromLngLats(stepPoints); - Point firstStepPoint = stepPoints.get(FIRST_POINT); - List> distancesToIntersections = new ArrayList<>(); - - for (StepIntersection intersection : intersections) { - Point intersectionPoint = intersection.location(); - if (firstStepPoint.equals(intersectionPoint)) { - distancesToIntersections.add(new Pair<>(intersection, ZERO_METERS)); - } else { - LineString beginningLineString = TurfMisc.lineSlice(firstStepPoint, intersectionPoint, stepLineString); - double distanceToIntersectionInMeters = TurfMeasurement.length(beginningLineString, TurfConstants.UNIT_METERS); - distancesToIntersections.add(new Pair<>(intersection, distanceToIntersectionInMeters)); - } - } - return distancesToIntersections; - } - - /** - * Based on the list of measured intersections and the step distance traveled, finds - * the current intersection a user is traveling along. - * - * @param intersections along the step - * @param measuredIntersections measured intersections along the step - * @param stepDistanceTraveled how far the user has traveled along the step - * @return the current step intersection - * @since 0.13.0 - */ - public static StepIntersection findCurrentIntersection(@NonNull List intersections, - @NonNull List> measuredIntersections, - double stepDistanceTraveled) { - for (Pair measuredIntersection : measuredIntersections) { - if (measuredIntersection.first == null) - return intersections.get(0); - double intersectionDistance = measuredIntersection.second; - int intersectionIndex = measuredIntersections.indexOf(measuredIntersection); - int nextIntersectionIndex = intersectionIndex + ONE_INDEX; - int measuredIntersectionSize = measuredIntersections.size(); - boolean hasValidNextIntersection = nextIntersectionIndex < measuredIntersectionSize; - - if (hasValidNextIntersection) { - double nextIntersectionDistance = measuredIntersections.get(nextIntersectionIndex).second; - if (stepDistanceTraveled > intersectionDistance && stepDistanceTraveled < nextIntersectionDistance) { - return measuredIntersection.first; - } - } else if (stepDistanceTraveled > measuredIntersection.second) { - return measuredIntersection.first; - } else { - return measuredIntersections.get(FIRST_INTERSECTION).first; - } - } - return intersections.get(FIRST_INTERSECTION); - } - - /** - * Based on the current intersection index, add one and try to get the upcoming. - *

- * If there is not an upcoming intersection on the step, check for an upcoming step and - * return the first intersection from the upcoming step. - * - * @param intersections for the current step - * @param upcomingStep for the first intersection if needed - * @param currentIntersection being traveled along - * @return the upcoming intersection on the step - * @since 0.13.0 - */ - public static StepIntersection findUpcomingIntersection(@NonNull List intersections, - @Nullable LegStep upcomingStep, - StepIntersection currentIntersection) { - int intersectionIndex = intersections.indexOf(currentIntersection); - int nextIntersectionIndex = intersectionIndex + ONE_INDEX; - int intersectionSize = intersections.size(); - boolean isValidUpcomingIntersection = nextIntersectionIndex < intersectionSize; - if (isValidUpcomingIntersection) { - return intersections.get(nextIntersectionIndex); - } else if (upcomingStep != null) { - List upcomingIntersections = upcomingStep.intersections(); - if (upcomingIntersections != null && !upcomingIntersections.isEmpty()) { - return upcomingIntersections.get(FIRST_INTERSECTION); - } - } - return null; - } - - /** - * Given a list of distance annotations, find the current annotation index. This index retrieves the - * current annotation from any provided annotation list in {@link LegAnnotation}. - * - * @param currentLegAnnotation current annotation being traveled along - * @param leg holding each list of annotations - * @param legDistanceRemaining to determine the new set of annotations - * @return a current set of annotation data for the user's position along the route - */ - @Nullable - public static CurrentLegAnnotation createCurrentAnnotation(CurrentLegAnnotation currentLegAnnotation, - RouteLeg leg, double legDistanceRemaining) { - LegAnnotation legAnnotation = leg.annotation(); - if (legAnnotation == null) { - return null; - } - List distanceList = legAnnotation.distance(); - if (distanceList == null || distanceList.isEmpty()) { - return null; - } - - CurrentLegAnnotation.Builder annotationBuilder = CurrentLegAnnotation.builder(); - int annotationIndex = findAnnotationIndex( - currentLegAnnotation, annotationBuilder, leg, legDistanceRemaining, distanceList - ); - - annotationBuilder.distance(distanceList.get(annotationIndex)); - List durationList = legAnnotation.duration(); - if (durationList != null) { - annotationBuilder.duration(durationList.get(annotationIndex)); - } - List speedList = legAnnotation.speed(); - if (speedList != null) { - annotationBuilder.speed(speedList.get(annotationIndex)); - } - List maxspeedList = legAnnotation.maxspeed(); - if (maxspeedList != null) { - annotationBuilder.maxspeed(maxspeedList.get(annotationIndex)); - } - List congestionList = legAnnotation.congestion(); - if (congestionList != null) { - annotationBuilder.congestion(congestionList.get(annotationIndex)); - } - annotationBuilder.index(annotationIndex); - return annotationBuilder.build(); - } - - /** - * This method runs through the list of milestones in {@link MapboxNavigation#getMilestones()} - * and returns a list of occurring milestones (if any), based on their individual criteria. - * - * @param previousRouteProgress for checking if milestone is occurring - * @param routeProgress for checking if milestone is occurring - * @param mapboxNavigation for list of milestones - * @return list of occurring milestones - */ - static List checkMilestones(RouteProgress previousRouteProgress, - RouteProgress routeProgress, - MapboxNavigation mapboxNavigation) { - List milestones = new ArrayList<>(); - for (Milestone milestone : mapboxNavigation.getMilestones()) { - if (milestone.isOccurring(previousRouteProgress, routeProgress)) { - milestones.add(milestone); - } - } - return milestones; - } - - /** - * This method checks if off route detection is enabled or disabled. - *

- * If enabled, the off route engine is retrieved from {@link MapboxNavigation} and - * {@link OffRouteDetector#isUserOffRoute(Location, RouteProgress, MapboxNavigationOptions)} is called - * to determine if the location is on or off route. - * - * @param navigationLocationUpdate containing new location and navigation objects - * @param routeProgress to be used in off route check - * @param callback only used if using our default {@link OffRouteDetector} - * @return true if on route, false otherwise - */ - static boolean isUserOffRoute(NavigationLocationUpdate navigationLocationUpdate, RouteProgress routeProgress, - OffRouteCallback callback) { - MapboxNavigationOptions options = navigationLocationUpdate.mapboxNavigation().options(); - if (!options.enableOffRouteDetection()) { - return false; - } - OffRoute offRoute = navigationLocationUpdate.mapboxNavigation().getOffRouteEngine(); - setOffRouteDetectorCallback(offRoute, callback); - Location location = navigationLocationUpdate.location(); - return offRoute.isUserOffRoute(location, routeProgress, options); - } - - static boolean shouldCheckFasterRoute(NavigationLocationUpdate navigationLocationUpdate, - RouteProgress routeProgress) { - if(navigationLocationUpdate == null) - return false; - FasterRoute fasterRoute = navigationLocationUpdate.mapboxNavigation().getFasterRouteEngine(); - return fasterRoute.shouldCheckFasterRoute(navigationLocationUpdate.location(), routeProgress); - } - - /** - * Retrieves the next steps maneuver position if one exist, otherwise it decodes the current steps - * geometry and uses the last coordinate in the position list. - */ - @Nullable - static Point nextManeuverPosition(int stepIndex, List steps, List coords) { - // If there is an upcoming step, use it's maneuver as the position. - if (steps.size() > (stepIndex + 1)) { - return steps.get(stepIndex + 1).maneuver().location(); - } - return !coords.isEmpty() ? coords.get(coords.size() - 1) : null; - } - - private static int findAnnotationIndex(CurrentLegAnnotation currentLegAnnotation, - CurrentLegAnnotation.Builder annotationBuilder, RouteLeg leg, - double legDistanceRemaining, List distanceAnnotationList) { - List legDistances = new ArrayList<>(distanceAnnotationList); - Double totalLegDistance = leg.distance(); - double distanceTraveled = totalLegDistance - legDistanceRemaining; - - int distanceIndex = 0; - double annotationDistancesTraveled = 0; - if (currentLegAnnotation != null) { - distanceIndex = currentLegAnnotation.index(); - annotationDistancesTraveled = currentLegAnnotation.distanceToAnnotation(); - } - for (int i = distanceIndex; i < legDistances.size(); i++) { - Double distance = legDistances.get(i); - annotationDistancesTraveled += distance; - if (annotationDistancesTraveled > distanceTraveled || i == legDistances.size() -1 ) { - double distanceToAnnotation = annotationDistancesTraveled - distance; - annotationBuilder.distanceToAnnotation(distanceToAnnotation); - return i; - } - } - return INDEX_ZERO; - } - - private static Location getSnappedLocation(MapboxNavigation mapboxNavigation, Location location, - RouteProgress routeProgress) { - Snap snap = mapboxNavigation.getSnapEngine(); - return snap.getSnappedLocation(location, routeProgress); - } - - private static void setOffRouteDetectorCallback(OffRoute offRoute, OffRouteCallback callback) { - if (offRoute instanceof OffRouteDetector) { - ((OffRouteDetector) offRoute).setOffRouteCallback(callback); - } - } - - private static boolean hasInvalidLegs(List legs) { - return legs == null || legs.isEmpty(); - } - - private static boolean hasInvalidSteps(List steps) { - return steps == null || steps.isEmpty(); - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationIndices.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationIndices.java deleted file mode 100644 index 28657e41..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationIndices.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import com.google.auto.value.AutoValue; - -@AutoValue -abstract class NavigationIndices { - - static NavigationIndices create(int legIndex, int stepIndex) { - return new AutoValue_NavigationIndices(legIndex, stepIndex); - } - - abstract int legIndex(); - - abstract int stepIndex(); -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLifecycleMonitor.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLifecycleMonitor.java deleted file mode 100644 index a3c82959..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLifecycleMonitor.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.app.Activity; -import android.app.Application; -import android.content.res.Configuration; -import android.os.Bundle; - -import java.util.ArrayList; - -public class NavigationLifecycleMonitor implements Application.ActivityLifecycleCallbacks { - - private static final int ONE_HUNDRED_PERCENT = 100; - - private long startSessionTime = 0; - private ArrayList resumes; - private ArrayList pauses; - private Integer currentOrientation; - private long portraitStartTime = 0; - private double portraitTimeInMillis = 0; - - NavigationLifecycleMonitor(Application application) { - application.registerActivityLifecycleCallbacks(this); - startSessionTime = System.currentTimeMillis(); - resumes = new ArrayList<>(); - pauses = new ArrayList<>(); - initCurrentOrientation(application); - } - - @Override - public void onActivityStarted(Activity activity) { - int newOrientation = activity.getResources().getConfiguration().orientation; - // If a new orientation is found, set it to the current - if (!currentOrientation.equals(newOrientation)) { - currentOrientation = newOrientation; - long currentTimeMillis = System.currentTimeMillis(); - // If the current orientation is now landscape, add the time the phone was just in portrait - if (currentOrientation.equals(Configuration.ORIENTATION_LANDSCAPE)) { - portraitTimeInMillis = portraitTimeInMillis + (currentTimeMillis - portraitStartTime); - } else if (currentOrientation.equals(Configuration.ORIENTATION_PORTRAIT)) { - portraitStartTime = currentTimeMillis; - } - } - } - - @Override - public void onActivityResumed(Activity activity) { - resumes.add(System.currentTimeMillis()); - } - - @Override - public void onActivityPaused(Activity activity) { - pauses.add(System.currentTimeMillis()); - } - - @Override - public void onActivityDestroyed(Activity activity) { - if (activity.isFinishing()) { - activity.getApplication().unregisterActivityLifecycleCallbacks(this); - } - } - - //region Unused Lifecycle Methods - - @Override - public void onActivityCreated(Activity activity, Bundle bundle) { - - } - - @Override - public void onActivityStopped(Activity activity) { - - } - - @Override - public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { - - } - - //endregion - - int obtainPortraitPercentage() { - // If no changes to landscape - if (currentOrientation.equals(Configuration.ORIENTATION_PORTRAIT) && portraitTimeInMillis == 0) { - return ONE_HUNDRED_PERCENT; - } - // Calculate given the time spent in portrait - double portraitFraction = portraitTimeInMillis / (System.currentTimeMillis() - startSessionTime); - return (int) (ONE_HUNDRED_PERCENT * portraitFraction); - } - - int obtainForegroundPercentage() { - long currentTime = System.currentTimeMillis(); - double foregroundTime = calculateForegroundTime(currentTime); - return (int) (100 * (foregroundTime / (currentTime - startSessionTime))); - } - - private void initCurrentOrientation(Application application) { - currentOrientation = application.getResources().getConfiguration().orientation; - // If starting in portrait, set the portrait start time - if (currentOrientation.equals(Configuration.ORIENTATION_PORTRAIT)) { - portraitStartTime = System.currentTimeMillis(); - } - } - - private double calculateForegroundTime(long currentTime) { - ArrayList tempResumes = new ArrayList<>(resumes); - - // If the activity was destroyed while in the background - if (tempResumes.size() < pauses.size() && pauses.size() > 0) { - tempResumes.add(currentTime); - } - long resumePauseDiff = 0; - for (int i = 0; i < tempResumes.size(); i++) { - if (i < pauses.size()) { - resumePauseDiff = resumePauseDiff + (tempResumes.get(i) - pauses.get(i)); - } - } - return currentTime - resumePauseDiff - startSessionTime; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineListener.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineListener.java deleted file mode 100644 index a84025af..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineListener.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.location.Location; - -import androidx.annotation.NonNull; - -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback; -import com.mapbox.mapboxsdk.location.engine.LocationEngineResult; -import com.mapbox.services.android.navigation.v5.location.LocationValidator; - -class NavigationLocationEngineListener implements LocationEngineCallback { - - private final RouteProcessorBackgroundThread thread; - private final LocationValidator validator; - private final LocationEngine locationEngine; - private MapboxNavigation mapboxNavigation; - - NavigationLocationEngineListener(RouteProcessorBackgroundThread thread, MapboxNavigation mapboxNavigation, - LocationEngine locationEngine, LocationValidator validator) { - this.thread = thread; - this.mapboxNavigation = mapboxNavigation; - this.locationEngine = locationEngine; - this.validator = validator; - } - - boolean isValidLocationUpdate(Location location) { - return location != null && validator.isValidUpdate(location); - } - - /** - * Queues a new task created from a location update to be sent - * to {@link RouteProcessorBackgroundThread} for processing. - * - * @param location to be processed - */ - void queueLocationUpdate(Location location) { - thread.queueUpdate(NavigationLocationUpdate.create(location, mapboxNavigation)); - } - - @Override - public void onSuccess(LocationEngineResult result) { - if (isValidLocationUpdate(result.getLastLocation())) { - queueLocationUpdate(result.getLastLocation()); - } - } - - @Override - public void onFailure(@NonNull Exception exception) { - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineUpdater.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineUpdater.java deleted file mode 100644 index 282a94f2..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationEngineUpdater.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.annotation.SuppressLint; -import android.location.Location; -import android.os.Looper; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback; -import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest; -import com.mapbox.mapboxsdk.location.engine.LocationEngineResult; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -import timber.log.Timber; - -class NavigationLocationEngineUpdater { - - private static final int LOCATION_ENGINE_INTERVAL = 1000; - - private final NavigationLocationEngineListener listener; - private RouteUtils routeUtils; - private LocationEngine locationEngine; - - NavigationLocationEngineUpdater(LocationEngine locationEngine, - NavigationLocationEngineListener listener) { - this.locationEngine = locationEngine; - this.listener = listener; - requestLocationUpdates(); - } - - void updateLocationEngine(LocationEngine locationEngine) { - removeLocationEngineListener(); - this.locationEngine = locationEngine; - requestLocationUpdates(); - } - - @SuppressLint("MissingPermission") - private void requestLocationUpdates() { - this.locationEngine.requestLocationUpdates( - new LocationEngineRequest.Builder(LOCATION_ENGINE_INTERVAL).setFastestInterval( - LOCATION_ENGINE_INTERVAL).build(), listener, Looper.getMainLooper()); - } - - @SuppressWarnings("MissingPermission") - void forceLocationUpdate(final DirectionsRoute route) { - locationEngine.getLastLocation(new LocationEngineCallback() { - @Override - public void onSuccess(LocationEngineResult result) { - Location location = result.getLastLocation(); - if (!listener.isValidLocationUpdate(location)) { - routeUtils = obtainRouteUtils(); - location = routeUtils.createFirstLocationFromRoute(route); - } - listener.queueLocationUpdate(location); - } - - @Override - public void onFailure(@NonNull Exception exception) { - Timber.w(exception, "Cannot get a forced location update"); - } - }); - - } - - void removeLocationEngineListener() { - locationEngine.removeLocationUpdates(listener); - } - - private RouteUtils obtainRouteUtils() { - if (routeUtils == null) { - return new RouteUtils(); - } - return routeUtils; - } -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationUpdate.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationUpdate.java deleted file mode 100644 index 8343739f..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationLocationUpdate.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.location.Location; - -import com.google.auto.value.AutoValue; - -@AutoValue -abstract class NavigationLocationUpdate { - - static NavigationLocationUpdate create(Location location, MapboxNavigation mapboxNavigation) { - return new AutoValue_NavigationLocationUpdate(location, mapboxNavigation); - } - - abstract Location location(); - - abstract MapboxNavigation mapboxNavigation(); -} diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationMapRoute.java b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationMapRoute.java deleted file mode 100644 index 3ad50aff..00000000 --- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationMapRoute.java +++ /dev/null @@ -1,1148 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -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.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.layers.Property.ICON_ROTATION_ALIGNMENT_MAP; -import static com.mapbox.mapboxsdk.style.layers.Property.NONE; -import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; - -import androidx.annotation.ColorInt; -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.Size; -import androidx.annotation.StyleRes; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleObserver; -import androidx.lifecycle.OnLifecycleEvent; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -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.Layer; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.MathUtils; -import com.mapbox.services.android.navigation.R; -import com.mapbox.services.android.navigation.v5.route.MapRouteProgressChangeListener; -import com.mapbox.services.android.navigation.v5.route.OnRouteSelectionChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.Constants; -import com.mapbox.services.android.navigation.v5.utils.MapImageUtils; -import com.mapbox.services.android.navigation.v5.utils.MapUtils; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; -import com.mapbox.turf.TurfMisc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; - -/** - * Provide a route using {@link NavigationMapRoute#addRoutes(List)} and a route will be drawn using - * runtime styling. The route will automatically be placed below all labels independent of specific - * style. If the map styles changed when a routes drawn on the map, the route will automatically be - * redrawn onto the new map style. If during a navigation session, the user gets re-routed, the - * route line will be redrawn to reflect the new geometry. To remove the route from the map, use - * {@link NavigationMapRoute#removeRoute()}. - *

- * You are given the option when first constructing an instance of this class to pass in a style - * resource. This allows for custom colorizing and line scaling of the route. Inside your - * applications {@code style.xml} file, you extend {@code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25dp - 125dp - - - - \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/de.json b/libandroid-navigation/src/main/resources/translations/de.json deleted file mode 100644 index 96b03150..00000000 --- a/libandroid-navigation/src/main/resources/translations/de.json +++ /dev/null @@ -1,397 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "erste", - "2": "zweite", - "3": "dritte", - "4": "vierte", - "5": "fünfte", - "6": "sechste", - "7": "siebente", - "8": "achte", - "9": "neunte", - "10": "zehnte" - }, - "direction": { - "north": "Norden", - "northeast": "Nordosten", - "east": "Osten", - "southeast": "Südosten", - "south": "Süden", - "southwest": "Südwesten", - "west": "Westen", - "northwest": "Nordwesten" - }, - "modifier": { - "left": "links", - "right": "rechts", - "sharp left": "scharf links", - "sharp right": "scharf rechts", - "slight left": "leicht links", - "slight right": "leicht rechts", - "straight": "geradeaus", - "uturn": "180°-Wendung" - }, - "lanes": { - "xo": "Rechts halten", - "ox": "Links halten", - "xox": "Mittlere Spur nutzen", - "oxo": "Rechts oder links halten" - } - }, - "modes": { - "ferry": { - "default": "Fähre nehmen", - "name": "Fähre nehmen {way_name}", - "destination": "Fähre nehmen Richtung {destination}" - } - }, - "arrive": { - "default": { - "default": "Sie haben Ihr {nth} Ziel erreicht" - }, - "left": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich links von Ihnen" - }, - "right": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich rechts von Ihnen" - }, - "sharp left": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich links von Ihnen" - }, - "sharp right": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich rechts von Ihnen" - }, - "slight right": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich rechts von Ihnen" - }, - "slight left": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich links von Ihnen" - }, - "straight": { - "default": "Sie haben Ihr {nth} Ziel erreicht, es befindet sich direkt vor Ihnen" - } - }, - "continue": { - "default": { - "default": "{modifier} weiterfahren", - "name": "{modifier} weiterfahren auf {way_name}", - "destination": "{modifier} weiterfahren Richtung {destination}" - }, - "slight left": { - "default": "Leicht links weiter", - "name": "Leicht links weiter auf {way_name}", - "destination": "Leicht links weiter Richtung {destination}" - }, - "slight right": { - "default": "Leicht rechts weiter", - "name": "Leicht rechts weiter auf {way_name}", - "destination": "Leicht rechts weiter Richtung {destination}" - }, - "uturn": { - "default": "180°-Wendung", - "name": "180°-Wendung auf {way_name}", - "destination": "180°-Wendung Richtung {destination}" - } - }, - "depart": { - "default": { - "default": "Fahren Sie Richtung {direction}", - "name": "Fahren Sie Richtung {direction} auf {way_name}" - } - }, - "end of road": { - "default": { - "default": "{modifier} abbiegen", - "name": "{modifier} abbiegen auf {way_name}", - "destination": "{modifier} abbiegen Richtung {destination}" - }, - "straight": { - "default": "Geradeaus weiterfahren", - "name": "Geradeaus weiterfahren auf {way_name}", - "destination": "Geradeaus weiterfahren Richtung {destination}" - }, - "uturn": { - "default": "180°-Wendung am Ende der Straße", - "name": "180°-Wendung auf {way_name} am Ende der Straße", - "destination": "180°-Wendung Richtung {destination} am Ende der Straße" - } - }, - "fork": { - "default": { - "default": "{modifier} halten an der Gabelung", - "name": "{modifier} halten an der Gabelung auf {way_name}", - "destination": "{modifier} halten an der Gabelung Richtung {destination}" - }, - "slight left": { - "default": "Links halten an der Gabelung", - "name": "Links halten an der Gabelung auf {way_name}", - "destination": "Links halten an der Gabelung Richtung {destination}" - }, - "slight right": { - "default": "Rechts halten an der Gabelung", - "name": "Rechts halten an der Gabelung auf {way_name}", - "destination": "Rechts halten an der Gabelung Richtung {destination}" - }, - "sharp left": { - "default": "Scharf links abbiegen an der Gabelung", - "name": "Scharf links abbiegen an der Gabelung auf {way_name}", - "destination": "Scharf links abbiegen an der Gabelung Richtung {destination}" - }, - "sharp right": { - "default": "Scharf rechts abbiegen an der Gabelung", - "name": "Scharf rechts abbiegen an der Gabelung auf {way_name}", - "destination": "Scharf rechts abbiegen an der Gabelung Richtung {destination}" - }, - "uturn": { - "default": "180°-Wendung", - "name": "180°-Wendung auf {way_name}", - "destination": "180°-Wendung Richtung {destination}" - } - }, - "merge": { - "default": { - "default": "{modifier} auffahren", - "name": "{modifier} auffahren auf {way_name}", - "destination": "{modifier} auffahren Richtung {destination}" - }, - "slight left": { - "default": "Leicht links auffahren", - "name": "Leicht links auffahren auf {way_name}", - "destination": "Leicht links auffahren Richtung {destination}" - }, - "slight right": { - "default": "Leicht rechts auffahren", - "name": "Leicht rechts auffahren auf {way_name}", - "destination": "Leicht rechts auffahren Richtung {destination}" - }, - "sharp left": { - "default": "Scharf links auffahren", - "name": "Scharf links auffahren auf {way_name}", - "destination": "Scharf links auffahren Richtung {destination}" - }, - "sharp right": { - "default": "Scharf rechts auffahren", - "name": "Scharf rechts auffahren auf {way_name}", - "destination": "Scharf rechts auffahren Richtung {destination}" - }, - "uturn": { - "default": "180°-Wendung", - "name": "180°-Wendung auf {way_name}", - "destination": "180°-Wendung Richtung {destination}" - } - }, - "new name": { - "default": { - "default": "{modifier} weiterfahren", - "name": "{modifier} weiterfahren auf {way_name}", - "destination": "{modifier} weiterfahren Richtung {destination}" - }, - "sharp left": { - "default": "Scharf links", - "name": "Scharf links auf {way_name}", - "destination": "Scharf links Richtung {destination}" - }, - "sharp right": { - "default": "Scharf rechts", - "name": "Scharf rechts auf {way_name}", - "destination": "Scharf rechts Richtung {destination}" - }, - "slight left": { - "default": "Leicht links weiter", - "name": "Leicht links weiter auf {way_name}", - "destination": "Leicht links weiter Richtung {destination}" - }, - "slight right": { - "default": "Leicht rechts weiter", - "name": "Leicht rechts weiter auf {way_name}", - "destination": "Leicht rechts weiter Richtung {destination}" - }, - "uturn": { - "default": "180°-Wendung", - "name": "180°-Wendung auf {way_name}", - "destination": "180°-Wendung Richtung {destination}" - } - }, - "notification": { - "default": { - "default": "{modifier} weiterfahren", - "name": "{modifier} weiterfahren auf {way_name}", - "destination": "{modifier} weiterfahren Richtung {destination}" - }, - "uturn": { - "default": "180°-Wendung", - "name": "180°-Wendung auf {way_name}", - "destination": "180°-Wendung Richtung {destination}" - } - }, - "off ramp": { - "default": { - "default": "Rampe nehmen", - "name": "Rampe nehmen auf {way_name}", - "destination": "Rampe nehmen Richtung {destination}" - }, - "left": { - "default": "Rampe auf der linken Seite nehmen", - "name": "Rampe auf der linken Seite nehmen auf {way_name}", - "destination": "Rampe auf der linken Seite nehmen Richtung {destination}" - }, - "right": { - "default": "Rampe auf der rechten Seite nehmen", - "name": "Rampe auf der rechten Seite nehmen auf {way_name}", - "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}" - }, - "sharp left": { - "default": "Rampe auf der linken Seite nehmen", - "name": "Rampe auf der linken Seite nehmen auf {way_name}", - "destination": "Rampe auf der linken Seite nehmen Richtung {destination}" - }, - "sharp right": { - "default": "Rampe auf der rechten Seite nehmen", - "name": "Rampe auf der rechten Seite nehmen auf {way_name}", - "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}" - }, - "slight left": { - "default": "Rampe auf der linken Seite nehmen", - "name": "Rampe auf der linken Seite nehmen auf {way_name}", - "destination": "Rampe auf der linken Seite nehmen Richtung {destination}" - }, - "slight right": { - "default": "Rampe auf der rechten Seite nehmen", - "name": "Rampe auf der rechten Seite nehmen auf {way_name}", - "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}" - } - }, - "on ramp": { - "default": { - "default": "Rampe nehmen", - "name": "Rampe nehmen auf {way_name}", - "destination": "Rampe nehmen Richtung {destination}" - }, - "left": { - "default": "Rampe auf der linken Seite nehmen", - "name": "Rampe auf der linken Seite nehmen auf {way_name}", - "destination": "Rampe auf der linken Seite nehmen Richtung {destination}" - }, - "right": { - "default": "Rampe auf der rechten Seite nehmen", - "name": "Rampe auf der rechten Seite nehmen auf {way_name}", - "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}" - }, - "sharp left": { - "default": "Rampe auf der linken Seite nehmen", - "name": "Rampe auf der linken Seite nehmen auf {way_name}", - "destination": "Rampe auf der linken Seite nehmen Richtung {destination}" - }, - "sharp right": { - "default": "Rampe auf der rechten Seite nehmen", - "name": "Rampe auf der rechten Seite nehmen auf {way_name}", - "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}" - }, - "slight left": { - "default": "Rampe auf der linken Seite nehmen", - "name": "Rampe auf der linken Seite nehmen auf {way_name}", - "destination": "Rampe auf der linken Seite nehmen Richtung {destination}" - }, - "slight right": { - "default": "Rampe auf der rechten Seite nehmen", - "name": "Rampe auf der rechten Seite nehmen auf {way_name}", - "destination": "Rampe auf der rechten Seite nehmen Richtung {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "In den Kreisverkehr fahren", - "name": "In den Kreisverkehr fahren und auf {way_name} verlassen", - "destination": "In den Kreisverkehr fahren und Richtung {destination} verlassen" - }, - "name": { - "default": "In {rotary_name} fahren", - "name": "In {rotary_name} fahren und auf {way_name} verlassen", - "destination": "In {rotary_name} fahren und Richtung {destination} verlassen" - }, - "exit": { - "default": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen", - "name": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen auf {way_name}", - "destination": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen Richtung {destination}" - }, - "name_exit": { - "default": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen", - "name": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen auf {way_name}", - "destination": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen Richtung {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen", - "name": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen auf {way_name}", - "destination": "In den Kreisverkehr fahren und {exit_number} Ausfahrt nehmen Richtung {destination}" - }, - "default": { - "default": "In den Kreisverkehr fahren", - "name": "In den Kreisverkehr fahren und auf {way_name} verlassen", - "destination": "In den Kreisverkehr fahren und Richtung {destination} verlassen" - } - } - }, - "roundabout turn": { - "default": { - "default": "Am Kreisverkehr {modifier}", - "name": "Am Kreisverkehr {modifier} auf {way_name}", - "destination": "Am Kreisverkehr {modifier} Richtung {destination}" - }, - "left": { - "default": "Am Kreisverkehr links", - "name": "Am Kreisverkehr links auf {way_name}", - "destination": "Am Kreisverkehr links Richtung {destination}" - }, - "right": { - "default": "Am Kreisverkehr rechts", - "name": "Am Kreisverkehr rechts auf {way_name}", - "destination": "Am Kreisverkehr rechts Richtung {destination}" - }, - "straight": { - "default": "Am Kreisverkehr geradeaus weiterfahren", - "name": "Am Kreisverkehr geradeaus weiterfahren auf {way_name}", - "destination": "Am Kreisverkehr geradeaus weiterfahren Richtung {destination}" - } - }, - "turn": { - "default": { - "default": "{modifier} abbiegen", - "name": "{modifier} abbiegen auf {way_name}", - "destination": "{modifier} abbiegen Richtung {destination}" - }, - "left": { - "default": "Links abbiegen", - "name": "Links abbiegen auf {way_name}", - "destination": "Links abbiegen Richtung {destination}" - }, - "right": { - "default": "Rechts abbiegen", - "name": "Rechts abbiegen auf {way_name}", - "destination": "Rechts abbiegen Richtung {destination}" - }, - "straight": { - "default": "Geradeaus weiterfahren", - "name": "Geradeaus weiterfahren auf {way_name}", - "destination": "Geradeaus weiterfahren Richtung {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Geradeaus weiterfahren" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/en.json b/libandroid-navigation/src/main/resources/translations/en.json deleted file mode 100644 index d96c3ff6..00000000 --- a/libandroid-navigation/src/main/resources/translations/en.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "1st", - "2": "2nd", - "3": "3rd", - "4": "4th", - "5": "5th", - "6": "6th", - "7": "7th", - "8": "8th", - "9": "9th", - "10": "10th" - }, - "direction": { - "north": "north", - "northeast": "northeast", - "east": "east", - "southeast": "southeast", - "south": "south", - "southwest": "southwest", - "west": "west", - "northwest": "northwest" - }, - "modifier": { - "left": "left", - "right": "right", - "sharp left": "sharp left", - "sharp right": "sharp right", - "slight left": "slight left", - "slight right": "slight right", - "straight": "straight", - "uturn": "U-turn" - }, - "lanes": { - "xo": "Keep right", - "ox": "Keep left", - "xox": "Keep in the middle", - "oxo": "Keep left or right" - } - }, - "modes": { - "ferry": { - "default": "Take the ferry", - "name": "Take the ferry {way_name}", - "destination": "Take the ferry towards {destination}" - } - }, - "arrive": { - "default": { - "default": "You have arrived at your {nth} destination" - }, - "left": { - "default": "You have arrived at your {nth} destination, on the left" - }, - "right": { - "default": "You have arrived at your {nth} destination, on the right" - }, - "sharp left": { - "default": "You have arrived at your {nth} destination, on the left" - }, - "sharp right": { - "default": "You have arrived at your {nth} destination, on the right" - }, - "slight right": { - "default": "You have arrived at your {nth} destination, on the right" - }, - "slight left": { - "default": "You have arrived at your {nth} destination, on the left" - }, - "straight": { - "default": "You have arrived at your {nth} destination, straight ahead" - } - }, - "continue": { - "default": { - "default": "Continue {modifier}", - "name": "Continue {modifier} onto {way_name}", - "destination": "Continue {modifier} towards {destination}" - }, - "straight": { - "default": "Continue straight", - "name": "Continue onto {way_name}", - "destination": "Continue towards {destination}" - }, - "slight left": { - "default": "Continue slightly left", - "name": "Continue slightly left onto {way_name}", - "destination": "Continue slightly left towards {destination}" - }, - "slight right": { - "default": "Continue slightly right", - "name": "Continue slightly right onto {way_name}", - "destination": "Continue slightly right towards {destination}" - }, - "uturn": { - "default": "Make a U-turn", - "name": "Make a U-turn onto {way_name}", - "destination": "Make a U-turn towards {destination}" - } - }, - "depart": { - "default": { - "default": "Head {direction}", - "name": "Head {direction} on {way_name}" - } - }, - "end of road": { - "default": { - "default": "Turn {modifier}", - "name": "Turn {modifier} onto {way_name}", - "destination": "Turn {modifier} towards {destination}" - }, - "straight": { - "default": "Continue straight", - "name": "Continue straight onto {way_name}", - "destination": "Continue straight towards {destination}" - }, - "uturn": { - "default": "Make a U-turn at the end of the road", - "name": "Make a U-turn onto {way_name} at the end of the road", - "destination": "Make a U-turn towards {destination} at the end of the road" - } - }, - "fork": { - "default": { - "default": "Keep {modifier} at the fork", - "name": "Keep {modifier} at the fork onto {way_name}", - "destination": "Keep {modifier} at the fork towards {destination}" - }, - "slight left": { - "default": "Keep left at the fork", - "name": "Keep left at the fork onto {way_name}", - "destination": "Keep left at the fork towards {destination}" - }, - "slight right": { - "default": "Keep right at the fork", - "name": "Keep right at the fork onto {way_name}", - "destination": "Keep right at the fork towards {destination}" - }, - "sharp left": { - "default": "Take a sharp left at the fork", - "name": "Take a sharp left at the fork onto {way_name}", - "destination": "Take a sharp left at the fork towards {destination}" - }, - "sharp right": { - "default": "Take a sharp right at the fork", - "name": "Take a sharp right at the fork onto {way_name}", - "destination": "Take a sharp right at the fork towards {destination}" - }, - "uturn": { - "default": "Make a U-turn", - "name": "Make a U-turn onto {way_name}", - "destination": "Make a U-turn towards {destination}" - } - }, - "merge": { - "default": { - "default": "Merge {modifier}", - "name": "Merge {modifier} onto {way_name}", - "destination": "Merge {modifier} towards {destination}" - }, - "slight left": { - "default": "Merge left", - "name": "Merge left onto {way_name}", - "destination": "Merge left towards {destination}" - }, - "slight right": { - "default": "Merge right", - "name": "Merge right onto {way_name}", - "destination": "Merge right towards {destination}" - }, - "sharp left": { - "default": "Merge left", - "name": "Merge left onto {way_name}", - "destination": "Merge left towards {destination}" - }, - "sharp right": { - "default": "Merge right", - "name": "Merge right onto {way_name}", - "destination": "Merge right towards {destination}" - }, - "uturn": { - "default": "Make a U-turn", - "name": "Make a U-turn onto {way_name}", - "destination": "Make a U-turn towards {destination}" - } - }, - "new name": { - "default": { - "default": "Continue {modifier}", - "name": "Continue {modifier} onto {way_name}", - "destination": "Continue {modifier} towards {destination}" - }, - "sharp left": { - "default": "Take a sharp left", - "name": "Take a sharp left onto {way_name}", - "destination": "Take a sharp left towards {destination}" - }, - "sharp right": { - "default": "Take a sharp right", - "name": "Take a sharp right onto {way_name}", - "destination": "Take a sharp right towards {destination}" - }, - "slight left": { - "default": "Continue slightly left", - "name": "Continue slightly left onto {way_name}", - "destination": "Continue slightly left towards {destination}" - }, - "slight right": { - "default": "Continue slightly right", - "name": "Continue slightly right onto {way_name}", - "destination": "Continue slightly right towards {destination}" - }, - "uturn": { - "default": "Make a U-turn", - "name": "Make a U-turn onto {way_name}", - "destination": "Make a U-turn towards {destination}" - } - }, - "notification": { - "default": { - "default": "Continue {modifier}", - "name": "Continue {modifier} onto {way_name}", - "destination": "Continue {modifier} towards {destination}" - }, - "uturn": { - "default": "Make a U-turn", - "name": "Make a U-turn onto {way_name}", - "destination": "Make a U-turn towards {destination}" - } - }, - "off ramp": { - "default": { - "default": "Take the ramp", - "name": "Take the ramp onto {way_name}", - "destination": "Take the ramp towards {destination}" - }, - "left": { - "default": "Take the ramp on the left", - "name": "Take the ramp on the left onto {way_name}", - "destination": "Take the ramp on the left towards {destination}" - }, - "right": { - "default": "Take the ramp on the right", - "name": "Take the ramp on the right onto {way_name}", - "destination": "Take the ramp on the right towards {destination}" - }, - "sharp left": { - "default": "Take the ramp on the left", - "name": "Take the ramp on the left onto {way_name}", - "destination": "Take the ramp on the left towards {destination}" - }, - "sharp right": { - "default": "Take the ramp on the right", - "name": "Take the ramp on the right onto {way_name}", - "destination": "Take the ramp on the right towards {destination}" - }, - "slight left": { - "default": "Take the ramp on the left", - "name": "Take the ramp on the left onto {way_name}", - "destination": "Take the ramp on the left towards {destination}" - }, - "slight right": { - "default": "Take the ramp on the right", - "name": "Take the ramp on the right onto {way_name}", - "destination": "Take the ramp on the right towards {destination}" - } - }, - "on ramp": { - "default": { - "default": "Take the ramp", - "name": "Take the ramp onto {way_name}", - "destination": "Take the ramp towards {destination}" - }, - "left": { - "default": "Take the ramp on the left", - "name": "Take the ramp on the left onto {way_name}", - "destination": "Take the ramp on the left towards {destination}" - }, - "right": { - "default": "Take the ramp on the right", - "name": "Take the ramp on the right onto {way_name}", - "destination": "Take the ramp on the right towards {destination}" - }, - "sharp left": { - "default": "Take the ramp on the left", - "name": "Take the ramp on the left onto {way_name}", - "destination": "Take the ramp on the left towards {destination}" - }, - "sharp right": { - "default": "Take the ramp on the right", - "name": "Take the ramp on the right onto {way_name}", - "destination": "Take the ramp on the right towards {destination}" - }, - "slight left": { - "default": "Take the ramp on the left", - "name": "Take the ramp on the left onto {way_name}", - "destination": "Take the ramp on the left towards {destination}" - }, - "slight right": { - "default": "Take the ramp on the right", - "name": "Take the ramp on the right onto {way_name}", - "destination": "Take the ramp on the right towards {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "Enter the rotary", - "name": "Enter the rotary and exit onto {way_name}", - "destination": "Enter the rotary and exit towards {destination}" - }, - "name": { - "default": "Enter {rotary_name}", - "name": "Enter {rotary_name} and exit onto {way_name}", - "destination": "Enter {rotary_name} and exit towards {destination}" - }, - "exit": { - "default": "Enter the rotary and take the {exit_number} exit", - "name": "Enter the rotary and take the {exit_number} exit onto {way_name}", - "destination": "Enter the rotary and take the {exit_number} exit towards {destination}" - }, - "name_exit": { - "default": "Enter {rotary_name} and take the {exit_number} exit", - "name": "Enter {rotary_name} and take the {exit_number} exit onto {way_name}", - "destination": "Enter {rotary_name} and take the {exit_number} exit towards {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "Enter the roundabout and take the {exit_number} exit", - "name": "Enter the roundabout and take the {exit_number} exit onto {way_name}", - "destination": "Enter the roundabout and take the {exit_number} exit towards {destination}" - }, - "default": { - "default": "Enter the roundabout", - "name": "Enter the roundabout and exit onto {way_name}", - "destination": "Enter the roundabout and exit towards {destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "At the roundabout make a {modifier}", - "name": "At the roundabout make a {modifier} onto {way_name}", - "destination": "At the roundabout make a {modifier} towards {destination}" - }, - "left": { - "default": "At the roundabout turn left", - "name": "At the roundabout turn left onto {way_name}", - "destination": "At the roundabout turn left towards {destination}" - }, - "right": { - "default": "At the roundabout turn right", - "name": "At the roundabout turn right onto {way_name}", - "destination": "At the roundabout turn right towards {destination}" - }, - "straight": { - "default": "At the roundabout continue straight", - "name": "At the roundabout continue straight onto {way_name}", - "destination": "At the roundabout continue straight towards {destination}" - } - }, - "turn": { - "default": { - "default": "Make a {modifier}", - "name": "Make a {modifier} onto {way_name}", - "destination": "Make a {modifier} towards {destination}" - }, - "left": { - "default": "Turn left", - "name": "Turn left onto {way_name}", - "destination": "Turn left towards {destination}" - }, - "right": { - "default": "Turn right", - "name": "Turn right onto {way_name}", - "destination": "Turn right towards {destination}" - }, - "straight": { - "default": "Go straight", - "name": "Go straight onto {way_name}", - "destination": "Go straight towards {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Continue straight" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/fr.json b/libandroid-navigation/src/main/resources/translations/fr.json deleted file mode 100644 index a96e6b52..00000000 --- a/libandroid-navigation/src/main/resources/translations/fr.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "première", - "2": "seconde", - "3": "troisième", - "4": "quatrième", - "5": "cinquième", - "6": "sixième", - "7": "setpième", - "8": "huitième", - "9": "neuvième", - "10": "dixième" - }, - "direction": { - "north": "le nord", - "northeast": "le nord-est", - "east": "l'est", - "southeast": "le sud-est", - "south": "le sud", - "southwest": "le sud-ouest", - "west": "l'ouest", - "northwest": "le nord-ouest" - }, - "modifier": { - "left": "à gauche", - "right": "à droite", - "sharp left": "franchement à gauche", - "sharp right": "franchement à droite", - "slight left": "légèrement à gauche", - "slight right": "légèrement à droite", - "straight": "tout droit", - "uturn": "demi-tour" - }, - "lanes": { - "xo": "Serrer à droite", - "ox": "Serrer à gauche", - "xox": "Rester au milieu", - "oxo": "Rester à gauche ou à droite" - } - }, - "modes": { - "ferry": { - "default": "Prendre le ferry", - "name": "Prendre le ferry {way_name}", - "destination": "Prendre le ferry en direction de {destination}" - } - }, - "arrive": { - "default": { - "default": "Vous êtes arrivés à votre {nth} destination" - }, - "left": { - "default": "Vous êtes arrivés à votre {nth} destination, sur la gauche" - }, - "right": { - "default": "Vous êtes arrivés à votre {nth} destination, sur la droite" - }, - "sharp left": { - "default": "Vous êtes arrivés à votre {nth} destination, sur la gauche" - }, - "sharp right": { - "default": "Vous êtes arrivés à votre {nth} destination, sur la droite" - }, - "slight right": { - "default": "Vous êtes arrivés à votre {nth} destination, sur la droite" - }, - "slight left": { - "default": "Vous êtes arrivés à votre {nth} destination, sur la gauche" - }, - "straight": { - "default": "Vous êtes arrivés à votre {nth} destination, droit devant" - } - }, - "continue": { - "default": { - "default": "Continuer {modifier}", - "name": "Continuer {modifier} sur {way_name}", - "destination": "Continuer {modifier} en direction de {destination}" - }, - "straight": { - "default": "Continuer tout droit", - "name": "Continuer tout droit sur {way_name}", - "destination": "Continuer tout droit en direction de {destination}" - }, - "slight left": { - "default": "Continuer légèrement à gauche", - "name": "Continuer légèrement à gauche sur {way_name}", - "destination": "Continuer légèrement à gauche en direction de {destination}" - }, - "slight right": { - "default": "Continuer légèrement à droite", - "name": "Continuer légèrement à droite sur {way_name}", - "destination": "Continuer légèrement à droite en direction de {destination}" - }, - "uturn": { - "default": "Faire demi-tour", - "name": "Faire demi-tour sur {way_name}", - "destination": "Faire demi-tour en direction de {destination}" - } - }, - "depart": { - "default": { - "default": "Rouler vers {direction}", - "name": "Rouler vers {direction} sur {way_name}" - } - }, - "end of road": { - "default": { - "default": "Tourner {modifier}", - "name": "Tourner {modifier} sur {way_name}", - "destination": "Tourner {modifier} en direction de {destination}" - }, - "straight": { - "default": "Continuer tout droit", - "name": "Continuer tout droit sur {way_name}", - "destination": "Continuer tout droit en direction de {destination}" - }, - "uturn": { - "default": "Faire demi-tour à la fin de la route", - "name": "Faire demi-tour à la fin de la route {way_name}", - "destination": "Faire demi-tour à la fin de la route en direction de {destination}" - } - }, - "fork": { - "default": { - "default": "Rester {modifier} à l'embranchement", - "name": "Rester {modifier} à l'embranchement sur {way_name}", - "destination": "Rester {modifier} à l'embranchement en direction de {destination}" - }, - "slight left": { - "default": "Rester à gauche à l'embranchement", - "name": "Rester à gauche à l'embranchement sur {way_name}", - "destination": "Rester à gauche à l'embranchement en direction de {destination}" - }, - "slight right": { - "default": "Rester à droite à l'embranchement", - "name": "Rester à droite à l'embranchement sur {way_name}", - "destination": "Rester à droite à l'embranchement en direction de {destination}" - }, - "sharp left": { - "default": "Prendre à gauche à l'embranchement", - "name": "Prendre à gauche à l'embranchement sur {way_name}", - "destination": "Prendre à gauche à l'embranchement en direction de {destination}" - }, - "sharp right": { - "default": "Prendre à droite à l'embranchement", - "name": "Prendre à droite à l'embranchement sur {way_name}", - "destination": "Prendre à droite à l'embranchement en direction de {destination}" - }, - "uturn": { - "default": "Faire demi-tour", - "name": "Faire demi-tour sur {way_name}", - "destination": "Faire demi-tour en direction de {destination}" - } - }, - "merge": { - "default": { - "default": "Rejoindre {modifier}", - "name": "Rejoindre {modifier} sur {way_name}", - "destination": "Rejoindre {modifier} en direction de {destination}" - }, - "slight left": { - "default": "Rejoindre légèrement par la gauche", - "name": "Rejoindre {way_name} légèrement par la gauche", - "destination": "Rejoindre légèrement par la gauche la route en direction de {destination}" - }, - "slight right": { - "default": "Rejoindre légèrement par la droite", - "name": "Rejoindre {way_name} légèrement par la droite", - "destination": "Rejoindre légèrement par la droite la route en direction de {destination}" - }, - "sharp left": { - "default": "Rejoindre par la gauche", - "name": "Rejoindre {way_name} par la gauche", - "destination": "Rejoindre par la gauche la route en direction de {destination}" - }, - "sharp right": { - "default": "Rejoindre par la droite", - "name": "Rejoindre {way_name} par la droite", - "destination": "Rejoindre par la droite la route en direction de {destination}" - }, - "uturn": { - "default": "Fair demi-tour", - "name": "Fair demi-tour sur {way_name}", - "destination": "Fair demi-tour en direction de {destination}" - } - }, - "new name": { - "default": { - "default": "Continuer {modifier}", - "name": "Continuer {modifier} sur {way_name}", - "destination": "Continuer {modifier} en direction de {destination}" - }, - "sharp left": { - "default": "Prendre à gauche", - "name": "Prendre à gauche sur {way_name}", - "destination": "Prendre à gauche en direction de {destination}" - }, - "sharp right": { - "default": "Prendre à droite", - "name": "Prendre à droite sur {way_name}", - "destination": "Prendre à droite en direction de {destination}" - }, - "slight left": { - "default": "Continuer légèrement à gauche", - "name": "Continuer légèrement à gauche sur {way_name}", - "destination": "Continuer légèrement à gauche en direction de {destination}" - }, - "slight right": { - "default": "Continuer légèrement à droite", - "name": "Continuer légèrement à droite sur {way_name}", - "destination": "Continuer légèrement à droite en direction de {destination}" - }, - "uturn": { - "default": "Fair demi-tour", - "name": "Fair demi-tour sur {way_name}", - "destination": "Fair demi-tour en direction de {destination}" - } - }, - "notification": { - "default": { - "default": "Continuer {modifier}", - "name": "Continuer {modifier} sur {way_name}", - "destination": "Continuer {modifier} en direction de {destination}" - }, - "uturn": { - "default": "Fair demi-tour", - "name": "Fair demi-tour sur {way_name}", - "destination": "Fair demi-tour en direction de {destination}" - } - }, - "off ramp": { - "default": { - "default": "Prendre la sortie", - "name": "Prendre la sortie sur {way_name}", - "destination": "Prendre la sortie en direction de {destination}" - }, - "left": { - "default": "Prendre la sortie à gauche", - "name": "Prendre la sortie à gauche sur {way_name}", - "destination": "Prendre la sortie à gauche en direction de {destination}" - }, - "right": { - "default": "Prendre la sortie à droite", - "name": "Prendre la sortie à droite sur {way_name}", - "destination": "Prendre la sortie à droite en direction de {destination}" - }, - "sharp left": { - "default": "Prendre la sortie à gauche", - "name": "Prendre la sortie à gauche sur {way_name}", - "destination": "Prendre la sortie à gauche en direction de {destination}" - }, - "sharp right": { - "default": "Prendre la sortie à droite", - "name": "Prendre la sortie à droite sur {way_name}", - "destination": "Prendre la sortie à droite en direction de {destination}" - }, - "slight left": { - "default": "Prendre la sortie à gauche", - "name": "Prendre la sortie à gauche sur {way_name}", - "destination": "Prendre la sortie à gauche en direction de {destination}" - }, - "slight right": { - "default": "Prendre la sortie à droite", - "name": "Prendre la sortie à droite sur {way_name}", - "destination": "Prendre la sortie à droite en direction de {destination}" - } - }, - "on ramp": { - "default": { - "default": "Prendre la sortie", - "name": "Prendre la sortie sur {way_name}", - "destination": "Prendre la sortie en direction de {destination}" - }, - "left": { - "default": "Prendre la sortie à gauche", - "name": "Prendre la sortie à gauche sur {way_name}", - "destination": "Prendre la sortie à gauche en direction de {destination}" - }, - "right": { - "default": "Prendre la sortie à droite", - "name": "Prendre la sortie à droite sur {way_name}", - "destination": "Prendre la sortie à droite en direction de {destination}" - }, - "sharp left": { - "default": "Prendre la sortie à gauche", - "name": "Prendre la sortie à gauche sur {way_name}", - "destination": "Prendre la sortie à gauche en direction de {destination}" - }, - "sharp right": { - "default": "Prendre la sortie à droite", - "name": "Prendre la sortie à droite sur {way_name}", - "destination": "Prendre la sortie à droite en direction de {destination}" - }, - "slight left": { - "default": "Prendre la sortie à gauche", - "name": "Prendre la sortie à gauche sur {way_name}", - "destination": "Prendre la sortie à gauche en direction de {destination}" - }, - "slight right": { - "default": "Prendre la sortie à droite", - "name": "Prendre la sortie à droite sur {way_name}", - "destination": "Prendre la sortie à droite en direction de {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "Entrer dans le rond-point", - "name": "Entrer dans le rond-point et sortir par {way_name}", - "destination": "Entrer dans le rond-point et sortir en direction de {destination}" - }, - "name": { - "default": "Entrer dans le rond-point {rotary_name}", - "name": "Entrer dans le rond-point {rotary_name} et sortir par {way_name}", - "destination": "Entrer dans le rond-point {rotary_name} et sortir en direction de {destination}" - }, - "exit": { - "default": "Entrer dans le rond-point et prendre la {exit_number} sortie", - "name": "Entrer dans le rond-point et prendre la {exit_number} sortie sur {way_name}", - "destination": "Entrer dans le rond-point et prendre la {exit_number} sortie en direction de {destination}" - }, - "name_exit": { - "default": "Entrer dans le rond-point {rotary_name} et prendre la {exit_number} sortie", - "name": "Entrer dans le rond-point {rotary_name} et prendre la {exit_number} sortie sur {way_name}", - "destination": "Entrer dans le rond-point {rotary_name} et prendre la {exit_number} sortie en direction de {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "Entrer dans le rond-point et prendre la {exit_number} sortie", - "name": "Entrer dans le rond-point et prendre la {exit_number} sortie sur {way_name}", - "destination": "Entrer dans le rond-point et prendre la {exit_number} sortie en direction de {destination}" - }, - "default": { - "default": "Entrer dans le rond-point", - "name": "Entrer dans le rond-point et sortir par {way_name}", - "destination": "Entrer dans le rond-point et sortir en direction de {destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "Au rond-point, tourner {modifier}", - "name": "Au rond-point, tourner {modifier} sur {way_name}", - "destination": "Au rond-point, tourner {modifier} en direction de {destination}" - }, - "left": { - "default": "Au rond-point, tourner à gauche", - "name": "Au rond-point, tourner à gauche sur {way_name}", - "destination": "Au rond-point, tourner à gauche en direction de {destination}" - }, - "right": { - "default": "Au rond-point, tourner à droite", - "name": "Au rond-point, tourner à droite sur {way_name}", - "destination": "Au rond-point, tourner à droite en direction de {destination}" - }, - "straight": { - "default": "Au rond-point, continuer tout droit", - "name": "Au rond-point, continuer tout droit sur {way_name}", - "destination": "Au rond-point, continuer tout droit en direction de {destination}" - } - }, - "turn": { - "default": { - "default": "Tourner {modifier}", - "name": "Tourner {modifier} sur {way_name}", - "destination": "Tourner {modifier} en direction de {destination}" - }, - "left": { - "default": "Tourner à gauche", - "name": "Tourner à gauche sur {way_name}", - "destination": "Tourner à gauche en direction de {destination}" - }, - "right": { - "default": "Tourner à droite", - "name": "Tourner à droite sur {way_name}", - "destination": "Tourner à droite en direction de {destination}" - }, - "straight": { - "default": "Aller tout droit", - "name": "Aller tout droit sur {way_name}", - "destination": "Aller tout droit en direction de {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Continuer tout droit" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/nl.json b/libandroid-navigation/src/main/resources/translations/nl.json deleted file mode 100644 index ac519ede..00000000 --- a/libandroid-navigation/src/main/resources/translations/nl.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "eerste", - "2": "tweede", - "3": "derde", - "4": "vierde", - "5": "vijfde", - "6": "zesde", - "7": "zevende", - "8": "achtste", - "9": "negende", - "10": "tiende" - }, - "direction": { - "north": "noord", - "northeast": "noordoost", - "east": "oost", - "southeast": "zuidoost", - "south": "zuid", - "southwest": "zuidwest", - "west": "west", - "northwest": "noordwest" - }, - "modifier": { - "left": "links", - "right": "rechts", - "sharp left": "linksaf", - "sharp right": "rechtsaf", - "slight left": "links", - "slight right": "rechts", - "straight": "rechtdoor", - "uturn": "omkeren" - }, - "lanes": { - "xo": "Rechts aanhouden", - "ox": "Links aanhouden", - "xox": "In het midden blijven", - "oxo": "Links of rechts blijven" - } - }, - "modes": { - "ferry": { - "default": "Neem het veer", - "name": "Neem het veer {way_name}", - "destination": "Neem het veer naar {destination}" - } - }, - "arrive": { - "default": { - "default": "Je bent gearriveerd op de {nth} bestemming." - }, - "left": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich links." - }, - "right": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich rechts." - }, - "sharp left": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich links." - }, - "sharp right": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich rechts." - }, - "slight right": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich rechts." - }, - "slight left": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich links." - }, - "straight": { - "default": "Je bent gearriveerd. De {nth} bestemming bevindt zich voor je." - } - }, - "continue": { - "default": { - "default": "Ga {modifier}", - "name": "Ga {modifier} naar {way_name}", - "destination": "Ga {modifier} richting {destination}" - }, - "straight": { - "default": "Ga rechtdoor", - "name": "Ga rechtdoor naar {way_name}", - "destination": "Ga rechtdoor richting {destination}" - }, - "slight left": { - "default": "Links aanhouden", - "name": "Links aanhouden naar {way_name}", - "destination": "Links aanhouden richting {destination}" - }, - "slight right": { - "default": "Rechts aanhouden", - "name": "Rechts aanhouden naar {way_name}", - "destination": "Rechts aanhouden richting {destination}" - }, - "uturn": { - "default": "Keer om", - "name": "Keer om naar {way_name}", - "destination": "Keer om richting {destination}" - } - }, - "depart": { - "default": { - "default": "Vertrek in {direction}elijke richting", - "name": "Neem {way_name} in {direction}elijke richting" - } - }, - "end of road": { - "default": { - "default": "Ga {modifier}", - "name": "Ga {modifier} naar {way_name}", - "destination": "Ga {modifier} richting {destination}" - }, - "straight": { - "default": "Ga in de aangegeven richting", - "name": "Ga naar {way_name}", - "destination": "Ga richting {destination}" - }, - "uturn": { - "default": "Keer om", - "name": "Keer om naar {way_name}", - "destination": "Keer om richting {destination}" - } - }, - "fork": { - "default": { - "default": "Ga {modifier} op de splitsing", - "name": "Ga {modifier} op de splitsing naar {way_name}", - "destination": "Ga {modifier} op de splitsing richting {destination}" - }, - "slight left": { - "default": "Links aanhouden op de splitsing", - "name": "Links aanhouden op de splitsing naar {way_name}", - "destination": "Links aanhouden op de splitsing richting {destination}" - }, - "slight right": { - "default": "Rechts aanhouden op de splitsing", - "name": "Rechts aanhouden op de splitsing naar {way_name}", - "destination": "Rechts aanhouden op de splitsing richting {destination}" - }, - "sharp left": { - "default": "Linksaf op de splitsing", - "name": "Linksaf op de splitsing naar {way_name}", - "destination": "Linksaf op de splitsing richting {destination}" - }, - "sharp right": { - "default": "Rechtsaf op de splitsing", - "name": "Rechtsaf op de splitsing naar {way_name}", - "destination": "Rechtsaf op de splitsing richting {destination}" - }, - "uturn": { - "default": "Keer om", - "name": "Keer om naar {way_name}", - "destination": "Keer om richting {destination}" - } - }, - "merge": { - "default": { - "default": "Bij de splitsing {modifier}", - "name": "Bij de splitsing {modifier} naar {way_name}", - "destination": "Bij de splitsing {modifier} richting {destination}" - }, - "slight left": { - "default": "Bij de splitsing links aanhouden", - "name": "Bij de splitsing links aanhouden naar {way_name}", - "destination": "Bij de splitsing links aanhouden richting {destination}" - }, - "slight right": { - "default": "Bij de splitsing rechts aanhouden", - "name": "Bij de splitsing rechts aanhouden naar {way_name}", - "destination": "Bij de splitsing rechts aanhouden richting {destination}" - }, - "sharp left": { - "default": "Bij de splitsing linksaf", - "name": "Bij de splitsing linksaf naar {way_name}", - "destination": "Bij de splitsing linksaf richting {destination}" - }, - "sharp right": { - "default": "Bij de splitsing rechtsaf", - "name": "Bij de splitsing rechtsaf naar {way_name}", - "destination": "Bij de splitsing rechtsaf richting {destination}" - }, - "uturn": { - "default": "Keer om", - "name": "Keer om naar {way_name}", - "destination": "Keer om richting {destination}" - } - }, - "new name": { - "default": { - "default": "Ga {modifier}", - "name": "Ga {modifier} naar {way_name}", - "destination": "Ga {modifier} richting {destination}" - }, - "sharp left": { - "default": "Linksaf", - "name": "Linksaf naar {way_name}", - "destination": "Linksaf richting {destination}" - }, - "sharp right": { - "default": "Rechtsaf", - "name": "Rechtsaf naar {way_name}", - "destination": "Rechtsaf richting {destination}" - }, - "slight left": { - "default": "Links aanhouden", - "name": "Links aanhouden naar {way_name}", - "destination": "Links aanhouden richting {destination}" - }, - "slight right": { - "default": "Rechts aanhouden", - "name": "Rechts aanhouden naar {way_name}", - "destination": "Rechts aanhouden richting {destination}" - }, - "uturn": { - "default": "Keer om", - "name": "Keer om naar {way_name}", - "destination": "Keer om richting {destination}" - } - }, - "notification": { - "default": { - "default": "Ga {modifier}", - "name": "Ga {modifier} naar {way_name}", - "destination": "Ga {modifier} richting {destination}" - }, - "uturn": { - "default": "Keer om", - "name": "Keer om naar {way_name}", - "destination": "Keer om richting {destination}" - } - }, - "off ramp": { - "default": { - "default": "Neem de afrit", - "name": "Neem de afrit naar {way_name}", - "destination": "Neem de afrit richting {destination}" - }, - "left": { - "default": "Neem de afrit links", - "name": "Neem de afrit links naar {way_name}", - "destination": "Neem de afrit links richting {destination}" - }, - "right": { - "default": "Neem de afrit rechts", - "name": "Neem de afrit rechts naar {way_name}", - "destination": "Neem de afrit rechts richting {destination}" - }, - "sharp left": { - "default": "Neem de afrit links", - "name": "Neem de afrit links naar {way_name}", - "destination": "Neem de afrit links richting {destination}" - }, - "sharp right": { - "default": "Neem de afrit rechts", - "name": "Neem de afrit rechts naar {way_name}", - "destination": "Neem de afrit rechts richting {destination}" - }, - "slight left": { - "default": "Neem de afrit links", - "name": "Neem de afrit links naar {way_name}", - "destination": "Neem de afrit links richting {destination}" - }, - "slight right": { - "default": "Neem de afrit rechts", - "name": "Neem de afrit rechts naar {way_name}", - "destination": "Neem de afrit rechts richting {destination}" - } - }, - "on ramp": { - "default": { - "default": "Neem de oprit", - "name": "Neem de oprit naar {way_name}", - "destination": "Neem de oprit richting {destination}" - }, - "left": { - "default": "Neem de oprit links", - "name": "Neem de oprit links naar {way_name}", - "destination": "Neem de oprit links richting {destination}" - }, - "right": { - "default": "Neem de oprit rechts", - "name": "Neem de oprit rechts naar {way_name}", - "destination": "Neem de oprit rechts richting {destination}" - }, - "sharp left": { - "default": "Neem de oprit links", - "name": "Neem de oprit links naar {way_name}", - "destination": "Neem de oprit links richting {destination}" - }, - "sharp right": { - "default": "Neem de oprit rechts", - "name": "Neem de oprit rechts naar {way_name}", - "destination": "Neem de oprit rechts richting {destination}" - }, - "slight left": { - "default": "Neem de oprit links", - "name": "Neem de oprit links naar {way_name}", - "destination": "Neem de oprit links richting {destination}" - }, - "slight right": { - "default": "Neem de oprit rechts", - "name": "Neem de oprit rechts naar {way_name}", - "destination": "Neem de oprit rechts richting {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "Ga het knooppunt op", - "name": "Verlaat het knooppunt naar {way_name}", - "destination": "Verlaat het knooppunt richting {destination}" - }, - "name": { - "default": "Ga het knooppunt {rotary_name} op", - "name": "Verlaat het knooppunt {rotary_name} naar {way_name}", - "destination": "Verlaat het knooppunt {rotary_name} richting {destination}" - }, - "exit": { - "default": "Ga het knooppunt op en neem afslag {exit_number}", - "name": "Ga het knooppunt op en neem afslag {exit_number} naar {way_name}", - "destination": "Ga het knooppunt op en neem afslag {exit_number} richting {destination}" - }, - "name_exit": { - "default": "Ga het knooppunt {rotary_name} op en neem afslag {exit_number}", - "name": "Ga het knooppunt {rotary_name} op en neem afslag {exit_number} naar {way_name}", - "destination": "Ga het knooppunt {rotary_name} op en neem afslag {exit_number} richting {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "Ga de rotonde op en neem afslag {exit_number}", - "name": "Ga de rotonde op en neem afslag {exit_number} naar {way_name}", - "destination": "Ga de rotonde op en neem afslag {exit_number} richting {destination}" - }, - "default": { - "default": "Ga de rotonde op", - "name": "Verlaat de rotonde naar {way_name}", - "destination": "Verlaat de rotonde richting {destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "Ga {modifier} op de rotonde", - "name": "Ga {modifier} op de rotonde naar {way_name}", - "destination": "Ga {modifier} op de rotonde richting {destination}" - }, - "left": { - "default": "Ga links op de rotonde", - "name": "Ga links op de rotonde naar {way_name}", - "destination": "Ga links op de rotonde richting {destination}" - }, - "right": { - "default": "Ga rechts op de rotonde", - "name": "Ga rechts op de rotonde naar {way_name}", - "destination": "Ga rechts op de rotonde richting {destination}" - }, - "straight": { - "default": "Rechtdoor op de rotonde", - "name": "Rechtdoor op de rotonde naar {way_name}", - "destination": "Rechtdoor op de rotonde richting {destination}" - } - }, - "turn": { - "default": { - "default": "Ga {modifier}", - "name": "Ga {modifier} naar {way_name}", - "destination": "Ga {modifier} richting {destination}" - }, - "left": { - "default": "Ga linksaf", - "name": "Ga linksaf naar {way_name}", - "destination": "Ga linksaf richting {destination}" - }, - "right": { - "default": "Ga rechtsaf", - "name": "Ga rechtsaf naar {way_name}", - "destination": "Ga rechtsaf richting {destination}" - }, - "straight": { - "default": "Ga rechtdoor", - "name": "Ga rechtdoor naar {way_name}", - "destination": "Ga rechtdoor richting {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Rechtdoor" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/ru.json b/libandroid-navigation/src/main/resources/translations/ru.json deleted file mode 100644 index 9bb07f0a..00000000 --- a/libandroid-navigation/src/main/resources/translations/ru.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "первый", - "2": "второй", - "3": "третий", - "4": "четвёртый", - "5": "пятый", - "6": "шестой", - "7": "седьмой", - "8": "восьмой", - "9": "девятый", - "10": "десятый" - }, - "direction": { - "north": "северном", - "northeast": "северо-восточном", - "east": "восточном", - "southeast": "юго-восточном", - "south": "южном", - "southwest": "юго-западном", - "west": "западном", - "northwest": "северо-западном" - }, - "modifier": { - "left": "налево", - "right": "направо", - "sharp left": "резко налево", - "sharp right": "резко направо", - "slight left": "плавно налево", - "slight right": "плавно направо", - "straight": "прямо", - "uturn": "разворот" - }, - "lanes": { - "xo": "Держитесь правой стороны", - "ox": "Держитесь левой стороны", - "xox": "Держитесь середины", - "oxo": "Держите левой или правой стороны" - } - }, - "modes": { - "ferry": { - "default": "Возьмите паром", - "name": "Возьмите паром {way_name}", - "destination": "Возьмите паром в направлении {destination}" - } - }, - "arrive": { - "default": { - "default": "Вы прибыли в {nth} пункт назначения" - }, - "left": { - "default": "Вы прибыли в {nth} пункт назначения, который находится слева" - }, - "right": { - "default": "Вы прибыли в {nth} пункт назначения, который находится справа" - }, - "sharp left": { - "default": "Вы прибыли в {nth} пункт назначения, который находится слева" - }, - "sharp right": { - "default": "Вы прибыли в {nth} пункт назначения, который находится справа" - }, - "slight right": { - "default": "Вы прибыли в {nth} пункт назначения, который находится справа" - }, - "slight left": { - "default": "Вы прибыли в {nth} пункт назначения, который находится слева" - }, - "straight": { - "default": "Вы прибыли в {nth} пункт назначения, который находится перед вами" - } - }, - "continue": { - "default": { - "default": "Продолжайте движение {modifier}", - "name": "Продолжайте движение {modifier} по {way_name}", - "destination": "Продолжайте движение {modifier} в направлении {destination}" - }, - "straight": { - "default": "Продолжайте движение прямо", - "name": "Продолжайте движение по {way_name}", - "destination": "Продолжайте движение в направлении {destination}" - }, - "slight left": { - "default": "Плавный поворот налево", - "name": "Плавный поворот налево на {way_name}", - "destination": "Плавный поворот налево в направлении {destination}" - }, - "slight right": { - "default": "Плавный поворот направо", - "name": "Плавный поворот направо на {way_name}", - "destination": "Плавный поворот направо в направлении {destination}" - }, - "uturn": { - "default": "Сделайте разворот", - "name": "Сделайте разворот на {way_name}", - "destination": "Сделайте разворот в направлении {destination}" - } - }, - "depart": { - "default": { - "default": "Двигайтесь в {direction} направлении", - "name": "Двигайтесь в {direction} направлении по {way_name}" - } - }, - "end of road": { - "default": { - "default": "Поверните {modifier}", - "name": "Поверните {modifier} на {way_name}", - "destination": "Поверните {modifier} в направлении {destination}" - }, - "straight": { - "default": "Продолжайте движение прямо", - "name": "Продолжайте движение прямо по {way_name}", - "destination": "Продолжайте движение прямо в направлении {destination}" - }, - "uturn": { - "default": "Сделайте разворот в конце дороги", - "name": "Сделайте разворот на {way_name} в конце дороги", - "destination": "Сделайте разворот в направлении {destination} в конце дороги" - } - }, - "fork": { - "default": { - "default": "На развилке поверните {modifier}", - "name": "На развилке поверните {modifier} на {way_name}", - "destination": "На развилке поверните {modifier} и продолжайте движение в направлении {destination}" - }, - "slight left": { - "default": "Держитесь левее на развилке", - "name": "Держитесь левее на развилке на {way_name}", - "destination": "На развилке держитесь левой стороны и продолжайте движение в направлении {destination}" - }, - "slight right": { - "default": "Держитесь правее на развилке", - "name": "Держитесь правее на развилке на {way_name}", - "destination": "На развилке держитесь правой стороны и продолжайте движение в направлении {destination}" - }, - "sharp left": { - "default": "На развилке поверните резко налево", - "name": "На развилке поверните резко налево на {way_name}", - "destination": "На развилке поверните резко налево и продолжайте движение в направлении {destination}" - }, - "sharp right": { - "default": "На развилке поверните резко направо", - "name": "На развилке поверните резко направо на {way_name}", - "destination": "На развилке поверните резко направо и продолжайте движение в направлении {destination}" - }, - "uturn": { - "default": "На развилке сделайте разворот", - "name": "На развилке сделайте разворот на {way_name}", - "destination": "На развилке сделайте разворот и продолжайте движение в направлении {destination}" - } - }, - "merge": { - "default": { - "default": "Слияние полосы {modifier}", - "name": "Слияние полосы {modifier} на {way_name}", - "destination": "Слияние полосы {modifier} в направлении {destination}" - }, - "slight left": { - "default": "Слияние полосы налево", - "name": "Слияние полосы налево на {way_name}", - "destination": "Слияние полосы налево в направлении {destination}" - }, - "slight right": { - "default": "Слияние полосы направо", - "name": "Слияние полосы направо на {way_name}", - "destination": "Слияние полосы направо в направлении {destination}" - }, - "sharp left": { - "default": "Слияние полосы налево", - "name": "Слияние полосы налево на {way_name}", - "destination": "Слияние полосы налево в направлении {destination}" - }, - "sharp right": { - "default": "Слияние полосы направо", - "name": "Слияние полосы направо на {way_name}", - "destination": "Слияние полосы направо в направлении {destination}" - }, - "uturn": { - "default": "Сделайте разворот", - "name": "Сделайте разворот на {way_name}", - "destination": "Сделайте разворот в направлении {destination}" - } - }, - "new name": { - "default": { - "default": "Поверните {modifier}", - "name": "Поверните {modifier} на {way_name}", - "destination": "Поверните {modifier} и продолжайте движение в направлении {destination}" - }, - "sharp left": { - "default": "Поверните резко налево", - "name": "Поверните резко налево на {way_name}", - "destination": "Поверните резко налево и продолжайте движение в направлении {destination}" - }, - "sharp right": { - "default": "Поверните резко направо", - "name": "Поверните резко направо на {way_name}", - "destination": "Поверните резко направо и продолжайте движение в направлении {destination}" - }, - "slight left": { - "default": "Плавный поворот налево", - "name": "Плавный поворот налево на {way_name}", - "destination": "Плавный поворот налево в направлении {destination}" - }, - "slight right": { - "default": "Плавный поворот направо", - "name": "Плавный поворот направо на {way_name}", - "destination": "Плавный поворот направо в направлении {destination}" - }, - "uturn": { - "default": "Сделайте разворот", - "name": "Сделайте разворот на {way_name}", - "destination": "Сделайте разворот и продолжайте движение в направлении {destination}" - } - }, - "notification": { - "default": { - "default": "Продолжайте движение {modifier}", - "name": "Продолжайте движение {modifier} по {way_name}", - "destination": "Продолжайте движение {modifier} в направлении {destination}" - }, - "uturn": { - "default": "Сделайте разворот", - "name": "Сделайте разворот на {way_name}", - "destination": "Сделайте разворот и продолжайте движение в направлении {destination}" - } - }, - "off ramp": { - "default": { - "default": "Используйте съезд", - "name": "Используйте съезд на {way_name}", - "destination": "Используйте съезд в направлении {destination}" - }, - "left": { - "default": "Используйте съезд слева", - "name": "Используйте съезд слева на {way_name}", - "destination": "Используйте съезд слева в направлении {destination}" - }, - "right": { - "default": "Используйте съезд справа", - "name": "Используйте съезд справа на {way_name}", - "destination": "Используйте съезд справа в направлении {destination}" - }, - "sharp left": { - "default": "Используйте съезд слева", - "name": "Используйте съезд слева на {way_name}", - "destination": "Используйте съезд слева в направлении {destination}" - }, - "sharp right": { - "default": "Используйте съезд справа", - "name": "Используйте съезд справа на {way_name}", - "destination": "Используйте съезд справа в направлении {destination}" - }, - "slight left": { - "default": "Используйте съезд слева", - "name": "Используйте съезд слева на {way_name}", - "destination": "Используйте съезд слева в направлении {destination}" - }, - "slight right": { - "default": "Используйте съезд справа", - "name": "Используйте съезд справа на {way_name}", - "destination": "Используйте съезд справа в направлении {destination}" - } - }, - "on ramp": { - "default": { - "default": "Используйте въезд на автомагистраль", - "name": "Используйте въезд на {way_name}", - "destination": "Используйте въезд на автомагистраль и продолжайте движение в направлении {destination}" - }, - "left": { - "default": "Используйте въезд на автомагистраль слева", - "name": "Используйте въезд на {way_name} слева", - "destination": "Используйте въезд на автомагистраль слева и продолжайте движение в направлении {destination}" - }, - "right": { - "default": "Используйте въезд на автомагистраль справа", - "name": "Используйте въезд на {way_name} справа", - "destination": "Используйте въезд на автомагистраль справа и продолжайте движение в направлении {destination}" - }, - "sharp left": { - "default": "Используйте въезд на автомагистраль слева", - "name": "Используйте въезд на {way_name} слева", - "destination": "Используйте въезд на автомагистраль слева и продолжайте движение в направлении {destination}" - }, - "sharp right": { - "default": "Используйте въезд на автомагистраль справа", - "name": "Используйте въезд на {way_name} справа", - "destination": "Используйте въезд на автомагистраль справа и продолжайте движение в направлении {destination}" - }, - "slight left": { - "default": "Используйте въезд на автомагистраль слева", - "name": "Используйте въезд на {way_name} слева", - "destination": "Используйте въезд на автомагистраль слева и продолжайте движение в направлении {destination}" - }, - "slight right": { - "default": "Используйте въезд на автомагистраль справа", - "name": "Используйте въезд на {way_name} справа", - "destination": "Используйте въезд на автомагистраль справа и продолжайте движение в направлении {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "Въезд на кольцевую развязку", - "name": "На кольцевой развязке используйте съезд на {way_name}", - "destination": "На кольцевой развязке используйте съезд в направлении {destination}" - }, - "name": { - "default": "Въезд на площадь {rotary_name} с круговым движением", - "name": "На площади {rotary_name} с круговым движением используйте съезд на {way_name}", - "destination": "На площади {rotary_name} с круговым движением используйте съезд в направлении {destination}" - }, - "exit": { - "default": "На кольцевой развязке используйте {exit_number} съезд", - "name": "На кольцевой развязке используйте {exit_number} съезд на {way_name}", - "destination": "На кольцевой развязке используйте {exit_number} съезд в направлении {destination}" - }, - "name_exit": { - "default": "На площади {rotary_name} с круговым движением используйте {exit_number} съезд", - "name": "На площади {rotary_name} с круговым движением используйте {exit_number} съезд на {way_name}", - "destination": "На площади {rotary_name} с круговым движением используйте {exit_number} съезд в направлении {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "На круговом перекрёстке используйте {exit_number} съезд", - "name": "На круговом перекрёстке используйте {exit_number} съезд на {way_name}", - "destination": "На круговом перекрёстке используйте {exit_number} съезд в направлении {destination}" - }, - "default": { - "default": "Въезд на круговой перекрёсток", - "name": "На круговом перекрёстке используйте съезд на {way_name}", - "destination": "На круговом перекрёстке используйте съезд в направлении {destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "На круговом перекрёстке {modifier}", - "name": "На круговом перекрёстке {modifier} на {way_name}", - "destination": "На круговом перекрёстке {modifier} в направлении {destination}" - }, - "left": { - "default": "На круговом перекрёстке поверните налево", - "name": "На круговом перекрёстке поверните налево на {way_name}", - "destination": "На круговом перекрёстке поверните налево в направлении {destination}" - }, - "right": { - "default": "На круговом перекрёстке поверните направо", - "name": "На круговом перекрёстке поверните направо на {way_name}", - "destination": "На круговом перекрёстке поверните направо в направлении {destination}" - }, - "straight": { - "default": "На круговом перекрёстке продолжайте движение прямо", - "name": "На круговом перекрёстке продолжайте движение прямо по {way_name}", - "destination": "На круговом перекрёстке продолжайте движение в направлении {destination}" - } - }, - "turn": { - "default": { - "default": "Поверните {modifier}", - "name": "Поверните {modifier} на {way_name}", - "destination": "Поверните {modifier} в направлении {destination}" - }, - "left": { - "default": "Поверните налево", - "name": "Поверните налево на {way_name}", - "destination": "Поверните налево в направлении {destination}" - }, - "right": { - "default": "Поверните направо", - "name": "Поверните направо на {way_name}", - "destination": "Поверните направо в направлении {destination}" - }, - "straight": { - "default": "Продолжайте движение прямо", - "name": "Продолжайте движение прямо по {way_name}", - "destination": "Продолжайте движение прямо в направлении {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Продолжайте движение прямо" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/sv.json b/libandroid-navigation/src/main/resources/translations/sv.json deleted file mode 100644 index b4b5e661..00000000 --- a/libandroid-navigation/src/main/resources/translations/sv.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "1:a", - "2": "2:a", - "3": "3:e", - "4": "4:e", - "5": "5:e", - "6": "6:e", - "7": "7:e", - "8": "8:e", - "9": "9:e", - "10": "10:e" - }, - "direction": { - "north": "norr", - "northeast": "nordost", - "east": "öster", - "southeast": "sydost", - "south": "söder", - "southwest": "sydväst", - "west": "väster", - "northwest": "nordväst" - }, - "modifier": { - "left": "vänster", - "right": "höger", - "sharp left": "skarp vänster", - "sharp right": "skarp höger", - "slight left": "lätt vänster", - "slight right": "lätt höger", - "straight": "rakt fram", - "uturn": "U-sväng" - }, - "lanes": { - "xo": "Håll till höger", - "ox": "Håll till vänster", - "xox": "Håll till mitten", - "oxo": "Håll till vänster eller höger" - } - }, - "modes": { - "ferry": { - "default": "Ta färjan", - "name": "Ta färjan på {way_name}", - "destination": "Ta färjan mot {destination}" - } - }, - "arrive": { - "default": { - "default": "Du är framme vid din {nth} destination" - }, - "left": { - "default": "Du är framme vid din {nth} destination, till vänster" - }, - "right": { - "default": "Du är framme vid din {nth} destination, till höger" - }, - "sharp left": { - "default": "Du är framme vid din {nth} destination, skarpt till vänster" - }, - "sharp right": { - "default": "Du är framme vid din {nth} destination, skarpt till höger" - }, - "slight right": { - "default": "Du är framme vid din {nth} destination, lätt till höger" - }, - "slight left": { - "default": "Du är framme vid din {nth} destination, lätt till vänster" - }, - "straight": { - "default": "Du är framme vid din {nth} destination, rakt fram" - } - }, - "continue": { - "default": { - "default": "Fortsätt {modifier}", - "name": "Fortsätt {modifier} in på {way_name}", - "destination": "Fortsätt {modifier} mot {destination}" - }, - "straight": { - "default": "Fortsätt rakt fram", - "name": "Fortsätt in på {way_name}", - "destination": "Fortsätt mot {destination}" - }, - "slight left": { - "default": "Fortsätt med lätt vänstersväng", - "name": "Fortsätt med lätt vänstersväng in på {way_name}", - "destination": "Fortsätt med lätt vänstersväng mot {destination}" - }, - "slight right": { - "default": "Fortsätt med lätt högersväng", - "name": "Fortsätt med lätt högersväng in på {way_name}", - "destination": "Fortsätt med lätt högersväng mot {destination}" - }, - "uturn": { - "default": "Gör en U-sväng", - "name": "Gör en U-sväng in på {way_name}", - "destination": "Gör en U-sväng mot {destination}" - } - }, - "depart": { - "default": { - "default": "Kör åt {direction}", - "name": "Kör åt {direction} på {way_name}" - } - }, - "end of road": { - "default": { - "default": "Sväng {modifier}", - "name": "Sväng {modifier} in på {way_name}", - "destination": "Sväng {modifier} mot {destination}" - }, - "straight": { - "default": "Fortsätt rakt fram", - "name": "Fortsätt rakt fram in på {way_name}", - "destination": "Fortsätt rakt fram mot {destination}" - }, - "uturn": { - "default": "Gör en U-sväng i slutet av vägen", - "name": "Gör en U-sväng in på {way_name} i slutet av vägen", - "destination": "Gör en U-sväng mot {destination} i slutet av vägen" - } - }, - "fork": { - "default": { - "default": "Håll till {modifier} där vägen delar sig", - "name": "Håll till {modifier} in på {way_name}", - "destination": "Håll till {modifier} mot {destination}" - }, - "slight left": { - "default": "Håll till vänster där vägen delar sig", - "name": "Håll till vänster in på {way_name}", - "destination": "Håll till vänster mot {destination}" - }, - "slight right": { - "default": "Håll till höger där vägen delar sig", - "name": "Håll till höger in på {way_name}", - "destination": "Håll till höger mot {destination}" - }, - "sharp left": { - "default": "Gör en skarp vänstersväng där vägen delar sig", - "name": "Gör en skarp vänstersväng in på {way_name}", - "destination": "Gör en skarp vänstersväng mot {destination}" - }, - "sharp right": { - "default": "Gör en skarp högersväng där vägen delar sig", - "name": "Gör en skarp högersväng in på {way_name}", - "destination": "Gör en skarp högersväng mot {destination}" - }, - "uturn": { - "default": "Gör en U-sväng", - "name": "Gör en U-sväng in på {way_name}", - "destination": "Gör en U-sväng mot {destination}" - } - }, - "merge": { - "default": { - "default": "Körfältsbyte åt {modifier}", - "name": "Körfältsbyte åt {modifier} in på {way_name}", - "destination": "Körfältsbyte åt {modifier} mot {destination}" - }, - "slight left": { - "default": "Körfältsbyte åt vänster", - "name": "Körfältsbyte åt vänster in på {way_name}", - "destination": "Körfältsbyte åt vänster mot {destination}" - }, - "slight right": { - "default": "Körfältsbyte åt höger", - "name": "Körfältsbyte åt höger in på {way_name}", - "destination": "Körfältsbyte åt höger mot {destination}" - }, - "sharp left": { - "default": "Körfältsbyte åt vänster", - "name": "Körfältsbyte åt vänster in på {way_name}", - "destination": "Körfältsbyte åt vänster mot {destination}" - }, - "sharp right": { - "default": "Körfältsbyte åt höger", - "name": "Körfältsbyte åt höger in på {way_name}", - "destination": "Körfältsbyte åt höger mot {destination}" - }, - "uturn": { - "default": "Gör en U-sväng", - "name": "Gör en U-sväng in på {way_name}", - "destination": "Gör en U-sväng mot {destination}" - } - }, - "new name": { - "default": { - "default": "Fortsätt {modifier}", - "name": "Fortsätt {modifier} på {way_name}", - "destination": "Fortsätt {modifier} mot {destination}" - }, - "sharp left": { - "default": "Gör en skarp vänstersväng", - "name": "Gör en skarp vänstersväng in på {way_name}", - "destination": "Gör en skarp vänstersväng mot {destination}" - }, - "sharp right": { - "default": "Gör en skarp högersväng", - "name": "Gör en skarp högersväng in på {way_name}", - "destination": "Gör en skarp högersväng mot {destination}" - }, - "slight left": { - "default": "Fortsätt med lätt vänstersväng", - "name": "Fortsätt med lätt vänstersväng in på {way_name}", - "destination": "Fortsätt med lätt vänstersväng mot {destination}" - }, - "slight right": { - "default": "Fortsätt med lätt högersväng", - "name": "Fortsätt med lätt högersväng in på {way_name}", - "destination": "Fortsätt med lätt högersväng mot {destination}" - }, - "uturn": { - "default": "Gör en U-sväng", - "name": "Gör en U-sväng in på {way_name}", - "destination": "Gör en U-sväng mot {destination}" - } - }, - "notification": { - "default": { - "default": "Fortsätt {modifier}", - "name": "Fortsätt {modifier} på {way_name}", - "destination": "Fortsätt {modifier} mot {destination}" - }, - "uturn": { - "default": "Gör en U-sväng", - "name": "Gör en U-sväng in på {way_name}", - "destination": "Gör en U-sväng mot {destination}" - } - }, - "off ramp": { - "default": { - "default": "Ta avfartrampen", - "name": "Ta avfartsrampen in på {way_name}", - "destination": "Ta avfartsrampen mot {destination}" - }, - "left": { - "default": "Ta avfartsrampen till vänster", - "name": "Ta avfartsrampen till vänster in på {way_name}", - "destination": "Ta avfartsrampen till vänster mot {destination}" - }, - "right": { - "default": "Ta avfartsrampen till höger", - "name": "Ta avfartsrampen till höger in på {way_name}", - "destination": "Ta avfartsrampen till höger mot {destination}" - }, - "sharp left": { - "default": "Ta avfartsrampen till vänster", - "name": "Ta avfartsrampen till vänster in på {way_name}", - "destination": "Ta avfartsrampen till vänster mot {destination}" - }, - "sharp right": { - "default": "Ta avfartsrampen till höger", - "name": "Ta avfartsrampen till höger in på {way_name}", - "destination": "Ta avfartsrampen till höger mot {destination}" - }, - "slight left": { - "default": "Ta avfartsrampen till vänster", - "name": "Ta avfartsrampen till vänster in på {way_name}", - "destination": "Ta avfartsrampen till vänster mot {destination}" - }, - "slight right": { - "default": "Ta avfartsrampen till höger", - "name": "Ta avfartsrampen till höger in på {way_name}", - "destination": "Ta avfartsrampen till höger mot {destination}" - } - }, - "on ramp": { - "default": { - "default": "Ta påfartsrampen", - "name": "Ta påfartsrampen in på {way_name}", - "destination": "Ta påfartsrampen mot {destination}" - }, - "left": { - "default": "Ta påfartsrampen till vänster", - "name": "Ta påfartsrampen till vänster in på {way_name}", - "destination": "Ta påfartsrampen till vänster mot {destination}" - }, - "right": { - "default": "Ta påfartsrampen till höger", - "name": "Ta påfartsrampen till höger in på {way_name}", - "destination": "Ta påfartsrampen till höger mot {destination}" - }, - "sharp left": { - "default": "Ta påfartsrampen till vänster", - "name": "Ta påfartsrampen till vänster in på {way_name}", - "destination": "Ta påfartsrampen till vänster mot {destination}" - }, - "sharp right": { - "default": "Ta påfartsrampen till höger", - "name": "Ta påfartsrampen till höger in på {way_name}", - "destination": "Ta påfartsrampen till höger mot {destination}" - }, - "slight left": { - "default": "Ta påfartsrampen till vänster", - "name": "Ta påfartsrampen till vänster in på {way_name}", - "destination": "Ta påfartsrampen till vänster mot {destination}" - }, - "slight right": { - "default": "Ta påfartsrampen till höger", - "name": "Ta påfartsrampen till höger in på {way_name}", - "destination": "Ta påfartsrampen till höger mot {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "Kör in i rondellen", - "name": "Kör in i rondellen och ta av mot {way_name}", - "destination": "Kör in i rondellen och ta av mot {destination}" - }, - "name": { - "default": "Kör in i {rotary_name}", - "name": "Kör in i {rotary_name} och ta av mot {way_name}", - "destination": "Kör in i {rotary_name} och ta av mot {destination}" - }, - "exit": { - "default": "Kör in i rondellen och ta avfart {exit_number}", - "name": "Kör in i rondellen och ta avfart {exit_number} mot {way_name}", - "destination": "Kör in i rondellen och ta avfart {exit_number} mot {destination}" - }, - "name_exit": { - "default": "Kör in i {rotary_name} och ta avfart {exit_number}", - "name": "Kör in i {rotary_name} och ta avfart {exit_number} mot {way_name}", - "destination": "Kör in i {rotary_name} och ta avfart {exit_number} mot {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "Kör in i rondellen och ta avfart {exit_number}", - "name": "Kör in i rondellen och ta avfart {exit_number} mot {way_name}", - "destination": "Kör in i rondellen och ta avfart {exit_number} mot {destination}" - }, - "default": { - "default": "Kör in i rondellen", - "name": "Kör in i rondellen och ta av mot {way_name}", - "destination": "Kör in i rondellen och ta av mot {destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "Vid rondellen sväng {modifier}", - "name": "Vid rondellen sväng {modifier} in på {way_name}", - "destination": "Vid rondellen sväng {modifier} mot {destination}" - }, - "left": { - "default": "Vid rondellen sväng vänster", - "name": "Vid rondellen sväng vänster in på {way_name}", - "destination": "Vid rondellen sväng vänster mot {destination}" - }, - "right": { - "default": "Vid rondellen sväng höger", - "name": "Vid rondellen sväng höger in på {way_name}", - "destination": "Vid rondellen sväng höger mot {destination}" - }, - "straight": { - "default": "Vid rondellen fortsätt rakt fram", - "name": "Vid rondellen fortsätt rakt fram in på {way_name}", - "destination": "Vid rondellen fortsätt rakt fram mot {destination}" - } - }, - "turn": { - "default": { - "default": "Sväng åt {modifier}", - "name": "Sväng åt {modifier} in på {way_name}", - "destination": "Sväng åt {modifier} mot {destination}" - }, - "left": { - "default": "Sväng vänster", - "name": "Sväng vänster in på {way_name}", - "destination": "Sväng vänster mot {destination}" - }, - "right": { - "default": "Sväng höger", - "name": "Sväng höger in på {way_name}", - "destination": "Sväng höger mot {destination}" - }, - "straight": { - "default": "Kör rakt fram", - "name": "Kör rakt fram in på {way_name}", - "destination": "Kör rakt fram mot {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Fortsätt rakt fram" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/vi.json b/libandroid-navigation/src/main/resources/translations/vi.json deleted file mode 100644 index 0283324f..00000000 --- a/libandroid-navigation/src/main/resources/translations/vi.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": true - }, - "v5": { - "constants": { - "ordinalize": { - "1": "đầu tiên", - "2": "thứ 2", - "3": "thứ 3", - "4": "thứ 4", - "5": "thứ 5", - "6": "thú 6", - "7": "thứ 7", - "8": "thứ 8", - "9": "thứ 9", - "10": "thứ 10" - }, - "direction": { - "north": "bắc", - "northeast": "đông bắc", - "east": "đông", - "southeast": "đông nam", - "south": "nam", - "southwest": "tây nam", - "west": "tây", - "northwest": "tây bắc" - }, - "modifier": { - "left": "trái", - "right": "phải", - "sharp left": "trái gắt", - "sharp right": "phải gắt", - "slight left": "trái nghiêng", - "slight right": "phải nghiêng", - "straight": "thẳng", - "uturn": "ngược" - }, - "lanes": { - "xo": "Đi bên phải", - "ox": "Đi bên trái", - "xox": "Đi vào giữa", - "oxo": "Đi bên trái hay bên phải" - } - }, - "modes": { - "ferry": { - "default": "Lên phà", - "name": "Lên phà {way_name}", - "destination": "Lên phà đi {destination}" - } - }, - "arrive": { - "default": { - "default": "Đến nơi {nth}" - }, - "left": { - "default": "Đến nơi {nth} ở bên trái" - }, - "right": { - "default": "Đến nơi {nth} ở bên phải" - }, - "sharp left": { - "default": "Đến nơi {nth} ở bên trái" - }, - "sharp right": { - "default": "Đến nơi {nth} ở bên phải" - }, - "slight right": { - "default": "Đến nơi {nth} ở bên phải" - }, - "slight left": { - "default": "Đến nơi {nth} ở bên trái" - }, - "straight": { - "default": "Đến nơi {nth} ở trước mặt" - } - }, - "continue": { - "default": { - "default": "Chạy tiếp bên {modifier}", - "name": "Chạy tiếp bên {modifier} trên {way_name}", - "destination": "Chạy tiếp bên {modifier} đến {destination}" - }, - "straight": { - "default": "Chạy thẳng", - "name": "Chạy tiếp trên {way_name}", - "destination": "Chạy tiếp đến {destination}" - }, - "slight left": { - "default": "Nghiêng về bên trái", - "name": "Nghiêng về bên trái vào {way_name}", - "destination": "Nghiêng về bên trái đến {destination}" - }, - "slight right": { - "default": "Nghiêng về bên phải", - "name": "Nghiêng về bên phải vào {way_name}", - "destination": "Nghiêng về bên phải đến {destination}" - }, - "uturn": { - "default": "Quẹo ngược lại", - "name": "Quẹo ngược lại {way_name}", - "destination": "Quẹo ngược đến {destination}" - } - }, - "depart": { - "default": { - "default": "Đi về hướng {direction}", - "name": "Đi về hướng {direction} trên {way_name}" - } - }, - "end of road": { - "default": { - "default": "Quẹo {modifier}", - "name": "Quẹo {modifier} vào {way_name}", - "destination": "Quẹo {modifier} đến {destination}" - }, - "straight": { - "default": "Chạy thẳng", - "name": "Chạy tiếp trên {way_name}", - "destination": "Chạy tiếp đến {destination}" - }, - "uturn": { - "default": "Quẹo ngược lại tại cuối đường", - "name": "Quẹo ngược vào {way_name} tại cuối đường", - "destination": "Quẹo ngược đến {destination} tại cuối đường" - } - }, - "fork": { - "default": { - "default": "Đi bên {modifier} ở ngã ba", - "name": "Đi bên {modifier} ở ngã ba vào {way_name}", - "destination": "Đi bên {modifier} ở ngã ba đến {destination}" - }, - "slight left": { - "default": "Nghiêng về bên trái ở ngã ba", - "name": "Nghiêng về bên trái ở ngã ba vào {way_name}", - "destination": "Nghiêng về bên trái ở ngã ba đến {destination}" - }, - "slight right": { - "default": "Nghiêng về bên phải ở ngã ba", - "name": "Nghiêng về bên phải ở ngã ba vào {way_name}", - "destination": "Nghiêng về bên phải ở ngã ba đến {destination}" - }, - "sharp left": { - "default": "Quẹo gắt bên trái ở ngã ba", - "name": "Quẹo gắt bên trái ở ngã ba vào {way_name}", - "destination": "Quẹo gắt bên trái ở ngã ba đến {destination}" - }, - "sharp right": { - "default": "Quẹo gắt bên phải ở ngã ba", - "name": "Quẹo gắt bên phải ở ngã ba vào {way_name}", - "destination": "Quẹo gắt bên phải ở ngã ba đến {destination}" - }, - "uturn": { - "default": "Quẹo ngược lại", - "name": "Quẹo ngược lại {way_name}", - "destination": "Quẹo ngược lại đến {destination}" - } - }, - "merge": { - "default": { - "default": "Nhập sang {modifier}", - "name": "Nhập sang {modifier} vào {way_name}", - "destination": "Nhập sang {modifier} đến {destination}" - }, - "slight left": { - "default": "Nhập sang trái", - "name": "Nhập sang trái vào {way_name}", - "destination": "Nhập sang trái đến {destination}" - }, - "slight right": { - "default": "Nhập sang phải", - "name": "Nhập sang phải vào {way_name}", - "destination": "Nhập sang phải đến {destination}" - }, - "sharp left": { - "default": "Nhập sang trái", - "name": "Nhập sang trái vào {way_name}", - "destination": "Nhập sang trái đến {destination}" - }, - "sharp right": { - "default": "Nhập sang phải", - "name": "Nhập sang phải vào {way_name}", - "destination": "Nhập sang phải đến {destination}" - }, - "uturn": { - "default": "Quẹo ngược lại", - "name": "Quẹo ngược lại {way_name}", - "destination": "Quẹo ngược lại đến {destination}" - } - }, - "new name": { - "default": { - "default": "Chạy tiếp bên {modifier}", - "name": "Chạy tiếp bên {modifier} trên {way_name}", - "destination": "Chạy tiếp bên {modifier} đến {destination}" - }, - "sharp left": { - "default": "Quẹo gắt bên trái", - "name": "Quẹo gắt bên trái vào {way_name}", - "destination": "Quẹo gắt bên trái đến {destination}" - }, - "sharp right": { - "default": "Quẹo gắt bên phải", - "name": "Quẹo gắt bên phải vào {way_name}", - "destination": "Quẹo gắt bên phải đến {destination}" - }, - "slight left": { - "default": "Nghiêng về bên trái", - "name": "Nghiêng về bên trái vào {way_name}", - "destination": "Nghiêng về bên trái đến {destination}" - }, - "slight right": { - "default": "Nghiêng về bên phải", - "name": "Nghiêng về bên phải vào {way_name}", - "destination": "Nghiêng về bên phải đến {destination}" - }, - "uturn": { - "default": "Quẹo ngược lại", - "name": "Quẹo ngược lại {way_name}", - "destination": "Quẹo ngược lại đến {destination}" - } - }, - "notification": { - "default": { - "default": "Chạy tiếp bên {modifier}", - "name": "Chạy tiếp bên {modifier} trên {way_name}", - "destination": "Chạy tiếp bên {modifier} đến {destination}" - }, - "uturn": { - "default": "Quẹo ngược lại", - "name": "Quẹo ngược lại {way_name}", - "destination": "Quẹo ngược lại đến {destination}" - } - }, - "off ramp": { - "default": { - "default": "Đi đường nhánh", - "name": "Đi đường nhánh {way_name}", - "destination": "Đi đường nhánh đến {destination}" - }, - "left": { - "default": "Đi đường nhánh bên trái", - "name": "Đi đường nhánh {way_name} bên trái", - "destination": "Đi đường nhánh bên trái đến {destination}" - }, - "right": { - "default": "Đi đường nhánh bên phải", - "name": "Đi đường nhánh {way_name} bên phải", - "destination": "Đi đường nhánh bên phải đến {destination}" - }, - "sharp left": { - "default": "Đi đường nhánh bên trái", - "name": "Đi đường nhánh {way_name} bên trái", - "destination": "Đi đường nhánh bên trái đến {destination}" - }, - "sharp right": { - "default": "Đi đường nhánh bên phải", - "name": "Đi đường nhánh {way_name} bên phải", - "destination": "Đi đường nhánh bên phải đến {destination}" - }, - "slight left": { - "default": "Đi đường nhánh bên trái", - "name": "Đi đường nhánh {way_name} bên trái", - "destination": "Đi đường nhánh bên trái đến {destination}" - }, - "slight right": { - "default": "Đi đường nhánh bên phải", - "name": "Đi đường nhánh {way_name} bên phải", - "destination": "Đi đường nhánh bên phải đến {destination}" - } - }, - "on ramp": { - "default": { - "default": "Đi đường nhánh", - "name": "Đi đường nhánh {way_name}", - "destination": "Đi đường nhánh đến {destination}" - }, - "left": { - "default": "Đi đường nhánh bên trái", - "name": "Đi đường nhánh {way_name} bên trái", - "destination": "Đi đường nhánh bên trái đến {destination}" - }, - "right": { - "default": "Đi đường nhánh bên phải", - "name": "Đi đường nhánh {way_name} bên phải", - "destination": "Đi đường nhánh bên phải đến {destination}" - }, - "sharp left": { - "default": "Đi đường nhánh bên trái", - "name": "Đi đường nhánh {way_name} bên trái", - "destination": "Đi đường nhánh bên trái đến {destination}" - }, - "sharp right": { - "default": "Đi đường nhánh bên phải", - "name": "Đi đường nhánh {way_name} bên phải", - "destination": "Đi đường nhánh bên phải đến {destination}" - }, - "slight left": { - "default": "Đi đường nhánh bên trái", - "name": "Đi đường nhánh {way_name} bên trái", - "destination": "Đi đường nhánh bên trái đến {destination}" - }, - "slight right": { - "default": "Đi đường nhánh bên phải", - "name": "Đi đường nhánh {way_name} bên phải", - "destination": "Đi đường nhánh bên phải đến {destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "Đi vào bùng binh", - "name": "Đi vào bùng binh và ra tại {way_name}", - "destination": "Vào bùng binh và ra để đi {destination}" - }, - "name": { - "default": "Đi vào {rotary_name}", - "name": "Đi vào {rotary_name} và ra tại {way_name}", - "destination": "Đi và {rotary_name} và ra để đi {destination}" - }, - "exit": { - "default": "Đi vào bùng binh và ra tại đường {exit_number}", - "name": "Đi vào bùng binh và ra tại đường {exit_number} tức {way_name}", - "destination": "Đi vào bùng binh và ra tại đường {exit_number} đến {destination}" - }, - "name_exit": { - "default": "Đi vào {rotary_name} và ra tại đường {exit_number}", - "name": "Đi vào {rotary_name} và ra tại đường {exit_number} tức {way_name}", - "destination": "Đi vào {rotary_name} và ra tại đường {exit_number} đến {destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "Đi vào vòng xuyến và ra tại đường {exit_number}", - "name": "Đi vào vòng xuyến và ra tại đường {exit_number} tức {way_name}", - "destination": "Đi vào vòng xuyến và ra tại đường {exit_number} đến {destination}" - }, - "default": { - "default": "Đi vào vòng xuyến", - "name": "Đi vào vòng xuyến và ra tại {way_name}", - "destination": "Đi vào vòng xuyến và ra để đi {destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "Đi bên {modifier} tại vòng xuyến", - "name": "Đi bên {modifier} tại vòng xuyến để vào {way_name}", - "destination": "Đi bên {modifier} tại vòng xuyến để đi {destination}" - }, - "left": { - "default": "Quẹo trái tại vòng xuyến", - "name": "Quẹo trái tại vòng xuyến để vào {way_name}", - "destination": "Quẹo trái tại vòng xuyến để đi {destination}" - }, - "right": { - "default": "Quẹo phải tại vòng xuyến", - "name": "Quẹo phải ti vòng xuyến để vào {way_name}", - "destination": "Quẹo phải tại vòng xuyến để đi {destination}" - }, - "straight": { - "default": "Chạy thẳng tại vòng xuyến", - "name": "Chạy thẳng tại vòng xuyến để chạy tiếp trên {way_name}", - "destination": "Chạy thẳng tại vòng xuyến để đi {destination}" - } - }, - "turn": { - "default": { - "default": "Quẹo {modifier}", - "name": "Quẹo {modifier} vào {way_name}", - "destination": "Quẹo {modifier} đến {destination}" - }, - "left": { - "default": "Quẹo trái", - "name": "Quẹo trái vào {way_name}", - "destination": "Quẹo trái đến {destination}" - }, - "right": { - "default": "Quẹo phải", - "name": "Quẹo phải vào {way_name}", - "destination": "Quẹo phải đến {destination}" - }, - "straight": { - "default": "Chạy thẳng", - "name": "Chạy thẳng vào {way_name}", - "destination": "Chạy thẳng đến {destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "Chạy thẳng" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/main/resources/translations/zh-Hans.json b/libandroid-navigation/src/main/resources/translations/zh-Hans.json deleted file mode 100644 index 65b1e73d..00000000 --- a/libandroid-navigation/src/main/resources/translations/zh-Hans.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "meta": { - "capitalizeFirstLetter": false - }, - "v5": { - "constants": { - "ordinalize": { - "1": "第一", - "2": "第二", - "3": "第三", - "4": "第四", - "5": "第五", - "6": "第六", - "7": "第七", - "8": "第八", - "9": "第九", - "10": "第十" - }, - "direction": { - "north": "北", - "northeast": "东北", - "east": "东", - "southeast": "东南", - "south": "南", - "southwest": "西南", - "west": "西", - "northwest": "西北" - }, - "modifier": { - "left": "向左", - "right": "向右", - "sharp left": "向左", - "sharp right": "向右", - "slight left": "向左", - "slight right": "向右", - "straight": "直行", - "uturn": "调头" - }, - "lanes": { - "xo": "靠右直行", - "ox": "靠左直行", - "xox": "保持在道路中间直行", - "oxo": "保持在道路两侧直行" - } - }, - "modes": { - "ferry": { - "default": "乘坐轮渡", - "name": "乘坐{way_name}轮渡", - "destination": "乘坐开往{destination}的轮渡" - } - }, - "arrive": { - "default": { - "default": "您已经到达您的{nth}个目的地" - }, - "left": { - "default": "您已经到达您的{nth}个目的地,在道路左侧" - }, - "right": { - "default": "您已经到达您的{nth}个目的地,在道路右侧" - }, - "sharp left": { - "default": "您已经到达您的{nth}个目的地,在道路左侧" - }, - "sharp right": { - "default": "您已经到达您的{nth}个目的地,在道路右侧" - }, - "slight right": { - "default": "您已经到达您的{nth}个目的地,在道路右侧" - }, - "slight left": { - "default": "您已经到达您的{nth}个目的地,在道路左侧" - }, - "straight": { - "default": "您已经到达您的{nth}个目的地,在您正前方" - } - }, - "continue": { - "default": { - "default": "继续{modifier}", - "name": "继续{modifier},上{way_name}", - "destination": "继续{modifier}行驶,前往{destination}" - }, - "uturn": { - "default": "调头", - "name": "调头上{way_name}", - "destination": "调头后前往{destination}" - } - }, - "depart": { - "default": { - "default": "出发向{direction}", - "name": "出发向{direction},上{way_name}" - } - }, - "end of road": { - "default": { - "default": "{modifier}行驶", - "name": "{modifier}行驶,上{way_name}", - "destination": "{modifier}行驶,前往{destination}" - }, - "straight": { - "default": "继续直行", - "name": "继续直行,上{way_name}", - "destination": "继续直行,前往{destination}" - }, - "uturn": { - "default": "在道路尽头调头", - "name": "在道路尽头调头上{way_name}", - "destination": "在道路尽头调头,前往{destination}" - } - }, - "fork": { - "default": { - "default": "在岔道保持{modifier}", - "name": "在岔道保持{modifier},上{way_name}", - "destination": "在岔道保持{modifier},前往{destination}" - }, - "uturn": { - "default": "调头", - "name": "调头,上{way_name}", - "destination": "调头,前往{destination}" - } - }, - "merge": { - "default": { - "default": "{modifier}并道", - "name": "{modifier}并道,上{way_name}", - "destination": "{modifier}并道,前往{destination}" - }, - "uturn": { - "default": "调头", - "name": "调头,上{way_name}", - "destination": "调头,前往{destination}" - } - }, - "new name": { - "default": { - "default": "继续{modifier}", - "name": "继续{modifier},上{way_name}", - "destination": "继续{modifier},前往{destination}" - }, - "uturn": { - "default": "调头", - "name": "调头,上{way_name}", - "destination": "调头,前往{destination}" - } - }, - "notification": { - "default": { - "default": "继续{modifier}", - "name": "继续{modifier},上{way_name}", - "destination": "继续{modifier},前往{destination}" - }, - "uturn": { - "default": "调头", - "name": "调头,上{way_name}", - "destination": "调头,前往{destination}" - } - }, - "off ramp": { - "default": { - "default": "上匝道", - "name": "通过匝道驶入{way_name}", - "destination": "通过匝道前往{destination}" - }, - "left": { - "default": "通过左边的匝道", - "name": "通过左边的匝道驶入{way_name}", - "destination": "通过左边的匝道前往{destination}" - }, - "right": { - "default": "通过右边的匝道", - "name": "通过右边的匝道驶入{way_name}", - "destination": "通过右边的匝道前往{destination}" - } - }, - "on ramp": { - "default": { - "default": "通过匝道", - "name": "通过匝道驶入{way_name}", - "destination": "通过匝道前往{destination}" - }, - "left": { - "default": "通过左边的匝道", - "name": "通过左边的匝道驶入{way_name}", - "destination": "通过左边的匝道前往{destination}" - }, - "right": { - "default": "通过右边的匝道", - "name": "通过右边的匝道驶入{way_name}", - "destination": "通过右边的匝道前往{destination}" - } - }, - "rotary": { - "default": { - "default": { - "default": "进入环岛", - "name": "通过环岛后驶入{way_name}", - "destination": "通过环岛前往{destination}" - }, - "name": { - "default": "进入{rotary_name}环岛", - "name": "通过{rotary_name}环岛后驶入{way_name}", - "destination": "通过{rotary_name}环岛后前往{destination}" - }, - "exit": { - "default": "进入环岛并从{exit_number}出口驶出", - "name": "进入环岛后从{exit_number}出口驶出进入{way_name}", - "destination": "进入环岛后从{exit_number}出口驶出前往{destination}" - }, - "name_exit": { - "default": "进入{rotary_name}环岛后从{exit_number}出口驶出", - "name": "进入{rotary_name}环岛后从{exit_number}出口驶出进入{way_name}", - "destination": "进入{rotary_name}环岛后从{exit_number}出口驶出前往{destination}" - } - } - }, - "roundabout": { - "default": { - "exit": { - "default": "进入环岛后从{exit_number}出口驶出", - "name": "进入环岛后从{exit_number}出口驶出前往{way_name}", - "destination": "进入环岛后从{exit_number}出口驶出前往{destination}" - }, - "default": { - "default": "进入环岛", - "name": "通过环岛后驶入{way_name}", - "destination": "通过环岛后前往{destination}" - } - } - }, - "roundabout turn": { - "default": { - "default": "在环岛{modifier}行驶", - "name": "在环岛{modifier}行驶,上{way_name}", - "destination": "在环岛{modifier}行驶,前往{destination}" - }, - "left": { - "default": "在环岛左转", - "name": "在环岛左转,上{way_name}", - "destination": "在环岛左转,前往{destination}" - }, - "right": { - "default": "在环岛右转", - "name": "在环岛右转,上{way_name}", - "destination": "在环岛右转,前往{destination}" - }, - "straight": { - "default": "在环岛继续直行", - "name": "在环岛继续直行,上{way_name}", - "destination": "在环岛继续直行,前往{destination}" - } - }, - "turn": { - "default": { - "default": "{modifier}转弯", - "name": "{modifier}转弯,上{way_name}", - "destination": "{modifier}转弯,前往{destination}" - }, - "left": { - "default": "左转", - "name": "左转,上{way_name}", - "destination": "左转,前往{destination}" - }, - "right": { - "default": "右转", - "name": "右转,上{way_name}", - "destination": "右转,前往{destination}" - }, - "straight": { - "default": "直行", - "name": "直行,上{way_name}", - "destination": "直行,前往{destination}" - } - }, - "use lane": { - "no_lanes": { - "default": "继续直行" - }, - "default": { - "default": "{lane_instruction}" - } - } - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/BaseTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/BaseTest.java deleted file mode 100644 index 10419a77..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/BaseTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.mapbox.services.android.navigation.v5; - -import android.location.Location; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.io.IOException; -import java.util.List; - -public class BaseTest { - - protected static final double DELTA = 1E-10; - protected static final double LARGE_DELTA = 0.1; - protected static final String ACCESS_TOKEN = "pk.XXX"; - - private TestRouteBuilder routeBuilder; - private TestRouteProgressBuilder routeProgressBuilder; - private MockLocationBuilder locationBuilder; - - public BaseTest() { - routeBuilder = new TestRouteBuilder(); - routeProgressBuilder = new TestRouteProgressBuilder(); - locationBuilder = new MockLocationBuilder(); - } - - protected String loadJsonFixture(String filename) throws IOException { - return routeBuilder.loadJsonFixture(filename); - } - - protected DirectionsRoute buildTestDirectionsRoute() throws IOException { - return routeBuilder.buildTestDirectionsRoute(null); - } - - protected DirectionsRoute buildTestDirectionsRoute(@Nullable String fixtureName) throws IOException { - return routeBuilder.buildTestDirectionsRoute(fixtureName); - } - - protected RouteProgress buildDefaultTestRouteProgress() throws Exception { - DirectionsRoute testRoute = routeBuilder.buildTestDirectionsRoute(null); - return routeProgressBuilder.buildDefaultTestRouteProgress(testRoute); - } - - protected RouteProgress buildDefaultTestRouteProgress(DirectionsRoute testRoute) throws Exception { - return routeProgressBuilder.buildDefaultTestRouteProgress(testRoute); - } - - protected RouteProgress buildTestRouteProgress(DirectionsRoute route, - double stepDistanceRemaining, - double legDistanceRemaining, - double distanceRemaining, - int stepIndex, - int legIndex) throws Exception { - return routeProgressBuilder.buildTestRouteProgress( - route, stepDistanceRemaining, legDistanceRemaining, distanceRemaining, stepIndex, legIndex - ); - } - - protected Location buildDefaultLocationUpdate(double lng, double lat) { - return locationBuilder.buildDefaultMockLocationUpdate(lng, lat); - } - - @NonNull - protected Point buildPointAwayFromLocation(Location location, double distanceAway) { - return locationBuilder.buildPointAwayFromLocation(location, distanceAway); - } - - @NonNull - protected Point buildPointAwayFromPoint(Point point, double distanceAway, double bearing) { - return locationBuilder.buildPointAwayFromPoint(point, distanceAway, bearing); - } - - @NonNull - protected List createCoordinatesFromCurrentStep(RouteProgress progress) { - return locationBuilder.createCoordinatesFromCurrentStep(progress); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/MockLocationBuilder.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/MockLocationBuilder.java deleted file mode 100644 index 1f9e143b..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/MockLocationBuilder.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.mapbox.services.android.navigation.v5; - -import static com.mapbox.services.android.navigation.v5.utils.Constants.PRECISION_6; - -import android.location.Location; -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; - -import java.util.List; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -class MockLocationBuilder { - - Location buildDefaultMockLocationUpdate(double lng, double lat) { - return buildMockLocationUpdate(lng, lat, 30f, 10f, System.currentTimeMillis()); - } - - @NonNull - Point buildPointAwayFromLocation(Location location, double distanceAway) { - Point fromLocation = Point.fromLngLat( - location.getLongitude(), location.getLatitude()); - return TurfMeasurement.destination(fromLocation, distanceAway, 90, TurfConstants.UNIT_METERS); - } - - @NonNull - Point buildPointAwayFromPoint(Point point, double distanceAway, double bearing) { - return TurfMeasurement.destination(point, distanceAway, bearing, TurfConstants.UNIT_METERS); - } - - @NonNull - List createCoordinatesFromCurrentStep(RouteProgress progress) { - LegStep currentStep = progress.currentLegProgress().currentStep(); - LineString lineString = LineString.fromPolyline(currentStep.geometry(), PRECISION_6); - return lineString.coordinates(); - } - - private Location buildMockLocationUpdate(double lng, double lat, float speed, float horizontalAccuracy, long time) { - Location location = mock(Location.class); - when(location.getLongitude()).thenReturn(lng); - when(location.getLatitude()).thenReturn(lat); - when(location.getSpeed()).thenReturn(speed); - when(location.getAccuracy()).thenReturn(horizontalAccuracy); - when(location.getTime()).thenReturn(time); - return location; - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteBuilder.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteBuilder.java deleted file mode 100644 index 170d592c..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteBuilder.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mapbox.services.android.navigation.v5; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.utils.Constants; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; - -import static com.mapbox.services.android.navigation.v5.BaseTest.ACCESS_TOKEN; - -class TestRouteBuilder { - - private static final String DIRECTIONS_PRECISION_6 = "directions_v5_precision_6.json"; - - String loadJsonFixture(String filename) throws IOException { - ClassLoader classLoader = getClass().getClassLoader(); - InputStream inputStream = classLoader.getResourceAsStream(filename); - Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8.name()).useDelimiter("\\A"); - return scanner.hasNext() ? scanner.next() : ""; - } - - DirectionsRoute buildTestDirectionsRoute(@Nullable String fixtureName) throws IOException { - fixtureName = checkNullFixtureName(fixtureName); - Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(fixtureName); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - DirectionsRoute route = response.routes().get(0); - return buildRouteWithOptions(route); - } - - private DirectionsRoute buildRouteWithOptions(DirectionsRoute route) throws IOException { - List coordinates = new ArrayList<>(); - RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder() - .baseUrl(Constants.BASE_API_URL) - .user("user") - .profile("profile") - .accessToken(ACCESS_TOKEN) - .requestUuid("uuid") - .geometries("mocked_geometries") - .voiceInstructions(true) - .bannerInstructions(true) - .coordinates(coordinates).build(); - - return route.toBuilder() - .routeOptions(routeOptionsWithoutVoiceInstructions) - .build(); - } - - @NonNull - private String checkNullFixtureName(@Nullable String fixtureName) { - if (fixtureName == null) { - fixtureName = DIRECTIONS_PRECISION_6; - } - return fixtureName; - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteProgressBuilder.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteProgressBuilder.java deleted file mode 100644 index 0d3e857b..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/TestRouteProgressBuilder.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.mapbox.services.android.navigation.v5; - -import android.util.Pair; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.StepIntersection; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import java.util.List; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.createDistancesToIntersections; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.createIntersectionsList; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.findCurrentIntersection; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.findUpcomingIntersection; -import static com.mapbox.services.android.navigation.v5.utils.Constants.PRECISION_6; - -class TestRouteProgressBuilder { - - RouteProgress buildDefaultTestRouteProgress(DirectionsRoute testRoute) throws Exception { - return buildTestRouteProgress(testRoute, 100, 100, - 100, 0, 0); - } - - RouteProgress buildTestRouteProgress(DirectionsRoute route, - double stepDistanceRemaining, - double legDistanceRemaining, - double distanceRemaining, - int stepIndex, - int legIndex) throws Exception { - List steps = route.legs().get(legIndex).steps(); - LegStep currentStep = steps.get(stepIndex); - List currentStepPoints = buildCurrentStepPoints(currentStep); - int upcomingStepIndex = stepIndex + 1; - List upcomingStepPoints = null; - LegStep upcomingStep = null; - if (upcomingStepIndex < steps.size()) { - upcomingStep = steps.get(upcomingStepIndex); - String upcomingStepGeometry = upcomingStep.geometry(); - upcomingStepPoints = buildStepPointsFromGeometry(upcomingStepGeometry); - } - List intersections = createIntersectionsList(currentStep, upcomingStep); - List> intersectionDistances = createDistancesToIntersections( - currentStepPoints, intersections - ); - - StepIntersection currentIntersection = createCurrentIntersection(stepDistanceRemaining, currentStep, - intersections, intersectionDistances); - StepIntersection upcomingIntersection = createUpcomingIntersection(upcomingStep, intersections, - currentIntersection); - - return RouteProgress.builder() - .stepDistanceRemaining(stepDistanceRemaining) - .legDistanceRemaining(legDistanceRemaining) - .distanceRemaining(distanceRemaining) - .directionsRoute(route) - .currentStepPoints(currentStepPoints) - .upcomingStepPoints(upcomingStepPoints) - .intersections(intersections) - .currentIntersection(currentIntersection) - .upcomingIntersection(upcomingIntersection) - .intersectionDistancesAlongStep(intersectionDistances) - .stepIndex(stepIndex) - .legIndex(legIndex) - .build(); - } - - @NonNull - private List buildCurrentStepPoints(LegStep currentStep) { - String currentStepGeometry = currentStep.geometry(); - return buildStepPointsFromGeometry(currentStepGeometry); - } - - private StepIntersection createCurrentIntersection(double stepDistanceRemaining, LegStep currentStep, - List intersections, - List> intersectionDistances) { - double stepDistanceTraveled = currentStep.distance() - stepDistanceRemaining; - return findCurrentIntersection(intersections, - intersectionDistances, stepDistanceTraveled - ); - } - - private StepIntersection createUpcomingIntersection(LegStep upcomingStep, List intersections, - StepIntersection currentIntersection) { - return findUpcomingIntersection( - intersections, upcomingStep, currentIntersection - ); - } - - private List buildStepPointsFromGeometry(String stepGeometry) { - return PolylineUtils.decode(stepGeometry, PRECISION_6); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/LocationValidatorTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/LocationValidatorTest.java deleted file mode 100644 index b0c15f42..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/LocationValidatorTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location; - -import android.location.Location; - -import org.junit.Test; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class LocationValidatorTest { - - @Test - public void isValidUpdate_trueOnFirstUpdate() { - Location location = buildLocationWithAccuracy(10); - int accuracyThreshold = 100; - LocationValidator validator = new LocationValidator(accuracyThreshold); - - boolean isValid = validator.isValidUpdate(location); - - assertTrue(isValid); - } - - @Test - public void isValidUpdate_trueWhenUnder100MeterAccuracyThreshold() { - Location location = buildLocationWithAccuracy(90); - LocationValidator validator = buildValidatorWithUpdate(); - - boolean isValid = validator.isValidUpdate(location); - - assertTrue(isValid); - } - - @Test - public void isValidUpdate_falseWhenOver100MeterAccuracyThreshold() { - Location location = buildLocationWithAccuracy(110); - LocationValidator validator = buildValidatorWithUpdate(); - - boolean isValid = validator.isValidUpdate(location); - - assertFalse(isValid); - } - - private LocationValidator buildValidatorWithUpdate() { - Location location = buildLocationWithAccuracy(10); - int accuracyThreshold = 100; - LocationValidator validator = new LocationValidator(accuracyThreshold); - validator.isValidUpdate(location); - return validator; - } - - private Location buildLocationWithAccuracy(float accuracy) { - Location location = mock(Location.class); - when(location.getAccuracy()).thenReturn(accuracy); - return location; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParserTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParserTest.java deleted file mode 100644 index 6a0abfaa..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/GpxParserTest.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; - -@RunWith(RobolectricTestRunner.class) -public class GpxParserTest { - - private static final double DELTA = 1E-10; - private static final String TEST_GPX = "test.gpx"; - private static final String TEST_INVALID_GPX = "test_invalid.gpx"; - private static final double FIRST_TEST_GPS_LATITUDE = 47.644548; - private static final double FIRST_TEST_GPS_LONGITUDE = -122.326897; - private static final long FIRST_TEST_GPS_TIME = 1255804646000L; - private static final int FIRST_LOCATION = 0; - - @Test - public void sanity() { - GpxParser parser = new GpxParser(); - - assertNotNull(parser); - } - - @Test - public void invalidGpxTags_returnsNullList() throws ParserConfigurationException, SAXException, - ParseException, IOException { - GpxParser parser = new GpxParser(); - InputStream inputStream = buildTestGpxInputStream(TEST_INVALID_GPX); - - List parsedLocations = parser.parseGpx(inputStream); - - assertNull(parsedLocations); - } - - @Test - public void validGpxFile_returnsPopulatedLocationList() throws ParserConfigurationException, SAXException, - ParseException, IOException { - GpxParser parser = new GpxParser(); - InputStream inputStream = buildTestGpxInputStream(TEST_GPX); - - List parsedLocations = parser.parseGpx(inputStream); - - assertTrue(!parsedLocations.isEmpty()); - } - - @Test - public void validGpxFile_returnsCorrectAmountOfLocations() throws ParserConfigurationException, SAXException, - ParseException, IOException { - GpxParser parser = new GpxParser(); - InputStream inputStream = buildTestGpxInputStream(TEST_GPX); - - List parsedLocations = parser.parseGpx(inputStream); - - assertEquals(3, parsedLocations.size()); - } - - @Test - public void firstLocationUpdate_returnsCorrectLatitude() throws ParserConfigurationException, SAXException, - ParseException, IOException { - GpxParser parser = new GpxParser(); - InputStream inputStream = buildTestGpxInputStream(TEST_GPX); - - List parsedLocations = parser.parseGpx(inputStream); - - double actualFirstLatitude = parsedLocations.get(FIRST_LOCATION).getLatitude(); - assertEquals(FIRST_TEST_GPS_LATITUDE, actualFirstLatitude); - } - - @Test - public void firstLocationUpdate_returnsCorrectLongitude() throws ParserConfigurationException, SAXException, - ParseException, IOException { - GpxParser parser = new GpxParser(); - InputStream inputStream = buildTestGpxInputStream(TEST_GPX); - - List parsedLocations = parser.parseGpx(inputStream); - - double actualFirstLongitude = parsedLocations.get(FIRST_LOCATION).getLongitude(); - assertEquals(FIRST_TEST_GPS_LONGITUDE, actualFirstLongitude); - } - - @Test - public void firstLocationUpdate_returnsCorrectTimeInMillis() throws ParserConfigurationException, SAXException, - ParseException, IOException { - GpxParser parser = new GpxParser(); - InputStream inputStream = buildTestGpxInputStream(TEST_GPX); - - List parsedLocations = parser.parseGpx(inputStream); - - long actualFirstTime = parsedLocations.get(FIRST_LOCATION).getTime(); - assertEquals(FIRST_TEST_GPS_TIME, actualFirstTime, DELTA); - } - - private InputStream buildTestGpxInputStream(String gpxFileName) { - ClassLoader classLoader = getClass().getClassLoader(); - assert classLoader != null; - return classLoader.getResourceAsStream(gpxFileName); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapperTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapperTest.java deleted file mode 100644 index 2f29592e..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayJsonRouteLocationMapperTest.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -@RunWith(RobolectricTestRunner.class) -public class ReplayJsonRouteLocationMapperTest { - - private static final double DELTA = 1e-15; - - @Test(expected = IllegalArgumentException.class) - public void checksNonNullLocationListRequired() { - List nullLocations = null; - - new ReplayJsonRouteLocationMapper(nullLocations); - } - - @Test(expected = IllegalArgumentException.class) - public void checksNonEmptyLocationListRequired() { - List empty = Collections.emptyList(); - - new ReplayJsonRouteLocationMapper(empty); - } - - @Test - public void checksProviderMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals("ReplayLocation", theLocation.getProvider()); - } - - @Test - public void checksLongitudeMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setLongitude(2.0); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(2.0, theLocation.getLongitude(), DELTA); - } - - @Test - public void checksAccuracyMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setHorizontalAccuracyMeters(3.0f); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(3.0f, theLocation.getAccuracy(), DELTA); - } - - @Test - public void checksBearingMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setBearing(180.0); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(180f, theLocation.getBearing(), DELTA); - } - - @Test - @Config(sdk = 26) - public void checksVerticalAccuracyMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setVerticalAccuracyMeters(8.0f); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(8.0, theLocation.getVerticalAccuracyMeters(), DELTA); - } - - @Test(expected = NoSuchMethodError.class) - @Config(sdk = 25) - public void checksVerticalAccuracyNotMappedForBelowOreo() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setVerticalAccuracyMeters(8.0f); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - theLocation.getVerticalAccuracyMeters(); - } - - @Test - public void checksSpeedMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setSpeed(65.0); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(65.0f, theLocation.getSpeed(), DELTA); - } - - @Test - public void checksLatitudeMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setLatitude(7.0); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(7.0, theLocation.getLatitude(), DELTA); - } - - @Test - public void checksAltitudeMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - aReplayLocation.setAltitude(9.0); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - assertEquals(9.0, theLocation.getAltitude(), DELTA); - } - - @Test - public void checksTimeMapping() { - List anyReplayLocations = new ArrayList<>(1); - ReplayLocationDto aReplayLocation = new ReplayLocationDto(); - Date aDate = new Date(); - aReplayLocation.setDate(aDate); - anyReplayLocations.add(aReplayLocation); - ReplayJsonRouteLocationMapper theReplayJsonRouteLocationMapper = new ReplayJsonRouteLocationMapper(anyReplayLocations); - - List locations = theReplayJsonRouteLocationMapper.toLocations(); - - Location theLocation = locations.get(0); - long timeFromDate = aDate.getTime(); - assertEquals(timeFromDate, theLocation.getTime(), DELTA); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcherTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcherTest.java deleted file mode 100644 index 0743b054..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayLocationDispatcherTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import android.location.Location; -import android.os.Handler; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class ReplayLocationDispatcherTest { - - @Test(expected = IllegalArgumentException.class) - public void checksNonNullLocationListRequired() { - List nullLocations = null; - - new ReplayLocationDispatcher(nullLocations); - } - - @Test(expected = IllegalArgumentException.class) - public void checksNonEmptyLocationListRequired() { - List empty = Collections.emptyList(); - - new ReplayLocationDispatcher(empty); - } - - @Test - public void checksLocationDispatchedWhenIsNotLastLocation() { - List anyLocations = new ArrayList<>(1); - Location aLocation = createALocation(); - anyLocations.add(aLocation); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations); - ReplayLocationListener aReplayLocationListener = mock(ReplayLocationListener.class); - theReplayLocationDispatcher.addReplayLocationListener(aReplayLocationListener); - - theReplayLocationDispatcher.run(); - - verify(aReplayLocationListener).onLocationReplay(eq(aLocation)); - } - - @Test - public void checksNextDispatchScheduledWhenLocationsIsNotEmpty() { - List anyLocations = new ArrayList<>(2); - Location firstLocation = createALocation(); - when(firstLocation.getTime()).thenReturn(1000L); - Location secondLocation = createALocation(); - when(secondLocation.getTime()).thenReturn(2000L); - anyLocations.add(firstLocation); - anyLocations.add(secondLocation); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - - theReplayLocationDispatcher.run(); - - verify(aHandler, times(1)).postDelayed(eq(theReplayLocationDispatcher), eq(1000L)); - } - - @Test - public void checksNextDispatchNotScheduledWhenLocationsIsEmpty() { - List anyLocations = new ArrayList<>(1); - Location firstLocation = createALocation(); - anyLocations.add(firstLocation); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - - theReplayLocationDispatcher.run(); - - verify(aHandler, never()).postDelayed(any(Runnable.class), anyLong()); - } - - @Test - public void checksStopDispatchingWhenLocationsIsEmpty() { - List anyLocations = new ArrayList<>(1); - Location firstLocation = createALocation(); - anyLocations.add(firstLocation); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - - theReplayLocationDispatcher.run(); - - verify(aHandler, times(1)).removeCallbacks(eq(theReplayLocationDispatcher)); - } - - @Test - public void checksClearLocationsWhenStop() { - List theLocations = mock(List.class); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(theLocations, aHandler); - - theReplayLocationDispatcher.stop(); - - verify(theLocations, times(1)).clear(); - } - - @Test - public void checksStopDispatchingWhenStop() { - List anyLocations = mock(List.class); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - - theReplayLocationDispatcher.stop(); - - verify(aHandler, times(1)).removeCallbacks(eq(theReplayLocationDispatcher)); - } - - @Test - public void checksStopDispatchingWhenPause() { - List anyLocations = mock(List.class); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - - theReplayLocationDispatcher.pause(); - - verify(aHandler, times(1)).removeCallbacks(eq(theReplayLocationDispatcher)); - } - - @Test(expected = IllegalArgumentException.class) - public void checksNonNullLocationListRequiredWhenUpdate() { - List anyLocations = mock(List.class); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - List nullLocations = null; - - theReplayLocationDispatcher.update(nullLocations); - } - - @Test(expected = IllegalArgumentException.class) - public void checksNonEmptyLocationListRequiredWhenUpdate() { - List anyLocations = mock(List.class); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - List empty = Collections.emptyList(); - - theReplayLocationDispatcher.update(empty); - } - - @Test - public void checksAddLocationsWhenAdd() { - List anyLocations = mock(List.class); - Handler aHandler = mock(Handler.class); - ReplayLocationDispatcher theReplayLocationDispatcher = new ReplayLocationDispatcher(anyLocations, aHandler); - List locationsToReplay = mock(List.class); - - theReplayLocationDispatcher.add(locationsToReplay); - - verify(anyLocations, times(1)).addAll(eq(locationsToReplay)); - } - - private Location createALocation() { - Location location = mock(Location.class); - return location; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverterTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverterTest.java deleted file mode 100644 index 036cf07b..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverterTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; - -import org.junit.Test; - -import java.util.List; - -public class ReplayRouteLocationConverterTest { - - - @Test - public void testSliceRouteWithEmptyLineString() { - ReplayRouteLocationConverter replayRouteLocationConverter = new ReplayRouteLocationConverter(null, 100, 1); - List result = replayRouteLocationConverter.sliceRoute(LineString.fromJson("")); - - assert (result.isEmpty()); - } - - @Test - public void testSliceRouteWithNullLineString() { - ReplayRouteLocationConverter replayRouteLocationConverter = new ReplayRouteLocationConverter(null, 100, 1); - List result = replayRouteLocationConverter.sliceRoute(null); - - assert (result.isEmpty()); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteParserTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteParserTest.java deleted file mode 100644 index b6c0e712..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteParserTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.mapbox.services.android.navigation.v5.location.replay; - -import com.google.gson.GsonBuilder; - -import org.junit.Test; - -import java.io.InputStream; -import java.text.SimpleDateFormat; -import java.util.Scanner; -import java.util.TimeZone; - -import static org.junit.Assert.assertEquals; - -public class ReplayRouteParserTest { - - private static final double DELTA = 1e-15; - - @Test - public void checksLongitudeParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(11.579233823791801, firstLocation.getLongitude(), DELTA); - } - - @Test - public void checksHorizontalAccuracyParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(40, firstLocation.getHorizontalAccuracyMeters(), DELTA); - } - - @Test - public void checksBearingParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(277.0355517432898, firstLocation.getBearing(), DELTA); - } - - @Test - public void checksVerticalAccuracyParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(10, firstLocation.getVerticalAccuracyMeters(), DELTA); - } - - @Test - public void checksSpeedParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(14.704089336389941, firstLocation.getSpeed(), DELTA); - } - - @Test - public void checksLatitudeParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(48.1776966801359, firstLocation.getLatitude(), DELTA); - } - - @Test - public void checksAltitudeParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - assertEquals(0, firstLocation.getAltitude(), DELTA); - } - - @Test - public void checksTimestampParsing() { - String json = obtainJson("reroute.json"); - - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - - ReplayLocationDto firstLocation = routeFromJson.getLocations().get(0); - String dateFormatPattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatPattern); - dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - assertEquals("2018-06-25T18:16:11.005+0000", dateFormat.format(firstLocation.getDate())); - } - - @Test - public void checksRouteParsing() { - String json = obtainJson("reroute.json"); - ReplayJsonRouteDto routeFromJson = new GsonBuilder().create().fromJson(json, ReplayJsonRouteDto.class); - assertEquals("https://api.mapbox.com/directions/v5/mapbox/driving-traffic/11.579233823791801,48.1776966801359;" + - "11.573521553454881,48.17812728496367.json?access_token=pk" + - ".eyJ1IjoibWFwYm94LW5hdmlnYXRpb24iLCJhIjoiY2plZzkxZnl4MW9tZDMzb2R2ZXlkeHlhbCJ9.L1c9Wo-gk6d3cR3oi1n9SQ&steps" + - "=true&overview=full&geometries=geojson", routeFromJson.getRouteRequest()); - } - - private String obtainJson(String fileName) { - ClassLoader classLoader = getClass().getClassLoader(); - return convertStreamToString(classLoader.getResourceAsStream(fileName)); - } - - private String convertStreamToString(InputStream is) { - Scanner s = new Scanner(is).useDelimiter("\\A"); - return s.hasNext() ? s.next() : ""; - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestoneTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestoneTest.java deleted file mode 100644 index 6da1b395..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/BannerInstructionMilestoneTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - -public class BannerInstructionMilestoneTest extends BaseTest { - - @Test - public void sanity() { - BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); - - assertNotNull(milestone); - } - - @Test - public void onBeginningOfStep_bannerInstructionsShouldTrigger() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); - - boolean isOccurring = milestone.isOccurring(routeProgress, routeProgress); - - assertTrue(isOccurring); - } - - @Test - public void onSameInstructionOccurring_milestoneDoesNotTriggerTwice() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - RouteProgress firstProgress = createBeginningOfStepRouteProgress(routeProgress); - double fortyMetersIntoStep = routeProgress.currentLegProgress().currentStep().distance() - 40; - RouteProgress secondProgress = routeProgress.toBuilder() - .stepDistanceRemaining(fortyMetersIntoStep) - .stepIndex(0) - .build(); - BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); - - milestone.isOccurring(firstProgress, firstProgress); - boolean shouldNotBeOccurring = milestone.isOccurring(firstProgress, secondProgress); - - assertFalse(shouldNotBeOccurring); - } - - @Test - public void nullInstructions_MilestoneDoesNotGetTriggered() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List instructions = currentStep.bannerInstructions(); - instructions.clear(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); - - boolean isOccurring = milestone.isOccurring(routeProgress, routeProgress); - - assertFalse(isOccurring); - } - - @Test - public void onOccurringMilestone_beginningOfStep_bannerInstructionsAreReturned() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepDistanceRemaining(routeProgress.currentLegProgress().currentStep().distance()) - .stepIndex(1) - .build(); - BannerInstructions instructions = routeProgress.currentLegProgress().currentStep().bannerInstructions().get(0); - BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); - - milestone.isOccurring(routeProgress, routeProgress); - - assertEquals(instructions, milestone.getBannerInstructions()); - } - - @Test - public void onOccurringMilestone_endOfStep_bannerInstructionsAreReturned() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - int tenMetersRemainingInStep = 10; - routeProgress = routeProgress.toBuilder() - .stepDistanceRemaining(tenMetersRemainingInStep) - .stepIndex(1) - .build(); - List bannerInstructions = routeProgress.currentLegProgress().currentStep().bannerInstructions(); - BannerInstructions instructions = bannerInstructions.get(bannerInstructions.size() - 1); - BannerInstructionMilestone milestone = buildBannerInstructionMilestone(); - - milestone.isOccurring(routeProgress, routeProgress); - - assertEquals(instructions, milestone.getBannerInstructions()); - } - - private RouteProgress createBeginningOfStepRouteProgress(RouteProgress routeProgress) { - return routeProgress.toBuilder() - .stepDistanceRemaining(routeProgress.currentLegProgress().currentStep().distance()) - .stepIndex(0) - .build(); - } - - private BannerInstructionMilestone buildBannerInstructionMilestone() { - return (BannerInstructionMilestone) new BannerInstructionMilestone.Builder().setIdentifier(1234).build(); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestoneTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestoneTest.java deleted file mode 100644 index a3345948..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/StepMilestoneTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - -@RunWith(RobolectricTestRunner.class) -public class StepMilestoneTest extends BaseTest { - - private static final String ROUTE_FIXTURE = "directions_v5_precision_6.json"; - - @Test - public void sanity() throws Exception { - RouteProgress routeProgress = buildStepMilestoneRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .setIdentifier(101) - .build(); - - assertNotNull(milestone); - assertTrue(milestone.isOccurring(routeProgress, routeProgress)); - } - - @Test - public void getIdentifier_doesEqualSetValue() { - Milestone milestone = new StepMilestone.Builder() - .setIdentifier(101) - .build(); - - assertEquals(101, milestone.getIdentifier()); - } - - private RouteProgress buildStepMilestoneRouteProgress() throws Exception { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(ROUTE_FIXTURE); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - DirectionsRoute route = response.routes().get(0); - double distanceRemaining = route.distance(); - double legDistanceRemaining = route.legs().get(0).distance(); - double stepDistanceRemaining = route.legs().get(0).steps().get(0).distance(); - return buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, 1, 0); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerPropertyTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerPropertyTest.java deleted file mode 100644 index 200796da..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerPropertyTest.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import junit.framework.Assert; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -@RunWith(RobolectricTestRunner.class) -public class TriggerPropertyTest extends BaseTest { - private static final String ROUTE_FIXTURE = "directions_v5_precision_6.json"; - - @Test - public void stepDurationRemainingProperty_onlyPassesValidationWhenEqual() throws Exception { - RouteProgress routeProgress = buildTestRouteProgressForTrigger(); - double stepDuration = routeProgress.currentLegProgress().currentStepProgress().durationRemaining(); - - for (int i = 10; i > 0; i--) { - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, (stepDuration / i)) - ).build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - if ((stepDuration / i) == stepDuration) { - Assert.assertTrue(result); - } else { - Assert.assertFalse(result); - } - } - } - - @Test - public void stepDistanceRemainingProperty_onlyPassesValidationWhenEqual() throws Exception { - RouteProgress routeProgress = buildTestRouteProgressForTrigger(); - double stepDistance = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - - for (int i = 10; i > 0; i--) { - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_DISTANCE_REMAINING_METERS, (stepDistance / i)) - ).build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - if ((stepDistance / i) == stepDistance) { - Assert.assertTrue(result); - } else { - Assert.assertFalse(result); - } - } - } - - @Test - public void stepDistanceTotalProperty_onlyPassesValidationWhenEqual() throws Exception { - RouteProgress routeProgress = buildTestRouteProgressForTrigger(); - double stepDistanceTotal = routeProgress.currentLegProgress().currentStep().distance(); - - for (int i = 10; i > 0; i--) { - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, (stepDistanceTotal / i)) - ).build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - if ((stepDistanceTotal / i) == stepDistanceTotal) { - Assert.assertTrue(result); - } else { - Assert.assertFalse(result); - } - } - } - - @Test - public void stepDurationTotalProperty_onlyPassesValidationWhenEqual() throws Exception { - RouteProgress routeProgress = buildTestRouteProgressForTrigger(); - double stepDurationTotal = routeProgress.currentLegProgress().currentStep().duration(); - - for (int i = 10; i > 0; i--) { - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_DURATION_TOTAL_SECONDS, (stepDurationTotal / i)) - ).build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - if ((stepDurationTotal / i) == stepDurationTotal) { - Assert.assertTrue(result); - } else { - Assert.assertFalse(result); - } - } - } - - @Test - public void stepIndexProperty_onlyPassesValidationWhenEqual() throws Exception { - RouteProgress routeProgress = buildTestRouteProgressForTrigger(); - int stepIndex = routeProgress.currentLegProgress().stepIndex(); - - for (int i = 10; i > 0; i--) { - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_INDEX, Math.abs(stepIndex - i)) - ).build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - if (Math.abs(stepIndex - i) == stepIndex) { - Assert.assertTrue(result); - } else { - Assert.assertFalse(result); - } - } - } - - private RouteProgress buildTestRouteProgressForTrigger() throws Exception { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(ROUTE_FIXTURE); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - - DirectionsRoute route = response.routes().get(0); - double distanceRemaining = route.distance(); - double legDistanceRemaining = route.legs().get(0).distance(); - double stepDistanceRemaining = route.legs().get(0).steps().get(0).distance(); - return buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, 1, 0); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerTest.java deleted file mode 100644 index ee7d8f0a..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/TriggerTest.java +++ /dev/null @@ -1,368 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import junit.framework.Assert; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -@RunWith(RobolectricTestRunner.class) -public class TriggerTest extends BaseTest { - - private static final String ROUTE_FIXTURE = "directions_v5_precision_6.json"; - - @Test - public void triggerAll_noStatementsProvidedResultsInTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.all()) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void triggerAll_validatesAllStatements() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.all( - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d), - Trigger.eq(TriggerProperty.STEP_INDEX, 1) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void triggerAll_oneConditionsFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.all( - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d), - Trigger.eq(TriggerProperty.NEW_STEP, TriggerProperty.FALSE) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void triggerAny_noConditionsAreTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.any( - Trigger.gt(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, 200d), - Trigger.lt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void triggerAny_validatesAllStatementsTillOnesTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.any( - Trigger.eq(TriggerProperty.STEP_INDEX, 1), - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d), - Trigger.eq(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void triggerAny_oneConditionsTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.any( - Trigger.gt(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, 100d), - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - - @Test - public void triggerNone_noConditionsAreTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.none( - Trigger.gt(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, 200d), - Trigger.lt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void triggerNone_validatesAllStatementsTillOnesTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.none( - Trigger.neq(TriggerProperty.STEP_INDEX, 1), - Trigger.lt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void triggerNone_onoConditionsTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger(Trigger.none( - Trigger.gt(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, 100d), - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - )) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void greaterThan_validatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void greaterThan_validatesToFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 10000d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void greaterThanEqual_validatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.gte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void greaterThanEqual_equalStillValidatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.gte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, - routeProgress.currentLegProgress().currentStep().distance()) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void greaterThanEqual_validatesToFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.gte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 10000d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void lessThan_validatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.lt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 10000d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void lessThan_validatesToFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.lt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void lessThanEqual_validatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.lte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 10000d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void lessThanEqual_equalStillValidatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.lte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, - routeProgress.currentLegProgress().currentStep().distance()) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void lessThanEqual_validatesToFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.lte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void equal_validatesToFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void equal_validatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.eq(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, - routeProgress.currentLegProgress().currentStep().distance()) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - @Test - public void notEqual_validatesToFalse() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.neq(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, - routeProgress.currentLegProgress().currentStep().distance()) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertFalse(result); - } - - @Test - public void notEqual_validatesToTrue() throws Exception { - RouteProgress routeProgress = buildTriggerRouteProgress(); - Milestone milestone = new StepMilestone.Builder() - .setTrigger( - Trigger.neq(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d) - ) - .build(); - - boolean result = milestone.isOccurring(routeProgress, routeProgress); - - Assert.assertTrue(result); - } - - private RouteProgress buildTriggerRouteProgress() throws Exception { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(ROUTE_FIXTURE); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - DirectionsRoute route = response.routes().get(0); - int stepDistanceRemaining = (int) route.legs().get(0).steps().get(0).distance(); - int legDistanceRemaining = route.legs().get(0).distance().intValue(); - int routeDistance = route.distance().intValue(); - return buildTestRouteProgress(route, stepDistanceRemaining, legDistanceRemaining, - routeDistance, 1, 0); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestoneTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestoneTest.java deleted file mode 100644 index 96d89275..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/milestone/VoiceInstructionMilestoneTest.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.mapbox.services.android.navigation.v5.milestone; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.VoiceInstructions; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - -public class VoiceInstructionMilestoneTest extends BaseTest { - - @Test - public void sanity() { - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - assertNotNull(milestone); - } - - @Test - public void onBeginningOfStep_voiceInstructionsShouldTrigger() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - boolean isOccurring = milestone.isOccurring(routeProgress, routeProgress); - - assertTrue(isOccurring); - } - - @Test - public void onSameInstructionOccurring_milestoneDoesNotTriggerTwice() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - RouteProgress firstProgress = createBeginningOfStepRouteProgress(routeProgress); - RouteProgress secondProgress = routeProgress.toBuilder() - .stepDistanceRemaining(routeProgress.currentLegProgress().currentStep().distance() - 40) - .stepIndex(0) - .build(); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - milestone.isOccurring(firstProgress, firstProgress); - boolean shouldNotBeOccurring = milestone.isOccurring(firstProgress, secondProgress); - - assertFalse(shouldNotBeOccurring); - } - - @Test - public void nullInstructions_doNotGetTriggered() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List instructions = currentStep.voiceInstructions(); - instructions.clear(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - boolean isOccurring = milestone.isOccurring(routeProgress, routeProgress); - - assertFalse(isOccurring); - } - - @Test - public void onOccurringMilestone_voiceSsmlInstructionsAreReturned() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - VoiceInstructions instructions = routeProgress.currentLegProgress().currentStep().voiceInstructions().get(0); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - milestone.isOccurring(routeProgress, routeProgress); - - assertEquals(instructions.ssmlAnnouncement(), milestone.getSsmlAnnouncement()); - } - - @Test - public void onOccurringMilestone_voiceInstructionsAreReturned() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - VoiceInstructions instructions = routeProgress.currentLegProgress().currentStep().voiceInstructions().get(0); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - milestone.isOccurring(routeProgress, routeProgress); - - assertEquals(instructions.announcement(), milestone.getAnnouncement()); - } - - @Test - public void onOccurringMilestone_instructionsAreReturned() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = createBeginningOfStepRouteProgress(routeProgress); - VoiceInstructions instructions = routeProgress.currentLegProgress().currentStep().voiceInstructions().get(0); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - milestone.isOccurring(routeProgress, routeProgress); - - assertEquals(instructions.announcement(), milestone.getInstruction().buildInstruction(routeProgress)); - } - - @Test - public void onNullMilestoneInstructions_emptyInstructionsAreReturned() throws Exception { - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - assertEquals("", milestone.getAnnouncement()); - } - - @Test - public void onNullMilestoneInstructions_emptySsmlInstructionsAreReturned() throws Exception { - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - assertEquals("", milestone.getSsmlAnnouncement()); - } - - @Test - public void onNullMilestoneInstructions_stepNameIsReturnedForInstruction() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - VoiceInstructionMilestone milestone = buildVoiceInstructionMilestone(); - - assertEquals(currentStep.name(), milestone.getInstruction().buildInstruction(routeProgress)); - } - - private RouteProgress createBeginningOfStepRouteProgress(RouteProgress routeProgress) { - return routeProgress.toBuilder() - .stepDistanceRemaining(routeProgress.currentLegProgress().currentStep().distance()) - .stepIndex(0) - .build(); - } - - private VoiceInstructionMilestone buildVoiceInstructionMilestone() { - return (VoiceInstructionMilestone) new VoiceInstructionMilestone.Builder().setIdentifier(1234).build(); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/FasterRouteDetectorTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/FasterRouteDetectorTest.java deleted file mode 100644 index 2462a215..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/FasterRouteDetectorTest.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.Context; -import android.location.Location; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.route.FasterRoute; -import com.mapbox.services.android.navigation.v5.route.FasterRouteDetector; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.io.IOException; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FasterRouteDetectorTest extends BaseTest { - - private static final String PRECISION_6 = "directions_v5_precision_6.json"; - - @Test - public void sanity() throws Exception { - FasterRouteDetector fasterRouteDetector = new FasterRouteDetector(); - - assertNotNull(fasterRouteDetector); - } - - @Test - public void defaultFasterRouteEngine_didGetAddedOnInitialization() throws Exception { - MapboxNavigation navigation = buildNavigationWithFasterRouteEnabled(); - - assertNotNull(navigation.getFasterRouteEngine()); - } - - @Test - public void addFasterRouteEngine_didGetAdded() throws Exception { - MapboxNavigation navigation = buildNavigationWithFasterRouteEnabled(); - FasterRoute fasterRouteEngine = mock(FasterRoute.class); - - navigation.setFasterRouteEngine(fasterRouteEngine); - - assertEquals(navigation.getFasterRouteEngine(), fasterRouteEngine); - } - - @Test - public void onFasterRouteResponse_isFasterRouteIsTrue() throws Exception { - MapboxNavigation navigation = buildNavigationWithFasterRouteEnabled(); - FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine(); - RouteProgress currentProgress = obtainDefaultRouteProgress(); - DirectionsRoute longerRoute = currentProgress.directionsRoute().toBuilder() - .duration(10000000d) - .build(); - currentProgress = currentProgress.toBuilder() - .directionsRoute(longerRoute) - .build(); - DirectionsResponse response = obtainADirectionsResponse(); - - boolean isFasterRoute = fasterRouteEngine.isFasterRoute(response, currentProgress); - - assertTrue(isFasterRoute); - } - - @Test - public void onSlowerRouteResponse_isFasterRouteIsFalse() throws Exception { - MapboxNavigation navigation = buildNavigationWithFasterRouteEnabled(); - FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine(); - RouteProgress currentProgress = obtainDefaultRouteProgress(); - DirectionsRoute longerRoute = currentProgress.directionsRoute().toBuilder() - .duration(1000d) - .build(); - currentProgress = currentProgress.toBuilder() - .directionsRoute(longerRoute) - .build(); - DirectionsResponse response = obtainADirectionsResponse(); - - boolean isFasterRoute = fasterRouteEngine.isFasterRoute(response, currentProgress); - - assertFalse(isFasterRoute); - } - - @Test - public void onNullLocationPassed_shouldCheckFasterRouteIsFalse() throws Exception { - MapboxNavigation navigation = buildNavigationWithFasterRouteEnabled(); - FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine(); - - boolean checkFasterRoute = fasterRouteEngine.shouldCheckFasterRoute(null, obtainDefaultRouteProgress()); - - assertFalse(checkFasterRoute); - } - - @Test - public void onNullRouteProgressPassed_shouldCheckFasterRouteIsFalse() throws Exception { - MapboxNavigation navigation = buildNavigationWithFasterRouteEnabled(); - FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine(); - - boolean checkFasterRoute = fasterRouteEngine.shouldCheckFasterRoute(mock(Location.class), null); - - assertFalse(checkFasterRoute); - } - - private MapboxNavigation buildNavigationWithFasterRouteEnabled() { - MapboxNavigationOptions options = MapboxNavigationOptions.builder() - .enableFasterRouteDetection(true) - .build(); - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(mock(Context.class)); - return new MapboxNavigation(context, options, mock(LocationEngine.class)); - } - - private RouteProgress obtainDefaultRouteProgress() throws Exception { - DirectionsRoute aRoute = obtainADirectionsRoute(); - return buildTestRouteProgress(aRoute, 100, 700, 1000, 0, 0); - } - - private DirectionsRoute obtainADirectionsRoute() throws IOException { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(PRECISION_6); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - DirectionsRoute aRoute = response.routes().get(0); - - return aRoute; - } - - private DirectionsResponse obtainADirectionsResponse() throws IOException { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(PRECISION_6); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response; - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotificationTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotificationTest.java deleted file mode 100644 index 680282a0..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationNotificationTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.app.NotificationManager; -import android.content.Context; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import junit.framework.Assert; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; - -public class MapboxNavigationNotificationTest extends BaseTest { - - private static final String DIRECTIONS_ROUTE_FIXTURE = "directions_v5_precision_6.json"; - - @Mock - NotificationManager notificationManager; - - private DirectionsRoute route; - - @Before - public void setUp() throws Exception { - final String json = loadJsonFixture(DIRECTIONS_ROUTE_FIXTURE); - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - DirectionsResponse response = gson.fromJson(json, DirectionsResponse.class); - route = response.routes().get(0); - } - - @Ignore - @Test - public void sanity() throws Exception { - MapboxNavigationNotification mapboxNavigationNotification = new MapboxNavigationNotification( - Mockito.mock(Context.class), Mockito.mock(MapboxNavigation.class)); - Assert.assertNotNull(mapboxNavigationNotification); - } - - @Ignore - @Test - public void updateDefaultNotification_onlyUpdatesNameWhenNew() throws Exception { - RouteProgress routeProgress = RouteProgress.builder() - .directionsRoute(route) - .stepIndex(0) - .legIndex(0) - .build(); - - MapboxNavigationNotification mapboxNavigationNotification = new MapboxNavigationNotification( - Mockito.mock(Context.class), Mockito.mock(MapboxNavigation.class)); - - mapboxNavigationNotification.updateNotification(routeProgress); - // notificationManager.getActiveNotifications()[0].getNotification().contentView; - // verify(notificationManager, times(1)).getActiveNotifications()[0]; - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationTest.java deleted file mode 100644 index 74e6dda9..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationTest.java +++ /dev/null @@ -1,300 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.Context; - -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.StepMilestone; -import com.mapbox.services.android.navigation.v5.milestone.VoiceInstructionMilestone; -import com.mapbox.services.android.navigation.v5.navigation.camera.SimpleCamera; -import com.mapbox.services.android.navigation.v5.offroute.OffRoute; -import com.mapbox.services.android.navigation.v5.snap.Snap; -import com.mapbox.services.android.navigation.v5.snap.SnapToRoute; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.BANNER_INSTRUCTION_MILESTONE_ID; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.VOICE_INSTRUCTION_MILESTONE_ID; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNotSame; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class MapboxNavigationTest extends BaseTest { - - @Test - public void sanityTest() { - MapboxNavigation navigation = buildMapboxNavigation(); - - assertNotNull(navigation); - } - - @Test - public void sanityTestWithOptions() { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - - assertNotNull(navigationWithOptions); - } - - @Test - public void voiceInstructionMilestone_onInitializationDoesGetAdded() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - int identifier = searchForVoiceInstructionMilestone(navigation); - - assertEquals(VOICE_INSTRUCTION_MILESTONE_ID, identifier); - } - - @Test - public void bannerInstructionMilestone_onInitializationDoesGetAdded() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - int identifier = searchForBannerInstructionMilestone(navigation); - - assertEquals(BANNER_INSTRUCTION_MILESTONE_ID, identifier); - } - - @Test - public void defaultMilestones_onInitializationDoNotGetAdded() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - - assertEquals(0, navigationWithOptions.getMilestones().size()); - } - - @Test - public void defaultEngines_offRouteEngineDidGetInitialized() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - assertNotNull(navigation.getOffRouteEngine()); - } - - @Test - public void defaultEngines_snapEngineDidGetInitialized() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - assertNotNull(navigation.getSnapEngine()); - } - - @Test - public void addMilestone_milestoneDidGetAdded() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - Milestone milestone = new StepMilestone.Builder().build(); - - navigation.addMilestone(milestone); - - assertTrue(navigation.getMilestones().contains(milestone)); - } - - @Test - public void addMilestone_milestoneOnlyGetsAddedOnce() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - - Milestone milestone = new StepMilestone.Builder().build(); - navigationWithOptions.addMilestone(milestone); - navigationWithOptions.addMilestone(milestone); - - assertEquals(1, navigationWithOptions.getMilestones().size()); - } - - @Test - public void removeMilestone_milestoneDidGetRemoved() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - - Milestone milestone = new StepMilestone.Builder().build(); - navigationWithOptions.addMilestone(milestone); - navigationWithOptions.removeMilestone(milestone); - - assertEquals(0, navigationWithOptions.getMilestones().size()); - } - - @Test - public void removeMilestone_milestoneDoesNotExist() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - - Milestone milestone = new StepMilestone.Builder().build(); - navigationWithOptions.addMilestone(new StepMilestone.Builder().build()); - navigationWithOptions.removeMilestone(milestone); - - assertEquals(1, navigationWithOptions.getMilestones().size()); - } - - @Test - public void removeMilestone_nullRemovesAllMilestones() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - navigationWithOptions.addMilestone(new StepMilestone.Builder().build()); - navigationWithOptions.addMilestone(new StepMilestone.Builder().build()); - navigationWithOptions.addMilestone(new StepMilestone.Builder().build()); - navigationWithOptions.addMilestone(new StepMilestone.Builder().build()); - - navigationWithOptions.removeMilestone(null); - - assertEquals(0, navigationWithOptions.getMilestones().size()); - } - - @Test - public void removeMilestone_correctMilestoneWithIdentifierGetsRemoved() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - int removedMilestoneIdentifier = 5678; - Milestone milestone = new StepMilestone.Builder().setIdentifier(removedMilestoneIdentifier).build(); - navigationWithOptions.addMilestone(milestone); - - navigationWithOptions.removeMilestone(removedMilestoneIdentifier); - - assertEquals(0, navigationWithOptions.getMilestones().size()); - } - - @Test - public void removeMilestone_noMilestoneWithIdentifierFound() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - navigationWithOptions.addMilestone(new StepMilestone.Builder().build()); - int removedMilestoneIdentifier = 5678; - - navigationWithOptions.removeMilestone(removedMilestoneIdentifier); - - assertEquals(1, navigationWithOptions.getMilestones().size()); - } - - @Test - public void addMilestoneList_duplicateIdentifiersAreIgnored() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - int milestoneIdentifier = 5678; - Milestone milestone = new StepMilestone.Builder().setIdentifier(milestoneIdentifier).build(); - navigationWithOptions.addMilestone(milestone); - List milestones = new ArrayList<>(); - milestones.add(milestone); - milestones.add(milestone); - milestones.add(milestone); - - navigationWithOptions.addMilestones(milestones); - - assertEquals(1, navigationWithOptions.getMilestones().size()); - } - - @Test - public void addMilestoneList_allMilestonesAreAdded() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build(); - MapboxNavigation navigationWithOptions = buildMapboxNavigationWithOptions(options); - int firstMilestoneId = 5678; - int secondMilestoneId = 5679; - Milestone firstMilestone = new StepMilestone.Builder().setIdentifier(firstMilestoneId).build(); - Milestone secondMilestone = new StepMilestone.Builder().setIdentifier(secondMilestoneId).build(); - List milestones = new ArrayList<>(); - milestones.add(firstMilestone); - milestones.add(secondMilestone); - - navigationWithOptions.addMilestones(milestones); - - assertEquals(2, navigationWithOptions.getMilestones().size()); - } - - @Test - public void getLocationEngine_returnsCorrectLocationEngine() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - LocationEngine locationEngine = mock(LocationEngine.class); - LocationEngine locationEngineInstanceNotUsed = mock(LocationEngine.class); - - navigation.setLocationEngine(locationEngine); - - assertNotSame(locationEngineInstanceNotUsed, navigation.getLocationEngine()); - assertEquals(locationEngine, navigation.getLocationEngine()); - } - - @Test - public void startNavigation_doesSendTrueToNavigationEvent() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - NavigationEventListener navigationEventListener = mock(NavigationEventListener.class); - - navigation.addNavigationEventListener(navigationEventListener); - navigation.startNavigation(buildTestDirectionsRoute()); - - verify(navigationEventListener, times(1)).onRunning(true); - } - - @Test - public void setSnapEngine_doesReplaceDefaultEngine() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - Snap snap = mock(Snap.class); - navigation.setSnapEngine(snap); - - assertTrue(!(navigation.getSnapEngine() instanceof SnapToRoute)); - } - - @Test - public void setOffRouteEngine_doesReplaceDefaultEngine() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - OffRoute offRoute = mock(OffRoute.class); - navigation.setOffRouteEngine(offRoute); - - assertEquals(offRoute, navigation.getOffRouteEngine()); - } - - @Test - public void getCameraEngine_returnsNonNullEngine() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - navigation.setOffRouteEngine(null); - - assertNotNull(navigation.getCameraEngine()); - } - - @Test - public void getCameraEngine_returnsSimpleCameraWhenNull() throws Exception { - MapboxNavigation navigation = buildMapboxNavigation(); - - navigation.setCameraEngine(null); - - assertTrue(navigation.getCameraEngine() instanceof SimpleCamera); - } - - private MapboxNavigation buildMapboxNavigation() { - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(context); - return new MapboxNavigation(context, mock(LocationEngine.class)); - } - - private MapboxNavigation buildMapboxNavigationWithOptions(MapboxNavigationOptions options) { - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(context); - return new MapboxNavigation(context, options, mock(LocationEngine.class)); - } - - private int searchForVoiceInstructionMilestone(MapboxNavigation navigation) { - int identifier = -1; - for (Milestone milestone : navigation.getMilestones()) { - if (milestone instanceof VoiceInstructionMilestone) { - identifier = milestone.getIdentifier(); - } - } - return identifier; - } - - private int searchForBannerInstructionMilestone(MapboxNavigation navigation) { - int identifier = -1; - for (Milestone milestone : navigation.getMilestones()) { - if (milestone instanceof BannerInstructionMilestone) { - identifier = milestone.getIdentifier(); - } - } - return identifier; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactoryTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactoryTest.java deleted file mode 100644 index 60bd7969..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEngineFactoryTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import org.junit.Test; - -import static junit.framework.Assert.assertNotNull; - -public class NavigationEngineFactoryTest { - - @Test - public void onInitialization_defaultCameraEngineIsCreated() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - assertNotNull(provider.retrieveCameraEngine()); - } - - @Test - public void onInitialization_defaultOffRouteEngineIsCreated() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - assertNotNull(provider.retrieveOffRouteEngine()); - } - - @Test - public void onInitialization_defaultSnapEngineIsCreated() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - assertNotNull(provider.retrieveSnapEngine()); - } - - @Test - public void onInitialization_defaultFasterRouteEngineIsCreated() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - assertNotNull(provider.retrieveFasterRouteEngine()); - } - - @Test - public void updateFasterRouteEngine_ignoresNull() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - provider.updateFasterRouteEngine(null); - - assertNotNull(provider.retrieveFasterRouteEngine()); - } - - @Test - public void updateOffRouteEngine_ignoresNull() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - provider.updateOffRouteEngine(null); - - assertNotNull(provider.retrieveOffRouteEngine()); - } - - @Test - public void updateCameraEngine_ignoresNull() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - provider.updateCameraEngine(null); - - assertNotNull(provider.retrieveCameraEngine()); - } - - @Test - public void updateSnapEngine_ignoresNull() { - NavigationEngineFactory provider = new NavigationEngineFactory(); - - provider.updateSnapEngine(null); - - assertNotNull(provider.retrieveSnapEngine()); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcherTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcherTest.java deleted file mode 100644 index ad7c6f29..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationEventDispatcherTest.java +++ /dev/null @@ -1,323 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.Context; -import android.location.Location; - -import androidx.annotation.NonNull; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.MilestoneEventListener; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener; -import com.mapbox.services.android.navigation.v5.route.FasterRouteListener; -import com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.RouteUtils; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.robolectric.RobolectricTestRunner; - -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@RunWith(RobolectricTestRunner.class) -public class NavigationEventDispatcherTest extends BaseTest { - - private static final String PRECISION_6 = "directions_v5_precision_6.json"; - - @Mock - MilestoneEventListener milestoneEventListener; - @Mock - ProgressChangeListener progressChangeListener; - @Mock - OffRouteListener offRouteListener; - @Mock - NavigationEventListener navigationEventListener; - @Mock - FasterRouteListener fasterRouteListener; - @Mock - Location location; - @Mock - Milestone milestone; - - private NavigationEventDispatcher navigationEventDispatcher; - private MapboxNavigation navigation; - private DirectionsRoute route; - private RouteProgress routeProgress; - - @Before - public void setup() throws Exception { - MockitoAnnotations.initMocks(this); - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(mock(Context.class)); - navigation = new MapboxNavigation(context, mock(LocationEngine.class)); - navigationEventDispatcher = navigation.getEventDispatcher(); - - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(PRECISION_6); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - route = response.routes().get(0); - - routeProgress = buildTestRouteProgress(route, 100, 100, 100, 0, 0); - } - - @Test - public void sanity() throws Exception { - NavigationEventDispatcher navigationEventDispatcher = new NavigationEventDispatcher(); - assertNotNull(navigationEventDispatcher); - } - - @Test - public void addMilestoneEventListener_didAddListener() throws Exception { - navigationEventDispatcher.onMilestoneEvent(routeProgress, "", milestone); - verify(milestoneEventListener, times(0)).onMilestoneEvent(routeProgress, "", milestone); - - navigation.addMilestoneEventListener(milestoneEventListener); - navigationEventDispatcher.onMilestoneEvent(routeProgress, "", milestone); - verify(milestoneEventListener, times(1)).onMilestoneEvent(routeProgress, "", milestone); - } - - @Test - public void addMilestoneEventListener_onlyAddsListenerOnce() throws Exception { - navigationEventDispatcher.onMilestoneEvent(routeProgress, "", milestone); - verify(milestoneEventListener, times(0)).onMilestoneEvent(routeProgress, "", milestone); - - navigation.addMilestoneEventListener(milestoneEventListener); - navigation.addMilestoneEventListener(milestoneEventListener); - navigation.addMilestoneEventListener(milestoneEventListener); - navigationEventDispatcher.onMilestoneEvent(routeProgress, "", milestone); - verify(milestoneEventListener, times(1)).onMilestoneEvent(routeProgress, "", milestone); - } - - @Test - public void removeMilestoneEventListener_didRemoveListener() throws Exception { - navigation.addMilestoneEventListener(milestoneEventListener); - navigation.removeMilestoneEventListener(milestoneEventListener); - navigationEventDispatcher.onMilestoneEvent(routeProgress, "", milestone); - verify(milestoneEventListener, times(0)).onMilestoneEvent(routeProgress, "", milestone); - } - - @Test - public void removeMilestoneEventListener_nullRemovesAllListeners() throws Exception { - navigation.addMilestoneEventListener(milestoneEventListener); - navigation.addMilestoneEventListener(mock(MilestoneEventListener.class)); - navigation.addMilestoneEventListener(mock(MilestoneEventListener.class)); - navigation.addMilestoneEventListener(mock(MilestoneEventListener.class)); - - navigation.removeMilestoneEventListener(null); - navigationEventDispatcher.onMilestoneEvent(routeProgress, "", milestone); - verify(milestoneEventListener, times(0)).onMilestoneEvent(routeProgress, "", milestone); - } - - @Test - public void addProgressChangeListener_didAddListener() throws Exception { - navigationEventDispatcher.onProgressChange(location, routeProgress); - verify(progressChangeListener, times(0)).onProgressChange(location, routeProgress); - - navigation.addProgressChangeListener(progressChangeListener); - navigationEventDispatcher.onProgressChange(location, routeProgress); - verify(progressChangeListener, times(1)).onProgressChange(location, routeProgress); - } - - @Test - public void addProgressChangeListener_onlyAddsListenerOnce() throws Exception { - navigationEventDispatcher.onProgressChange(location, routeProgress); - verify(progressChangeListener, times(0)).onProgressChange(location, routeProgress); - - navigation.addProgressChangeListener(progressChangeListener); - navigation.addProgressChangeListener(progressChangeListener); - navigation.addProgressChangeListener(progressChangeListener); - navigationEventDispatcher.onProgressChange(location, routeProgress); - verify(progressChangeListener, times(1)).onProgressChange(location, routeProgress); - } - - @Test - public void removeProgressChangeListener_didRemoveListener() throws Exception { - navigation.addProgressChangeListener(progressChangeListener); - navigation.removeProgressChangeListener(progressChangeListener); - navigationEventDispatcher.onProgressChange(location, routeProgress); - verify(progressChangeListener, times(0)).onProgressChange(location, routeProgress); - } - - @Test - public void removeProgressChangeListener_nullRemovesAllListeners() throws Exception { - navigation.addProgressChangeListener(progressChangeListener); - navigation.addProgressChangeListener(mock(ProgressChangeListener.class)); - navigation.addProgressChangeListener(mock(ProgressChangeListener.class)); - navigation.addProgressChangeListener(mock(ProgressChangeListener.class)); - - navigation.removeProgressChangeListener(null); - navigationEventDispatcher.onProgressChange(location, routeProgress); - verify(progressChangeListener, times(0)).onProgressChange(location, routeProgress); - } - - @Test - public void addOffRouteListener_didAddListener() throws Exception { - navigationEventDispatcher.onUserOffRoute(location); - verify(offRouteListener, times(0)).userOffRoute(location); - - navigation.addOffRouteListener(offRouteListener); - navigationEventDispatcher.onUserOffRoute(location); - verify(offRouteListener, times(1)).userOffRoute(location); - } - - @Test - public void addOffRouteListener_onlyAddsListenerOnce() throws Exception { - navigationEventDispatcher.onUserOffRoute(location); - verify(offRouteListener, times(0)).userOffRoute(location); - - navigation.addOffRouteListener(offRouteListener); - navigation.addOffRouteListener(offRouteListener); - navigation.addOffRouteListener(offRouteListener); - navigationEventDispatcher.onUserOffRoute(location); - verify(offRouteListener, times(1)).userOffRoute(location); - } - - @Test - public void removeOffRouteListener_didRemoveListener() throws Exception { - navigation.addOffRouteListener(offRouteListener); - navigation.removeOffRouteListener(offRouteListener); - navigationEventDispatcher.onUserOffRoute(location); - verify(offRouteListener, times(0)).userOffRoute(location); - } - - @Test - public void removeOffRouteListener_nullRemovesAllListeners() throws Exception { - navigation.addOffRouteListener(offRouteListener); - navigation.addOffRouteListener(mock(OffRouteListener.class)); - navigation.addOffRouteListener(mock(OffRouteListener.class)); - navigation.addOffRouteListener(mock(OffRouteListener.class)); - navigation.addOffRouteListener(mock(OffRouteListener.class)); - - navigation.removeOffRouteListener(null); - navigationEventDispatcher.onUserOffRoute(location); - verify(offRouteListener, times(0)).userOffRoute(location); - } - - @Test - public void addNavigationEventListener_didAddListener() throws Exception { - navigationEventDispatcher.onNavigationEvent(true); - verify(navigationEventListener, times(0)).onRunning(true); - - navigation.addNavigationEventListener(navigationEventListener); - navigationEventDispatcher.onNavigationEvent(true); - verify(navigationEventListener, times(1)).onRunning(true); - } - - @Test - public void addNavigationEventListener_onlyAddsListenerOnce() throws Exception { - navigationEventDispatcher.onNavigationEvent(true); - verify(navigationEventListener, times(0)).onRunning(true); - - navigation.addNavigationEventListener(navigationEventListener); - navigation.addNavigationEventListener(navigationEventListener); - navigation.addNavigationEventListener(navigationEventListener); - navigationEventDispatcher.onNavigationEvent(true); - verify(navigationEventListener, times(1)).onRunning(true); - } - - @Test - public void removeNavigationEventListener_didRemoveListener() throws Exception { - navigation.addNavigationEventListener(navigationEventListener); - navigation.removeNavigationEventListener(navigationEventListener); - navigationEventDispatcher.onNavigationEvent(true); - verify(navigationEventListener, times(0)).onRunning(true); - } - - @Test - public void removeNavigationEventListener_nullRemovesAllListeners() throws Exception { - navigation.addNavigationEventListener(navigationEventListener); - navigation.addNavigationEventListener(mock(NavigationEventListener.class)); - navigation.addNavigationEventListener(mock(NavigationEventListener.class)); - navigation.addNavigationEventListener(mock(NavigationEventListener.class)); - navigation.addNavigationEventListener(mock(NavigationEventListener.class)); - - navigation.removeNavigationEventListener(null); - navigationEventDispatcher.onNavigationEvent(true); - verify(navigationEventListener, times(0)).onRunning(true); - } - - @Test - public void addFasterRouteListener_didAddListener() throws Exception { - navigationEventDispatcher.onFasterRouteEvent(route); - verify(fasterRouteListener, times(0)).fasterRouteFound(route); - - navigation.addFasterRouteListener(fasterRouteListener); - navigationEventDispatcher.onFasterRouteEvent(route); - verify(fasterRouteListener, times(1)).fasterRouteFound(route); - } - - @Test - public void addFasterRouteListener_onlyAddsListenerOnce() throws Exception { - navigationEventDispatcher.onFasterRouteEvent(route); - verify(fasterRouteListener, times(0)).fasterRouteFound(route); - - navigation.addFasterRouteListener(fasterRouteListener); - navigation.addFasterRouteListener(fasterRouteListener); - navigation.addFasterRouteListener(fasterRouteListener); - navigationEventDispatcher.onFasterRouteEvent(route); - verify(fasterRouteListener, times(1)).fasterRouteFound(route); - } - - @Test - public void removeFasterRouteListener_didRemoveListener() throws Exception { - navigation.addFasterRouteListener(fasterRouteListener); - navigation.removeFasterRouteListener(fasterRouteListener); - navigationEventDispatcher.onFasterRouteEvent(route); - verify(fasterRouteListener, times(0)).fasterRouteFound(route); - } - - @Test - public void removeFasterRouteListener_nullRemovesAllListeners() throws Exception { - navigation.addFasterRouteListener(fasterRouteListener); - navigation.addFasterRouteListener(mock(FasterRouteListener.class)); - navigation.addFasterRouteListener(mock(FasterRouteListener.class)); - navigation.addFasterRouteListener(mock(FasterRouteListener.class)); - navigation.addFasterRouteListener(mock(FasterRouteListener.class)); - - navigation.removeFasterRouteListener(null); - navigationEventDispatcher.onFasterRouteEvent(route); - verify(fasterRouteListener, times(0)).fasterRouteFound(route); - } - - // TODO this test fails, we need to investigate why it fails. - @Ignore - public void onArrivalDuringLastLeg_offRouteListenerIsRemoved() { - String instruction = ""; - Location location = mock(Location.class); - BannerInstructionMilestone milestone = mock(BannerInstructionMilestone.class); - RouteUtils routeUtils = mock(RouteUtils.class); - when(routeUtils.isArrivalEvent(routeProgress, milestone)).thenReturn(true); - when(routeUtils.isLastLeg(routeProgress)).thenReturn(true); - NavigationEventDispatcher navigationEventDispatcher = buildEventDispatcherHasArrived(instruction, routeUtils, milestone); - - navigationEventDispatcher.onUserOffRoute(location); - - verify(offRouteListener, times(0)).userOffRoute(location); - } - - @NonNull - private NavigationEventDispatcher buildEventDispatcherHasArrived(String instruction, RouteUtils routeUtils, - Milestone milestone) { - NavigationEventDispatcher navigationEventDispatcher = new NavigationEventDispatcher(routeUtils); - navigationEventDispatcher.addOffRouteListener(offRouteListener); - navigationEventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone); - return navigationEventDispatcher; - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListenerTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListenerTest.java deleted file mode 100644 index 656c3215..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationFasterRouteListenerTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.route.FasterRoute; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; - -public class NavigationFasterRouteListenerTest { - - @Test - public void onResponseReceived_fasterRouteIsSentToDispatcher() { - NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); - FasterRoute fasterRoute = buildFasterRouteThatReturns(true); - NavigationFasterRouteListener listener = new NavigationFasterRouteListener(eventDispatcher, fasterRoute); - DirectionsResponse response = buildDirectionsResponse(); - RouteProgress routeProgress = mock(RouteProgress.class); - - listener.onResponseReceived(response, routeProgress); - - verify(eventDispatcher).onFasterRouteEvent(any(DirectionsRoute.class)); - } - - @Test - public void onResponseReceived_slowerRouteIsNotSentToDispatcher() { - NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); - FasterRoute fasterRoute = buildFasterRouteThatReturns(false); - NavigationFasterRouteListener listener = new NavigationFasterRouteListener(eventDispatcher, fasterRoute); - DirectionsResponse response = buildDirectionsResponse(); - RouteProgress routeProgress = mock(RouteProgress.class); - - listener.onResponseReceived(response, routeProgress); - - verifyNoInteractions (eventDispatcher); - } - - @NonNull - private FasterRoute buildFasterRouteThatReturns(boolean isFaster) { - FasterRoute fasterRoute = mock(FasterRoute.class); - when(fasterRoute.isFasterRoute(any(DirectionsResponse.class), any(RouteProgress.class))).thenReturn(isFaster); - return fasterRoute; - } - - @NonNull - private DirectionsResponse buildDirectionsResponse() { - DirectionsResponse response = mock(DirectionsResponse.class); - List routes = new ArrayList<>(); - routes.add(mock(DirectionsRoute.class)); - when(response.routes()).thenReturn(routes); - return response; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelperTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelperTest.java deleted file mode 100644 index b2dc1e61..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelperTest.java +++ /dev/null @@ -1,489 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.Context; -import android.location.Location; -import android.util.Pair; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegAnnotation; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.services.android.navigation.v5.models.StepIntersection; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.StepMilestone; -import com.mapbox.services.android.navigation.v5.milestone.Trigger; -import com.mapbox.services.android.navigation.v5.milestone.TriggerProperty; -import com.mapbox.services.android.navigation.v5.offroute.OffRouteCallback; -import com.mapbox.services.android.navigation.v5.routeprogress.CurrentLegAnnotation; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteLegProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteStepProgress; -import com.mapbox.services.android.navigation.v5.utils.Constants; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.checkMilestones; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.isUserOffRoute; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotSame; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(RobolectricTestRunner.class) -public class NavigationHelperTest extends BaseTest { - - private static final String MULTI_LEG_ROUTE_FIXTURE = "directions_two_leg_route.json"; - private static final String ANNOTATED_DISTANCE_CONGESTION_ROUTE_FIXTURE = "directions_distance_congestion_annotation.json"; - - @Test - public void increaseIndex_increasesStepByOne() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - NavigationIndices previousIndices = NavigationIndices.create(0, 0); - - NavigationIndices newIndices = NavigationHelper.increaseIndex(routeProgress, previousIndices); - - assertEquals(0, newIndices.legIndex()); - assertEquals(1, newIndices.stepIndex()); - } - - @Test - public void increaseIndex_increasesLegIndex() throws Exception { - RouteProgress multiLegRouteProgress = buildMultiLegRouteProgress(); - RouteProgress routeProgress = multiLegRouteProgress.toBuilder() - .legIndex(0) - .stepIndex(21) - .build(); - NavigationIndices previousIndices = NavigationIndices.create(0, 21); - - NavigationIndices newIndices = NavigationHelper.increaseIndex(routeProgress, previousIndices); - - assertEquals(1, newIndices.legIndex()); - } - - @Test - public void increaseIndex_stepIndexResetsOnLegIndexIncrease() throws Exception { - RouteProgress multiLegRouteProgress = buildMultiLegRouteProgress(); - RouteProgress routeProgress = multiLegRouteProgress.toBuilder() - .legIndex(0) - .stepIndex(21) - .build(); - NavigationIndices previousIndices = NavigationIndices.create(0, 21); - - NavigationIndices newIndices = NavigationHelper.increaseIndex(routeProgress, previousIndices); - - assertEquals(0, newIndices.stepIndex()); - } - - @Test - public void checkMilestones_onlyTriggeredMilestonesGetReturned() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - MapboxNavigationOptions options = MapboxNavigationOptions.builder() - .defaultMilestonesEnabled(false).build(); - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(mock(Context.class)); - MapboxNavigation mapboxNavigation = new MapboxNavigation(context, options, mock(LocationEngine.class)); - mapboxNavigation.addMilestone(new StepMilestone.Builder() - .setTrigger(Trigger.eq(TriggerProperty.STEP_INDEX, 0)) - .setIdentifier(1001).build()); - mapboxNavigation.addMilestone(new StepMilestone.Builder() - .setTrigger(Trigger.eq(TriggerProperty.STEP_INDEX, 4)) - .setIdentifier(1002).build()); - - List triggeredMilestones = checkMilestones(routeProgress, routeProgress, mapboxNavigation); - - assertEquals(1, triggeredMilestones.size()); - assertEquals(1001, triggeredMilestones.get(0).getIdentifier()); - assertNotSame(1002, triggeredMilestones.get(0).getIdentifier()); - } - - @Test - public void offRouteDetectionDisabled_isOffRouteReturnsFalse() throws Exception { - MapboxNavigationOptions options = MapboxNavigationOptions.builder() - .enableOffRouteDetection(false) - .build(); - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(mock(Context.class)); - MapboxNavigation mapboxNavigation = new MapboxNavigation(context, options, mock(LocationEngine.class)); - NavigationLocationUpdate model = NavigationLocationUpdate.create(mock(Location.class), mapboxNavigation); - - boolean userOffRoute = isUserOffRoute(model, mock(RouteProgress.class), mock(OffRouteCallback.class)); - - assertFalse(userOffRoute); - } - - @Test - public void stepDistanceRemaining_returnsZeroWhenPositionsEqualEachOther() throws Exception { - DirectionsRoute route = buildMultiLegRoute(); - Location location = buildDefaultLocationUpdate(-77.062996, 38.798405); - List coordinates = PolylineUtils.decode( - route.legs().get(0).steps().get(1).geometry(), Constants.PRECISION_6 - ); - - double distance = NavigationHelper.stepDistanceRemaining(location, 0, 1, route, coordinates); - - assertEquals(0.0, distance); - } - - @Test - public void stepDistanceRemaining_returnsFullLengthForLargeDistance() throws Exception { - DirectionsRoute route = buildMultiLegRoute(); - Location location = buildDefaultLocationUpdate(0, 0); - List coordinates = PolylineUtils.decode( - route.legs().get(0).steps().get(1).geometry(), Constants.PRECISION_6 - ); - - double distance = NavigationHelper.stepDistanceRemaining(location, 0, 1, route, coordinates); - - assertEquals(25.0, distance, 1); - } - - @Test - public void nextManeuverPosition_correctlyReturnsNextManeuverPosition() throws Exception { - DirectionsRoute route = buildMultiLegRoute(); - List coordinates = PolylineUtils.decode( - route.legs().get(0).steps().get(0).geometry(), Constants.PRECISION_6 - ); - - Point nextManeuver = NavigationHelper.nextManeuverPosition(0, - route.legs().get(0).steps(), coordinates); - - assertTrue(nextManeuver.equals(route.legs().get(0).steps().get(1).maneuver().location())); - } - - @Test - public void nextManeuverPosition_correctlyReturnsNextManeuverPositionInNextLeg() throws Exception { - DirectionsRoute route = buildMultiLegRoute(); - int stepIndex = route.legs().get(0).steps().size() - 1; - List coordinates = PolylineUtils.decode( - route.legs().get(0).steps().get(stepIndex).geometry(), Constants.PRECISION_6); - - Point nextManeuver = NavigationHelper.nextManeuverPosition(stepIndex, - route.legs().get(0).steps(), coordinates); - - assertTrue(nextManeuver.equals(route.legs().get(1).steps().get(0).maneuver().location())); - } - - @Test - public void createIntersectionList_returnsCompleteIntersectionList() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - LegStep upcomingStep = routeProgress.currentLegProgress().upComingStep(); - - List intersections = NavigationHelper.createIntersectionsList(currentStep, upcomingStep); - int correctListSize = currentStep.intersections().size() + 1; - - assertTrue(correctListSize == intersections.size()); - } - - @Test - public void createIntersectionList_upcomingStepNull_returnsCurrentStepIntersectionList() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - LegStep upcomingStep = null; - - List intersections = NavigationHelper.createIntersectionsList(currentStep, upcomingStep); - int correctListSize = currentStep.intersections().size() + 1; - - assertFalse(correctListSize == intersections.size()); - } - - @Test - public void createIntersectionDistanceList_samePointsForDistanceCalculationsEqualZero() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List currentStepPoints = PolylineUtils.decode(currentStep.geometry(), Constants.PRECISION_6); - List currentStepIntersections = currentStep.intersections(); - - List> intersectionDistances = NavigationHelper.createDistancesToIntersections( - currentStepPoints, currentStepIntersections - ); - - assertTrue(intersectionDistances.get(0).second == 0); - } - - @Test - public void createIntersectionDistanceList_intersectionListSizeEqualsDistanceListSize() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List currentStepPoints = PolylineUtils.decode(currentStep.geometry(), Constants.PRECISION_6); - List currentStepIntersections = currentStep.intersections(); - - List> intersectionDistances = NavigationHelper.createDistancesToIntersections( - currentStepPoints, currentStepIntersections - ); - - assertTrue(currentStepIntersections.size() == intersectionDistances.size()); - } - - @Test - public void createIntersectionDistanceList_emptyStepPointsReturnsEmptyList() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List currentStepPoints = new ArrayList<>(); - List currentStepIntersections = currentStep.intersections(); - - List> intersectionDistances = NavigationHelper.createDistancesToIntersections( - currentStepPoints, currentStepIntersections - ); - - assertTrue(intersectionDistances.isEmpty()); - } - - @Test - public void createIntersectionDistanceList_oneStepPointReturnsEmptyList() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List currentStepPoints = new ArrayList<>(); - currentStepPoints.add(Point.fromLngLat(1d, 1d)); - List currentStepIntersections = currentStep.intersections(); - - List> intersectionDistances = NavigationHelper.createDistancesToIntersections( - currentStepPoints, currentStepIntersections - ); - - assertTrue(intersectionDistances.isEmpty()); - } - - @Test - public void createIntersectionDistanceList_emptyStepIntersectionsReturnsEmptyList() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - List currentStepPoints = PolylineUtils.decode(currentStep.geometry(), Constants.PRECISION_6); - List currentStepIntersections = new ArrayList<>(); - - List> intersectionDistances = NavigationHelper.createDistancesToIntersections( - currentStepPoints, currentStepIntersections - ); - - assertTrue(intersectionDistances.isEmpty()); - } - - @Test - public void findCurrentIntersection_beginningOfStepReturnsFirstIntersection() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - RouteStepProgress stepProgress = legProgress.currentStepProgress(); - List intersections = stepProgress.intersections(); - List> intersectionDistances = stepProgress.intersectionDistancesAlongStep(); - - StepIntersection currentIntersection = NavigationHelper.findCurrentIntersection( - intersections, intersectionDistances, 0 - ); - - assertTrue(currentIntersection.equals(intersections.get(0))); - } - - @Test - public void findCurrentIntersection_endOfStepReturnsLastIntersection() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - RouteStepProgress stepProgress = legProgress.currentStepProgress(); - List intersections = stepProgress.intersections(); - List> intersectionDistances = stepProgress.intersectionDistancesAlongStep(); - - StepIntersection currentIntersection = NavigationHelper.findCurrentIntersection( - intersections, intersectionDistances, legProgress.currentStep().distance() - ); - - assertTrue(currentIntersection.equals(intersections.get(intersections.size() - 1))); - } - - @Test - public void findCurrentIntersection_middleOfStepReturnsCorrectIntersection() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(100, 0, 0, 2, 0); - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - RouteStepProgress stepProgress = legProgress.currentStepProgress(); - List intersections = stepProgress.intersections(); - List> intersectionDistances = stepProgress.intersectionDistancesAlongStep(); - - StepIntersection currentIntersection = NavigationHelper.findCurrentIntersection( - intersections, intersectionDistances, 130 - ); - - assertTrue(currentIntersection.equals(intersections.get(1))); - } - - @Test - public void findUpcomingIntersection_beginningOfStepReturnsSecondIntersection() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - RouteStepProgress stepProgress = legProgress.currentStepProgress(); - List intersections = stepProgress.intersections(); - - StepIntersection upcomingIntersection = NavigationHelper.findUpcomingIntersection( - intersections, legProgress.upComingStep(), stepProgress.currentIntersection() - ); - - assertTrue(upcomingIntersection.equals(intersections.get(1))); - } - - @Test - public void findUpcomingIntersection_endOfStepReturnsUpcomingStepFirstIntersection() throws Exception { - RouteProgress routeProgress = buildMultiLegRouteProgress(); - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - RouteStepProgress stepProgress = legProgress.currentStepProgress(); - List intersections = stepProgress.intersections(); - List> intersectionDistances = stepProgress.intersectionDistancesAlongStep(); - StepIntersection currentIntersection = NavigationHelper.findCurrentIntersection( - intersections, intersectionDistances, legProgress.currentStep().distance() - ); - - StepIntersection upcomingIntersection = NavigationHelper.findUpcomingIntersection( - intersections, legProgress.upComingStep(), currentIntersection - ); - - assertEquals(legProgress.upComingStep().intersections().get(0), upcomingIntersection); - } - - @Test - public void findUpcomingIntersection_endOfLegReturnsNullIntersection() throws Exception { - int stepIndex = buildMultiLegRoute().legs().get(1).steps().size() - 1; - RouteProgress routeProgress = buildMultiLegRouteProgress(0, 0, 0, stepIndex, 1); - RouteLegProgress legProgress = routeProgress.currentLegProgress(); - RouteStepProgress stepProgress = legProgress.currentStepProgress(); - List intersections = stepProgress.intersections(); - List> intersectionDistances = stepProgress.intersectionDistancesAlongStep(); - StepIntersection currentIntersection = NavigationHelper.findCurrentIntersection( - intersections, intersectionDistances, legProgress.currentStep().distance() - ); - - StepIntersection upcomingIntersection = NavigationHelper.findUpcomingIntersection( - intersections, legProgress.upComingStep(), currentIntersection - ); - - assertEquals(null, upcomingIntersection); - } - - @Test - public void createCurrentAnnotation_nullAnnotationReturnsNull() throws Exception { - CurrentLegAnnotation currentLegAnnotation = NavigationHelper.createCurrentAnnotation( - null, mock(RouteLeg.class), 0 - ); - - assertEquals(null, currentLegAnnotation); - } - - @Test - public void createCurrentAnnotation_emptyDistanceArrayReturnsNull() throws Exception { - CurrentLegAnnotation currentLegAnnotation = buildCurrentAnnotation(); - RouteLeg routeLeg = buildRouteLegWithAnnotation(); - - CurrentLegAnnotation newLegAnnotation = NavigationHelper.createCurrentAnnotation( - currentLegAnnotation, routeLeg, 0 - ); - - assertEquals(null, newLegAnnotation); - } - - @Test - public void createCurrentAnnotation_beginningOfStep_correctAnnotationIsReturned() throws Exception { - RouteProgress routeProgress = buildDistanceCongestionAnnotationRouteProgress(0, 0, 0, 0, 0); - Double legDistanceRemaining = routeProgress.currentLeg().distance(); - - CurrentLegAnnotation newLegAnnotation = NavigationHelper.createCurrentAnnotation( - null, routeProgress.currentLeg(), legDistanceRemaining - ); - - assertEquals("moderate", newLegAnnotation.congestion()); - } - - @Test - public void createCurrentAnnotation_midStep_correctAnnotationIsReturned() throws Exception { - RouteProgress routeProgress = buildDistanceCongestionAnnotationRouteProgress(0, 0, 0, 0, 0); - Double legDistanceRemaining = routeProgress.currentLeg().distance() / 2; - - CurrentLegAnnotation newLegAnnotation = NavigationHelper.createCurrentAnnotation( - null, routeProgress.currentLeg(), legDistanceRemaining - ); - - assertTrue(newLegAnnotation.distanceToAnnotation() < legDistanceRemaining); - assertEquals("heavy", newLegAnnotation.congestion()); - } - - @Test - public void createCurrentAnnotation_usesCurrentLegAnnotationForPriorDistanceTraveled() throws Exception { - RouteProgress routeProgress = buildDistanceCongestionAnnotationRouteProgress(0, 0, 0, 0, 0); - Double legDistanceRemaining = routeProgress.currentLeg().distance() / 2; - Double previousAnnotationDistance = routeProgress.currentLeg().distance() / 3; - CurrentLegAnnotation currentLegAnnotation = CurrentLegAnnotation.builder() - .distance(100d) - .distanceToAnnotation(previousAnnotationDistance) - .index(0) - .build(); - - CurrentLegAnnotation newLegAnnotation = NavigationHelper.createCurrentAnnotation( - currentLegAnnotation, routeProgress.currentLeg(), legDistanceRemaining - ); - - assertEquals(11, newLegAnnotation.index()); - } - - private RouteProgress buildMultiLegRouteProgress(double stepDistanceRemaining, double legDistanceRemaining, - double distanceRemaining, int stepIndex, int legIndex) throws Exception { - DirectionsRoute multiLegRoute = buildMultiLegRoute(); - return buildTestRouteProgress(multiLegRoute, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - } - - private RouteProgress buildDistanceCongestionAnnotationRouteProgress(double stepDistanceRemaining, double legDistanceRemaining, - double distanceRemaining, int stepIndex, int legIndex) throws Exception { - DirectionsRoute annotatedRoute = buildDistanceCongestionAnnotationRoute(); - return buildTestRouteProgress(annotatedRoute, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - } - - private RouteProgress buildMultiLegRouteProgress() throws Exception { - DirectionsRoute multiLegRoute = buildMultiLegRoute(); - return buildTestRouteProgress(multiLegRoute, 1000, 1000, 1000, 0, 0); - } - - private DirectionsRoute buildMultiLegRoute() throws IOException { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(MULTI_LEG_ROUTE_FIXTURE); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response.routes().get(0); - } - - private DirectionsRoute buildDistanceCongestionAnnotationRoute() throws IOException { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(ANNOTATED_DISTANCE_CONGESTION_ROUTE_FIXTURE); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response.routes().get(0); - } - - private CurrentLegAnnotation buildCurrentAnnotation() { - return CurrentLegAnnotation.builder() - .distance(54d) - .distanceToAnnotation(100) - .congestion("severe") - .index(1) - .build(); - } - - private RouteLeg buildRouteLegWithAnnotation() { - RouteLeg routeLeg = mock(RouteLeg.class); - LegAnnotation legAnnotation = LegAnnotation.builder() - .distance(new ArrayList()) - .build(); - when(routeLeg.annotation()).thenReturn(legAnnotation); - return routeLeg; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationNotificationProviderTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationNotificationProviderTest.java deleted file mode 100644 index 95d8e671..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationNotificationProviderTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.Context; -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.navigation.notification.NavigationNotification; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class NavigationNotificationProviderTest { - - @Test - public void updateNavigationNotification() { - NavigationNotification notification = mock(NavigationNotification.class); - MapboxNavigation mapboxNavigation = buildNavigationWithNotificationOptions(notification); - Context context = mock(Context.class); - NavigationNotificationProvider provider = new NavigationNotificationProvider(context, mapboxNavigation); - - RouteProgress routeProgress = mock(RouteProgress.class); - provider.updateNavigationNotification(routeProgress); - - verify(notification).updateNotification(eq(routeProgress)); - } - - @Test - public void updateNavigationNotification_doesNotUpdateAfterShutdown() { - NavigationNotification notification = mock(NavigationNotification.class); - MapboxNavigation mapboxNavigation = buildNavigationWithNotificationOptions(notification); - Context context = mock(Context.class); - NavigationNotificationProvider provider = new NavigationNotificationProvider(context, mapboxNavigation); - RouteProgress routeProgress = mock(RouteProgress.class); - - provider.shutdown(context); - provider.updateNavigationNotification(routeProgress); - - verify(notification, times(0)).updateNotification(routeProgress); - } - - @Test - public void onShutdown_onNavigationStoppedIsCalled() { - NavigationNotification notification = mock(NavigationNotification.class); - MapboxNavigation mapboxNavigation = buildNavigationWithNotificationOptions(notification); - Context context = mock(Context.class); - NavigationNotificationProvider provider = new NavigationNotificationProvider(context, mapboxNavigation); - - provider.shutdown(context); - - verify(notification).onNavigationStopped(context); - } - - @NonNull - private MapboxNavigation buildNavigationWithNotificationOptions(NavigationNotification notification) { - MapboxNavigation mapboxNavigation = mock(MapboxNavigation.class); - MapboxNavigationOptions options = mock(MapboxNavigationOptions.class); - when(options.navigationNotification()).thenReturn(notification); - when(mapboxNavigation.options()).thenReturn(options); - return mapboxNavigation; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationRouteProcessorTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationRouteProcessorTest.java deleted file mode 100644 index b5fe2018..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/NavigationRouteProcessorTest.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.content.Context; -import android.location.Location; - -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.mapboxsdk.location.engine.LocationEngine; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.Constants; - -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.util.List; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationHelper.buildSnappedLocation; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class NavigationRouteProcessorTest extends BaseTest { - - private NavigationRouteProcessor routeProcessor; - private MapboxNavigation navigation; - - @Before - public void before() throws Exception { - routeProcessor = new NavigationRouteProcessor(); - MapboxNavigationOptions options = MapboxNavigationOptions.builder().build(); - Context context = mock(Context.class); - when(context.getApplicationContext()).thenReturn(context); - navigation = new MapboxNavigation(context, options, mock(LocationEngine.class)); - navigation.startNavigation(buildTestDirectionsRoute()); - } - - @Test - public void sanity() throws Exception { - assertNotNull(routeProcessor); - } - - @Test - public void onFirstRouteProgressBuilt_newRouteIsDecoded() throws Exception { - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - assertEquals(0, progress.legIndex()); - assertEquals(0, progress.currentLegProgress().stepIndex()); - } - - @Test - public void onShouldIncreaseStepIndex_indexIsIncreased() throws Exception { - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - int currentStepIndex = progress.currentLegProgress().stepIndex(); - routeProcessor.onShouldIncreaseIndex(); - routeProcessor.checkIncreaseIndex(navigation); - - RouteProgress secondProgress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - int secondStepIndex = secondProgress.currentLegProgress().stepIndex(); - - assertTrue(currentStepIndex != secondStepIndex); - } - - @Test - public void onSnapToRouteEnabledAndUserOnRoute_snappedLocationReturns() throws Exception { - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - boolean snapEnabled = true; - boolean userOffRoute = false; - List coordinates = createCoordinatesFromCurrentStep(progress); - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location rawLocation = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - - Location snappedLocation = buildSnappedLocation( - navigation, snapEnabled, rawLocation, progress, userOffRoute - ); - - assertTrue(!rawLocation.equals(snappedLocation)); - } - - @Test - public void onSnapToRouteDisabledAndUserOnRoute_rawLocationReturns() throws Exception { - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - boolean snapEnabled = false; - boolean userOffRoute = false; - List coordinates = createCoordinatesFromCurrentStep(progress); - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location rawLocation = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - - Location snappedLocation = buildSnappedLocation( - navigation, snapEnabled, rawLocation, progress, userOffRoute - ); - - assertTrue(rawLocation.equals(snappedLocation)); - } - - @Test - public void onSnapToRouteEnabledAndUserOffRoute_rawLocationReturns() throws Exception { - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - boolean snapEnabled = false; - boolean userOffRoute = false; - List coordinates = createCoordinatesFromCurrentStep(progress); - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location rawLocation = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - - Location snappedLocation = buildSnappedLocation( - navigation, snapEnabled, rawLocation, progress, userOffRoute - ); - - assertTrue(rawLocation.equals(snappedLocation)); - } - - @Test - public void onStepDistanceRemainingZeroAndNoBearingMatch_stepIndexForceIncreased() throws Exception { - RouteProgress firstProgress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - int firstProgressIndex = firstProgress.currentLegProgress().stepIndex(); - List coordinates = createCoordinatesFromCurrentStep(firstProgress); - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location rawLocation = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - - RouteProgress secondProgress = routeProcessor.buildNewRouteProgress(navigation, rawLocation); - int secondProgressIndex = secondProgress.currentLegProgress().stepIndex(); - - assertTrue(firstProgressIndex != secondProgressIndex); - } - - @Test - public void onInvalidNextLeg_indexIsNotIncreased() throws Exception { - routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - int legSize = navigation.getRoute().legs().size(); - - for (int i = 0; i < legSize; i++) { - routeProcessor.onShouldIncreaseIndex(); - routeProcessor.checkIncreaseIndex(navigation); - } - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - - assertTrue(progress.legIndex() == legSize - 1); - } - - @Test - public void onInvalidNextStep_indexIsNotIncreased() throws Exception { - routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - int stepSize = navigation.getRoute().legs().get(0).steps().size(); - - for (int i = 0; i < stepSize; i++) { - routeProcessor.onShouldIncreaseIndex(); - routeProcessor.checkIncreaseIndex(navigation); - } - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - - assertTrue(progress.currentLegProgress().stepIndex() == stepSize - 1); - } - - @Test - public void onNewRoute_testStepProgressSetCorrectly() throws IOException { - navigation.startNavigation(buildTestDirectionsRoute("directions_distance_congestion_annotation.json")); - Location firstOnRoute = buildDefaultLocationUpdate(-77.034043, 38.900205); - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, firstOnRoute); - assertEquals(35.1, progress.currentLegProgress().currentStepProgress().distanceRemaining(), 1); - // If the step progress is calculated correctly, we must be on the first step of the route (index = 0) - assertEquals(0, progress.currentLegProgress().currentLegAnnotation().index()); - - Location otherOnRoute = buildDefaultLocationUpdate(-77.033638, 38.900207); - RouteProgress progress2 = routeProcessor.buildNewRouteProgress(navigation, otherOnRoute); - assertEquals(2, progress2.currentLegProgress().currentLegAnnotation().index()); - - // Creating a new route should trigger a new routeProgress to be built. Annotation must be reset to 0 for same location - DirectionsRoute testRoute2 = buildTestDirectionsRoute("directions_distance_congestion_annotation.json"); - List decoded = PolylineUtils.decode(testRoute2.geometry(), Constants.PRECISION_6); - decoded.remove(0); - String alteredGeometry = PolylineUtils.encode(decoded, Constants.PRECISION_6); - navigation.startNavigation(testRoute2.toBuilder().geometry(alteredGeometry).build()); - - RouteProgress progress3 = routeProcessor.buildNewRouteProgress(navigation, firstOnRoute); - assertEquals(0, progress3.currentLegProgress().currentLegAnnotation().index()); - } - - @Test - public void onAdvanceIndices_testAnnotationsSetCorrectly() throws IOException { - navigation.startNavigation(buildTestDirectionsRoute("directions_two_leg_route_with_distances.json")); - - RouteProgress progress0 = routeProcessor.buildNewRouteProgress(navigation, - buildDefaultLocationUpdate(-74.220588, 40.745062)); - assertEquals(0, progress0.currentLegProgress().stepIndex()); - // Location right before the via point, third annotation - Location location1 = buildDefaultLocationUpdate(-74.219569,40.745062); - RouteProgress progress = routeProcessor.buildNewRouteProgress(navigation, location1); - assertEquals(1, progress.currentLegProgress().stepIndex()); - assertEquals(0, progress.legIndex()); - assertEquals(2, progress.currentLegProgress().currentLegAnnotation().index()); - - // Location shortly after the via point, must have a lower annotation index! - Location location2 = buildDefaultLocationUpdate(-74.219444,40.745065); - RouteProgress progress2 = routeProcessor.buildNewRouteProgress(navigation, location2); - assertEquals(1, progress2.legIndex()); - assertEquals(0, progress2.currentLegProgress().currentLegAnnotation().index()); - // This must mean that the annotation was reset correctly in the meantime - } - - @Test - public void withinManeuverRadiusAndBearingMatches_stepIndexIsIncreased() throws Exception { - RouteProgress firstProgress = routeProcessor.buildNewRouteProgress(navigation, mock(Location.class)); - int firstProgressIndex = firstProgress.currentLegProgress().stepIndex(); - List coordinates = createCoordinatesFromCurrentStep(firstProgress); - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location rawLocation = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - when(rawLocation.getBearing()).thenReturn(145f); - - RouteProgress secondProgress = routeProcessor.buildNewRouteProgress(navigation, rawLocation); - int secondProgressIndex = secondProgress.currentLegProgress().stepIndex(); - - assertTrue(firstProgressIndex != secondProgressIndex); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListenerTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListenerTest.java deleted file mode 100644 index 981aa5db..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListenerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.mapbox.services.android.navigation.v5.navigation; - -import android.location.Location; -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.instruction.Instruction; -import com.mapbox.services.android.navigation.v5.milestone.Milestone; -import com.mapbox.services.android.navigation.v5.milestone.StepMilestone; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; - -public class RouteProcessorThreadListenerTest { - - @Test - public void onNewRouteProgress_notificationProviderIsUpdated() { - NavigationNotificationProvider provider = mock(NavigationNotificationProvider.class); - RouteProcessorThreadListener listener = buildListener(provider); - RouteProgress routeProgress = mock(RouteProgress.class); - - listener.onNewRouteProgress(mock(Location.class), routeProgress); - - verify(provider).updateNavigationNotification(eq(routeProgress)); - } - - @Test - public void onNewRouteProgress_eventDispatcherProgressIsUpdated() { - NavigationEventDispatcher dispatcher = mock(NavigationEventDispatcher.class); - RouteProcessorThreadListener listener = buildListener(dispatcher); - Location location = mock(Location.class); - RouteProgress routeProgress = mock(RouteProgress.class); - - listener.onNewRouteProgress(location, routeProgress); - - verify(dispatcher).onProgressChange(eq(location), eq(routeProgress)); - } - - @Test - public void onMilestoneTrigger_eventDispatcherSendsMilestone() { - List milestones = new ArrayList<>(); - StepMilestone stepMilestone = new StepMilestone.Builder().build(); - milestones.add(stepMilestone); - NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); - RouteProcessorThreadListener listener = buildListener(eventDispatcher); - RouteProgress routeProgress = mock(RouteProgress.class); - - listener.onMilestoneTrigger(milestones, routeProgress); - - verify(eventDispatcher).onMilestoneEvent(eq(routeProgress), anyString(), eq(stepMilestone)); - } - - @Test - public void onMilestoneTrigger_correctInstructionIsBuilt() { - String customInstruction = "Custom instruction!"; - Instruction instruction = buildCustomInstruction(customInstruction); - List milestones = new ArrayList<>(); - Milestone stepMilestone = new StepMilestone.Builder().setInstruction(instruction).build(); - milestones.add(stepMilestone); - NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); - RouteProcessorThreadListener listener = buildListener(eventDispatcher); - RouteProgress routeProgress = mock(RouteProgress.class); - - listener.onMilestoneTrigger(milestones, routeProgress); - - verify(eventDispatcher).onMilestoneEvent(eq(routeProgress), eq(customInstruction), eq(stepMilestone)); - } - - @Test - public void onUserOffRouteTrue_eventDispatcherSendsEvent() { - NavigationEventDispatcher dispatcher = mock(NavigationEventDispatcher.class); - RouteProcessorThreadListener listener = buildListener(dispatcher); - Location location = mock(Location.class); - - listener.onUserOffRoute(location, true); - - verify(dispatcher).onUserOffRoute(eq(location)); - } - - @Test - public void onUserOffRouteFalse_eventDispatcherDoesNotSendEvent() { - NavigationEventDispatcher dispatcher = mock(NavigationEventDispatcher.class); - RouteProcessorThreadListener listener = buildListener(dispatcher); - - listener.onUserOffRoute(mock(Location.class), false); - - verifyNoInteractions (dispatcher); - } - - private RouteProcessorThreadListener buildListener(NavigationNotificationProvider provider) { - NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); - return new RouteProcessorThreadListener(eventDispatcher, provider); - } - - private RouteProcessorThreadListener buildListener(NavigationEventDispatcher eventDispatcher) { - NavigationNotificationProvider provider = mock(NavigationNotificationProvider.class); - return new RouteProcessorThreadListener(eventDispatcher, provider); - } - - @NonNull - private Instruction buildCustomInstruction(final String customInstruction) { - return new Instruction() { - @Override - public String buildInstruction(RouteProgress routeProgress) { - return customInstruction; - } - }; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteDetectorTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteDetectorTest.java deleted file mode 100644 index 3376ec7b..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteDetectorTest.java +++ /dev/null @@ -1,417 +0,0 @@ -package com.mapbox.services.android.navigation.v5.offroute; - -import android.location.Location; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.services.android.navigation.v5.utils.Constants; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import java.util.List; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class OffRouteDetectorTest extends BaseTest { - - @Mock - private Location mockLocation; - @Mock - private RouteProgress mockProgress; - @Mock - private OffRouteCallback mockCallback; - private OffRouteDetector offRouteDetector; - private MapboxNavigationOptions options; - - @Before - public void setup() throws Exception { - MockitoAnnotations.initMocks(this); - - options = MapboxNavigationOptions.builder().build(); - - offRouteDetector = new OffRouteDetector(); - offRouteDetector.setOffRouteCallback(mockCallback); - } - - @Test - public void sanity() throws Exception { - assertNotNull(offRouteDetector); - } - - @Test - public void invalidOffRoute_onFirstLocationUpdate() throws Exception { - when(mockProgress.distanceRemaining()).thenReturn(1000d); - - boolean isUserOffRoute = offRouteDetector.isUserOffRoute(mockLocation, mockProgress, options); - - assertFalse(isUserOffRoute); - } - - @Test - public void validOffRoute_onMinimumDistanceBeforeReroutingPassed() throws Exception { - Location mapboxOffice = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - when(mockProgress.distanceRemaining()).thenReturn(1000d); - offRouteDetector.isUserOffRoute(mockLocation, mockProgress, options); - Point target = buildPointAwayFromLocation(mapboxOffice, options.minimumDistanceBeforeRerouting() + 1); - Location locationOverMinimumDistance = buildDefaultLocationUpdate(target.longitude(), target.latitude()); - - boolean validOffRoute = offRouteDetector.isUserOffRoute(locationOverMinimumDistance, routeProgress, options); - - assertTrue(validOffRoute); - } - - @Test - public void isUserOffRoute_AssertTrueWhenTooFarFromStep() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - Point stepManeuverPoint = routeProgress.directionsRoute().legs().get(0).steps().get(0).maneuver().location(); - - Location firstUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstUpdate, routeProgress, options); - - Point offRoutePoint = buildPointAwayFromPoint(stepManeuverPoint, 100, 90); - Location secondUpdate = buildDefaultLocationUpdate(offRoutePoint.longitude(), offRoutePoint.latitude()); - - boolean isUserOffRoute = offRouteDetector.isUserOffRoute(secondUpdate, routeProgress, options); - assertTrue(isUserOffRoute); - } - - @Test - public void isUserOffRoute_StepPointSize() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - Point stepManeuverPoint = routeProgress.directionsRoute().legs().get(0).steps().get(0).maneuver().location(); - removeAllButOneStepPoints(routeProgress); - Location firstUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstUpdate, routeProgress, options); - Point offRoutePoint = buildPointAwayFromPoint(stepManeuverPoint, 50, 90); - Location secondUpdate = buildDefaultLocationUpdate(offRoutePoint.longitude(), offRoutePoint.latitude()); - - boolean isUserOffRoute = offRouteDetector.isUserOffRoute(secondUpdate, routeProgress, options); - - assertFalse(isUserOffRoute); - } - - @Test - public void isUserOffRoute_AssertFalseWhenOnStep() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - Point stepManeuverPoint = routeProgress.directionsRoute().legs().get(0).steps().get(0).maneuver().location(); - - Location firstUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstUpdate, routeProgress, options); - - Point offRoutePoint = buildPointAwayFromPoint(stepManeuverPoint, 10, 90); - Location secondUpdate = buildDefaultLocationUpdate(offRoutePoint.longitude(), offRoutePoint.latitude()); - - boolean isUserOffRoute = offRouteDetector.isUserOffRoute(secondUpdate, routeProgress, options); - assertFalse(isUserOffRoute); - } - - @Test - public void isUserOffRoute_AssertFalseWhenWithinRadiusAndStepLocationHasBadAccuracy() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - Point stepManeuverPoint = routeProgress.directionsRoute().legs().get(0).steps().get(0).maneuver().location(); - - Location firstUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstUpdate, routeProgress, options); - - Point offRoutePoint = buildPointAwayFromPoint(stepManeuverPoint, 250, 90); - Location secondUpdate = buildDefaultLocationUpdate(offRoutePoint.longitude(), offRoutePoint.latitude()); - when(secondUpdate.getAccuracy()).thenReturn(300f); - - boolean isUserOffRoute = offRouteDetector.isUserOffRoute(secondUpdate, routeProgress, options); - assertFalse(isUserOffRoute); - } - - @Test - public void isUserOffRoute_AssertFalseWhenOffRouteButCloseToUpcomingStep() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - Point upcomingStepManeuverPoint = routeProgress.currentLegProgress().upComingStep().maneuver().location(); - - Location firstUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstUpdate, routeProgress, options); - - Point offRoutePoint = buildPointAwayFromPoint(upcomingStepManeuverPoint, 30, 180); - Location secondUpdate = buildDefaultLocationUpdate(offRoutePoint.longitude(), offRoutePoint.latitude()); - - boolean isUserOffRoute = offRouteDetector.isUserOffRoute(secondUpdate, routeProgress, options); - assertFalse(isUserOffRoute); - verify(mockCallback, times(1)).onShouldIncreaseIndex(); - } - - @Test - public void isUserOffRoute_AssertTrueWhenOnRouteButMovingAwayFromManeuver() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - - LineString lineString = LineString.fromPolyline(currentStep.geometry(), Constants.PRECISION_6); - List coordinates = lineString.coordinates(); - - Location firstLocationUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstLocationUpdate, routeProgress, options); - - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location secondLocationUpdate = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFirstTry = offRouteDetector.isUserOffRoute(secondLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFirstTry); - - Point secondLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location thirdLocationUpdate = buildDefaultLocationUpdate( - secondLastPointInCurrentStep.longitude(), secondLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteSecondTry = offRouteDetector.isUserOffRoute(thirdLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSecondTry); - - Point thirdLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location fourthLocationUpdate = buildDefaultLocationUpdate( - thirdLastPointInCurrentStep.longitude(), thirdLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteThirdTry = offRouteDetector.isUserOffRoute(fourthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteThirdTry); - - Point fourthLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location fifthLocationUpdate = buildDefaultLocationUpdate( - fourthLastPointInCurrentStep.longitude(), fourthLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFourthTry = offRouteDetector.isUserOffRoute(fifthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFourthTry); - - Point fifthLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location sixthLocationUpdate = buildDefaultLocationUpdate( - fifthLastPointInCurrentStep.longitude(), fifthLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFifthTry = offRouteDetector.isUserOffRoute(sixthLocationUpdate, routeProgress, options); - assertTrue(isUserOffRouteFifthTry); - } - - @Test - public void isUserOffRoute_AssertFalseWhenOnRouteMovingAwayButNotFarEnoughFromManeuver() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - - LineString lineString = LineString.fromPolyline(currentStep.geometry(), Constants.PRECISION_6); - List coordinates = lineString.coordinates(); - - Location firstLocationUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstLocationUpdate, routeProgress, options); - - Point lastPointInCurrentStep = coordinates.get(7); - Location secondLocationUpdate = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFirstTry = offRouteDetector.isUserOffRoute(secondLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFirstTry); - - Point pointSix = coordinates.get(6); - Location thirdLocationUpdate = buildDefaultLocationUpdate( - pointSix.longitude(), pointSix.latitude() - ); - boolean isUserOffRouteSecondTry = offRouteDetector.isUserOffRoute(thirdLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSecondTry); - - Location fourthLocationUpdate = buildDefaultLocationUpdate( - pointSix.longitude(), pointSix.latitude() - ); - boolean isUserOffRouteThirdTry = offRouteDetector.isUserOffRoute(fourthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteThirdTry); - - Location fifthLocationUpdate = buildDefaultLocationUpdate( - pointSix.longitude(), pointSix.latitude() - ); - boolean isUserOffRouteFourthTry = offRouteDetector.isUserOffRoute(fifthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFourthTry); - - Location sixthLocationUpdate = buildDefaultLocationUpdate( - pointSix.longitude(), pointSix.latitude() - ); - boolean isUserOffRouteFifthTry = offRouteDetector.isUserOffRoute(sixthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFifthTry); - - Point pointFive = coordinates.get(5); - Location seventhLocationUpdate = buildDefaultLocationUpdate( - pointFive.longitude(), pointFive.latitude() - ); - boolean isUserOffRouteSixthTry = offRouteDetector.isUserOffRoute(seventhLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSixthTry); - - Point pointFour = coordinates.get(4); - Location eighthLocationUpdate = buildDefaultLocationUpdate( - pointFour.longitude(), pointFour.latitude() - ); - boolean isUserOffRouteSeventhTry = offRouteDetector.isUserOffRoute(eighthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSeventhTry); - } - - @Test - public void isUserOffRoute_AssertTrueWhenOnRouteMovingAwayWithRightDirectionTraveling() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - - LineString lineString = LineString.fromPolyline(currentStep.geometry(), Constants.PRECISION_6); - List coordinates = lineString.coordinates(); - - Location firstLocationUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstLocationUpdate, routeProgress, options); - - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location secondLocationUpdate = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFirstTry = offRouteDetector.isUserOffRoute(secondLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFirstTry); - - Point secondLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location thirdLocationUpdate = buildDefaultLocationUpdate( - secondLastPointInCurrentStep.longitude(), secondLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteSecondTry = offRouteDetector.isUserOffRoute(thirdLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSecondTry); - - Point thirdLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location fourthLocationUpdate = buildDefaultLocationUpdate( - thirdLastPointInCurrentStep.longitude(), thirdLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteThirdTry = offRouteDetector.isUserOffRoute(fourthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteThirdTry); - - Point fourthLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location fifthLocationUpdate = buildDefaultLocationUpdate( - fourthLastPointInCurrentStep.longitude(), fourthLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFourthTry = offRouteDetector.isUserOffRoute(fifthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFourthTry); - - Location eighthLocationUpdate = buildDefaultLocationUpdate( - secondLastPointInCurrentStep.longitude(), secondLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteSeventhTry = offRouteDetector.isUserOffRoute(eighthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSeventhTry); - - Point fifthLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location sixthLocationUpdate = buildDefaultLocationUpdate( - fifthLastPointInCurrentStep.longitude(), fifthLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFifthTry = offRouteDetector.isUserOffRoute(sixthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFifthTry); - } - - @Test - public void isUserOffRoute_AssertTrueWhenOnRouteMovingAwayWithNotEnoughRightDirectionTraveling() throws Exception { - MapboxNavigationOptions options = this.options.toBuilder() - .offRouteMinimumDistanceMetersBeforeRightDirection(60) - .build(); - - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - - LineString lineString = LineString.fromPolyline(currentStep.geometry(), Constants.PRECISION_6); - List coordinates = lineString.coordinates(); - - Location firstLocationUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstLocationUpdate, routeProgress, options); - - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location secondLocationUpdate = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFirstTry = offRouteDetector.isUserOffRoute(secondLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFirstTry); - - Point secondLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location thirdLocationUpdate = buildDefaultLocationUpdate( - secondLastPointInCurrentStep.longitude(), secondLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteSecondTry = offRouteDetector.isUserOffRoute(thirdLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSecondTry); - - Point thirdLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location fourthLocationUpdate = buildDefaultLocationUpdate( - thirdLastPointInCurrentStep.longitude(), thirdLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteThirdTry = offRouteDetector.isUserOffRoute(fourthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteThirdTry); - - Point fourthLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location fifthLocationUpdate = buildDefaultLocationUpdate( - fourthLastPointInCurrentStep.longitude(), fourthLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFourthTry = offRouteDetector.isUserOffRoute(fifthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFourthTry); - - Location eighthLocationUpdate = buildDefaultLocationUpdate( - secondLastPointInCurrentStep.longitude(), secondLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteSeventhTry = offRouteDetector.isUserOffRoute(eighthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSeventhTry); - - Point fifthLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location sixthLocationUpdate = buildDefaultLocationUpdate( - fifthLastPointInCurrentStep.longitude(), fifthLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFifthTry = offRouteDetector.isUserOffRoute(sixthLocationUpdate, routeProgress, options); - assertTrue(isUserOffRouteFifthTry); - } - - @Test - public void isUserOffRoute_AssertFalseTwoUpdatesAwayFromManeuverThenOneTowards() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - - LineString lineString = LineString.fromPolyline(currentStep.geometry(), Constants.PRECISION_6); - List coordinates = lineString.coordinates(); - - Location firstLocationUpdate = buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637); - offRouteDetector.isUserOffRoute(firstLocationUpdate, routeProgress, options); - - Point lastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location secondLocationUpdate = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteFirstTry = offRouteDetector.isUserOffRoute(secondLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteFirstTry); - - Point secondLastPointInCurrentStep = coordinates.remove(coordinates.size() - 1); - Location thirdLocationUpdate = buildDefaultLocationUpdate( - secondLastPointInCurrentStep.longitude(), secondLastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteSecondTry = offRouteDetector.isUserOffRoute(thirdLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteSecondTry); - - Location fourthLocationUpdate = buildDefaultLocationUpdate( - lastPointInCurrentStep.longitude(), lastPointInCurrentStep.latitude() - ); - boolean isUserOffRouteThirdTry = offRouteDetector.isUserOffRoute(fourthLocationUpdate, routeProgress, options); - assertFalse(isUserOffRouteThirdTry); - } - - @Test - public void isUserOffRoute_assertTrueWhenRouteDistanceRemainingIsZero() { - Location location = mock(Location.class); - RouteProgress routeProgress = mock(RouteProgress.class); - when(routeProgress.distanceRemaining()).thenReturn(0d); - - boolean isOffRoute = offRouteDetector.isUserOffRoute(location, routeProgress, options); - - assertTrue(isOffRoute); - } - - private void removeAllButOneStepPoints(RouteProgress routeProgress) { - for (int i = routeProgress.currentStepPoints().size() - 2; i >= 0; i--) { - routeProgress.currentStepPoints().remove(i); - } - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgressTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgressTest.java deleted file mode 100644 index db61f2e7..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgressTest.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.mapbox.services.android.navigation.v5.routeprogress; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.services.android.navigation.v5.BaseTest; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNotSame; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; - -public class RouteLegProgressTest extends BaseTest { - - @Test - public void sanityTest() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - - assertNotNull(routeProgress.currentLegProgress()); - } - - @Test - public void upComingStep_returnsNextStepInLeg() throws Exception { - int stepIndex = 5; - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder().stepIndex(5).build(); - List steps = routeProgress.currentLeg().steps(); - - LegStep upComingStep = routeProgress.currentLegProgress().upComingStep(); - int upComingStepIndex = steps.indexOf(upComingStep); - - assertEquals(stepIndex + 1, upComingStepIndex); - } - - @Test - public void upComingStep_returnsNull() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - - LegStep upComingStep = findUpcomingStep(routeProgress, firstLeg); - - assertNull(upComingStep); - } - - @Test - public void currentStep_returnsCurrentStep() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - - routeProgress = routeProgress.toBuilder().stepIndex(5).build(); - - assertEquals( - firstLeg.steps().get(5).geometry(), routeProgress.currentLegProgress().currentStep().geometry() - ); - assertNotSame( - firstLeg.steps().get(6).geometry(), routeProgress.currentLegProgress().currentStep().geometry() - ); - } - - @Test - public void previousStep_returnsPreviousStep() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - - routeProgress = routeProgress.toBuilder().stepIndex(5).build(); - - assertEquals( - firstLeg.steps().get(4).geometry(), routeProgress.currentLegProgress().previousStep().geometry() - ); - assertNotSame( - firstLeg.steps().get(5).geometry(), routeProgress.currentLegProgress().previousStep().geometry() - ); - } - - @Test - public void stepIndex_returnsCurrentStepIndex() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - - routeProgress = routeProgress.toBuilder().stepIndex(3).build(); - - assertEquals(3, routeProgress.currentLegProgress().stepIndex(), BaseTest.DELTA); - } - - @Test - public void fractionTraveled_equalsZeroAtBeginning() throws Exception { - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(); - - assertEquals(0.0, routeProgress.currentLegProgress().fractionTraveled(), BaseTest.DELTA); - } - - @Test - public void fractionTraveled_equalsCorrectValueAtIntervals() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - double stepSegmentsInMeters = 5000; - List fractionsRemaining = new ArrayList<>(); - List routeProgressFractionsTraveled = new ArrayList<>(); - - for (double i = 0; i < firstLeg.distance(); i += stepSegmentsInMeters) { - float fractionRemaining = (float) (routeProgress.currentLegProgress().distanceTraveled() / firstLeg.distance()); - fractionsRemaining.add(fractionRemaining); - routeProgressFractionsTraveled.add(routeProgress.currentLegProgress().fractionTraveled()); - } - - assertTrue(fractionsRemaining.equals(routeProgressFractionsTraveled)); - } - - @Test - public void fractionTraveled_equalsOneAtEndOfLeg() throws Exception { - RouteProgress routeProgress = buildEndOfLegRouteProgress(); - - assertEquals(1.0, routeProgress.currentLegProgress().fractionTraveled(), BaseTest.DELTA); - } - - @Test - public void distanceRemaining_equalsLegDistanceAtBeginning() throws Exception { - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - - assertEquals(firstLeg.distance(), routeProgress.currentLegProgress().distanceRemaining(), - BaseTest.LARGE_DELTA); - } - - @Test - public void distanceRemaining_equalsZeroAtEndOfLeg() throws Exception { - RouteProgress routeProgress = buildEndOfLegRouteProgress(); - - assertEquals(0, routeProgress.currentLegProgress().distanceRemaining(), BaseTest.DELTA); - } - - @Test - public void distanceTraveled_equalsZeroAtBeginning() throws Exception { - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(); - - assertEquals(0, routeProgress.currentLegProgress().distanceTraveled(), BaseTest.DELTA); - } - - @Test - public void getDistanceTraveled_equalsLegDistanceAtEndOfLeg() throws Exception { - RouteProgress routeProgress = buildEndOfLegRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - - Double firstLegDistance = firstLeg.distance(); - double distanceTraveled = routeProgress.currentLegProgress().distanceTraveled(); - - assertEquals(firstLegDistance, distanceTraveled, BaseTest.DELTA); - } - - @Test - public void getDurationRemaining_equalsLegDurationAtBeginning() throws Exception { - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(); - DirectionsRoute route = routeProgress.directionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - - Double firstLegDuration = firstLeg.duration(); - double currentLegDurationRemaining = routeProgress.currentLegProgress().durationRemaining(); - - assertEquals(firstLegDuration, currentLegDurationRemaining, BaseTest.DELTA); - } - - @Test - public void getDurationRemaining_equalsZeroAtEndOfLeg() throws Exception { - RouteProgress routeProgress = buildEndOfLegRouteProgress(); - - assertEquals(0, routeProgress.currentLegProgress().durationRemaining(), BaseTest.DELTA); - } - - @Test - public void followOnStep_doesReturnTwoStepsAheadOfCurrent() throws Exception { - int stepIndex = 5; - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder().stepIndex(stepIndex).build(); - List steps = routeProgress.directionsRoute().legs().get(0).steps(); - - LegStep followOnStep = routeProgress.currentLegProgress().followOnStep(); - int followOnIndex = steps.indexOf(followOnStep); - - assertEquals(stepIndex + 2, followOnIndex); - } - - @Test - public void followOnStep_returnsNull() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int lastStepIndex = firstLeg.steps().size() - 1; - - routeProgress = routeProgress.toBuilder().stepIndex(lastStepIndex).build(); - - assertNull(routeProgress.currentLegProgress().followOnStep()); - } - - private RouteProgress buildBeginningOfLegRouteProgress() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - double stepDistanceRemaining = route.legs().get(0).steps().get(0).distance(); - double legDistanceRemaining = route.legs().get(0).distance(); - double routeDistance = route.distance(); - return buildTestRouteProgress(route, stepDistanceRemaining, legDistanceRemaining, - routeDistance, 0, 0); - } - - private RouteProgress buildEndOfLegRouteProgress() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int lastStepIndex = firstLeg.steps().size() - 1; - return buildTestRouteProgress(route, 0, 0, 0, lastStepIndex, 0); - } - - private LegStep findUpcomingStep(RouteProgress routeProgress, RouteLeg firstLeg) { - int lastStepIndex = firstLeg.steps().size() - 1; - routeProgress = routeProgress.toBuilder().stepIndex(lastStepIndex).build(); - return routeProgress.currentLegProgress().upComingStep(); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteProgressTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteProgressTest.java deleted file mode 100644 index 11b8ad73..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteProgressTest.java +++ /dev/null @@ -1,292 +0,0 @@ -package com.mapbox.services.android.navigation.v5.routeprogress; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.services.android.navigation.v5.BaseTest; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - -public class RouteProgressTest extends BaseTest { - - private static final String MULTI_LEG_ROUTE_FIXTURE = "directions_two_leg_route.json"; - - @Test - public void sanityTest() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertNotNull(beginningRouteProgress); - } - - @Test - public void directionsRoute_returnsDirectionsRoute() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertEquals(route, beginningRouteProgress.directionsRoute()); - } - - @Test - public void distanceRemaining_equalsRouteDistanceAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertEquals(route.distance(), beginningRouteProgress.distanceRemaining(), LARGE_DELTA); - } - - @Test - public void distanceRemaining_equalsZeroAtEndOfRoute() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - RouteProgress lastRouteProgress = buildLastRouteProgress(route, firstLeg); - - assertEquals(0, lastRouteProgress.distanceRemaining(), DELTA); - } - - @Test - public void fractionTraveled_equalsZeroAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertEquals(0, beginningRouteProgress.fractionTraveled(), BaseTest.LARGE_DELTA); - } - - @Test - public void fractionTraveled_equalsCorrectValueAtIntervals() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - List fractionsRemaining = new ArrayList<>(); - List routeProgressFractionsTraveled = new ArrayList<>(); - - for (int stepIndex = 0; stepIndex < route.legs().get(0).steps().size(); stepIndex++) { - double stepDistanceRemaining = getFirstStep(multiLegRoute).distance(); - double legDistanceRemaining = multiLegRoute.legs().get(0).distance(); - double distanceRemaining = multiLegRoute.distance(); - RouteProgress routeProgress = buildTestRouteProgress(multiLegRoute, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, 0); - float fractionRemaining = (float) (routeProgress.distanceTraveled() / route.distance()); - - fractionsRemaining.add(fractionRemaining); - routeProgressFractionsTraveled.add(routeProgress.fractionTraveled()); - } - - assertTrue(fractionsRemaining.equals(routeProgressFractionsTraveled)); - } - - @Test - public void fractionTraveled_equalsOneAtEndOfRoute() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - RouteProgress lastRouteProgress = buildLastRouteProgress(route, firstLeg); - - assertEquals(1.0, lastRouteProgress.fractionTraveled(), DELTA); - } - - @Test - public void durationRemaining_equalsRouteDurationAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - double durationRemaining = route.duration(); - double progressDurationRemaining = beginningRouteProgress.durationRemaining(); - - assertEquals(durationRemaining, progressDurationRemaining, BaseTest.DELTA); - } - - @Test - public void durationRemaining_equalsZeroAtEndOfRoute() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - RouteProgress lastRouteProgress = buildLastRouteProgress(route, firstLeg); - - assertEquals(0, lastRouteProgress.durationRemaining(), BaseTest.DELTA); - } - - @Test - public void distanceTraveled_equalsZeroAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertEquals(0, beginningRouteProgress.distanceTraveled(), BaseTest.DELTA); - } - - @Test - public void distanceTraveled_equalsRouteDistanceAtEndOfRoute() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - RouteProgress lastRouteProgress = buildLastRouteProgress(route, firstLeg); - - assertEquals(route.distance(), lastRouteProgress.distanceTraveled(), BaseTest.DELTA); - } - - @Test - public void currentLeg_returnsCurrentLeg() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertEquals(route.legs().get(0), beginningRouteProgress.currentLeg()); - } - - @Test - public void legIndex_returnsCurrentLegIndex() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress beginningRouteProgress = buildBeginningOfLegRouteProgress(route); - - assertEquals(0, beginningRouteProgress.legIndex()); - } - - @Test - public void multiLeg_distanceRemaining_equalsRouteDistanceAtBeginning() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); - - assertEquals(multiLegRoute.distance(), routeProgress.distanceRemaining(), LARGE_DELTA); - } - - @Test - public void multiLeg_distanceRemaining_equalsZeroAtEndOfRoute() throws Exception { - RouteProgress routeProgress = buildEndOfMultiRouteProgress(); - - assertEquals(0, routeProgress.distanceRemaining(), DELTA); - } - - @Test - public void multiLeg_fractionTraveled_equalsZeroAtBeginning() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); - - assertEquals(0, routeProgress.fractionTraveled(), BaseTest.LARGE_DELTA); - } - - @Test - public void multiLeg_getFractionTraveled_equalsCorrectValueAtIntervals() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - List fractionsRemaining = new ArrayList<>(); - List routeProgressFractionsTraveled = new ArrayList<>(); - - for (RouteLeg leg : multiLegRoute.legs()) { - for (int stepIndex = 0; stepIndex < leg.steps().size(); stepIndex++) { - double stepDistanceRemaining = getFirstStep(multiLegRoute).distance(); - double legDistanceRemaining = multiLegRoute.legs().get(0).distance(); - double distanceRemaining = multiLegRoute.distance(); - RouteProgress routeProgress = buildTestRouteProgress(multiLegRoute, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, 0); - float fractionRemaining = (float) (routeProgress.distanceTraveled() / multiLegRoute.distance()); - - fractionsRemaining.add(fractionRemaining); - routeProgressFractionsTraveled.add(routeProgress.fractionTraveled()); - } - } - - assertTrue(fractionsRemaining.equals(routeProgressFractionsTraveled)); - } - - @Test - public void multiLeg_getFractionTraveled_equalsOneAtEndOfRoute() throws Exception { - RouteProgress routeProgress = buildEndOfMultiRouteProgress(); - - assertEquals(1.0, routeProgress.fractionTraveled(), DELTA); - } - - @Test - public void multiLeg_getDurationRemaining_equalsRouteDurationAtBeginning() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); - - assertEquals(2858.1, routeProgress.durationRemaining(), BaseTest.LARGE_DELTA); - } - - @Test - public void multiLeg_getDurationRemaining_equalsZeroAtEndOfRoute() throws Exception { - RouteProgress routeProgress = buildEndOfMultiRouteProgress(); - - assertEquals(0, routeProgress.durationRemaining(), BaseTest.DELTA); - } - - @Test - public void multiLeg_getDistanceTraveled_equalsZeroAtBeginning() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); - - assertEquals(0, routeProgress.distanceTraveled(), BaseTest.LARGE_DELTA); - } - - @Test - public void multiLeg_getDistanceTraveled_equalsRouteDistanceAtEndOfRoute() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildEndOfMultiRouteProgress(); - - assertEquals(multiLegRoute.distance(), routeProgress.distanceTraveled(), BaseTest.DELTA); - } - - @Test - public void multiLeg_getLegIndex_returnsCurrentLegIndex() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); - routeProgress = routeProgress.toBuilder().legIndex(1).build(); - - assertEquals(1, routeProgress.legIndex()); - } - - @Test - public void remainingWaypoints_firstLegReturnsTwoWaypoints() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - RouteProgress routeProgress = buildBeginningOfLegRouteProgress(multiLegRoute); - - assertEquals(2, routeProgress.remainingWaypoints()); - } - - private DirectionsRoute buildMultipleLegRoute() throws Exception { - String body = loadJsonFixture(MULTI_LEG_ROUTE_FIXTURE); - Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response.routes().get(0); - } - - private RouteProgress buildLastRouteProgress(DirectionsRoute route, RouteLeg firstLeg) throws Exception { - int stepIndex = firstLeg.steps().size() - 1; - LegStep step = route.legs().get(0).steps().get(stepIndex); - int legIndex = route.legs().size() - 1; - double legDistanceRemaining = route.legs().get(0).distance(); - double stepDistanceRemaining = step.distance(); - - return buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, 0, stepIndex, legIndex); - } - - private LegStep getFirstStep(DirectionsRoute route) { - return route.legs().get(0).steps().get(0); - } - - private RouteProgress buildBeginningOfLegRouteProgress(DirectionsRoute route) throws Exception { - LegStep step = getFirstStep(route); - double stepDistanceRemaining = step.distance(); - double legDistanceRemaining = route.legs().get(0).distance(); - double distanceRemaining = route.distance(); - return buildTestRouteProgress(route, stepDistanceRemaining, legDistanceRemaining, - distanceRemaining, 0, 0); - } - - private RouteProgress buildEndOfMultiRouteProgress() throws Exception { - DirectionsRoute multiLegRoute = buildMultipleLegRoute(); - - int legIndex = multiLegRoute.legs().size() - 1; - int stepIndex = multiLegRoute.legs().get(legIndex).steps().size() - 1; - double stepDistanceRemaining = multiLegRoute.legs().get(0).steps().get(stepIndex).distance(); - double legDistanceRemaining = multiLegRoute.legs().get(0).distance(); - return buildTestRouteProgress(multiLegRoute, stepDistanceRemaining, - legDistanceRemaining, 0, stepIndex, legIndex); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteStepProgressTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteStepProgressTest.java deleted file mode 100644 index 356aa817..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteStepProgressTest.java +++ /dev/null @@ -1,366 +0,0 @@ -package com.mapbox.services.android.navigation.v5.routeprogress; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.utils.Constants; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; -import com.mapbox.turf.TurfMisc; - -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - -public class RouteStepProgressTest extends BaseTest { - - private static final String DCMAPBOX_CHIPOLTLE_FIXTURE = "dcmapbox_chipoltle.json"; - - @Test - public void sanityTest() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - double stepDistanceRemaining = route.legs().get(0).steps().get(0).distance(); - double legDistanceRemaining = route.legs().get(0).distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, legDistanceRemaining, - distanceRemaining, 0, 0); - - assertNotNull(routeProgress.currentLegProgress().currentStepProgress()); - } - - @Test - public void stepDistance_equalsZeroOnOneCoordSteps() throws Exception { - DirectionsRoute route = loadChipotleTestRoute(); - int stepIndex = route.legs().get(0).steps().size() - 1; - RouteProgress routeProgress = buildTestRouteProgress(route, 0, 0, 0, stepIndex, 0); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertNotNull(routeStepProgress); - assertEquals(1, routeStepProgress.fractionTraveled(), DELTA); - assertEquals(0, routeStepProgress.distanceRemaining(), DELTA); - assertEquals(0, routeStepProgress.distanceTraveled(), DELTA); - assertEquals(0, routeStepProgress.durationRemaining(), DELTA); - } - - @Test - public void distanceRemaining_equalsStepDistanceAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - LineString lineString = LineString.fromPolyline(firstLeg.steps().get(5).geometry(), Constants.PRECISION_6); - double stepDistance = TurfMeasurement.length(lineString, TurfConstants.UNIT_METERS); - - double stepDistanceRemaining = firstLeg.steps().get(5).distance(); - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - int stepIndex = 4; - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, 0); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(stepDistance, routeStepProgress.distanceRemaining(), BaseTest.LARGE_DELTA); - } - - @Test - public void distanceRemaining_equalsCorrectValueAtIntervals() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - LegStep firstStep = route.legs().get(0).steps().get(0); - LineString lineString = LineString.fromPolyline(firstStep.geometry(), Constants.PRECISION_6); - double stepDistance = TurfMeasurement.length(lineString, TurfConstants.UNIT_METERS); - double stepSegments = 5; - - for (double i = 0; i < stepDistance; i += stepSegments) { - Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); - - if (point.equals(route.legs().get(0).steps().get(1).maneuver().location())) { - return; - } - - LineString slicedLine = TurfMisc.lineSlice(point, - route.legs().get(0).steps().get(1).maneuver().location(), lineString); - - double stepDistanceRemaining = TurfMeasurement.length(slicedLine, TurfConstants.UNIT_METERS); - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, 0, 0); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(stepDistanceRemaining, routeStepProgress.distanceRemaining(), BaseTest.DELTA); - } - } - - @Test - public void distanceRemaining_equalsZeroAtEndOfStep() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress routeProgress = buildTestRouteProgress(route, 0, 0, 0, 3, 0); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(0, routeStepProgress.distanceRemaining(), BaseTest.DELTA); - } - - @Test - public void distanceTraveled_equalsZeroAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = 5; - int legIndex = 0; - double stepDistanceRemaining = firstLeg.steps().get(stepIndex).distance(); - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(0, routeStepProgress.distanceTraveled(), BaseTest.DELTA); - } - - @Test - public void distanceTraveled_equalsCorrectValueAtIntervals() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - LegStep firstStep = route.legs().get(0).steps().get(0); - LineString lineString = LineString.fromPolyline(firstStep.geometry(), Constants.PRECISION_6); - double stepSegments = 5; - List distances = new ArrayList<>(); - List routeProgressDistancesTraveled = new ArrayList<>(); - - for (double i = 0; i < firstStep.distance(); i += stepSegments) { - Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); - LineString slicedLine = TurfMisc.lineSlice(point, - route.legs().get(0).steps().get(1).maneuver().location(), lineString); - double distance = TurfMeasurement.length(slicedLine, TurfConstants.UNIT_METERS); - distance = firstStep.distance() - distance; - if (distance < 0) { - distance = 0; - } - int stepIndex = 0; - int legIndex = 0; - double stepDistanceRemaining = firstLeg.steps().get(0).distance() - distance; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - distances.add(distance); - routeProgressDistancesTraveled.add(routeStepProgress.distanceTraveled()); - } - - assertTrue(distances.equals(routeProgressDistancesTraveled)); - } - - @Test - public void distanceTraveled_equalsStepDistanceAtEndOfStep() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = 3; - int legIndex = 0; - double stepDistanceRemaining = 0; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(firstLeg.steps().get(3).distance(), - routeStepProgress.distanceTraveled(), BaseTest.DELTA); - } - - @Test - public void fractionTraveled_equalsZeroAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = 5; - int legIndex = 0; - double stepDistanceRemaining = firstLeg.steps().get(stepIndex).distance(); - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - assertEquals(0, routeStepProgress.fractionTraveled(), BaseTest.DELTA); - } - - @Test - public void fractionTraveled_equalsCorrectValueAtIntervals() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - LegStep firstStep = route.legs().get(0).steps().get(0); - LineString lineString = LineString.fromPolyline(firstStep.geometry(), Constants.PRECISION_6); - List fractionsRemaining = new ArrayList<>(); - List routeProgressFractionsTraveled = new ArrayList<>(); - double stepSegments = 5; - - for (double i = 0; i < firstStep.distance(); i += stepSegments) { - Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); - LineString slicedLine = TurfMisc.lineSlice(point, - route.legs().get(0).steps().get(1).maneuver().location(), lineString); - double stepDistanceRemaining = TurfMeasurement.length(slicedLine, TurfConstants.UNIT_METERS); - int stepIndex = 0; - int legIndex = 0; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - float fractionRemaining = (float) ((firstStep.distance() - stepDistanceRemaining) / firstStep.distance()); - if (fractionRemaining < 0) { - fractionRemaining = 0; - } - fractionsRemaining.add(fractionRemaining); - routeProgressFractionsTraveled.add(routeStepProgress.fractionTraveled()); - } - - assertTrue(fractionsRemaining.equals(routeProgressFractionsTraveled)); - } - - @Test - public void fractionTraveled_equalsOneAtEndOfStep() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = 3; - int legIndex = 0; - double stepDistanceRemaining = 0; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(1.0, routeStepProgress.fractionTraveled(), BaseTest.DELTA); - } - - @Test - public void getDurationRemaining_equalsStepDurationAtBeginning() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - LegStep fourthStep = firstLeg.steps().get(5); - double stepDuration = fourthStep.duration(); - int stepIndex = 5; - int legIndex = 0; - double stepDistanceRemaining = firstLeg.steps().get(stepIndex).distance(); - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - double durationRemaining = routeStepProgress.durationRemaining(); - - assertEquals(stepDuration, durationRemaining, BaseTest.DELTA); - } - - @Test - public void durationRemaining_equalsCorrectValueAtIntervals() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - LegStep firstStep = route.legs().get(0).steps().get(0); - LineString lineString = LineString.fromPolyline(firstStep.geometry(), Constants.PRECISION_6); - double stepSegments = 5; - List fractionsRemaining = new ArrayList<>(); - List routeProgressDurationsTraveled = new ArrayList<>(); - - for (double i = 0; i < firstStep.distance(); i += stepSegments) { - Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); - LineString slicedLine = TurfMisc.lineSlice(point, - route.legs().get(0).steps().get(1).maneuver().location(), lineString); - int stepIndex = 0; - int legIndex = 0; - double stepDistanceRemaining = TurfMeasurement.length(slicedLine, TurfConstants.UNIT_METERS); - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - double fractionRemaining = (firstStep.distance() - stepDistanceRemaining) / firstStep.distance(); - - double expectedFractionRemaining = (1.0 - fractionRemaining) * firstStep.duration(); - fractionsRemaining.add(Math.round(expectedFractionRemaining * 100.0) / 100.0); - routeProgressDurationsTraveled.add(Math.round(routeStepProgress.durationRemaining() * 100.0) / 100.0); - } - double fractionRemaining = fractionsRemaining.get(fractionsRemaining.size() - 1); - double routeProgressDuration = routeProgressDurationsTraveled.get(routeProgressDurationsTraveled.size() - 1); - - assertEquals(fractionRemaining, routeProgressDuration, BaseTest.DELTA); - } - - @Test - public void durationRemaining_equalsZeroAtEndOfStep() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = 3; - int legIndex = 0; - double stepDistanceRemaining = 0; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - assertEquals(0, routeStepProgress.durationRemaining(), BaseTest.DELTA); - } - - @Test - public void stepIntersections_includesAllStepIntersectionsAndNextManeuver() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = 3; - int legIndex = 0; - double stepDistanceRemaining = 0; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - - int stepIntersections = route.legs().get(0).steps().get(3).intersections().size(); - int intersectionSize = stepIntersections + 1; - - assertEquals(intersectionSize, routeStepProgress.intersections().size()); - } - - @Test - public void stepIntersections_handlesNullNextManeuverCorrectly() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteLeg firstLeg = route.legs().get(0); - int stepIndex = (route.legs().get(0).steps().size() - 1); - int legIndex = 0; - double stepDistanceRemaining = 0; - double legDistanceRemaining = firstLeg.distance(); - double distanceRemaining = route.distance(); - RouteProgress routeProgress = buildTestRouteProgress(route, stepDistanceRemaining, - legDistanceRemaining, distanceRemaining, stepIndex, legIndex); - RouteStepProgress routeStepProgress = routeProgress.currentLegProgress().currentStepProgress(); - int currentStepTotal = route.legs().get(0).steps().get(stepIndex).intersections().size(); - List lastStepLocation = PolylineUtils.decode( - route.legs().get(0).steps().get(stepIndex).geometry(), Constants.PRECISION_6); - - assertEquals(currentStepTotal, routeStepProgress.intersections().size()); - assertEquals(routeStepProgress.intersections().get(0).location().latitude(), lastStepLocation.get(0).latitude()); - assertEquals(routeStepProgress.intersections().get(0).location().longitude(), lastStepLocation.get(0).longitude()); - } - - private DirectionsRoute loadChipotleTestRoute() throws IOException { - Gson gson = new GsonBuilder() - .registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - String body = loadJsonFixture(DCMAPBOX_CHIPOLTLE_FIXTURE); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response.routes().get(0); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/snap/SnapToRouteTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/snap/SnapToRouteTest.java deleted file mode 100644 index ecb5069c..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/snap/SnapToRouteTest.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.mapbox.services.android.navigation.v5.snap; - -import android.location.Location; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mapbox.services.android.navigation.v5.models.DirectionsAdapterFactory; -import com.mapbox.services.android.navigation.v5.models.DirectionsResponse; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import static junit.framework.Assert.assertEquals; - -@RunWith(RobolectricTestRunner.class) -public class SnapToRouteTest extends BaseTest { - - private static final String MULTI_LEG_ROUTE_FIXTURE = "directions_two_leg_route.json"; - - @Test - public void getSnappedLocation_returnsProviderNameCorrectly() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - - Location snappedLocation = snap.getSnappedLocation(location, routeProgress); - - assertEquals("test", snappedLocation.getProvider()); - } - - @Test - public void getSnappedLocation_locationOnStart() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.7989792); - location.setLongitude(-77.0638882); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 100, - 100, - 200, - 0, - 0 - )); - - assertEquals(38.798979, snappedLocation.getLatitude()); - assertEquals(-77.063888, snappedLocation.getLongitude()); - } - - @Test - public void getSnappedLocation_locationOnStep() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.7984052); - location.setLongitude(-77.0629411); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 50, - 50, - 150, - 2, - 0 - )); - - assertEquals(38.79840909601134, snappedLocation.getLatitude()); - assertEquals(-77.06299551713687, snappedLocation.getLongitude()); - } - - @Test - public void getSnappedLocation_locationOnEnd() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.9623092); - location.setLongitude(-77.0282631); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 0.8, - 0.8, - 0.8, - 15, - 1 - )); - - assertEquals(38.9623092, snappedLocation.getLatitude()); - assertEquals(-77.0282631, snappedLocation.getLongitude()); - } - - @Test - public void getSnappedLocation_bearingStart() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.7989792); - location.setLongitude(-77.0638882); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 100, - 100, - 200, - 0, - 0 - )); - - assertEquals(136.2322f, snappedLocation.getBearing()); - } - - @Test - public void getSnappedLocation_bearingOnStep() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.79881); - location.setLongitude(-77.0629411); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 50, - 50, - 150, - 2, - 0 - )); - - assertEquals(5.0284705f, snappedLocation.getBearing()); - } - - @Test - public void getSnappedLocation_bearingBeforeNextLeg() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.8943771); - location.setLongitude(-77.0782341); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 0.8, - 0.8, - 200, - 21, - 0 - )); - - assertEquals(358.19876f, snappedLocation.getBearing()); - } - - @Test - public void getSnappedLocation_bearingEnd() throws Exception { - DirectionsRoute routeProgress = buildMultipleLegRoute(); - Snap snap = new SnapToRoute(); - Location location = new Location("test"); - location.setLatitude(38.9623091); - location.setLongitude(-77.0282631); - location.setBearing(20); - - Location snappedLocation = snap.getSnappedLocation(location, buildTestRouteProgress( - routeProgress, - 0.8, - 0.8, - 0.8, - 15, - 1 - )); - - assertEquals(0f, snappedLocation.getBearing()); - } - - private DirectionsRoute buildMultipleLegRoute() throws Exception { - String body = loadJsonFixture(MULTI_LEG_ROUTE_FIXTURE); - Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create(); - DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class); - return response.routes().get(0); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatterTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatterTest.java deleted file mode 100644 index 3fdcd18e..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatterTest.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils; - -import android.content.Context; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.os.LocaleList; - -import com.mapbox.services.android.navigation.R; -import com.mapbox.services.android.navigation.v5.models.DirectionsCriteria; - -import junit.framework.Assert; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.robolectric.RobolectricTestRunner; - -import java.util.Locale; - -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.ROUNDING_INCREMENT_FIFTY; -import static com.mapbox.services.android.navigation.v5.navigation.NavigationConstants.ROUNDING_INCREMENT_TEN; -import static org.mockito.Mockito.when; - -@RunWith(RobolectricTestRunner.class) -public class DistanceFormatterTest { - private static final double LARGE_LARGE_UNIT = 18124.65; - private static final double MEDIUM_LARGE_UNIT = 9812.33; - private static final double SMALL_SMALL_UNIT = 13.71; - private static final double LARGE_SMALL_UNIT = 109.73; - - @Mock - private Context context; - @Mock - private Resources resources; - @Mock - private Configuration configuration; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - when(context.getResources()).thenReturn(resources); - when(resources.getConfiguration()).thenReturn(configuration); - when(configuration.getLocales()).thenReturn(LocaleList.getDefault()); - when(context.getString(R.string.kilometers)).thenReturn("km"); - when(context.getString(R.string.meters)).thenReturn("m"); - when(context.getString(R.string.miles)).thenReturn("mi"); - when(context.getString(R.string.feet)).thenReturn("ft"); - } - - @Test - public void formatDistance_noLocaleCountry() { - assertOutput(LARGE_LARGE_UNIT, new Locale(Locale.ENGLISH.getLanguage()), DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY, "11 mi"); - - } - - @Test - public void formatDistance_noLocale() { - assertOutput(LARGE_LARGE_UNIT, new Locale("", ""), DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY, "11 mi"); - } - - @Test - public void formatDistance_unitTypeDifferentFromLocale() { - assertOutput(LARGE_LARGE_UNIT, Locale.US, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_FIFTY,"18 km"); - } - - @Test - public void formatDistance_largeMiles() { - assertOutput(LARGE_LARGE_UNIT, Locale.US, DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY, "11 mi"); - } - - @Test - public void formatDistance_largeKilometers() { - assertOutput(LARGE_LARGE_UNIT, Locale.FRANCE, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_FIFTY,"18 km"); - } - - @Test - public void formatDistance_largeKilometerNoUnitTypeButMetricLocale() { - assertOutput(LARGE_LARGE_UNIT, Locale.FRANCE, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_FIFTY,"18 km"); - } - - @Test - public void formatDistance_mediumMiles() { - assertOutput(MEDIUM_LARGE_UNIT, Locale.US, DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY,"6.1 mi"); - } - - @Test - public void formatDistance_mediumKilometers() { - assertOutput(MEDIUM_LARGE_UNIT, Locale.FRANCE, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_FIFTY,"9,8 km"); - } - - @Test - public void formatDistance_mediumKilometersUnitTypeDifferentFromLocale() { - assertOutput(MEDIUM_LARGE_UNIT, Locale.FRANCE, DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY,"6,1 mi"); - } - - @Test - public void formatDistance_smallFeet() { - assertOutput(SMALL_SMALL_UNIT, Locale.US, DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY, "50 ft"); - } - - @Test - public void formatDistance_smallFeet_roundToTen() { - assertOutput(SMALL_SMALL_UNIT, Locale.US, DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_TEN, "40 ft"); - } - - @Test - public void formatDistance_smallMeters() { - assertOutput(SMALL_SMALL_UNIT, Locale.FRANCE, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_FIFTY, "50 m"); - } - - @Test - public void formatDistance_smallMeters_roundToTen() { - assertOutput(SMALL_SMALL_UNIT, Locale.FRANCE, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_TEN, "10 m"); - } - - @Test - public void formatDistance_largeFeet() { - assertOutput(LARGE_SMALL_UNIT, Locale.US, DirectionsCriteria.IMPERIAL, ROUNDING_INCREMENT_FIFTY,"350 ft"); - } - - @Test - public void formatDistance_largeMeters() { - assertOutput(LARGE_SMALL_UNIT, Locale.FRANCE, DirectionsCriteria.METRIC, ROUNDING_INCREMENT_FIFTY,"100 m"); - } - - private void assertOutput(double distance, Locale locale, String unitType, int roundIncrement, String output) { - Assert.assertEquals(output, - new DistanceFormatter(context, locale.getLanguage(), unitType, roundIncrement).formatDistance(distance).toString()); - } -} diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/MeasurementUtilsTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/MeasurementUtilsTest.java deleted file mode 100644 index 03adacc6..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/MeasurementUtilsTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils; - -import static com.mapbox.services.android.navigation.v5.utils.Constants.PRECISION_6; - -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.StepManeuver; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.services.android.navigation.v5.BaseTest; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; - -public class MeasurementUtilsTest extends BaseTest { - - @Test - public void userTrueDistanceFromStep_returnsZeroWhenCurrentStepAndPointEqualSame() { - Point futurePoint = Point.fromLngLat(-95.367697, 29.758938); - - List geometryPoints = new ArrayList<>(); - geometryPoints.add(futurePoint); - double[] rawLocation = {0, 0}; - LegStep step = getLegStep(rawLocation, geometryPoints); - - double distance = MeasurementUtils.userTrueDistanceFromStep(futurePoint, step); - assertEquals(0d, distance, DELTA); - } - - @Test - public void userTrueDistanceFromStep_onlyOnePointInLineStringStillMeasuresDistanceCorrectly() { - Point futurePoint = Point.fromLngLat(-95.3676974, 29.7589382); - - List geometryPoints = new ArrayList<>(); - geometryPoints.add(Point.fromLngLat(-95.8427, 29.7757)); - double[] rawLocation = {0, 0}; - LegStep step = getLegStep(rawLocation, geometryPoints); - - double distance = MeasurementUtils.userTrueDistanceFromStep(futurePoint, step); - assertEquals(45900.73617999494, distance, DELTA); - } - - @Test - public void userTrueDistanceFromStep_onePointStepGeometryWithDifferentRawPoint() { - Point futurePoint = Point.fromLngLat(-95.3676974, 29.7589382); - - List geometryPoints = new ArrayList<>(); - geometryPoints.add(Point.fromLngLat(-95.8427, 29.7757)); - geometryPoints.add(futurePoint); - double[] rawLocation = {0, 0}; - LegStep step = getLegStep(rawLocation, geometryPoints); - - double distance = MeasurementUtils.userTrueDistanceFromStep(futurePoint, step); - assertEquals(0.04457271773629306d, distance, DELTA); - } - - private LegStep getLegStep(double[] rawLocation, List geometryPoints) { - return LegStep.builder() - .geometry(PolylineUtils.encode(geometryPoints, PRECISION_6)) - .mode("driving") - .distance(0) - .duration(0) - .maneuver(StepManeuver.builder().rawLocation(rawLocation).build()) - .weight(0) - .build(); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RingBufferTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RingBufferTest.java deleted file mode 100644 index 6e0192ab..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RingBufferTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils; - -import static junit.framework.Assert.assertEquals; - -import com.google.common.collect.Lists; -import com.mapbox.services.android.navigation.v5.BaseTest; - -import org.junit.Test; - -public class RingBufferTest extends BaseTest { - - @Test - public void testBounds() { - RingBuffer buffer = new RingBuffer<>(1); - buffer.add(1); - buffer.addFirst(2); - buffer.addLast(3); - buffer.addAll(Lists.newArrayList(4)); - buffer.push(5); - buffer.add(6); - - assertEquals(1, buffer.size()); - } - - @Test - public void testLifoOrder() { - RingBuffer buffer = new RingBuffer<>(1); - buffer.add(1); - buffer.add(2); - - assertEquals(1, buffer.size()); - assertEquals(2, buffer.pop(), DELTA); - } - - @Test - public void testFifo() throws Exception { - RingBuffer buffer = new RingBuffer<>(2); - buffer.add(1); - buffer.add(2); - - assertEquals(2, buffer.size()); - assertEquals(1, buffer.pop(), DELTA); - } - - @Test - public void testPeek() { - RingBuffer buffer = new RingBuffer<>(2); - buffer.add(1); - buffer.add(2); - buffer.add(3); - assertEquals(2, buffer.size()); - assertEquals(2, buffer.peekFirst(), DELTA); - assertEquals(3, buffer.peekLast(), DELTA); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RouteUtilsTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RouteUtilsTest.java deleted file mode 100644 index 7f7c4490..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/RouteUtilsTest.java +++ /dev/null @@ -1,497 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils; - -import androidx.annotation.NonNull; - -import com.mapbox.services.android.navigation.v5.models.BannerInstructions; -import com.mapbox.services.android.navigation.v5.models.BannerText; -import com.mapbox.services.android.navigation.v5.models.DirectionsCriteria; -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.LegStep; -import com.mapbox.services.android.navigation.v5.models.RouteLeg; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.services.android.navigation.v5.models.VoiceInstructions; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.milestone.BannerInstructionMilestone; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteLegProgress; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class RouteUtilsTest extends BaseTest { - - @Test - public void isNewRoute_returnsTrueWhenPreviousGeometriesNull() throws Exception { - RouteProgress defaultRouteProgress = buildDefaultTestRouteProgress(); - RouteUtils routeUtils = new RouteUtils(); - - boolean isNewRoute = routeUtils.isNewRoute(null, defaultRouteProgress); - - assertTrue(isNewRoute); - } - - @Test - public void isNewRoute_returnsFalseWhenGeometriesEqualEachOther() throws Exception { - RouteProgress previousRouteProgress = buildDefaultTestRouteProgress(); - RouteUtils routeUtils = new RouteUtils(); - - boolean isNewRoute = routeUtils.isNewRoute(previousRouteProgress, previousRouteProgress); - - assertFalse(isNewRoute); - } - - @Test - public void isNewRoute_returnsTrueWhenGeometriesDoNotEqual() throws Exception { - DirectionsRoute aRoute = buildTestDirectionsRoute(); - RouteProgress defaultRouteProgress = buildDefaultTestRouteProgress(); - RouteProgress previousRouteProgress = defaultRouteProgress.toBuilder() - .directionsRoute(aRoute.toBuilder().geometry("vfejnqiv").build()) - .build(); - RouteUtils routeUtils = new RouteUtils(); - - boolean isNewRoute = routeUtils.isNewRoute(previousRouteProgress, defaultRouteProgress); - - assertTrue(isNewRoute); - } - - @Test - public void isArrivalEvent_returnsTrueWhenManeuverTypeIsArrival_andIsLastInstruction() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - int first = 0; - int lastInstruction = 1; - RouteLeg routeLeg = route.legs().get(first); - List routeSteps = routeLeg.steps(); - int currentStepIndex = routeSteps.size() - 2; - int upcomingStepIndex = routeSteps.size() - 1; - LegStep currentStep = routeSteps.get(currentStepIndex); - LegStep upcomingStep = routeSteps.get(upcomingStepIndex); - RouteProgress routeProgress = buildRouteProgress(first, route, currentStep, upcomingStep); - BannerInstructionMilestone bannerInstructionMilestone = mock(BannerInstructionMilestone.class); - List currentStepBannerInstructions = currentStep.bannerInstructions(); - buildBannerInstruction(lastInstruction, bannerInstructionMilestone, currentStepBannerInstructions); - - RouteUtils routeUtils = new RouteUtils(); - - boolean isArrivalEvent = routeUtils.isArrivalEvent(routeProgress, bannerInstructionMilestone); - - assertTrue(isArrivalEvent); - } - - @Test - public void isArrivalEvent_returnsFalseWhenManeuverTypeIsArrival_andIsNotLastInstruction() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - int first = 0; - RouteLeg routeLeg = route.legs().get(first); - List routeSteps = routeLeg.steps(); - int currentStepIndex = routeSteps.size() - 2; - int upcomingStepIndex = routeSteps.size() - 1; - LegStep currentStep = routeSteps.get(currentStepIndex); - LegStep upcomingStep = routeSteps.get(upcomingStepIndex); - RouteProgress routeProgress = buildRouteProgress(first, route, currentStep, upcomingStep); - BannerInstructionMilestone bannerInstructionMilestone = mock(BannerInstructionMilestone.class); - List currentStepBannerInstructions = currentStep.bannerInstructions(); - buildBannerInstruction(first, bannerInstructionMilestone, currentStepBannerInstructions); - - RouteUtils routeUtils = new RouteUtils(); - - boolean isArrivalEvent = routeUtils.isArrivalEvent(routeProgress, bannerInstructionMilestone); - - assertFalse(isArrivalEvent); - } - - @Test - public void isArrivalEvent_returnsFalseWhenManeuverTypeIsNotArrival() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - int first = 0; - RouteLeg routeLeg = route.legs().get(first); - List routeSteps = routeLeg.steps(); - LegStep currentStep = routeSteps.get(first); - LegStep upcomingStep = routeSteps.get(first + 1); - RouteProgress routeProgress = buildRouteProgress(first, route, currentStep, upcomingStep); - BannerInstructionMilestone bannerInstructionMilestone = mock(BannerInstructionMilestone.class); - List currentStepBannerInstructions = currentStep.bannerInstructions(); - buildBannerInstruction(first, bannerInstructionMilestone, currentStepBannerInstructions); - - RouteUtils routeUtils = new RouteUtils(); - - boolean isArrivalEvent = routeUtils.isArrivalEvent(routeProgress, bannerInstructionMilestone); - - assertFalse(isArrivalEvent); - } - - @Test - public void isValidRouteProfile_returnsTrueWithDrivingTrafficProfile() throws Exception { - String routeProfileDrivingTraffic = DirectionsCriteria.PROFILE_DRIVING_TRAFFIC; - RouteUtils routeUtils = new RouteUtils(); - - boolean isValidProfile = routeUtils.isValidRouteProfile(routeProfileDrivingTraffic); - - assertTrue(isValidProfile); - } - - @Test - public void isValidRouteProfile_returnsTrueWithDrivingProfile() throws Exception { - String routeProfileDriving = DirectionsCriteria.PROFILE_DRIVING; - RouteUtils routeUtils = new RouteUtils(); - - boolean isValidProfile = routeUtils.isValidRouteProfile(routeProfileDriving); - - assertTrue(isValidProfile); - } - - @Test - public void isValidRouteProfile_returnsTrueWithCyclingProfile() throws Exception { - String routeProfileCycling = DirectionsCriteria.PROFILE_CYCLING; - RouteUtils routeUtils = new RouteUtils(); - - boolean isValidProfile = routeUtils.isValidRouteProfile(routeProfileCycling); - - assertTrue(isValidProfile); - } - - @Test - public void isValidRouteProfile_returnsTrueWithWalkingProfile() throws Exception { - String routeProfileWalking = DirectionsCriteria.PROFILE_WALKING; - RouteUtils routeUtils = new RouteUtils(); - - boolean isValidProfile = routeUtils.isValidRouteProfile(routeProfileWalking); - - assertTrue(isValidProfile); - } - - @Test - public void isValidRouteProfile_returnsFalseWithInvalidProfile() throws Exception { - String invalidProfile = "invalid_profile"; - RouteUtils routeUtils = new RouteUtils(); - - boolean isValidProfile = routeUtils.isValidRouteProfile(invalidProfile); - - assertFalse(isValidProfile); - } - - @Test - public void isValidRouteProfile_returnsFalseWithNullProfile() throws Exception { - String nullProfile = null; - RouteUtils routeUtils = new RouteUtils(); - - boolean isValidProfile = routeUtils.isValidRouteProfile(nullProfile); - - assertFalse(isValidProfile); - } - - @Test - public void findCurrentBannerInstructions_returnsNullWithNullCurrentStep() throws Exception { - LegStep currentStep = null; - double stepDistanceRemaining = 0; - RouteUtils routeUtils = new RouteUtils(); - - BannerInstructions currentBannerInstructions = routeUtils.findCurrentBannerInstructions( - currentStep, stepDistanceRemaining - ); - - assertNull(currentBannerInstructions); - } - - @Test - public void findCurrentBannerInstructions_returnsNullWithCurrentStepEmptyInstructions() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - List currentInstructions = currentStep.bannerInstructions(); - currentInstructions.clear(); - RouteUtils routeUtils = new RouteUtils(); - - BannerInstructions currentBannerInstructions = routeUtils.findCurrentBannerInstructions( - currentStep, stepDistanceRemaining - ); - - assertNull(currentBannerInstructions); - } - - @Test - public void findCurrentBannerInstructions_returnsCorrectCurrentInstruction() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - BannerInstructions currentBannerInstructions = routeUtils.findCurrentBannerInstructions( - currentStep, stepDistanceRemaining - ); - - assertEquals(currentStep.bannerInstructions().get(0), currentBannerInstructions); - } - - @Test - public void findCurrentBannerInstructions_adjustedDistanceRemainingReturnsCorrectInstruction() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepIndex(1) - .stepDistanceRemaining(50) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - BannerInstructions currentBannerInstructions = routeUtils.findCurrentBannerInstructions( - currentStep, stepDistanceRemaining - ); - - assertEquals(currentStep.bannerInstructions().get(1), currentBannerInstructions); - } - - @Test - public void findCurrentBannerInstructions_adjustedDistanceRemainingRemovesCorrectInstructions() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepIndex(1) - .stepDistanceRemaining(500) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - BannerInstructions currentBannerInstructions = routeUtils.findCurrentBannerInstructions( - currentStep, stepDistanceRemaining - ); - - assertEquals(currentStep.bannerInstructions().get(0), currentBannerInstructions); - } - - @Test - public void findCurrentBannerText_returnsCorrectPrimaryBannerText() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepIndex(1) - .stepDistanceRemaining(50) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - BannerText currentBannerText = routeUtils.findCurrentBannerText( - currentStep, stepDistanceRemaining, true - ); - - assertEquals(currentStep.bannerInstructions().get(1).primary(), currentBannerText); - } - - @Test - public void findCurrentBannerText_returnsCorrectSecondaryBannerText() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepIndex(1) - .stepDistanceRemaining(50) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - BannerText currentBannerText = routeUtils.findCurrentBannerText( - currentStep, stepDistanceRemaining, false - ); - - assertEquals(currentStep.bannerInstructions().get(1).secondary(), currentBannerText); - } - - @Test - public void findCurrentBannerText_returnsNullWithNullCurrentStep() throws Exception { - LegStep currentStep = null; - double stepDistanceRemaining = 0; - RouteUtils routeUtils = new RouteUtils(); - - BannerText currentBannerText = routeUtils.findCurrentBannerText( - currentStep, stepDistanceRemaining, false - ); - - assertNull(currentBannerText); - } - - @Test - public void findCurrentVoiceInstructions_returnsNullWithNullCurrentStep() throws Exception { - LegStep currentStep = null; - double stepDistanceRemaining = 0; - RouteUtils routeUtils = new RouteUtils(); - - VoiceInstructions currentVoiceInstructions = routeUtils.findCurrentVoiceInstructions( - currentStep, stepDistanceRemaining - ); - - assertNull(currentVoiceInstructions); - } - - @Test - public void findCurrentVoiceInstructions_returnsNullWithCurrentStepEmptyInstructions() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - List currentInstructions = currentStep.voiceInstructions(); - currentInstructions.clear(); - RouteUtils routeUtils = new RouteUtils(); - - VoiceInstructions voiceInstructions = routeUtils.findCurrentVoiceInstructions( - currentStep, stepDistanceRemaining - ); - - assertNull(voiceInstructions); - } - - @Test - public void findCurrentVoiceInstructions_returnsCorrectInstructionsBeginningOfStepDistanceRemaining() throws - Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepIndex(1) - .stepDistanceRemaining(300) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - VoiceInstructions currentVoiceInstructions = routeUtils.findCurrentVoiceInstructions( - currentStep, stepDistanceRemaining - ); - - assertEquals(currentStep.voiceInstructions().get(1), currentVoiceInstructions); - } - - @Test - public void findCurrentVoiceInstructions_returnsCorrectInstructionsNoDistanceTraveled() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepDistanceRemaining(routeProgress.currentLegProgress().currentStep().distance()) - .stepIndex(0) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - VoiceInstructions currentVoiceInstructions = routeUtils.findCurrentVoiceInstructions( - currentStep, stepDistanceRemaining - ); - - assertEquals(currentStep.voiceInstructions().get(0), currentVoiceInstructions); - } - - @Test - public void findCurrentVoiceInstructions_returnsCorrectInstructionsEndOfStepDistanceRemaining() throws Exception { - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - routeProgress = routeProgress.toBuilder() - .stepIndex(1) - .stepDistanceRemaining(50) - .build(); - LegStep currentStep = routeProgress.currentLegProgress().currentStep(); - double stepDistanceRemaining = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(); - RouteUtils routeUtils = new RouteUtils(); - - VoiceInstructions currentVoiceInstructions = routeUtils.findCurrentVoiceInstructions( - currentStep, stepDistanceRemaining - ); - - assertEquals(currentStep.voiceInstructions().get(2), currentVoiceInstructions); - } - - @Test - public void calculateRemainingWaypoints() { - DirectionsRoute route = mock(DirectionsRoute.class); - RouteOptions routeOptions = mock(RouteOptions.class); - when(routeOptions.coordinates()).thenReturn(buildCoordinateList()); - when(route.routeOptions()).thenReturn(routeOptions); - RouteProgress routeProgress = mock(RouteProgress.class); - when(routeProgress.remainingWaypoints()).thenReturn(2); - when(routeProgress.directionsRoute()).thenReturn(route); - RouteUtils routeUtils = new RouteUtils(); - - List remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); - - assertEquals(2, remainingWaypoints.size()); - assertEquals(Point.fromLngLat(7.890, 1.234), remainingWaypoints.get(0)); - assertEquals(Point.fromLngLat(5.678, 9.012), remainingWaypoints.get(1)); - } - - @Test - public void calculateRemainingWaypoints_handlesNullOptions() { - DirectionsRoute route = mock(DirectionsRoute.class); - when(route.routeOptions()).thenReturn(null); - RouteProgress routeProgress = mock(RouteProgress.class); - when(routeProgress.remainingWaypoints()).thenReturn(2); - when(routeProgress.directionsRoute()).thenReturn(route); - RouteUtils routeUtils = new RouteUtils(); - - List remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); - - assertNull(remainingWaypoints); - } - - @Test - public void calculateRemainingWaypointNames() { - DirectionsRoute route = mock(DirectionsRoute.class); - RouteOptions routeOptions = mock(RouteOptions.class); - when(routeOptions.coordinates()).thenReturn(buildCoordinateList()); - when(routeOptions.waypointNames()).thenReturn("first;second;third;fourth"); - when(route.routeOptions()).thenReturn(routeOptions); - RouteProgress routeProgress = mock(RouteProgress.class); - when(routeProgress.remainingWaypoints()).thenReturn(2); - when(routeProgress.directionsRoute()).thenReturn(route); - RouteUtils routeUtils = new RouteUtils(); - - String[] remainingWaypointNames = routeUtils.calculateRemainingWaypointNames(routeProgress); - - assertEquals(3, remainingWaypointNames.length); - assertEquals("first", remainingWaypointNames[0]); - assertEquals("third", remainingWaypointNames[1]); - assertEquals("fourth", remainingWaypointNames[2]); - } - - @Test - public void calculateRemainingWaypointNames_handlesNullOptions() { - DirectionsRoute route = mock(DirectionsRoute.class); - when(route.routeOptions()).thenReturn(null); - RouteProgress routeProgress = mock(RouteProgress.class); - when(routeProgress.remainingWaypoints()).thenReturn(2); - when(routeProgress.directionsRoute()).thenReturn(route); - RouteUtils routeUtils = new RouteUtils(); - - String[] remainingWaypointNames = routeUtils.calculateRemainingWaypointNames(routeProgress); - - assertNull(remainingWaypointNames); - } - - @NonNull - private RouteProgress buildRouteProgress(int first, DirectionsRoute route, LegStep currentStep, - LegStep upcomingStep) { - RouteProgress routeProgress = mock(RouteProgress.class); - RouteLegProgress legProgress = mock(RouteLegProgress.class); - when(legProgress.currentStep()).thenReturn(currentStep); - when(legProgress.upComingStep()).thenReturn(upcomingStep); - when(routeProgress.currentLegProgress()).thenReturn(legProgress); - when(routeProgress.directionsRoute()).thenReturn(route); - when(routeProgress.currentLeg()).thenReturn(route.legs().get(first)); - return routeProgress; - } - - private void buildBannerInstruction(int first, BannerInstructionMilestone bannerInstructionMilestone, - List currentStepBannerInstructions) { - BannerInstructions bannerInstructions = currentStepBannerInstructions.get(first); - when(bannerInstructionMilestone.getBannerInstructions()).thenReturn(bannerInstructions); - } - - private List buildCoordinateList() { - List coordinates = new ArrayList<>(); - coordinates.add(Point.fromLngLat(1.234, 5.678)); - coordinates.add(Point.fromLngLat(9.012, 3.456)); - coordinates.add(Point.fromLngLat(7.890, 1.234)); - coordinates.add(Point.fromLngLat(5.678, 9.012)); - return coordinates; - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtilsTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtilsTest.java deleted file mode 100644 index c4f10ebe..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtilsTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils; - -import static com.mapbox.services.android.navigation.v5.utils.Constants.PRECISION_6; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.geojson.utils.PolylineUtils; -import com.mapbox.services.android.navigation.v5.BaseTest; -import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions; -import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress; -import com.mapbox.turf.TurfConstants; -import com.mapbox.turf.TurfMeasurement; - -import org.junit.Test; - -import java.util.List; - -import static junit.framework.Assert.assertEquals; - -public class ToleranceUtilsTest extends BaseTest { - - @Test - public void dynamicRerouteDistanceTolerance_userFarAwayFromIntersection() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - List stepPoints = PolylineUtils.decode(route.geometry(), PRECISION_6); - Point midPoint = TurfMeasurement.midpoint(stepPoints.get(0), stepPoints.get(1)); - - double tolerance = ToleranceUtils.dynamicRerouteDistanceTolerance(midPoint, routeProgress, MapboxNavigationOptions.builder().build()); - - assertEquals(25.0, tolerance, DELTA); - } - - - @Test - public void dynamicRerouteDistanceTolerance_userCloseToIntersection() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - double distanceToIntersection = route.distance() - 39; - LineString lineString = LineString.fromPolyline(route.geometry(), PRECISION_6); - Point closePoint = TurfMeasurement.along(lineString, distanceToIntersection, TurfConstants.UNIT_METERS); - - double tolerance = ToleranceUtils.dynamicRerouteDistanceTolerance(closePoint, routeProgress, MapboxNavigationOptions.builder().build()); - - assertEquals(50.0, tolerance, DELTA); - } - - @Test - public void dynamicRerouteDistanceTolerance_userJustPastTheIntersection() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(); - RouteProgress routeProgress = buildDefaultTestRouteProgress(); - double distanceToIntersection = route.distance(); - LineString lineString = LineString.fromPolyline(route.geometry(), PRECISION_6); - Point closePoint = TurfMeasurement.along(lineString, distanceToIntersection, TurfConstants.UNIT_METERS); - - double tolerance = ToleranceUtils.dynamicRerouteDistanceTolerance(closePoint, routeProgress, MapboxNavigationOptions.builder().build()); - - assertEquals(50.0, tolerance, DELTA); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ValidationUtilsTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ValidationUtilsTest.java deleted file mode 100644 index be500f93..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ValidationUtilsTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils; - -import com.mapbox.services.android.navigation.v5.models.DirectionsRoute; -import com.mapbox.services.android.navigation.v5.models.RouteOptions; -import com.mapbox.geojson.Point; -import com.mapbox.services.android.navigation.v5.BaseTest; - -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.MissingFormatArgumentException; - -public class ValidationUtilsTest extends BaseTest { - - private static final String DIRECTIONS_WITHOUT_VOICE_INSTRUCTIONS = "directions_v5_no_voice.json"; - - @Test(expected = MissingFormatArgumentException.class) - public void validDirectionsRoute_isInvalidWithNullRouteOptions() throws Exception { - DirectionsRoute route = buildTestDirectionsRoute(DIRECTIONS_WITHOUT_VOICE_INSTRUCTIONS); - RouteOptions invalidRouteOptions = null; - route = route.toBuilder().routeOptions(invalidRouteOptions).build(); - - ValidationUtils.validDirectionsRoute(route, true); - } - - @Test(expected = MissingFormatArgumentException.class) - public void validDirectionsRoute_isInvalidWithNullInstructions() throws Exception { - DirectionsRoute routeWithNullInstructions = buildRouteWithNullInstructions(); - - ValidationUtils.validDirectionsRoute(routeWithNullInstructions, true); - } - - @Test(expected = MissingFormatArgumentException.class) - public void validDirectionsRoute_isInvalidWithFalseVoiceInstructions() throws Exception { - DirectionsRoute routeWithFalseVoiceInstructions = buildRouteWithFalseVoiceInstructions(); - - ValidationUtils.validDirectionsRoute(routeWithFalseVoiceInstructions, true); - } - - @Test(expected = MissingFormatArgumentException.class) - public void validDirectionsRoute_isInvalidWithFalseBannerInstructions() throws Exception { - DirectionsRoute routeWithFalseBannerInstructions = buildRouteWithFalseBannerInstructions(); - - ValidationUtils.validDirectionsRoute(routeWithFalseBannerInstructions, true); - } - - private DirectionsRoute buildRouteWithNullInstructions() throws IOException { - DirectionsRoute route = buildTestDirectionsRoute(); - List coordinates = new ArrayList<>(); - RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder() - .baseUrl(Constants.BASE_API_URL) - .user("user") - .profile("profile") - .accessToken(ACCESS_TOKEN) - .requestUuid("uuid") - .geometries("mocked_geometries") - .coordinates(coordinates).build(); - - return route.toBuilder() - .routeOptions(routeOptionsWithoutVoiceInstructions) - .build(); - } - - private DirectionsRoute buildRouteWithFalseVoiceInstructions() throws IOException { - DirectionsRoute route = buildTestDirectionsRoute(); - List coordinates = new ArrayList<>(); - RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder() - .baseUrl(Constants.BASE_API_URL) - .user("user") - .profile("profile") - .accessToken(ACCESS_TOKEN) - .requestUuid("uuid") - .geometries("mocked_geometries") - .voiceInstructions(false) - .coordinates(coordinates).build(); - - return route.toBuilder() - .routeOptions(routeOptionsWithoutVoiceInstructions) - .build(); - } - - private DirectionsRoute buildRouteWithFalseBannerInstructions() throws IOException { - DirectionsRoute route = buildTestDirectionsRoute(); - List coordinates = new ArrayList<>(); - RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder() - .baseUrl(Constants.BASE_API_URL) - .user("user") - .profile("profile") - .accessToken(ACCESS_TOKEN) - .requestUuid("uuid") - .geometries("mocked_geometries") - .voiceInstructions(true) - .bannerInstructions(false) - .coordinates(coordinates).build(); - - return route.toBuilder() - .routeOptions(routeOptionsWithoutVoiceInstructions) - .build(); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormatterTest.java b/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormatterTest.java deleted file mode 100644 index de798933..00000000 --- a/libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/time/TimeFormatterTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mapbox.services.android.navigation.v5.utils.time; - -import org.junit.Test; - -import java.util.Calendar; - -import static org.junit.Assert.assertEquals; - -public class TimeFormatterTest { - - @Test - public void checksTwelveHoursTimeFormat() throws Exception { - Calendar time = Calendar.getInstance(); - int anyYear = 2018; - int anyMonth = 3; - int anyDay = 26; - int sixPm = 18; - int eighteenMinutes = 18; - int zeroSeconds = 0; - time.set(anyYear, anyMonth, anyDay, sixPm, eighteenMinutes, zeroSeconds); - double elevenMinutes = 663.7; - int twelveHoursTimeFormatType = 0; - boolean indifferentDeviceTwentyFourHourFormat = true; - - String formattedTime = TimeFormatter.formatTime(time, elevenMinutes, twelveHoursTimeFormatType, - indifferentDeviceTwentyFourHourFormat); - - assertEquals("6:29 pm", formattedTime); - } - - @Test - public void checksTwentyFourHoursTimeFormat() throws Exception { - Calendar time = Calendar.getInstance(); - int anyYear = 2018; - int anyMonth = 3; - int anyDay = 26; - int sixPm = 18; - int eighteenMinutes = 18; - int zeroSeconds = 0; - time.set(anyYear, anyMonth, anyDay, sixPm, eighteenMinutes, zeroSeconds); - double elevenMinutes = 663.7; - int twentyFourHoursTimeFormatType = 1; - boolean indifferentDeviceTwentyFourHourFormat = false; - - String formattedTime = TimeFormatter.formatTime(time, elevenMinutes, twentyFourHoursTimeFormatType, - indifferentDeviceTwentyFourHourFormat); - - assertEquals("18:29", formattedTime); - } - - @Test - public void checksDefaultTwelveHoursTimeFormat() throws Exception { - Calendar time = Calendar.getInstance(); - int anyYear = 2018; - int anyMonth = 3; - int anyDay = 26; - int sixPm = 18; - int eighteenMinutes = 18; - int zeroSeconds = 0; - time.set(anyYear, anyMonth, anyDay, sixPm, eighteenMinutes, zeroSeconds); - double elevenMinutes = 663.7; - int noneSpecifiedTimeFormatType = -1; - boolean deviceTwelveHourFormat = false; - - String formattedTime = TimeFormatter.formatTime(time, elevenMinutes, noneSpecifiedTimeFormatType, - deviceTwelveHourFormat); - - assertEquals("6:29 pm", formattedTime); - } - - @Test - public void checksDefaultTwentyFourHoursTimeFormat() throws Exception { - Calendar time = Calendar.getInstance(); - int anyYear = 2018; - int anyMonth = 3; - int anyDay = 26; - int sixPm = 18; - int eighteenMinutes = 18; - int zeroSeconds = 0; - time.set(anyYear, anyMonth, anyDay, sixPm, eighteenMinutes, zeroSeconds); - double elevenMinutes = 663.7; - int noneSpecifiedTimeFormatType = -1; - boolean deviceTwentyFourHourFormat = true; - - String formattedTime = TimeFormatter.formatTime(time, elevenMinutes, noneSpecifiedTimeFormatType, - deviceTwentyFourHourFormat); - - assertEquals("18:29", formattedTime); - } -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/dcmapbox_chipoltle.json b/libandroid-navigation/src/test/resources/dcmapbox_chipoltle.json deleted file mode 100644 index 2db71950..00000000 --- a/libandroid-navigation/src/test/resources/dcmapbox_chipoltle.json +++ /dev/null @@ -1,660 +0,0 @@ -{ - "waypoints": [ - { - "location": [ - -77.036112, - 38.910057 - ], - "name": "" - }, - { - "location": [ - -77.044601, - 38.911872 - ], - "name": "" - } - ], - "routes": [ - { - "legs": [ - { - "steps": [ - { - "intersections": [ - { - "out": 0, - "entry": [ - true - ], - "location": [ - -77.036112, - 38.910057 - ], - "bearings": [ - 270 - ] - } - ], - "geometry": "qe{eiA~c||qC?|Q?jE", - "duration": 21.1, - "distance": 35.1, - "name": "", - "weight": 68.3, - "mode": "driving", - "maneuver": { - "bearing_after": 270, - "location": [ - -77.036112, - 38.910057 - ], - "type": "depart", - "bearing_before": 0, - "modifier": "left", - "instruction": "Head west" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.036517, - 38.910057 - ], - "bearings": [ - 0, - 90, - 180 - ] - } - ], - "geometry": "qe{eiAh}||qChS?vC@", - "duration": 10.4, - "distance": 44.6, - "name": "16th Street Northwest", - "weight": 10.4, - "mode": "driving", - "maneuver": { - "bearing_after": 180, - "location": [ - -77.036517, - 38.910057 - ], - "type": "turn", - "bearing_before": 268, - "modifier": "left", - "instruction": "Turn left onto 16th Street Northwest" - } - }, - { - "intersections": [ - { - "out": 3, - "in": 0, - "entry": [ - false, - true, - true, - true - ], - "location": [ - -77.036518, - 38.909656 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.037208, - 38.909655 - ], - "bearings": [ - 0, - 90, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.037272, - 38.909655 - ], - "bearings": [ - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.037813, - 38.909654 - ], - "bearings": [ - 90, - 180, - 270 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.038498, - 38.909652 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.039563, - 38.90965 - ], - "bearings": [ - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.040241, - 38.909649 - ], - "bearings": [ - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.040781, - 38.909648 - ], - "bearings": [ - 90, - 180, - 270 - ] - } - ], - "geometry": "olzeiAj}||qCAlGBta@?~B@x`@?lb@BjF?dA?~CBjz@@ji@@v`@Bfq@?vD", - "duration": 96.30000000000001, - "distance": 446.5, - "name": "P Street Northwest", - "weight": 96.30000000000001, - "mode": "driving", - "maneuver": { - "bearing_after": 268, - "location": [ - -77.036518, - 38.909656 - ], - "type": "turn", - "bearing_before": 180, - "modifier": "right", - "instruction": "Turn right onto P Street Northwest" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.041677, - 38.909646 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.041676, - 38.909264 - ], - "bearings": [ - 0, - 120, - 180 - ] - } - ], - "geometry": "{kzeiAx_g}qCzVArM?", - "duration": 31.7, - "distance": 68.5, - "name": "18th Street Northwest", - "weight": 31.7, - "mode": "driving", - "maneuver": { - "bearing_after": 178, - "location": [ - -77.041677, - 38.909646 - ], - "type": "turn", - "bearing_before": 268, - "modifier": "left", - "instruction": "Turn left onto 18th Street Northwest" - } - }, - { - "intersections": [ - { - "out": 3, - "in": 0, - "entry": [ - false, - true, - true, - true - ], - "location": [ - -77.041676, - 38.90903 - ], - "bearings": [ - 0, - 120, - 180, - 300 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.041946, - 38.909128 - ], - "bearings": [ - 15, - 120, - 300 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.042302, - 38.909257 - ], - "bearings": [ - 30, - 120, - 300 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.042422, - 38.909299 - ], - "bearings": [ - 120, - 270, - 315 - ] - } - ], - "geometry": "keyeiAv_g}qCmAtEuBdIaGfUsAnFgBfD{AvBwAbByBhB", - "duration": 22.599999999999998, - "distance": 102.5, - "name": "Massachusetts Avenue Northwest", - "weight": 22.599999999999998, - "mode": "driving", - "maneuver": { - "bearing_after": 293, - "location": [ - -77.041676, - 38.90903 - ], - "type": "turn", - "bearing_before": 180, - "modifier": "right", - "instruction": "Turn right onto Massachusetts Avenue Northwest" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - false, - true - ], - "location": [ - -77.042669, - 38.909502 - ], - "bearings": [ - 15, - 45, - 135, - 195, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.042667, - 38.909778 - ], - "bearings": [ - 150, - 165, - 345 - ] - }, - { - "out": 1, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.042819, - 38.910027 - ], - "bearings": [ - 150, - 315, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.043141, - 38.910215 - ], - "bearings": [ - 90, - 120, - 285 - ] - }, - { - "out": 1, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.043232, - 38.910239 - ], - "bearings": [ - 105, - 285, - 300 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.043398, - 38.91026 - ], - "bearings": [ - 90, - 270, - 285 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - false, - false, - false, - true - ], - "location": [ - -77.043573, - 38.910299 - ], - "bearings": [ - 45, - 105, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.043726, - 38.910395 - ], - "bearings": [ - 135, - 255, - 330 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.044162, - 38.91113 - ], - "bearings": [ - 90, - 150, - 270, - 330 - ] - } - ], - "geometry": "{bzeiAx}h}qCmASmAMoAGoA?mADoAJmARaATaAXaA^_Ab@}@f@{@l@y@n@w@t@_AdA{@hAw@nAq@tAi@lAg@pAa@tA]vAYxAUzASlBMlBGnBg@`Ee@zCa@z@y@lBOZsAjB}l@fZkm@lZ", - "duration": 90.9, - "distance": 333.7, - "name": "", - "weight": 105.10000000000001, - "mode": "driving", - "maneuver": { - "exit": 3, - "bearing_after": 12, - "location": [ - -77.042669, - 38.909502 - ], - "type": "roundabout", - "bearing_before": 316, - "modifier": "right", - "instruction": "Enter the roundabout and take the 3rd exit" - } - }, - { - "intersections": [ - { - "in": 0, - "entry": [ - true - ], - "location": [ - -77.044601, - 38.911872 - ], - "bearings": [ - 155 - ] - } - ], - "geometry": "_w~eiApvl}qC", - "duration": 0, - "distance": 0, - "name": "", - "weight": 0, - "mode": "driving", - "maneuver": { - "bearing_after": 0, - "location": [ - -77.044601, - 38.911872 - ], - "type": "arrive", - "bearing_before": 335, - "modifier": "right", - "instruction": "You have arrived at your destination, on the right" - } - } - ], - "weight": 334.4, - "distance": 1030.9, - "summary": "P Street Northwest, Dupont Circle Northwest", - "duration": 273 - } - ], - "weight_name": "routability", - "geometry": "qe{eiA~c||qC?|Q?jEhS?vC@AlGBta@?~B@x`@?lb@BjF?dA?~CBjz@@ji@@v`@Bfq@?vDzVArM?mAtEuBdIaGfUsAnFgBfD{AvBwAbByBhBmASmAMoAGoA?mADoAJmARaATaAXaA^_Ab@}@f@{@l@y@n@w@t@_AdA{@hAw@nAq@tAi@lAg@pAa@tA]vAYxAUzASlBMlBGnBg@`Ee@zCa@z@y@lBOZsAjB}l@fZkm@lZ", - "weight": 334.4, - "distance": 1030.9, - "duration": 273 - } - ], - "code": "Ok" -} diff --git a/libandroid-navigation/src/test/resources/directions_distance_congestion_annotation.json b/libandroid-navigation/src/test/resources/directions_distance_congestion_annotation.json deleted file mode 100644 index 451cb335..00000000 --- a/libandroid-navigation/src/test/resources/directions_distance_congestion_annotation.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"y}geiAtbx|qCAuOAsGjEDjC@x|@NlCMbEFtC@pHB|SJxDA`m@[tGGnFAhj@W|FCjFEnd@_@rHG`A?bHp@~BBfQDbXZxNAxnAIhY@vWGxGJAvK?nLFjt@CtR?~gA?fH@nIBfsA@~q@@jN?hF?dE?rGdI@nD?fw@Fb`AFf`@BxE?nB?nQBnAd@","legs":[{"annotation":{"distance":[23.112016030150045,11.94591569183382,11.348054208558962,7.786322167317381,110.00499038237562,7.920279704123473,10.905675412061527,8.342421605534534,17.018504505519864,37.264430122677474,10.344408091778023,81.98274085609594,15.464332651944924,13.347436708874096,77.08682521947556,14.12680104104299,13.127272439147664,66.75015140227,17.132349786767318,3.6704679003626186,16.38261372499044,7.120588339840168,32.47911789405421,44.72939444755939,28.140387054178913,142.03664462850554,46.82635232174102,44.04697599024749,15.69150769884056,17.660778184273596,18.69927650437887,73.93273951893696,27.27068669792202,101.1146091275924,12.812467596257864,14.5443075405087,116.69755529542641,70.64180427237105,21.296690643320208,10.12877577065231,8.57050257550639,11.946761167191836,18.130093588392782,9.787914399787779,100.104268948764,115.89832194024392,59.172644927202136,12.123666699825575,6.228672800572473,32.92344010993076,4.743397461507696],"congestion":["moderate","moderate","low","low","low","low","low","low","severe","severe","heavy","heavy","heavy","heavy","heavy","heavy","severe","severe","severe","severe","heavy","heavy","heavy","heavy","heavy","heavy","heavy","heavy","heavy","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low","low"]},"summary":"15th Street Northwest, Constitution Avenue Northwest","weight":715.2,"duration":512.7,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[90],"location":[-77.034043,38.900205]}],"driving_side":"right","geometry":"y}geiAtbx|qCAuOAsG","mode":"driving","maneuver":{"bearing_after":90,"bearing_before":0,"location":[-77.034043,38.900205],"modifier":"right","type":"depart","instruction":"Head east on H Street Northwest"},"weight":35,"duration":9.9,"name":"H Street Northwest","distance":35.1},{"intersections":[{"out":2,"in":3,"entry":[true,true,true,false],"bearings":[0,90,180,270],"location":[-77.033638,38.900207]},{"out":2,"in":0,"entry":[false,false,true],"bearings":[0,60,180],"location":[-77.033648,38.898802]},{"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":2,"in":0,"entry":[false,false,true],"bearings":[0,90,180],"location":[-77.033656,38.898314]},{"lanes":[{"valid":true,"indications":["straight","left"]},{"valid":true,"indications":["straight"]}],"out":2,"in":0,"entry":[false,true,true],"bearings":[0,90,180],"location":[-77.033637,38.897345]},{"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":2,"in":0,"entry":[false,false,true],"bearings":[0,90,180],"location":[-77.033622,38.896405]},{"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":2,"in":0,"entry":[false,true,true],"bearings":[0,90,180],"location":[-77.033599,38.8955]}],"driving_side":"right","geometry":"}}geiAjiw|qCjEDjC@x|@NlCMbEFtC@pHB|SJxDA`m@[tGGnFAhj@W|FCjFEnd@_@rHG`A?bHp@~BBfQDbXZxNAxnAIhY@vWGxGJ","mode":"driving","maneuver":{"bearing_after":180,"bearing_before":88,"location":[-77.033638,38.900207],"modifier":"right","type":"turn","instruction":"Turn right onto 15th Street Northwest"},"weight":488.5,"duration":391.7,"name":"15th Street Northwest","distance":901.1},{"intersections":[{"lanes":[{"valid":false,"indications":["straight"]},{"valid":false,"indications":["straight"]},{"valid":true,"indications":["right"]}],"out":3,"in":0,"entry":[false,false,true,true],"bearings":[0,90,180,270],"location":[-77.03364,38.892108]}],"driving_side":"right","geometry":"wcxdiAniw|qCAvK?nLFjt@CtR?~gA?fH@nIBfsA@~q@@jN?hF?dE?rG","mode":"driving","maneuver":{"bearing_after":270,"bearing_before":180,"location":[-77.03364,38.892108],"modifier":"right","type":"turn","instruction":"Turn right onto Constitution Avenue Northwest (US 50)"},"ref":"US 50","weight":127.5,"duration":71,"name":"Constitution Avenue Northwest (US 50)","distance":505.3},{"intersections":[{"out":2,"in":1,"entry":[true,false,true,true],"bearings":[0,90,180,270],"location":[-77.039477,38.892102]},{"out":2,"in":0,"entry":[false,false,true],"bearings":[0,165,195],"location":[-77.03949,38.888916]}],"driving_side":"right","geometry":"kcxdiAhvb}qCdI@nD?fw@Fb`AFf`@BxE?nB?nQBnAd@","mode":"driving","maneuver":{"bearing_after":180,"bearing_before":268,"location":[-77.039477,38.892102],"modifier":"left","type":"turn","instruction":"Turn left onto 17th Street Southwest"},"weight":64.2,"duration":40.1,"name":"17th Street Southwest","distance":359.1},{"intersections":[{"in":0,"entry":[true],"bearings":[20],"location":[-77.039509,38.888876]}],"driving_side":"right","geometry":"wyqdiAhxb}qC","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":200,"location":[-77.039509,38.888876],"type":"arrive","instruction":"You have arrived at your destination"},"weight":0,"duration":0,"name":"17th Street Southwest","distance":0}],"distance":1800.6}],"weight_name":"routability","weight":715.2,"duration":512.7,"distance":1800.6}],"waypoints":[{"name":"H Street Northwest","location":[-77.034043,38.900205]},{"name":"17th Street Southwest","location":[-77.039509,38.888876]}],"code":"Ok","uuid":"cjhs6f4v220rz7soioj3p8lxm"} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/directions_two_leg_route.json b/libandroid-navigation/src/test/resources/directions_two_leg_route.json deleted file mode 100644 index 49d88fe4..00000000 --- a/libandroid-navigation/src/test/resources/directions_two_leg_route.json +++ /dev/null @@ -1,6103 +0,0 @@ -{ - "waypoints": [ - { - "location": [ - -77.063888, - 38.798979 - ], - "name": "" - }, - { - "location": [ - -77.078234, - 38.894377 - ], - "name": "North Quinn Street" - }, - { - "location": [ - -77.028263, - 38.962309 - ], - "name": "" - } - ], - "routes": [ - { - "legs": [ - { - "steps": [ - { - "intersections": [ - { - "out": 0, - "entry": [ - true - ], - "location": [ - -77.063888, - 38.798979 - ], - "bearings": [ - 136 - ] - } - ], - "geometry": "egb_iA~kr~qCj[{a@^qI", - "duration": 39.9, - "distance": 84.7, - "name": "", - "weight": 154.3, - "mode": "driving", - "maneuver": { - "bearing_after": 136, - "location": [ - -77.063888, - 38.798979 - ], - "type": "depart", - "bearing_before": 0, - "modifier": "right", - "instruction": "Head southeast" - } - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.063161, - 38.798509 - ], - "bearings": [ - 0, - 180, - 270 - ] - } - ], - "geometry": "yia_iAp~p~qCxDTT_J", - "duration": 16.9, - "distance": 25.7, - "name": "", - "weight": 51.5, - "mode": "driving", - "maneuver": { - "bearing_after": 184, - "location": [ - -77.063161, - 38.798509 - ], - "type": "turn", - "bearing_before": 95, - "modifier": "right", - "instruction": "Turn right" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.062996, - 38.798405 - ], - "bearings": [ - 0, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.062941, - 38.7988 - ], - "bearings": [ - 0, - 60, - 195 - ] - } - ], - "geometry": "ica_iAftp~qCkNy@iHs@i`@oB_FY__@sBcZaBkAGwBK", - "duration": 44.5, - "distance": 232.8, - "name": "Hooffs Run Drive", - "weight": 44.5, - "mode": "driving", - "maneuver": { - "bearing_after": 4, - "location": [ - -77.062996, - 38.798405 - ], - "type": "turn", - "bearing_before": 94, - "modifier": "left", - "instruction": "Turn left onto Hooffs Run Drive" - } - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false, - false - ], - "location": [ - -77.062755, - 38.800489 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 1, - "in": 2, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - true, - false - ], - "location": [ - -77.062015, - 38.800438 - ], - "bearings": [ - 15, - 90, - 270 - ] - } - ], - "geometry": "qee_iAdep~qCJ{DxAkg@LmEb@}QTgEb@_DbAeDfAyApAiB", - "duration": 13.6, - "distance": 135.9, - "name": "Eisenhower Avenue", - "weight": 13.6, - "mode": "driving", - "maneuver": { - "bearing_after": 94, - "location": [ - -77.062755, - 38.800489 - ], - "type": "turn", - "bearing_before": 4, - "modifier": "right", - "instruction": "Turn right onto Eisenhower Avenue" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.061248, - 38.800273 - ], - "bearings": [ - 150, - 315, - 345 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.060932, - 38.800095 - ], - "bearings": [ - 90, - 105, - 285 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.060481, - 38.800352 - ], - "bearings": [ - 0, - 180, - 195 - ] - }, - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.060473, - 38.800416 - ], - "bearings": [ - 0, - 15, - 180 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.060248, - 38.80088 - ], - "bearings": [ - 15, - 210, - 240 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.060117, - 38.801412 - ], - "bearings": [ - 15, - 195, - 270 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.059922, - 38.802358 - ], - "bearings": [ - 15, - 195, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.059772, - 38.803114 - ], - "bearings": [ - 15, - 105, - 195, - 285 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - false - ], - "location": [ - -77.059499, - 38.804244 - ], - "bearings": [ - 15, - 105, - 195, - 285 - ] - } - ], - "geometry": "axd_iA~fm~qCdBqAz@}@|@yA|@}B^yAPeARoBDuBQ}De@_Ce@aBmA_CsAcBgAy@aAc@}Bm@_CO{FqAyAg@k@SwCuAeK}EoDaAwEw@_TkC{TqC{PsBkR_CuBW_KoAgOeBmJeA{BWmCaAuBu@iFcAyQyBcSaCqKqAuBWwER", - "duration": 74.8, - "distance": 543.2, - "name": "Holland Lane", - "weight": 76.39999999999999, - "mode": "driving", - "maneuver": { - "exit": 2, - "bearing_after": 147, - "location": [ - -77.061248, - 38.800273 - ], - "type": "roundabout", - "bearing_before": 133, - "modifier": "straight", - "instruction": "Enter the roundabout and take the 2nd exit onto Holland Lane" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 1, - "entry": [ - false, - true, - true - ], - "location": [ - -77.059509, - 38.804352 - ], - "bearings": [ - 105, - 195, - 285 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.059982, - 38.804413 - ], - "bearings": [ - 15, - 105, - 195, - 285 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.061299, - 38.804607 - ], - "bearings": [ - 15, - 105, - 195, - 285 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.061516, - 38.804639 - ], - "bearings": [ - 15, - 105, - 195, - 285 - ] - }, - { - "out": 1, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.062804, - 38.804828 - ], - "bearings": [ - 105, - 285, - 300 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.063276, - 38.804897 - ], - "bearings": [ - 30, - 105, - 195, - 285 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.063379, - 38.804912 - ], - "bearings": [ - 45, - 105, - 195, - 285 - ] - } - ], - "maneuver": { - "bearing_after": 278, - "location": [ - -77.059509, - 38.804352 - ], - "type": "end of road", - "bearing_before": 15, - "modifier": "left", - "instruction": "Turn left onto Duke Street (VA 236)" - }, - "duration": 58.3, - "distance": 452.8, - "name": "Duke Street (VA 236)", - "geometry": "_wl_iAhzi~qCaBzVWtDq@lI{Fvt@}@bLW~C_ApLU~CcFjo@aBvS]jEiBrU_@zE]lEiAbQ{Ddh@YxEs@dL", - "ref": "VA 236", - "weight": 58.3, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 1, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.064648, - 38.805082 - ], - "bearings": [ - 105, - 285, - 300 - ] - } - ], - "geometry": "sdn_iAn{s~qCcB`HkApBiAp@_BT{AIoA_@eAy@gAoA", - "duration": 9.5, - "distance": 50, - "name": "", - "weight": 9.5, - "mode": "driving", - "maneuver": { - "bearing_after": 292, - "location": [ - -77.064648, - 38.805082 - ], - "type": "turn", - "bearing_before": 278, - "modifier": "slight right", - "instruction": "Make a slight right" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.064796, - 38.805412 - ], - "bearings": [ - 45, - 225, - 240 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.062732, - 38.806871 - ], - "bearings": [ - 30, - 45, - 195 - ] - } - ], - "geometry": "gyn_iAvdt~qCsKcOsB}E_IgTkNaa@eF{N}CiHmC{DcDyCgD}AgMmFkGkCmKwE}A]wEM", - "duration": 38.3, - "distance": 291.1, - "name": "Callahan Drive", - "weight": 38.3, - "mode": "driving", - "maneuver": { - "bearing_after": 43, - "location": [ - -77.064796, - 38.805412 - ], - "type": "turn", - "bearing_before": 40, - "modifier": "straight", - "instruction": "Go straight onto Callahan Drive" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.062602, - 38.807225 - ], - "bearings": [ - 135, - 180, - 315, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.063845, - 38.808159 - ], - "bearings": [ - 45, - 135, - 315 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.064636, - 38.808788 - ], - "bearings": [ - 45, - 135, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.065142, - 38.809178 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.066933, - 38.810558 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.067584, - 38.811059 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.069007, - 38.812155 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.070983, - 38.813603 - ], - "bearings": [ - 135, - 210, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.071306, - 38.813855 - ], - "bearings": [ - 135, - 285, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.071553, - 38.814047 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.071882, - 38.814332 - ], - "bearings": [ - 135, - 150, - 315 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.072374, - 38.814771 - ], - "bearings": [ - 45, - 135, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.073247, - 38.815554 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.074716, - 38.816877 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.075329, - 38.817428 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.075812, - 38.817872 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.076805, - 38.818769 - ], - "bearings": [ - 45, - 135, - 315 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.077898, - 38.819768 - ], - "bearings": [ - 60, - 135, - 315 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.079629, - 38.821377 - ], - "bearings": [ - 30, - 135, - 315 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.082245, - 38.823428 - ], - "bearings": [ - 45, - 135, - 315 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.083334, - 38.824126 - ], - "bearings": [ - 135, - 225, - 315 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.085177, - 38.825338 - ], - "bearings": [ - 30, - 135, - 225, - 315 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.086428, - 38.826186 - ], - "bearings": [ - 0, - 135, - 225, - 315 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.087346, - 38.826837 - ], - "bearings": [ - 90, - 135, - 285, - 315 - ] - }, - { - "out": 2, - "in": 1, - "lanes": [ - { - "valid": true, - "indications": [ - "straight" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - false, - true - ], - "location": [ - -77.087556, - 38.826991 - ], - "bearings": [ - 90, - 135, - 315 - ] - } - ], - "maneuver": { - "bearing_after": 312, - "location": [ - -77.062602, - 38.807225 - ], - "type": "turn", - "bearing_before": 1, - "modifier": "left", - "instruction": "Turn left onto King Street (VA 7)" - }, - "duration": 317.8, - "distance": 3136.1, - "name": "King Street (VA 7)", - "geometry": "qjr_iAr{o~qCiClEgK|OcE|FwLzP}Tn[if@lp@kWr^guA|nB{RzXmJxMocA|wAoyAnzBwNdS_KlN_K`MyDnEmZv]gTtVcTpVqEhFaGxGuW|YgD|DiGhHuWtZuJbL_AjAm_@|b@wZd]mJtK_`@tc@cJ`KORed@vg@_OnPgH`ImXvZaBhBuEhFiPvQ}UlWcXrYkJnK}MbOqLhNsZb_@yPxV}OpV}X`g@sj@`cAwjAdrB_t@dmAgPhXgRhYeCvDsHbL}PlW", - "ref": "VA 7", - "weight": 317.8, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false, - true, - false, - true - ], - "location": [ - -77.087947, - 38.827278 - ], - "bearings": [ - 90, - 135, - 195, - 270, - 300, - 330 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.087191, - 38.827589 - ], - "bearings": [ - 45, - 240, - 315 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.086365, - 38.828329 - ], - "bearings": [ - 30, - 90, - 210, - 285 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.086056, - 38.828904 - ], - "bearings": [ - 30, - 195, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.085615, - 38.829858 - ], - "bearings": [ - 15, - 120, - 180, - 240 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.085221, - 38.832019 - ], - "bearings": [ - 0, - 105, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.085249, - 38.832919 - ], - "bearings": [ - 0, - 120, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.085273, - 38.83386 - ], - "bearings": [ - 0, - 105, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": false, - "indications": [ - "right" - ] - } - ], - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.084738, - 38.836207 - ], - "bearings": [ - 15, - 105, - 195, - 285 - ] - } - ], - "maneuver": { - "bearing_after": 85, - "location": [ - -77.087947, - 38.827278 - ], - "type": "turn", - "bearing_before": 312, - "modifier": "sharp right", - "instruction": "Make a sharp right onto North Quaker Lane (SR 402)" - }, - "duration": 126.29999999999998, - "distance": 1494.1, - "name": "North Quaker Lane (SR 402)", - "geometry": "{oy`iAtka`rCUcKaJcUuF_LiIiOwImKoIiJuMqJi[cNsFeC}HgEug@mU_Hb@uCmFoPqFy@SwFuAsCs@mKgByPiA}CQgHMi]h@}VPki@h@{LLsb@d@eVH_PDwK^kMb@oGMuDgAcMcDkOaFmPeFsPcFyUqEiFwA{IO{]u@sPW_GEsa@VyVGoTe@yNi@{M{AkMwCoW{G", - "ref": "SR 402", - "weight": 126.29999999999998, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.084348, - 38.839794 - ], - "bearings": [ - 15, - 195, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.084079, - 38.840378 - ], - "bearings": [ - 15, - 105, - 195 - ] - } - ], - "geometry": "c~qaiAvjz_rCoc@yOsWiJ", - "duration": 7.300000000000001, - "distance": 115.6, - "name": "Shirlington Circle", - "weight": 7.300000000000001, - "mode": "driving", - "maneuver": { - "bearing_after": 19, - "location": [ - -77.084348, - 38.839794 - ], - "type": "turn", - "bearing_before": 15, - "modifier": "straight", - "instruction": "Go straight onto Shirlington Circle" - } - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.083898, - 38.840772 - ], - "bearings": [ - 15, - 30, - 195 - ] - } - ], - "geometry": "g{saiArny_rC}TkLmJwEwGiE_UyPoU}Rm[{VeTgOyOyK{`@uY", - "duration": 16, - "distance": 388.3, - "name": "", - "weight": 16, - "mode": "driving", - "maneuver": { - "bearing_after": 25, - "location": [ - -77.083898, - 38.840772 - ], - "type": "on ramp", - "bearing_before": 19, - "modifier": "slight right", - "instruction": "Take the ramp on the right" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.081597, - 38.843763 - ], - "bearings": [ - 36, - 212, - 216 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.081264, - 38.84412 - ], - "bearings": [ - 30, - 45, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.079427, - 38.846346 - ], - "bearings": [ - 30, - 195, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.079019, - 38.846855 - ], - "bearings": [ - 30, - 45, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.077163, - 38.849116 - ], - "bearings": [ - 32, - 206, - 213 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.070686, - 38.857997 - ], - "bearings": [ - 26, - 33, - 209 - ] - } - ], - "maneuver": { - "bearing_after": 35, - "location": [ - -77.081597, - 38.843763 - ], - "type": "merge", - "bearing_before": 30, - "modifier": "slight left", - "instruction": "Merge left onto Shirley Highway (I 395)" - }, - "duration": 86.5, - "distance": 2240.6, - "name": "Shirley Highway (I 395)", - "geometry": "evyaiAx~t_rCiUyScjCyqBo[{UiBsAkl@uc@{EkDaxA}hAew@ml@iTqPg{C{sBgRaMk|C}mBe_CcwAoOyJotAuu@sJeEqWaJk\\uI}ZwGu[uC", - "ref": "I 395", - "weight": 86.5, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.069149, - 38.86132 - ], - "bearings": [ - 0, - 15, - 180 - ] - } - ], - "geometry": "o_|biAxt|~qCimAwN_h@kImTaHqLkEoPmJwK_HyVoVePcUyKyVkNo_@gPsm@{a@uyAaMa\\", - "maneuver": { - "bearing_after": 8, - "location": [ - -77.069149, - 38.86132 - ], - "type": "off ramp", - "bearing_before": 7, - "modifier": "slight right", - "instruction": "Take the ramp on the right towards VA-27" - }, - "duration": 35.1, - "distance": 790.8, - "destinations": "VA-27, Washington Blvd, Pentagon, Arlington Cemetery, Rosslyn", - "name": "", - "weight": 35.1, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.063864, - 38.866439 - ], - "bearings": [ - 60, - 240, - 255 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.062024, - 38.868065 - ], - "bearings": [ - 30, - 45, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.06116, - 38.869217 - ], - "bearings": [ - 30, - 195, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.059241, - 38.871796 - ], - "bearings": [ - 28, - 205, - 208 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.058093, - 38.873823 - ], - "bearings": [ - 15, - 195, - 210 - ] - } - ], - "maneuver": { - "bearing_after": 57, - "location": [ - -77.063864, - 38.866439 - ], - "type": "merge", - "bearing_before": 57, - "modifier": "slight left", - "instruction": "Merge left onto Washington Boulevard (VA 27)" - }, - "duration": 68, - "distance": 1445, - "name": "Washington Boulevard (VA 27)", - "geometry": "m_fciAnjr~qCwNe`@gJaQmNmPwJuJ}HaGod@qY_gA_u@{KiHeOmKktAu`Awm@o_@yj@o\\yo@yZaa@mMeYmKci@_P_[sI{bAcOqr@sGyVgC}QW", - "ref": "VA 27", - "weight": 68, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.056976, - 38.877959 - ], - "bearings": [ - 0, - 15, - 180 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.056322, - 38.878169 - ], - "bearings": [ - 135, - 300, - 330 - ] - } - ], - "geometry": "mo|ciA~{d~qCqGwB{D_CeBgCmAwCYaFl@mDhEsJrFyJvGsN~IuT", - "duration": 25.7, - "distance": 165.3, - "name": "", - "weight": 25.7, - "mode": "driving", - "maneuver": { - "bearing_after": 18, - "location": [ - -77.056976, - 38.877959 - ], - "type": "off ramp", - "bearing_before": 1, - "modifier": "slight right", - "instruction": "Take the ramp on the right" - } - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.055536, - 38.877731 - ], - "bearings": [ - 60, - 240, - 300 - ] - } - ], - "geometry": "ea|ciA~ab~qC|BvH`]rv@", - "duration": 13.1, - "distance": 109, - "name": "Pentagon Access Road", - "weight": 13.1, - "mode": "driving", - "maneuver": { - "bearing_after": 241, - "location": [ - -77.055536, - 38.877731 - ], - "type": "end of road", - "bearing_before": 122, - "modifier": "right", - "instruction": "Turn right onto Pentagon Access Road" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.056582, - 38.877187 - ], - "bearings": [ - 60, - 150, - 240 - ] - } - ], - "geometry": "e_{ciAjcd~qCnCpHPfCDbEYvB}n@lv@aMbQmQhX", - "duration": 14.8, - "distance": 233.6, - "name": "", - "weight": 14.8, - "mode": "driving", - "maneuver": { - "bearing_after": 237, - "location": [ - -77.056582, - 38.877187 - ], - "type": "new name", - "bearing_before": 234, - "modifier": "straight", - "instruction": "Continue straight" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.058543, - 38.878403 - ], - "bearings": [ - 133, - 141, - 319 - ] - }, - { - "out": 1, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.061716, - 38.881589 - ], - "bearings": [ - 144, - 326, - 332 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.065754, - 38.887619 - ], - "bearings": [ - 156, - 326, - 330 - ] - } - ], - "maneuver": { - "bearing_after": 319, - "location": [ - -77.058543, - 38.878403 - ], - "type": "merge", - "bearing_before": 312, - "modifier": "slight left", - "instruction": "Merge left onto North Jefferson Davis Highway (VA 110)" - }, - "duration": 85.30000000000001, - "distance": 1818.1, - "name": "North Jefferson Davis Highway (VA 110)", - "geometry": "ek}ciA|}g~qCucAljAur@ts@uw@vp@aUlSu[tW}\\|Vmb@nZiWbQcd@pXy]vQ}JbFiY|NmaAjh@asAbo@y@f@sGbEeHlEqJhHyCzBaC~BmIfJ{SbUuPj[wF~FmF`FqD~BoGzCuFtB}NpDoKb@mq@fBoPR{S?iRuBs_@aIsNuB", - "ref": "VA 110", - "weight": 85.30000000000001, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.06755, - 38.892563 - ], - "bearings": [ - 0, - 15, - 195 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.068295, - 38.894006 - ], - "bearings": [ - 15, - 150, - 180, - 330 - ] - }, - { - "out": 2, - "in": 0, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - true, - true - ], - "location": [ - -77.068613, - 38.894363 - ], - "bearings": [ - 150, - 225, - 315 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.069354, - 38.894768 - ], - "bearings": [ - 0, - 120, - 210, - 300 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": false, - "indications": [ - "right" - ] - } - ], - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.070746, - 38.895162 - ], - "bearings": [ - 0, - 105, - 180, - 270 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": false, - "indications": [ - "right" - ] - } - ], - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.070814, - 38.895164 - ], - "bearings": [ - 15, - 90, - 195, - 270 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.071477, - 38.895119 - ], - "bearings": [ - 0, - 90, - 180, - 255 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.072077, - 38.895013 - ], - "bearings": [ - 0, - 75, - 180, - 255 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - false, - false, - true, - true - ], - "location": [ - -77.072287, - 38.894973 - ], - "bearings": [ - 0, - 75, - 180, - 255 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.073135, - 38.894874 - ], - "bearings": [ - 0, - 75, - 180, - 270 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.073512, - 38.894837 - ], - "bearings": [ - 45, - 90, - 270 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.073852, - 38.894809 - ], - "bearings": [ - 0, - 90, - 180, - 255 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.07672, - 38.894394 - ], - "bearings": [ - 75, - 180, - 255 - ] - } - ], - "geometry": "e`ydiAzpy~qCyKT{Gt@{GhBsQ`J_h@x\\yEdDwLxJw@zAgEjIeKxToCnGkArDeGhOgDzKoAhHgBjL]fDkAxK[|Eg@bICfCR~IF`F^hO\\`Ft@dHZbDfB|PXfDnAbL^hFrAjRv@hQX~FRtDt@zP`@xLTlF`@dFtDpe@bBhTJvA^lEfEni@vCx`@pArRb@`FTzEz@tItApQj@vHnD~TpB|MdAbH", - "duration": 181.2, - "distance": 1088.7, - "name": "", - "weight": 181.2, - "mode": "driving", - "maneuver": { - "bearing_after": 357, - "location": [ - -77.06755, - 38.892563 - ], - "type": "fork", - "bearing_before": 9, - "modifier": "slight left", - "instruction": "Keep left at the fork" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.078191, - 38.894108 - ], - "bearings": [ - 0, - 75, - 240 - ] - } - ], - "geometry": "w`|diA|in_rCmCTwD\\sE`@", - "duration": 6.5, - "distance": 30.2, - "name": "North Quinn Street", - "weight": 6.5, - "mode": "driving", - "maneuver": { - "bearing_after": 351, - "location": [ - -77.078191, - 38.894108 - ], - "type": "turn", - "bearing_before": 251, - "modifier": "right", - "instruction": "Turn right onto North Quinn Street" - } - }, - { - "intersections": [ - { - "in": 0, - "entry": [ - true - ], - "location": [ - -77.078234, - 38.894377 - ], - "bearings": [ - 173 - ] - } - ], - "geometry": "qq|diArln_rC", - "duration": 0, - "distance": 0, - "name": "North Quinn Street", - "weight": 0, - "mode": "driving", - "maneuver": { - "bearing_after": 0, - "location": [ - -77.078234, - 38.894377 - ], - "type": "arrive", - "bearing_before": 353, - "modifier": "right", - "instruction": "You have arrived at your destination, on the right" - } - } - ], - "weight": 1430, - "distance": 14871.6, - "annotation": { - "congestion": [ - "unknown", - "unknown", - "unknown", - "unknown", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "heavy", - "low", - "heavy", - "low", - "low", - "low", - "heavy", - "heavy", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "heavy", - "heavy", - "low", - "low", - "moderate", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "heavy", - "heavy", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "heavy", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "low", - "heavy", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "moderate", - "moderate", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "moderate", - "heavy", - "heavy", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "heavy", - "moderate", - "low", - "low", - "low", - "heavy", - "heavy", - "heavy", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low" - ] - }, - "summary": "King Street, North Wilson Boulevard", - "duration": 1279.4 - }, - { - "steps": [ - { - "intersections": [ - { - "out": 0, - "entry": [ - true - ], - "location": [ - -77.078234, - 38.894377 - ], - "bearings": [ - 352 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.078344, - 38.895312 - ], - "bearings": [ - 0, - 90, - 180 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.078428, - 38.896038 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.078599, - 38.897331 - ], - "bearings": [ - 0, - 180, - 345 - ] - } - ], - "geometry": "qq|diArln_rCy@H_P|@sf@rCkEVga@xBwCTkF^oeAbH}APaKPeC?eCs@wBgBwByCgBiC", - "duration": 85.5, - "distance": 392.6, - "name": "North Quinn Street", - "weight": 85.5, - "mode": "driving", - "maneuver": { - "bearing_after": 352, - "location": [ - -77.078234, - 38.894377 - ], - "type": "depart", - "bearing_before": 0, - "modifier": "right", - "instruction": "Head north on North Quinn Street" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.078384, - 38.89783 - ], - "bearings": [ - 60, - 225, - 240 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.073579, - 38.898436 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.073048, - 38.898387 - ], - "bearings": [ - 90, - 120, - 270 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - false, - true, - true, - false - ], - "location": [ - -77.072514, - 38.898338 - ], - "bearings": [ - 30, - 90, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.072333, - 38.898329 - ], - "bearings": [ - 90, - 120, - 270 - ] - }, - { - "out": 0, - "in": 2, - "lanes": [ - { - "valid": true, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "straight", - "left" - ] - }, - { - "valid": true, - "indications": [ - "straight" - ] - } - ], - "entry": [ - true, - false, - false - ], - "location": [ - -77.071298, - 38.898271 - ], - "bearings": [ - 90, - 210, - 270 - ] - } - ], - "maneuver": { - "bearing_after": 61, - "location": [ - -77.078384, - 38.89783 - ], - "type": "turn", - "bearing_before": 43, - "modifier": "straight", - "instruction": "Go straight onto North Lee Highway (US 29)" - }, - "duration": 71.8, - "distance": 670.9, - "name": "North Lee Highway (US 29)", - "geometry": "kiceiA~un_rCmGmTqKgg@{Fkb@aFyo@uAmV}@cTUwo@jBc|@RcFlAaYf@cMf@sLPsDHmEF{CZkOv@{_@^mNFwAdAm\\", - "ref": "US 29", - "weight": 71.8, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 3, - "lanes": [ - { - "valid": true, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "straight", - "left" - ] - }, - { - "valid": false, - "indications": [ - "straight" - ] - } - ], - "entry": [ - true, - true, - false, - false - ], - "location": [ - -77.070783, - 38.898232 - ], - "bearings": [ - 0, - 105, - 180, - 270 - ] - } - ], - "maneuver": { - "bearing_after": 2, - "location": [ - -77.070783, - 38.898232 - ], - "type": "turn", - "bearing_before": 94, - "modifier": "left", - "instruction": "Turn left onto North Lynn Street (US 29)" - }, - "duration": 16.3, - "distance": 83.8, - "name": "North Lynn Street (US 29)", - "geometry": "obdeiA|z__rCsHYkd@_B", - "ref": "US 29", - "weight": 16.3, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": false, - "indications": [ - "straight" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.070722, - 38.898984 - ], - "bearings": [ - 0, - 105, - 180, - 270 - ] - }, - { - "out": 0, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - false, - true - ], - "location": [ - -77.07072, - 38.899274 - ], - "bearings": [ - 0, - 180, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.070793, - 38.899998 - ], - "bearings": [ - 150, - 165, - 345 - ] - } - ], - "maneuver": { - "bearing_after": 0, - "location": [ - -77.070722, - 38.898984 - ], - "type": "use lane", - "bearing_before": 2, - "modifier": "straight", - "instruction": "Keep right" - }, - "duration": 15.9, - "distance": 167.5, - "name": "North Lynn Street (US 29)", - "geometry": "oqeeiAbw__rC{CAkA?oCAkE?{I?mMIqFd@wDh@sEjA{Fr@{ERgNqB", - "ref": "US 29", - "weight": 15.9, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.070772, - 38.900478 - ], - "bearings": [ - 15, - 195, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.06916, - 38.903874 - ], - "bearings": [ - 15, - 60, - 195 - ] - }, - { - "out": 0, - "in": 1, - "lanes": [ - { - "valid": true, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "right" - ] - }, - { - "valid": true, - "indications": [ - "right" - ] - } - ], - "entry": [ - true, - false, - false - ], - "location": [ - -77.068766, - 38.904758 - ], - "bearings": [ - 15, - 195, - 345 - ] - } - ], - "maneuver": { - "bearing_after": 19, - "location": [ - -77.070772, - 38.900478 - ], - "type": "new name", - "bearing_before": 9, - "modifier": "straight", - "instruction": "Continue straight onto Francis Scott Key Bridge (US 29)" - }, - "duration": 64.60000000000001, - "distance": 541.6, - "name": "Francis Scott Key Bridge (US 29)", - "geometry": "{nheiAfz__rCoyDywAwX}Jw[mLiUcHeCaAuQqF", - "ref": "US 29", - "weight": 64.60000000000001, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.068645, - 38.905057 - ], - "bearings": [ - 90, - 195, - 270 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - false, - false, - false, - true - ], - "location": [ - -77.069043, - 38.905044 - ], - "bearings": [ - 30, - 90, - 120, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.069892, - 38.905028 - ], - "bearings": [ - 90, - 225, - 270 - ] - } - ], - "geometry": "amqeiAhu{~qCHzHN~MJtVRj\\DrO?pB", - "duration": 25.1, - "distance": 135.9, - "name": "M Street Northwest", - "weight": 25.1, - "mode": "driving", - "maneuver": { - "bearing_after": 267, - "location": [ - -77.068645, - 38.905057 - ], - "type": "end of road", - "bearing_before": 16, - "modifier": "left", - "instruction": "Turn left onto M Street Northwest" - } - }, - { - "intersections": [ - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - false, - true - ], - "location": [ - -77.070215, - 38.905025 - ], - "bearings": [ - 0, - 90, - 165, - 270 - ] - }, - { - "out": 1, - "in": 0, - "lanes": [ - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": false, - "indications": [ - "right" - ] - } - ], - "entry": [ - false, - true, - true - ], - "location": [ - -77.074027, - 38.905522 - ], - "bearings": [ - 105, - 270, - 315 - ] - }, - { - "out": 2, - "in": 0, - "lanes": [ - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": false, - "indications": [ - "right" - ] - } - ], - "entry": [ - false, - false, - true, - false - ], - "location": [ - -77.07427, - 38.905532 - ], - "bearings": [ - 90, - 150, - 270, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.07558, - 38.905519 - ], - "bearings": [ - 75, - 90, - 270 - ] - } - ], - "geometry": "akqeiAlw~~qC}@bOS~CEvNEzEGpAw@lT_BhSkE~[eDlWuCze@sC|_@[~Hk@|MSdNDzX^pc@KtI?vGQjJ}AnVgDlYmIfj@}I|h@aAlPCbUBdAd@xUPnI", - "duration": 62.599999999999994, - "distance": 784.8, - "name": "Canal Road Northwest", - "weight": 62.599999999999994, - "mode": "driving", - "maneuver": { - "bearing_after": 270, - "location": [ - -77.070215, - 38.905025 - ], - "type": "new name", - "bearing_before": 268, - "modifier": "straight", - "instruction": "Continue straight onto Canal Road Northwest" - } - }, - { - "intersections": [ - { - "out": 2, - "in": 0, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - true, - true - ], - "location": [ - -77.079125, - 38.906006 - ], - "bearings": [ - 90, - 240, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - false, - true - ], - "location": [ - -77.080895, - 38.906603 - ], - "bearings": [ - 150, - 285, - 330 - ] - }, - { - "out": 2, - "in": 1, - "lanes": [ - { - "valid": true, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - false, - true - ], - "location": [ - -77.081091, - 38.906863 - ], - "bearings": [ - 60, - 150, - 330 - ] - }, - { - "out": 2, - "in": 0, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - true, - true - ], - "location": [ - -77.081258, - 38.907079 - ], - "bearings": [ - 150, - 210, - 330 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.082402, - 38.908632 - ], - "bearings": [ - 75, - 150, - 330 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.083126, - 38.909617 - ], - "bearings": [ - 75, - 150, - 330 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.083888, - 38.910655 - ], - "bearings": [ - 60, - 150, - 240, - 330 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.08465, - 38.911687 - ], - "bearings": [ - 90, - 150, - 330 - ] - }, - { - "out": 1, - "in": 0, - "lanes": [ - { - "valid": true, - "indications": [ - "straight", - "left" - ] - }, - { - "valid": true, - "indications": [ - "straight", - "right" - ] - } - ], - "entry": [ - false, - true, - true - ], - "location": [ - -77.084897, - 38.912025 - ], - "bearings": [ - 150, - 330, - 345 - ] - }, - { - "out": 2, - "in": 0, - "lanes": [ - { - "valid": true, - "indications": [ - "straight", - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - false, - true, - true - ], - "location": [ - -77.085009, - 38.912252 - ], - "bearings": [ - 165, - 240, - 345 - ] - }, - { - "out": 3, - "in": 1, - "lanes": [ - { - "valid": true, - "indications": [ - "straight", - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.085047, - 38.912426 - ], - "bearings": [ - 105, - 165, - 285, - 345 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.085189, - 38.912855 - ], - "bearings": [ - 165, - 210, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - false, - false, - true - ], - "location": [ - -77.085191, - 38.912865 - ], - "bearings": [ - 150, - 165, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.085224, - 38.912984 - ], - "bearings": [ - 75, - 165, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.085894, - 38.913868 - ], - "bearings": [ - 45, - 135, - 315 - ] - }, - { - "out": 0, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - false, - true - ], - "location": [ - -77.088705, - 38.91644 - ], - "bearings": [ - 0, - 165, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.088772, - 38.918043 - ], - "bearings": [ - 0, - 90, - 180 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.088746, - 38.919166 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.089562, - 38.922575 - ], - "bearings": [ - 165, - 270, - 345 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.089937, - 38.925102 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.090041, - 38.925955 - ], - "bearings": [ - 0, - 75, - 180 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.090114, - 38.92655 - ], - "bearings": [ - 0, - 180, - 270 - ] - }, - { - "out": 3, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.090254, - 38.927529 - ], - "bearings": [ - 90, - 180, - 270, - 345 - ] - }, - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.090709, - 38.928868 - ], - "bearings": [ - 90, - 165, - 345 - ] - }, - { - "out": 2, - "in": 0, - "entry": [ - false, - true, - true - ], - "location": [ - -77.090757, - 38.929044 - ], - "bearings": [ - 165, - 255, - 345 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.091054, - 38.930275 - ], - "bearings": [ - 0, - 90, - 165, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.091065, - 38.931347 - ], - "bearings": [ - 0, - 90, - 180 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.091063, - 38.932415 - ], - "bearings": [ - 0, - 90, - 180 - ] - } - ], - "geometry": "khseiAhdp_rCjAnXOlRoAtRm@`CYz@k@bBkArCg@fAi@dAk@bAm@`A_B|BiH|G}CdCuBxAkCxByKtHmBpAeDbCoCdByBbBoDbC{RtMuMzIor@vd@iCfBe@X_SzMgTpNiDxB_N~IeJfGmQxLaVpOeK~Go_Arn@{CrBqMpIu@f@yB|Au@d@}@ZwE~@eBVuFr@gP|DqH|ASBcB\\_ANiARqCr@{JfDoCxA{CnBqCnBqEvDcA~@cCfCaKdLuQdTgHxJeFhIcEnHwD`IsFtLyFdPoBpFeCtFwClFkC|D_EhFaD|DgChCwDfD_EbDsCrBuAz@oDpBeD`BcEbBgGtBuA`@oD|@oDr@eBVeD`@cBH{DNyAB{Xz@wF^eDNqADyFFmG?{AA}A?mPKoFC_ICqB?_MGiBC_IEi\\]kc@I_QNuAHiDRyF`AyBl@iJ~Cub@xMcN~Dw@RcCl@{Dz@}Dv@}AX}GbAkNvBoV|DoGfAuDp@mG~@sSpCyCZeBNgTpAoM|@oMp@wMt@s`@`CqObAsCTuo@xDaCNc`@`Cae@zCqG^wD\\m@D{APk@Jm@Hu@NqAXwA`@}O`EuI`CwHrB_B`@aB^o@PcE~@o@Pm@Lk@Nm@Lk@NuDv@m@Jk@LuJdBkF`AsB\\gCd@kHnAuP~CeEr@u@JgDh@oIhAoN`Bu@JmBRk@DyBLoBFkv@@iCAwaACgK?eN@oK?sHD", - "duration": 346.6, - "distance": 3378.6, - "name": "MacArthur Boulevard Northwest", - "weight": 344.6, - "mode": "driving", - "maneuver": { - "bearing_after": 262, - "location": [ - -77.079125, - 38.906006 - ], - "type": "turn", - "bearing_before": 267, - "modifier": "straight", - "instruction": "Go straight onto MacArthur Boulevard Northwest" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "right" - ] - } - ], - "entry": [ - true, - false, - true - ], - "location": [ - -77.091067, - 38.933208 - ], - "bearings": [ - 60, - 180, - 255 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.090487, - 38.933547 - ], - "bearings": [ - 45, - 105, - 225 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.089146, - 38.934542 - ], - "bearings": [ - 45, - 90, - 225, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.088642, - 38.934931 - ], - "bearings": [ - 45, - 180, - 225 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.087709, - 38.935779 - ], - "bearings": [ - 30, - 135, - 210 - ] - } - ], - "geometry": "olhgiAtng`rCwAoEa@eAi@oAy@wB_@{@aAqBeAoBqCiEmCaEge@{q@}V}_@mGmIuIaMeD_FoMiR_DsE{AwBm@y@]c@wBcCgDaDgRoOgCsBuYwUcCqBuIgHoLuJkKcIs@i@aNgL{QcOsEiD", - "duration": 78.2, - "distance": 652.6, - "name": "Nebraska Avenue Northwest", - "weight": 78.2, - "mode": "driving", - "maneuver": { - "bearing_after": 61, - "location": [ - -77.091067, - 38.933208 - ], - "type": "end of road", - "bearing_before": 358, - "modifier": "right", - "instruction": "Turn right onto Nebraska Avenue Northwest" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - false, - false - ], - "location": [ - -77.086157, - 38.9376 - ], - "bearings": [ - 90, - 120, - 210, - 300, - 330 - ] - } - ], - "geometry": "__qgiAx{}_rCCiGuAeFmBuD}CiEwCkC_Bk@oC}@mFu@cBTkCbC", - "duration": 14.4, - "distance": 98.2, - "name": "Ward Circle Northwest", - "weight": 14.4, - "mode": "driving", - "maneuver": { - "exit": 1, - "bearing_after": 88, - "location": [ - -77.086157, - 38.9376 - ], - "type": "roundabout", - "bearing_before": 32, - "modifier": "right", - "instruction": "Enter the roundabout and take the 1st exit onto Ward Circle Northwest" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false, - false, - false - ], - "location": [ - -77.085644, - 38.938214 - ], - "bearings": [ - 30, - 120, - 150, - 270, - 300 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.081968, - 38.942518 - ], - "bearings": [ - 30, - 210, - 330 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.08142, - 38.94316 - ], - "bearings": [ - 30, - 90, - 210, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.080393, - 38.944364 - ], - "bearings": [ - 30, - 150, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.080036, - 38.944783 - ], - "bearings": [ - 30, - 90, - 210, - 270 - ] - }, - { - "out": 1, - "in": 2, - "entry": [ - false, - true, - false - ], - "location": [ - -77.079204, - 38.945752 - ], - "bearings": [ - 0, - 45, - 210 - ] - } - ], - "geometry": "kergiAv{|_rC}KuIgYaU_\\aXmNiL}AqAeCqB}PmN}MuK_Au@eFeE_ScPiAaAgEgD_CqBeScPyFuEgScPyM{KoO_MwJeI}CeCkFiEyTuQiQqNyIiHyUcRm`@y[eG}EeYiUaFaE{GyF_L{I}KaJcI{GiEqDgAw@oF{J_DiK{@mC", - "duration": 134.4, - "distance": 1054.1, - "name": "Nebraska Avenue Northwest", - "weight": 134.4, - "mode": "driving", - "maneuver": { - "bearing_after": 32, - "location": [ - -77.085644, - 38.938214 - ], - "type": "turn", - "bearing_before": 324, - "modifier": "right", - "instruction": "Turn right onto Nebraska Avenue Northwest" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - false - ], - "location": [ - -77.078746, - 38.945982 - ], - "bearings": [ - 60, - 240, - 255 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.078625, - 38.946033 - ], - "bearings": [ - 45, - 150, - 240, - 330 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.07842, - 38.946283 - ], - "bearings": [ - 0, - 15, - 90, - 195 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true, - true - ], - "location": [ - -77.078345, - 38.946772 - ], - "bearings": [ - 30, - 195, - 240, - 345 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.078022, - 38.947141 - ], - "bearings": [ - 30, - 105, - 210 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.077693, - 38.947525 - ], - "bearings": [ - 30, - 210, - 300 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.077368, - 38.947905 - ], - "bearings": [ - 30, - 90, - 210, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.077074, - 38.948248 - ], - "bearings": [ - 30, - 165, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.075802, - 38.949735 - ], - "bearings": [ - 30, - 105, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.074947, - 38.950734 - ], - "bearings": [ - 30, - 90, - 210, - 270 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.074654, - 38.951076 - ], - "bearings": [ - 15, - 30, - 180, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.074317, - 38.95147 - ], - "bearings": [ - 30, - 105, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.073732, - 38.952153 - ], - "bearings": [ - 30, - 105, - 210 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.073626, - 38.952277 - ], - "bearings": [ - 30, - 210, - 285 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.072255, - 38.953879 - ], - "bearings": [ - 30, - 150, - 210, - 330 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.072175, - 38.953978 - ], - "bearings": [ - 30, - 90, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.071596, - 38.954691 - ], - "bearings": [ - 30, - 90, - 210, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.070644, - 38.955761 - ], - "bearings": [ - 30, - 75, - 210 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.070411, - 38.956033 - ], - "bearings": [ - 30, - 150, - 210, - 330 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.068461, - 38.958311 - ], - "bearings": [ - 30, - 210, - 285 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.067886, - 38.958983 - ], - "bearings": [ - 30, - 210, - 300 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.067541, - 38.959387 - ], - "bearings": [ - 30, - 135, - 210, - 315 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.066235, - 38.960913 - ], - "bearings": [ - 30, - 165, - 210, - 345 - ] - } - ], - "geometry": "{jahiArlo_rCeBqFi@}@m@w@o@q@s@m@w@g@sBwAc@U}@]i@OeD_AkGQgEOeGc@qAOqAuAoSoP_WqSwViSaMaKkFiEeJqHsEuD{D_DeMcKik@}d@wIeHgJsH}RaPaSePeJqHaCoBeH{FcG}EaN{KqHeGuEwDc[aW{FwEaBsAuC_CcIuGoQyNoI_Hcr@wj@{HmGeE_Dqk@ec@{aAoz@cBuA{L{JkmC{xB_i@}b@eFcEsAgAqAeA{K_JwAkAqAeAey@yp@}DiD}X}TsEuD", - "maneuver": { - "exit": 2, - "bearing_after": 60, - "location": [ - -77.078746, - 38.945982 - ], - "type": "rotary", - "bearing_before": 60, - "modifier": "straight", - "instruction": "Enter Tenley Circle Northwest and take the 2nd exit onto Nebraska Avenue Northwest" - }, - "duration": 244.89999999999992, - "distance": 2004.3, - "name": "Nebraska Avenue Northwest", - "rotary_name": "Tenley Circle Northwest", - "weight": 244.89999999999992, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.066144, - 38.961019 - ], - "bearings": [ - 30, - 90, - 210, - 270 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.063889, - 38.961016 - ], - "bearings": [ - 0, - 90, - 195, - 270 - ] - }, - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.062127, - 38.961016 - ], - "bearings": [ - 0, - 90, - 270 - ] - }, - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.060965, - 38.961016 - ], - "bearings": [ - 0, - 90, - 270 - ] - }, - { - "out": 1, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.059751, - 38.961018 - ], - "bearings": [ - 0, - 90, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.058748, - 38.961017 - ], - "bearings": [ - 90, - 180, - 270 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.057472, - 38.961014 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.056201, - 38.961013 - ], - "bearings": [ - 0, - 90, - 180, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.053117, - 38.961402 - ], - "bearings": [ - 60, - 75, - 255 - ] - }, - { - "out": 0, - "in": 2, - "lanes": [ - { - "valid": false, - "indications": [ - "left" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - }, - { - "valid": true, - "indications": [ - "none" - ] - } - ], - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.052682, - 38.961559 - ], - "bearings": [ - 60, - 195, - 240, - 345 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.044814, - 38.960642 - ], - "bearings": [ - 60, - 75, - 240 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.039042, - 38.963065 - ], - "bearings": [ - 90, - 105, - 270 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.033889, - 38.962069 - ], - "bearings": [ - 105, - 270, - 285 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - true - ], - "location": [ - -77.033421, - 38.962042 - ], - "bearings": [ - 0, - 105, - 180, - 285 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - false, - false - ], - "location": [ - -77.032001, - 38.961838 - ], - "bearings": [ - 105, - 210, - 285 - ] - }, - { - "out": 1, - "in": 3, - "entry": [ - true, - true, - true, - false - ], - "location": [ - -77.029694, - 38.961506 - ], - "bearings": [ - 0, - 105, - 180, - 285 - ] - }, - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false, - true - ], - "location": [ - -77.028546, - 38.961339 - ], - "bearings": [ - 105, - 180, - 285, - 345 - ] - } - ], - "geometry": "uv~hiA~xv~qC@g`@?c@@a`A@oh@?cmB?a@?qfAC{jAAiQBkk@Hmn@AwBAq[Ay@B{X?wr@vAuELeFMcLKaMOwJYgMc@qJa@oFu@qIkAgMq@aH}@sLgBqMoA{IiAaG}BgLsBkKyHeZiAiFeG}VwBkJwA}Hy@uHq@{G]cM?wM`@gJ`A{JbB{IvAkGhC}HxCkHfDuF~D{EtJgMbHaKfEgGzDuGpC{GbD}HdDkJpCgK|BgKjBqKvAwKlAkObAcOZaNTmKF{L?gMYcOaAwOy@wKsAgL{AwKqC}PyCqMqEkPqC{IiCqHmMkYuYcn@uImRyKoVoKcTeIaRaMeWmIcSgEwNeDaO_EyTmC_Wa@kHWqGUsDDySb@oOrA{P`BkPzEm^`Fc^~Ea^vFea@nFea@hFga@`D{WxCga@`A}MjAqPUuJvKwwAbBcTrPazBlIwfAxCo`@", - "duration": 376.5, - "distance": 3475.1, - "name": "Military Road Northwest", - "weight": 376.5, - "mode": "driving", - "maneuver": { - "bearing_after": 90, - "location": [ - -77.066144, - 38.961019 - ], - "type": "turn", - "bearing_before": 32, - "modifier": "right", - "instruction": "Turn right onto Military Road Northwest" - } - }, - { - "intersections": [ - { - "out": 0, - "in": 2, - "entry": [ - true, - true, - false - ], - "location": [ - -77.02801, - 38.961262 - ], - "bearings": [ - 0, - 180, - 285 - ] - }, - { - "out": 0, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.027996, - 38.961427 - ], - "bearings": [ - 0, - 180, - 285 - ] - } - ], - "maneuver": { - "bearing_after": 2, - "location": [ - -77.02801, - 38.961262 - ], - "type": "end of road", - "bearing_before": 99, - "modifier": "left", - "instruction": "Turn left onto Georgia Avenue Northwest (US 29)" - }, - "duration": 28.8, - "distance": 116, - "name": "Georgia Avenue Northwest (US 29)", - "geometry": "{e_iiAril|qCiI[aLe@yCK{c@_B", - "ref": "US 29", - "weight": 28.8, - "mode": "driving" - }, - { - "intersections": [ - { - "out": 2, - "in": 1, - "entry": [ - true, - false, - true - ], - "location": [ - -77.027923, - 38.962303 - ], - "bearings": [ - 0, - 180, - 270 - ] - } - ], - "geometry": "}faiiAddl|qCGbNCbE", - "duration": 13.1, - "distance": 29.4, - "name": "", - "weight": 52.8, - "mode": "driving", - "maneuver": { - "bearing_after": 270, - "location": [ - -77.027923, - 38.962303 - ], - "type": "turn", - "bearing_before": 2, - "modifier": "left", - "instruction": "Turn left" - } - }, - { - "intersections": [ - { - "in": 0, - "entry": [ - true - ], - "location": [ - -77.028263, - 38.962309 - ], - "bearings": [ - 92 - ] - } - ], - "geometry": "igaiiAlyl|qC", - "duration": 0, - "distance": 0, - "name": "", - "weight": 0, - "mode": "driving", - "maneuver": { - "bearing_after": 0, - "bearing_before": 272, - "type": "arrive", - "location": [ - -77.028263, - 38.962309 - ], - "instruction": "You have arrived at your destination" - } - } - ], - "weight": 1616.4, - "distance": 13585.5, - "annotation": { - "congestion": [ - "low", - "low", - "low", - "low", - "low", - "heavy", - "moderate", - "moderate", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "moderate", - "moderate", - "moderate", - "low", - "heavy", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "low", - "low", - "low", - "heavy", - "low", - "low", - "moderate", - "moderate", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "moderate", - "moderate", - "moderate", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "unknown", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "unknown", - "unknown", - "unknown", - "unknown", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "low", - "low", - "moderate", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "moderate", - "severe", - "moderate", - "low", - "low", - "moderate", - "low", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "moderate", - "moderate", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "moderate", - "moderate", - "moderate", - "low", - "moderate", - "moderate", - "low", - "low", - "low", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "low", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "moderate", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "moderate", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "heavy", - "low", - "heavy", - "moderate", - "moderate", - "moderate", - "moderate", - "heavy", - "moderate", - "heavy", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "moderate", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "heavy", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "low", - "moderate", - "moderate", - "heavy", - "heavy", - "low", - "heavy", - "low", - "low", - "low", - "heavy", - "unknown", - "unknown" - ] - }, - "summary": "Nebraska Avenue Northwest, Military Road Northwest", - "duration": 1578.7 - } - ], - "weight_name": "routability", - "geometry": "egb_iA~kr~qCj[{a@^qIxDTT_JkNy@iHs@i`@oB_FY__@sBcZaBkAGwBKJ{DxAkg@LmEb@}QTgEb@_DbAeDfAyApAiBdBqAz@}@|@yA|@}B^yAPeARoBDuBQ}De@_Ce@aBmA_CsAcBgAy@aAc@}Bm@_CO{FqAyAg@k@SwCuAeK}EoDaAwEw@_TkC{TqC{PsBkR_CuBW_KoAgOeBmJeA{BWmCaAuBu@iFcAyQyBcSaCqKqAuBWwERaBzVWtDq@lI{Fvt@}@bLW~C_ApLU~CcFjo@aBvS]jEiBrU_@zE]lEiAbQ{Ddh@YxEs@dLcB`HkApBiAp@_BT{AIoA_@eAy@gAoAsKcOsB}E_IgTkNaa@eF{N}CiHmC{DcDyCgD}AgMmFkGkCmKwE}A]wEMiClEgK|OcE|FwLzP}Tn[if@lp@kWr^guA|nB{RzXmJxMocA|wAoyAnzBwNdS_KlN_K`MyDnEmZv]gTtVcTpVqEhFaGxGuW|YgD|DiGhHuWtZuJbL_AjAm_@|b@wZd]mJtK_`@tc@cJ`KORed@vg@_OnPgH`ImXvZaBhBuEhFiPvQ}UlWcXrYkJnK}MbOqLhNsZb_@yPxV}OpV}X`g@sj@`cAwjAdrB_t@dmAgPhXgRhYeCvDsHbL}PlWUcKaJcUuF_LiIiOwImKoIiJuMqJi[cNsFeC}HgEug@mU_Hb@uCmFoPqFy@SwFuAsCs@mKgByPiA}CQgHMi]h@}VPki@h@{LLsb@d@eVH_PDwK^kMb@oGMuDgAcMcDkOaFmPeFsPcFyUqEiFwA{IO{]u@sPW_GEsa@VyVGoTe@yNi@{M{AkMwCoW{Goc@yOsWiJ}TkLmJwEwGiE_UyPoU}Rm[{VeTgOyOyK{`@uYiUyScjCyqBo[{UiBsAkl@uc@{EkDaxA}hAew@ml@iTqPg{C{sBgRaMk|C}mBe_CcwAoOyJotAuu@sJeEqWaJk\\uI}ZwGu[uCimAwN_h@kImTaHqLkEoPmJwK_HyVoVePcUyKyVkNo_@gPsm@{a@uyAaMa\\wNe`@gJaQmNmPwJuJ}HaGod@qY_gA_u@{KiHeOmKktAu`Awm@o_@yj@o\\yo@yZaa@mMeYmKci@_P_[sI{bAcOqr@sGyVgC}QWqGwB{D_CeBgCmAwCYaFl@mDhEsJrFyJvGsN~IuT|BvH`]rv@nCpHPfCDbEYvB}n@lv@aMbQmQhXucAljAur@ts@uw@vp@aUlSu[tW}\\|Vmb@nZiWbQcd@pXy]vQ}JbFiY|NmaAjh@asAbo@y@f@sGbEeHlEqJhHyCzBaC~BmIfJ{SbUuPj[wF~FmF`FqD~BoGzCuFtB}NpDoKb@mq@fBoPR{S?iRuBs_@aIsNuByKT{Gt@{GhBsQ`J_h@x\\yEdDwLxJw@zAgEjIeKxToCnGkArDeGhOgDzKoAhHgBjL]fDkAxK[|Eg@bICfCR~IF`F^hO\\`Ft@dHZbDfB|PXfDnAbL^hFrAjRv@hQX~FRtDt@zP`@xLTlF`@dFtDpe@bBhTJvA^lEfEni@vCx`@pArRb@`FTzEz@tItApQj@vHnD~TpB|MdAbHmCTwD\\sE`@y@H_P|@sf@rCkEVga@xBwCTkF^oeAbH}APaKPeC?eCs@wBgBwByCgBiCmGmTqKgg@{Fkb@aFyo@uAmV}@cTUwo@jBc|@RcFlAaYf@cMf@sLPsDHmEF{CZkOv@{_@^mNFwAdAm\\sHYkd@_B{CAkA?oCAkE?{I?mMIqFd@wDh@sEjA{Fr@{ERgNqBoyDywAwX}Jw[mLiUcHeCaAuQqFHzHN~MJtVRj\\DrO?pB}@bOS~CEvNEzEGpAw@lT_BhSkE~[eDlWuCze@sC|_@[~Hk@|MSdNDzX^pc@KtI?vGQjJ}AnVgDlYmIfj@}I|h@aAlPCbUBdAd@xUPnIjAnXOlRoAtRm@`CYz@k@bBkArCg@fAi@dAk@bAm@`A_B|BiH|G}CdCuBxAkCxByKtHmBpAeDbCoCdByBbBoDbC{RtMuMzIor@vd@iCfBe@X_SzMgTpNiDxB_N~IeJfGmQxLaVpOeK~Go_Arn@{CrBqMpIu@f@yB|Au@d@}@ZwE~@eBVuFr@gP|DqH|ASBcB\\_ANiARqCr@{JfDoCxA{CnBqCnBqEvDcA~@cCfCaKdLuQdTgHxJeFhIcEnHwD`IsFtLyFdPoBpFeCtFwClFkC|D_EhFaD|DgChCwDfD_EbDsCrBuAz@oDpBeD`BcEbBgGtBuA`@oD|@oDr@eBVeD`@cBH{DNyAB{Xz@wF^eDNqADyFFmG?{AA}A?mPKoFC_ICqB?_MGiBC_IEi\\]kc@I_QNuAHiDRyF`AyBl@iJ~Cub@xMcN~Dw@RcCl@{Dz@}Dv@}AX}GbAkNvBoV|DoGfAuDp@mG~@sSpCyCZeBNgTpAoM|@oMp@wMt@s`@`CqObAsCTuo@xDaCNc`@`Cae@zCqG^wD\\m@D{APk@Jm@Hu@NqAXwA`@}O`EuI`CwHrB_B`@aB^o@PcE~@o@Pm@Lk@Nm@Lk@NuDv@m@Jk@LuJdBkF`AsB\\gCd@kHnAuP~CeEr@u@JgDh@oIhAoN`Bu@JmBRk@DyBLoBFkv@@iCAwaACgK?eN@oK?sHDwAoEa@eAi@oAy@wB_@{@aAqBeAoBqCiEmCaEge@{q@}V}_@mGmIuIaMeD_FoMiR_DsE{AwBm@y@]c@wBcCgDaDgRoOgCsBuYwUcCqBuIgHoLuJkKcIs@i@aNgL{QcOsEiDCiGuAeFmBuD}CiEwCkC_Bk@oC}@mFu@cBTkCbC}KuIgYaU_\\aXmNiL}AqAeCqB}PmN}MuK_Au@eFeE_ScPiAaAgEgD_CqBeScPyFuEgScPyM{KoO_MwJeI}CeCkFiEyTuQiQqNyIiHyUcRm`@y[eG}EeYiUaFaE{GyF_L{I}KaJcI{GiEqDgAw@oF{J_DiK{@mCeBqFi@}@m@w@o@q@s@m@w@g@sBwAc@U}@]i@OeD_AkGQgEOeGc@qAOqAuAoSoP_WqSwViSaMaKkFiEeJqHsEuD{D_DeMcKik@}d@wIeHgJsH}RaPaSePeJqHaCoBeH{FcG}EaN{KqHeGuEwDc[aW{FwEaBsAuC_CcIuGoQyNoI_Hcr@wj@{HmGeE_Dqk@ec@{aAoz@cBuA{L{JkmC{xB_i@}b@eFcEsAgAqAeA{K_JwAkAqAeAey@yp@}DiD}X}TsEuD@g`@?c@@a`A@oh@?cmB?a@?qfAC{jAAiQBkk@Hmn@AwBAq[Ay@B{X?wr@vAuELeFMcLKaMOwJYgMc@qJa@oFu@qIkAgMq@aH}@sLgBqMoA{IiAaG}BgLsBkKyHeZiAiFeG}VwBkJwA}Hy@uHq@{G]cM?wM`@gJ`A{JbB{IvAkGhC}HxCkHfDuF~D{EtJgMbHaKfEgGzDuGpC{GbD}HdDkJpCgK|BgKjBqKvAwKlAkObAcOZaNTmKF{L?gMYcOaAwOy@wKsAgL{AwKqC}PyCqMqEkPqC{IiCqHmMkYuYcn@uImRyKoVoKcTeIaRaMeWmIcSgEwNeDaO_EyTmC_Wa@kHWqGUsDDySb@oOrA{P`BkPzEm^`Fc^~Ea^vFea@nFea@hFga@`D{WxCga@`A}MjAqPUuJvKwwAbBcTrPazBlIwfAxCo`@iI[aLe@yCK{c@_BGbNCbE", - "weight": 3046.4, - "distance": 28457.1, - "duration": 2858.1000000000004 - } - ], - "code": "Ok" -} diff --git a/libandroid-navigation/src/test/resources/directions_two_leg_route_with_distances.json b/libandroid-navigation/src/test/resources/directions_two_leg_route_with_distances.json deleted file mode 100644 index fd99705e..00000000 --- a/libandroid-navigation/src/test/resources/directions_two_leg_route_with_distances.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"weight_name":"auto","weight":33.207,"duration":27.475,"distance":183.091,"legs":[{"via_waypoints":[],"annotation":{"speed":[7.8,7.9,8.3],"distance":[50.8,21.3,20],"duration":[6.505,2.719,2.405]},"admins":[{"iso_3166_1_alpha3":"USA","iso_3166_1":"US"}],"weight":13.924,"duration":11.629,"steps":[{"bannerInstructions":[{"primary":{"components":[{"type":"text","text":"You will arrive at your destination"}],"type":"arrive","modifier":"straight","text":"You will arrive at your destination"},"distanceAlongGeometry":92.111},{"primary":{"components":[{"type":"text","text":"You have arrived at your destination"}],"type":"arrive","modifier":"straight","text":"You have arrived at your destination"},"distanceAlongGeometry":55.556}],"voiceInstructions":[{"ssmlAnnouncement":"Drive east on South Orange Avenue, County Route 5 10. Then, in 300 feet, You will arrive at your destination.","announcement":"Drive east on South Orange Avenue, County Route 5 10. Then, in 300 feet, You will arrive at your destination.","distanceAlongGeometry":92.111}],"intersections":[{"entry":[true],"bearings":[90],"duration":6.505,"traffic_signal":true,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":0,"weight":7.806,"geometry_index":0,"location":[-74.220588,40.745062]},{"entry":[true,true,false],"in":2,"bearings":[23,89,270],"duration":2.719,"turn_duration":0.019,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":1,"weight":3.24,"geometry_index":1,"location":[-74.219986,40.745065]},{"bearings":[89,197,269],"entry":[true,true,false],"in":2,"turn_duration":0.007,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":0,"geometry_index":2,"location":[-74.219733,40.745067]}],"maneuver":{"type":"depart","instruction":"Drive east on South Orange Avenue/CR 510.","bearing_after":90,"bearing_before":0,"location":[-74.220588,40.745062]},"name":"South Orange Avenue","duration":11.629,"distance":92.111,"driving_side":"right","weight":13.924,"mode":"driving","ref":"CR 510","geometry":"ke{ulAvaaqlCEsd@CyNCyM"},{"bannerInstructions":[],"voiceInstructions":[],"intersections":[{"bearings":[269],"entry":[true],"in":0,"admin_index":0,"geometry_index":3,"location":[-74.219496,40.745069]}],"maneuver":{"type":"arrive","instruction":"You have arrived at your destination.","bearing_after":0,"bearing_before":89,"location":[-74.219496,40.745069]},"name":"South Orange Avenue","duration":0,"distance":0,"driving_side":"right","weight":0,"mode":"driving","ref":"CR 510","geometry":"ye{ulAn}~plC??"}],"distance":92.111,"summary":"South Orange Avenue"},{"via_waypoints":[],"annotation":{"speed":[8.4,7.4,5.6,4.2],"distance":[29.4,13.8,16.2,31.6],"duration":[3.482,1.874,2.887,7.603]},"admins":[{"iso_3166_1_alpha3":"USA","iso_3166_1":"US"}],"weight":19.283,"duration":15.846,"steps":[{"bannerInstructions":[{"primary":{"components":[{"type":"text","text":"Your destination will be on the right"}],"type":"arrive","modifier":"right","text":"Your destination will be on the right"},"distanceAlongGeometry":90.98},{"primary":{"components":[{"type":"text","text":"Your destination is on the right"}],"type":"arrive","modifier":"right","text":"Your destination is on the right"},"distanceAlongGeometry":55.556}],"voiceInstructions":[{"ssmlAnnouncement":"Drive east on South Orange Avenue, County Route 5 10. Then, in 300 feet, Your destination will be on the right.","announcement":"Drive east on South Orange Avenue, County Route 5 10. Then, in 300 feet, Your destination will be on the right.","distanceAlongGeometry":90.98}],"intersections":[{"entry":[true],"bearings":[89],"duration":3.482,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":0,"weight":4.178,"geometry_index":0,"location":[-74.219496,40.745069]},{"entry":[true,true,false],"in":2,"bearings":[90,183,269],"duration":1.874,"turn_duration":0.007,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":0,"weight":2.287,"geometry_index":1,"location":[-74.219148,40.745071]},{"entry":[true,true,false],"in":2,"bearings":[24,90,270],"duration":2.887,"turn_duration":0.007,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":1,"weight":3.528,"geometry_index":2,"location":[-74.218984,40.745072]},{"bearings":[89,197,270],"entry":[true,false,false],"in":2,"turn_duration":0.019,"mapbox_streets_v8":{"class":"primary"},"is_urban":true,"admin_index":0,"out":0,"geometry_index":3,"location":[-74.218792,40.745073]}],"maneuver":{"type":"depart","instruction":"Drive east on South Orange Avenue/CR 510.","bearing_after":89,"bearing_before":0,"location":[-74.219496,40.745069]},"name":"South Orange Avenue","duration":15.846,"distance":90.98,"driving_side":"right","weight":19.283,"mode":"driving","ref":"CR 510","geometry":"ye{ulAn}~plCCwTAgIA_KEmV"},{"bannerInstructions":[],"voiceInstructions":[],"intersections":[{"bearings":[269],"entry":[true],"in":0,"admin_index":0,"geometry_index":4,"location":[-74.218417,40.745076]}],"maneuver":{"type":"arrive","instruction":"Your destination is on the right.","modifier":"right","bearing_after":0,"bearing_before":89,"location":[-74.218417,40.745076]},"name":"South Orange Avenue","duration":0,"distance":0,"driving_side":"right","weight":0,"mode":"driving","ref":"CR 510","geometry":"gf{ulA`z|plC??"}],"distance":90.98,"summary":"South Orange Avenue"}],"geometry":"ke{ulAvaaqlCEsd@CyNCyMCwTAgIA_KEmV","voiceLocale":"en-US"}],"waypoints":[{"distance":1.949,"name":"South Orange Avenue","location":[-74.220588,40.745062]},{"distance":0.514,"name":"South Orange Avenue","location":[-74.219496,40.745069]},{"distance":3.286,"name":"South Orange Avenue","location":[-74.218417,40.745076]}],"code":"Ok","uuid":"Rcua0Z2onGGvltk683mcg0F0YDvNIEbkaIdB-TS8pFok6GvgwYEnGg=="} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/directions_v5.json b/libandroid-navigation/src/test/resources/directions_v5.json deleted file mode 100644 index 4665a101..00000000 --- a/libandroid-navigation/src/test/resources/directions_v5.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"mqreFhodjVjBjYjuAoK~HurAv}AuNnwAv^jqJoyBbyClsB~cGsfAxvCkjFpPcnDjaPg_QnbBwtJ~yDa~HlmDuyD|~AebDd{E_wZzqDwbD~gAqM","legs":[{"summary":"Bayshore Freeway, Bayshore Freeway","weight":3999.4,"duration":3713.3,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[261],"location":[-122.416686,37.783425]},{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.417548,37.783315]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.419192,37.783106]}],"driving_side":"right","geometry":"mqreFhodjVTjDFn@`@vGN~BHfABXHvA","mode":"driving","maneuver":{"bearing_after":261,"bearing_before":0,"location":[-122.416686,37.783425],"modifier":"left","type":"depart","instruction":"Head west on Eddy Street"},"weight":217.4,"duration":193,"name":"Eddy Street","distance":362.7},{"intersections":[{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.42076,37.782907]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.42091,37.782888]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.420722,37.781954]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.420534,37.781023]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[90,165,255,345],"location":[-122.420342,37.780077]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419972,37.778242]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419782,37.777295]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419594,37.776367]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,255,345],"location":[-122.419398,37.775431]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[45,165,225,345],"location":[-122.41935,37.775193]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[45,165,225,345],"location":[-122.419314,37.775061]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,210,345],"location":[-122.418875,37.773667]},{"out":1,"in":4,"entry":[false,true,true,false,false],"bearings":[45,165,225,315,345],"location":[-122.418702,37.773081]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[30,165,210,345],"location":[-122.418631,37.772842]},{"out":0,"in":2,"entry":[true,false,false],"bearings":[165,270,345],"location":[-122.418498,37.772399]},{"out":1,"in":2,"entry":[true,true,false],"bearings":[75,165,345],"location":[-122.41845,37.772238]},{"out":1,"in":2,"entry":[false,true,false],"bearings":[120,165,345],"location":[-122.418146,37.771238]},{"out":1,"in":2,"entry":[true,true,false],"bearings":[135,165,345],"location":[-122.418096,37.771089]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,270,345],"location":[-122.418033,37.770901]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[0,195,210,270],"location":[-122.417742,37.770207]},{"out":2,"in":0,"entry":[false,false,true,false],"bearings":[15,105,195,285],"location":[-122.417803,37.769889]},{"out":2,"in":0,"entry":[false,true,true,false],"bearings":[15,105,180,285],"location":[-122.417834,37.769712]}],"driving_side":"right","geometry":"enreFvhejVB\\RChAMlAONCLAzAS|@KPCLA`BSx@KPC^EvC]zAQz@M^EPChDa@pBUp@ITE|AQxASB?^ENCJCFADATAZIVEjEcAtBc@n@MvAY^IfE{@\\IRGPEf@ORMPOLIHCJ?P@D?~@Jb@D^Bt@H","mode":"driving","maneuver":{"bearing_after":260,"bearing_before":260,"location":[-122.42076,37.782907],"modifier":"left","type":"turn","instruction":"Turn left onto Van Ness Avenue (US 101 South)"},"ref":"US 101 South","weight":479.7,"duration":307.1,"name":"Van Ness Avenue (US 101 South)","distance":1559.1},{"distance":379.8,"name":"US 101 South","ref":"US 101 South","maneuver":{"bearing_after":201,"bearing_before":187,"location":[-122.417903,37.769281],"modifier":"straight","type":"off ramp","instruction":"Take the ramp towards US 101 South: Oakland"},"destinations":"US 101 South, I-80 East: Oakland, San Jose","weight":49,"mode":"driving","geometry":"_yoeFzvdjVXLLJLJHNFPDT?TARCRGPILKLMHMBMBM?KCMEKGIIIKGOEQCQ?Q?U@SFu@Dc@B]Fw@Bo@Bk@Io@","intersections":[{"classes":["motorway"],"out":2,"in":0,"entry":[false,true,true,false],"bearings":[0,180,195,345],"location":[-122.417903,37.769281]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false],"bearings":[15,180],"location":[-122.419,37.769346]}],"duration":42.2,"driving_side":"right"},{"intersections":[{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[90,255,285],"location":[-122.416662,37.769596]},{"classes":["motorway"],"out":1,"in":2,"entry":[true,true,false],"bearings":[102,108,282],"location":[-122.40981,37.769161]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[174,353,358],"location":[-122.405473,37.767261]},{"classes":["motorway"],"out":1,"in":2,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.405244,37.766048]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[0,180,195],"location":[-122.402999,37.752554]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[0,15,195],"location":[-122.404558,37.746941]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[7,180,187],"location":[-122.408143,37.739469]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[155,332,335],"location":[-122.406401,37.734438]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[150,180,330],"location":[-122.405674,37.733191]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[165,330,345],"location":[-122.403995,37.730114]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[163,341,346],"location":[-122.402483,37.726603]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[163,168,343],"location":[-122.401701,37.724557]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.400278,37.720955]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.397974,37.714805]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.39554,37.710237]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false],"bearings":[165,345],"location":[-122.395121,37.708328]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[170,347,350],"location":[-122.393825,37.702429]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.391826,37.693636]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[170,345,350],"location":[-122.3906,37.688244]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[30,210,225],"location":[-122.392891,37.669787]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[30,210,225],"location":[-122.395051,37.667539]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[46,50,231],"location":[-122.39982,37.663398]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[30,45,210],"location":[-122.403926,37.660623]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[15,195,210],"location":[-122.405731,37.65805]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[176,181,356],"location":[-122.406979,37.651445]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.406419,37.64457]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[0,165,195],"location":[-122.406082,37.641332]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[150,165,345],"location":[-122.405024,37.63824]},{"classes":["motorway"],"out":1,"in":2,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.402719,37.630324]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[166,341,345],"location":[-122.401464,37.62492]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[162,342,345],"location":[-122.398689,37.616736]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.394473,37.611514]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[128,308,309],"location":[-122.391675,37.609715]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[129,134,309],"location":[-122.384799,37.605291]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.378646,37.601292]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.376557,37.599922]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[130,136,309],"location":[-122.364079,37.591793]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,285,300],"location":[-122.357438,37.587965]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.325833,37.581641]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[139,314,319],"location":[-122.322934,37.578971]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.316743,37.573261]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[139,316,319],"location":[-122.310821,37.567812]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.302578,37.560185]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.293655,37.550567]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.293005,37.549875]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.292169,37.548986]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[144,149,324],"location":[-122.291949,37.548743]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.286169,37.542512]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.283856,37.53998]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.273979,37.529546]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,313,318],"location":[-122.262626,37.51954]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[138,141,318],"location":[-122.260906,37.518025]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,314,318],"location":[-122.247718,37.506343]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,315,318],"location":[-122.242977,37.502159]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[137,142,317],"location":[-122.239937,37.499488]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,284,290],"location":[-122.231907,37.495907]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,283,290],"location":[-122.228972,37.495072]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.218915,37.491223]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.205884,37.487457]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[107,110,285],"location":[-122.185632,37.484733]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[120,285,300],"location":[-122.179679,37.482856]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[126,302,307],"location":[-122.177095,37.481497]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.155045,37.468654]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[126,305,307],"location":[-122.152581,37.467179]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.144516,37.462442]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[126,304,306],"location":[-122.136462,37.457738]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[131,141,308],"location":[-122.12693,37.452112]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[140,317,320],"location":[-122.118132,37.444081]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.103307,37.429953]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.101751,37.428459]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.092643,37.42097]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.09244,37.420823]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[133,309,312],"location":[-122.089184,37.418478]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[120,285,300],"location":[-122.081848,37.413404]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.081263,37.413111]},{"classes":["motorway"],"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["right"]}],"out":1,"in":2,"entry":[true,true,false],"bearings":[105,120,300],"location":[-122.078361,37.411892]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[118,124,297],"location":[-122.076323,37.411054]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.067607,37.407809]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,110,286],"location":[-122.067189,37.407713]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.063708,37.406961]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.056615,37.405407]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.047017,37.403049]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.036066,37.400658]},{"classes":["motorway"],"out":0,"in":3,"entry":[true,true,false,false],"bearings":[105,120,270,285],"location":[-122.03242,37.39989]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,279,286],"location":[-122.027075,37.398693]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,280,285],"location":[-122.024811,37.398202]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,111,285],"location":[-122.017288,37.396552]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.012976,37.395607]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.012709,37.395542]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[107,280,285],"location":[-122.008838,37.394702]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.000135,37.392318]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[111,284,291],"location":[-121.994151,37.390522]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,282,290],"location":[-121.991164,37.389654]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.983628,37.387548]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,287,290],"location":[-121.974838,37.385032]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.972437,37.384341]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.969543,37.383509]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,284,290],"location":[-121.957291,37.380021]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.945834,37.377446]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.941787,37.376663]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.941403,37.376591]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.939052,37.376128]}],"driving_side":"right","geometry":"_{oeFbodjVBm@Bm@@oABqANaR@a@?c@@a@@a@@_@Bc@B]Ba@Dc@De@XaDb@oCHg@Fg@Fk@Bc@Be@Bi@Bk@Fi@Fi@Hg@La@J]JYL]HQHOHQHMLSLQPSPQTOVMNGNE\\GJAtBOj@GnAUhGWd@C^?f@@d@@f@Dd@Fb@Ff@J`@Ld@P`@Pb@R`@T~Az@\\P^P^L^J^H^D^D^@`@@`@C`@Cb@Gb@Ib@O^O`@S^U`@Y^_@\\]Zc@Zc@Xc@p@eAV_@Xa@V[V[XUXWZSZQ`@S`@M^Kb@Ib@Gf@Ed@Cd@CbLg@r@Ct@Ap@An@@r@Dp@Ft@Hj@Jj@JzFnA`IdB~FnAtH`Bp@Nt@Rn@Vl@Xn@\\j@^l@b@nElDVRVPn@b@p@^n@Zp@Xt@Vn@Px@Nr@Lv@Jv@FfAFr@Br@At@Ar@Ct@El@Ir@Kr@Mt@Qp@Ql@Sj@Sn@Wt@]b@SlAm@tDiBtAq@bD_BtC}Az@c@|@a@jAg@x@]dAa@bBo@f@QrAg@jAa@lA]nEyA^K~EaBjFyAjDaArBm@rAa@dHyBdBe@zBk@v@Sx@Q|Du@lCc@f@KvGmAl@Mp@Op@Sn@UfAc@r@]n@]n@c@p@g@fAw@~CgCVQTOj@]j@[j@[l@Yh@Up@Ul@Sp@Op@On@KfAObBWnC_@nBWfBUTEdEi@`IcArSsC|u@oKv`@uFze@{GhC_@pDk@pASnAQfAMjAIx@C~@?z@?`AB`AF`AL~@Nv@L|@TdAZ`A\\v@X|@Zx@\\|@\\x@\\LFvBbA`Af@l@\\n@\\j@\\l@^j@^l@`@j@`@j@b@h@`@l@d@h@b@h@d@h@d@p@l@`MnLdD~ChBdBf@f@f@d@f@h@f@h@j@n@b@h@d@l@d@n@`@j@b@n@`@n@`@p@b@r@^p@`@t@hJrP^r@d@t@d@n@d@p@n@t@h@j@l@j@r@j@j@b@l@`@j@Zn@\\n@Xp@X|An@vF~Bp@Vr@Vr@Rr@Pt@Nv@Nn@Hr@Fn@Fr@Dp@@p@@v@?r@At@CtESnAEfGW~@CrDO`AE`X}@bNk@bDWf@EpAQ~AYtAY~@WhA]rAe@zAk@~GyClAc@`A[bA]z@Ux@U~@S`AS~@ObAM`AMbAI`BKzDUzGg@nG]pAKvAQzASfASjAWtEeAnCs@f@EvAYjQkEfGyAzOuDbCi@VIfAYpAc@vAk@pAm@vAw@jAu@rAcAjAcAbA{@hAkA~@gAbAoAzB}CdJmPdHuMzAcC|CgFtI}OxJiQdLcSpGaLvCgF`FuInDkGvTk`@zCwFlAwBlCyEnKcRz@_Bx@{Ax@cBt@gBl@gBl@kBh@oBbAeF^oCXiCNeBLsBH_CB}B@{BHmJXg]NcTPsTRmUDeDH{BJqATiBZeBb@gBh@eBp@_Br@qAv@kAx@aAlCyChNuOtOcQ|OiQvQkSzEmFdZq\\`SuTnScUhBsBxA_B\\a@fAgAhAcApAkA~GwFbByAvCmChD_DdB{AlBkBjDgDvAqA|AwAbLeKhCaCpDgDp@k@hP_OlEcEbCyB`JeIhBcBn@k@p@m@xDeDrBiBfLiKzUcT|@y@`KcJdA_AbAaAlAkAdAgA~@cAbAiA~@gApCeDbQsStPaS`IkJHKX]~IkKnB}B|DyEfGgHpA_BtBcCjHsIlByBdIqJvIeK|DqEzQiTnFoGvFyGzIiKfGgHvCmDtBiCv@aAv@aAr@eAr@kAl@iAl@oAN[JUTi@j@_Bb@qA`@qA^{AZwAZwAzCiPfDkQv@gEZcB\\gBXqAXoAXmAd@iB\\sAb@{A`@wAb@wAd@sAd@yAfI}U|CcJd@wAd@wAb@wA`@yARu@Lc@Nm@Nk@^{AXqAZwA\\cBRcAX_BV{AV_BT_BT}ARaBP_BP_BNaBLaBh@gIzJ__BLaBJgBLaBLaBNaBN_BP_BRaBR}ATaBRwAV}AV}AX_BX{AZ{AZ}A\\{A^{A^yA^wAb@yAb@wAf@uAf@uAh@sAj@sAl@oAl@oALOjTgd@~CuGdK}SdXwi@hCgFfK}SpGyMRShSya@hHqNpIiQ|NcZzA}C|]us@Xm@v@yAt@sA~@}Af@u@t@gAv@eAx@aAz@aAdSgTbIqInH_IzDeEfRgS`@a@rQoR`]q^X[rKeL|BeCjDqDdKyKnAsAnAuAjAsAfAsAnA_BhA}AxAwBxA}BpM}R\\g@tGcK|DgGtKkP~HyLd@s@^m@^s@p@kAn@oAl@qAj@oAf@sAPa@|@mCnCyId@{AfDwK`CyHtHwVV_AXcAVaATaATaATgAN{@PaANaAPiARsAh@kEjBkNtDaY~BgQ^gC`@kCd@iCrB{Kl@qD^aC\\eCZ}BrBmOtJot@n@}Ev@_GxCyUnE}[^mC`BeMhI_n@zD}YLu@fDeWdAaH|C{PvFmZhBqJ`BwHzCcO^mB~@wElAoGn@gDbAoFxA_ItEiW|Iie@xCsOhC_NdDcQl@}CN_ApFkYrF{YtCkOjB{JfA{GpBqOpBmPhB{O|CgXLmAzAuMjCaUh@eEX_CZyBj@uD\\_C","mode":"driving","maneuver":{"bearing_after":94,"bearing_before":73,"location":[-122.416662,37.769596],"modifier":"slight left","type":"merge","instruction":"Merge left onto US 101 South"},"ref":"US 101 South","weight":2842.4,"duration":2831.4,"name":"Central Freeway (US 101 South)","distance":70046.4},{"distance":4798.2,"name":"","maneuver":{"bearing_after":112,"bearing_before":106,"location":[-121.931731,37.374579],"modifier":"slight right","type":"off ramp","instruction":"Take exit 390 towards CA 87 South: Guadalupe Parkway"},"destinations":"CA 87 South: Guadalupe Parkway","exits":"390","intersections":[{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.931731,37.374579]},{"classes":["motorway"],"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,300,330],"location":[-121.926597,37.37012]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[128,138,308],"location":[-121.923722,37.367884]},{"classes":["motorway"],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[0,150,180,330],"location":[-121.918933,37.364245]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-121.915678,37.359877]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,330],"location":[-121.908322,37.349121]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,330,345],"location":[-121.901664,37.343143]}],"duration":192.39999999999998,"driving_side":"right","weight":206.7,"mode":"driving","geometry":"cvbcFhxegV~@{DTkA~@mEh@eBZq@Zi@~@kAj@k@j@_@VMVK^M\\IzCw@pA_@p@U`Aa@ZOp@c@d@_@Z[f@g@`@i@j@y@NYf@{@jAyBpAcCpFmKr@qAv@mA|@oA~@mAhAoAbAcAtAkATQFEz@o@nAy@tUyOlM{IvE_DpGkE|ByA~CkBxBeAzCuAhIqDl@Yl@]t@e@r@g@jB}AlB_Cd@s@b@s@d@{@b@_A`@eA`AeCbA_Cv@uAx@kAp@}@p@y@r@q@r@o@f@_@f@]`@Uf@[|@c@dBq@dCaA~As@`Ag@`@UdGsD"},{"distance":508.9,"name":"","maneuver":{"bearing_after":171,"bearing_before":150,"location":[-121.900192,37.340845],"modifier":"slight right","type":"off ramp","instruction":"Take exit 6B towards Julian Street"},"destinations":"Julian Street, Saint James Street","exits":"6B","intersections":[{"classes":["motorway"],"out":1,"in":2,"entry":[true,true,false],"bearings":[150,165,330],"location":[-121.900192,37.340845]}],"duration":44.8,"driving_side":"right","weight":57,"mode":"driving","geometry":"ic|bFds_gV^C|CmBl@[bDyAVKZI^Gh@?`@Br@NPBf@HXBT?^EXId@QVKTI"},{"intersections":[{"lanes":[{"valid":true,"indications":["left"]},{"valid":true,"indications":["straight","left"]},{"valid":false,"indications":["right"]}],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[60,150,240,345],"location":[-121.898785,37.336552]},{"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight","left"]},{"valid":false,"indications":["right"]}],"out":1,"in":3,"entry":[true,true,false,false],"bearings":[60,165,240,330],"location":[-121.898691,37.336402]}],"driving_side":"right","geometry":"mh{bFlj_gV\\SRIdAw@bBoARU","mode":"driving","maneuver":{"bearing_after":153,"bearing_before":158,"location":[-121.898785,37.336552],"modifier":"straight","type":"new name","instruction":"Continue onto North Almaden Boulevard"},"weight":75.1,"pronunciation":"ˈnoɹθ ˈɔlmədən ˈbʊləvɑɹd","duration":43.5,"name":"North Almaden Boulevard","distance":157.5},{"intersections":[{"out":1,"in":2,"entry":[true,true,false],"bearings":[105,240,315],"location":[-121.897852,37.335352]}],"driving_side":"right","geometry":"}`{bFpd_gVLVx@tBPd@Vr@DLb@lALb@`AdCJV","mode":"driving","maneuver":{"bearing_after":236,"bearing_before":136,"location":[-121.897852,37.335352],"modifier":"right","type":"turn","instruction":"Turn right onto West Saint John Street"},"weight":56.9,"duration":43.7,"name":"West Saint John Street","distance":267.1},{"intersections":[{"out":1,"in":0,"entry":[false,true,true,true],"bearings":[60,165,240,315],"location":[-121.900438,37.334113]}],"driving_side":"right","geometry":"eyzbFvt_gVVCVGlBG","mode":"driving","maneuver":{"bearing_after":171,"bearing_before":237,"location":[-121.900438,37.334113],"modifier":"left","type":"turn","instruction":"Turn left onto North Autumn Street"},"weight":15.2,"duration":15.2,"name":"North Autumn Street","distance":89.1},{"intersections":[{"in":0,"entry":[true],"bearings":[357],"location":[-121.90034,37.333317]}],"driving_side":"right","geometry":"gtzbFbt_gV","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":177,"location":[-121.90034,37.333317],"modifier":"left","type":"arrive","instruction":"You have arrived at your destination, on the left"},"weight":0,"duration":0,"name":"North Autumn Street","distance":0}],"distance":78168.7}],"weight_name":"routability","weight":3999.4,"duration":3713.3,"distance":78168.7}],"waypoints":[{"name":"Eddy Street","location":[-122.416686,37.783425]},{"name":"North Autumn Street","location":[-121.90034,37.333317]}],"code":"Ok","uuid":"cjhs6f4ez21393jnt0pjdmcl6"} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/directions_v5_no_voice.json b/libandroid-navigation/src/test/resources/directions_v5_no_voice.json deleted file mode 100644 index 23b52535..00000000 --- a/libandroid-navigation/src/test/resources/directions_v5_no_voice.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"y}geiAz`x|qCCoVoeAF?lz@cuC_@Ach@|MPvFpB","legs":[{"summary":"15th Street Northwest, 15th Street NW","weight":452.4,"duration":257.9,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[90],"location":[-77.034014,38.900205]}],"driving_side":"right","geometry":"y}geiAz`x|qCA{MAsG","mode":"driving","maneuver":{"bearing_after":90,"bearing_before":0,"location":[-77.034014,38.900205],"modifier":"right","type":"depart","instruction":"Head east on H Street Northwest"},"weight":60,"duration":15.7,"name":"H Street Northwest","distance":32.5},{"intersections":[{"out":0,"in":3,"entry":[true,true,true,false],"bearings":[0,90,180,270],"location":[-77.033638,38.900207]}],"driving_side":"right","geometry":"}}geiAjiw|qCiF?kVBqB?u\\BqE?","mode":"driving","maneuver":{"bearing_after":358,"bearing_before":88,"location":[-77.033638,38.900207],"modifier":"left","type":"turn","instruction":"Turn left onto 15th Street Northwest"},"weight":97.8,"duration":53.4,"name":"15th Street Northwest","distance":125.5},{"intersections":[{"out":3,"in":2,"entry":[true,false,false,true],"bearings":[0,90,180,270],"location":[-77.033642,38.901335]}],"driving_side":"right","geometry":"mdjeiAriw|qC?zE?~k@?pF","mode":"driving","maneuver":{"bearing_after":270,"bearing_before":358,"location":[-77.033642,38.901335],"modifier":"left","type":"turn","instruction":"Turn left onto I Street Northwest"},"weight":50.2,"duration":25.2,"name":"I Street Northwest","distance":82.3},{"intersections":[{"out":0,"in":1,"entry":[true,false,true,true],"bearings":[0,90,180,270],"location":[-77.034593,38.901335]},{"out":0,"in":1,"entry":[true,false],"bearings":[0,180],"location":[-77.034583,38.902102]},{"out":0,"in":1,"entry":[true,false,false],"bearings":[0,180,270],"location":[-77.03458,38.902416]},{"out":0,"in":2,"entry":[true,true,false,true],"bearings":[0,90,180,270],"location":[-77.034578,38.902523]},{"out":0,"in":2,"entry":[true,false,false,true],"bearings":[0,90,180,270],"location":[-77.03458,38.902644]}],"driving_side":"right","geometry":"mdjeiA`ey|qCsEA}SIkSGsIEsFAk@@uECqFBmB?iOAaXAoVA","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":268,"location":[-77.034593,38.901335],"modifier":"right","type":"turn","instruction":"Turn right onto 15th Street NW"},"weight":182,"duration":133.4,"name":"15th Street NW","distance":267.2},{"intersections":[{"out":1,"in":2,"entry":[true,true,false,false],"bearings":[0,90,180,270],"location":[-77.034577,38.903737]}],"driving_side":"right","geometry":"qzneiA`dy|qC?_JAc]","mode":"driving","maneuver":{"bearing_after":88,"bearing_before":0,"location":[-77.034577,38.903737],"modifier":"right","type":"turn","instruction":"Turn right onto L Street Northwest"},"weight":25.2,"duration":11.5,"name":"L Street Northwest","distance":57},{"intersections":[{"out":1,"in":2,"entry":[true,true,false],"bearings":[90,180,270],"location":[-77.033919,38.903738]}],"driving_side":"right","geometry":"szneiA|zw|qC|MPvFpB","mode":"driving","maneuver":{"bearing_after":181,"bearing_before":88,"location":[-77.033919,38.903738],"modifier":"right","type":"turn","instruction":"Turn right"},"weight":37.2,"duration":18.7,"name":"","distance":41.2},{"intersections":[{"in":0,"entry":[true],"bearings":[20],"location":[-77.033985,38.903375]}],"driving_side":"right","geometry":"}cneiA`_x|qC","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":200,"location":[-77.033985,38.903375],"modifier":"left","type":"arrive","instruction":"You have arrived at your destination, on the left"},"weight":0,"duration":0,"name":"","distance":0}],"distance":605.7}],"weight_name":"routability","weight":452.4,"duration":257.9,"distance":605.7}],"waypoints":[{"name":"H Street Northwest","location":[-77.034014,38.900205]},{"name":"","location":[-77.033985,38.903375]}],"code":"Ok","uuid":"cjhs6f5cg2yao3unt7zz2deh9"} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/directions_v5_precision_6.json b/libandroid-navigation/src/test/resources/directions_v5_precision_6.json deleted file mode 100644 index bf92e646..00000000 --- a/libandroid-navigation/src/test/resources/directions_v5_precision_6.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"awbagAzavnhFp`@~fGr~Ya|BhcBwcYbr\\u{C`tZ~{H~vrBsge@bdo@`kc@dqpAckUbmn@sphAjnDovu@zviDgasDpa^ixsBbmy@{ubBvou@ajy@|}\\y~q@dycAcotGj{v@cdr@lyUwpC","legs":[{"summary":"Bayshore Freeway, Bayshore Freeway","weight":3999.4,"duration":3713.3,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[261],"location":[-122.416686,37.783425]},{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.417548,37.783315]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.419192,37.783106]}],"driving_side":"right","geometry":"awbagAzavnhFzEzt@|@hNbJlvA`Dbg@xA~T`@dGnBtZ","mode":"driving","maneuver":{"bearing_after":261,"bearing_before":0,"location":[-122.416686,37.783425],"type":"depart","instruction":"Head west on Eddy Street"},"weight":217.4,"duration":193,"name":"Eddy Street","distance":362.7,"voiceInstructions":[{"distanceAlongGeometry":362.7,"announcement":"Head west on Eddy Street for a quarter mile","ssmlAnnouncement":"Head west on Eddy Street for a quarter mile"},{"distanceAlongGeometry":131.5,"announcement":"In 500 feet, turn left onto Van Ness Avenue (US 101 South)","ssmlAnnouncement":"In 500 feet, turn left onto Van Ness Avenue (US 101 South)"},{"distanceAlongGeometry":28.2,"announcement":"Turn left onto Van Ness Avenue (US 101 South)","ssmlAnnouncement":"Turn left onto Van Ness Avenue (US 101 South)"}],"bannerInstructions":[{"distanceAlongGeometry":362.7,"primary":{"text":"Van Ness Avenue","components":[{"text":"Van Ness Avenue","type":"text","abbr":"Van Ness Ave","abbr_priority":0}],"type":"turn","modifier":"left"},"secondary":{"text":"US 101 South","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"turn","modifier":"left"}}]},{"intersections":[{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.42076,37.782907]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.42091,37.782888]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.420722,37.781954]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.420534,37.781023]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[90,165,255,345],"location":[-122.420342,37.780077]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419972,37.778242]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419782,37.777295]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419594,37.776367]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,255,345],"location":[-122.419398,37.775431]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[45,165,225,345],"location":[-122.41935,37.775193]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[45,165,225,345],"location":[-122.419314,37.775061]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,210,345],"location":[-122.418875,37.773667]},{"out":1,"in":4,"entry":[false,true,true,false,false],"bearings":[45,165,225,315,345],"location":[-122.418702,37.773081]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[30,165,210,345],"location":[-122.418631,37.772842]},{"out":0,"in":2,"entry":[true,false,false],"bearings":[165,270,345],"location":[-122.418498,37.772399]},{"out":1,"in":2,"entry":[true,true,false],"bearings":[75,165,345],"location":[-122.41845,37.772238]},{"out":1,"in":2,"entry":[false,true,false],"bearings":[120,165,345],"location":[-122.418146,37.771238]},{"out":1,"in":2,"entry":[true,true,false],"bearings":[135,165,345],"location":[-122.418096,37.771089]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,270,345],"location":[-122.418033,37.770901]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[0,195,210,270],"location":[-122.417742,37.770207]},{"out":2,"in":0,"entry":[false,false,true,false],"bearings":[15,105,195,285],"location":[-122.417803,37.769889]},{"out":2,"in":0,"entry":[false,true,true,false],"bearings":[15,105,180,285],"location":[-122.417834,37.769712]}],"driving_side":"right","geometry":"uvaagAn`~nhFd@jHfEg@xUsCjW{C|C_@pC]v[yDtR_CdD_@zC_@f]cEfQuBvDe@tH}@tn@sHl[wD`R{BxH}@vDe@lt@uIjb@eFxN}AxEs@n\\}D~ZcE^ExH_A`D_@vBa@zAUr@OvEc@fHuAbFiA~~@iTrc@yI|MmCtZiG`I_Bn}@_RhHcBlEcAhDy@lKiDjEgCnDyCtCgBdBk@pBGjDVfAHzRxB`J|@dIf@vO`B","mode":"driving","maneuver":{"bearing_after":260,"bearing_before":260,"location":[-122.42076,37.782907],"modifier":"left","type":"turn","instruction":"Turn left onto Van Ness Avenue (US 101 South)"},"ref":"US 101 South","weight":479.7,"duration":307.1,"name":"Van Ness Avenue (US 101 South)","distance":1559.1,"voiceInstructions":[{"distanceAlongGeometry":1559.1,"announcement":"Continue on Van Ness Avenue (US 101 South) for 1 mile","ssmlAnnouncement":"Continue on Van Ness Avenue (US 101 South) for 1 mile"},{"distanceAlongGeometry":355.4,"announcement":"In a quarter mile, take the ramp towards US 101 South: Oakland","ssmlAnnouncement":"In a quarter mile, take the ramp towards US 101 South: Oakland"},{"distanceAlongGeometry":76.2,"announcement":"Take the ramp towards US 101 South: Oakland, then merge left onto US 101 South","ssmlAnnouncement":"Take the ramp towards US 101 South: Oakland, then merge left onto US 101 South"}],"bannerInstructions":[{"distanceAlongGeometry":1559.1,"primary":{"text":"US 101 South / I-80 East","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0},{"text":"/","type":"delimiter","delimiter":true},{"text":"I-80","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/i-80"},{"text":"East","type":"text","abbr":"E","abbr_priority":0}],"type":"off ramp","modifier":"straight"},"secondary":{"text":"Oakland / San Jose","components":[{"text":"Oakland","type":"text"},{"text":"/","type":"text"},{"text":"San Jose","type":"text"}],"type":"off ramp","modifier":"straight"}},{"distanceAlongGeometry":76.2,"primary":{"text":"US 101 South / I-80 East","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0},{"text":"/","type":"delimiter","delimiter":true},{"text":"I-80","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/i-80"},{"text":"East","type":"text","abbr":"E","abbr_priority":0}],"type":"off ramp","modifier":"straight"},"secondary":{"text":"Oakland / San Jose","components":[{"text":"Oakland","type":"text"},{"text":"/","type":"text"},{"text":"San Jose","type":"text"}],"type":"off ramp","modifier":"straight"},"sub":{"text":"US 101 South","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"merge","modifier":"slight left"}}]},{"distance":379.8,"name":"US 101 South","ref":"US 101 South","maneuver":{"bearing_after":201,"bearing_before":187,"location":[-122.417903,37.769281],"modifier":"straight","type":"off ramp","instruction":"Take the ramp towards US 101 South: Oakland"},"destinations":"US 101 South, I-80 East: Oakland, San Jose","weight":49,"mode":"driving","geometry":"acg`gA|mxnhFfGdCnCpBbC`ChB|CjAlDt@vEN`FSpEu@fEiAlDcBpCyB`CeCzAkCx@kC^iC?gCe@aCy@wBsAcB_BgBaCqA{Cy@qD_@}DKqDDmETuErA}Ox@cJf@gHdAoPr@yMh@aMcBuM","intersections":[{"classes":["motorway"],"out":2,"in":0,"entry":[false,true,true,false],"bearings":[0,180,195,345],"location":[-122.417903,37.769281]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false],"bearings":[15,180],"location":[-122.419,37.769346]}],"duration":42.2,"driving_side":"right","voiceInstructions":[{"distanceAlongGeometry":354.5,"announcement":"Merge left onto US 101 South","ssmlAnnouncement":"Merge left onto US 101 South"}],"bannerInstructions":[{"distanceAlongGeometry":379.8,"primary":{"text":"US 101 South","components":[{"text":"US 101","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/us-101"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"merge","modifier":"slight left"},"secondary":null}]},{"intersections":[{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[90,255,285],"location":[-122.416662,37.769596]},{"classes":["motorway"],"out":1,"in":2,"entry":[true,true,false],"bearings":[102,108,282],"location":[-122.40981,37.769161]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[174,353,358],"location":[-122.405473,37.767261]},{"classes":["motorway"],"out":1,"in":2,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.405244,37.766048]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[0,180,195],"location":[-122.402999,37.752554]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[0,15,195],"location":[-122.404558,37.746941]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[7,180,187],"location":[-122.408143,37.739469]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[155,332,335],"location":[-122.406401,37.734438]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[150,180,330],"location":[-122.405674,37.733191]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[165,330,345],"location":[-122.403995,37.730114]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[163,341,346],"location":[-122.402483,37.726603]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[163,168,343],"location":[-122.401701,37.724557]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.400278,37.720955]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.397974,37.714805]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.39554,37.710237]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false],"bearings":[165,345],"location":[-122.395121,37.708328]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[170,347,350],"location":[-122.393825,37.702429]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[165,180,345],"location":[-122.391826,37.693636]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[170,345,350],"location":[-122.3906,37.688244]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[30,210,225],"location":[-122.392891,37.669787]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[30,210,225],"location":[-122.395051,37.667539]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[46,50,231],"location":[-122.39982,37.663398]},{"classes":["motorway"],"out":2,"in":1,"entry":[false,false,true],"bearings":[30,45,210],"location":[-122.403926,37.660623]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[15,195,210],"location":[-122.405731,37.65805]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[176,181,356],"location":[-122.406979,37.651445]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.406419,37.64457]},{"classes":["motorway"],"out":1,"in":0,"entry":[false,true,true],"bearings":[0,165,195],"location":[-122.406082,37.641332]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[150,165,345],"location":[-122.405024,37.63824]},{"classes":["motorway"],"out":1,"in":2,"entry":[false,true,false],"bearings":[0,180,345],"location":[-122.402719,37.630324]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[166,341,345],"location":[-122.401464,37.62492]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[162,342,345],"location":[-122.398689,37.616736]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.394473,37.611514]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[128,308,309],"location":[-122.391675,37.609715]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[129,134,309],"location":[-122.384799,37.605291]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.378646,37.601292]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.376557,37.599922]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[130,136,309],"location":[-122.364079,37.591793]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,285,300],"location":[-122.357438,37.587965]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.325833,37.581641]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[139,314,319],"location":[-122.322934,37.578971]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.316743,37.573261]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[139,316,319],"location":[-122.310821,37.567812]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.302578,37.560185]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.293655,37.550567]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.293005,37.549875]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.292169,37.548986]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[144,149,324],"location":[-122.291949,37.548743]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.286169,37.542512]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-122.283856,37.53998]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.273979,37.529546]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,313,318],"location":[-122.262626,37.51954]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[138,141,318],"location":[-122.260906,37.518025]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,314,318],"location":[-122.247718,37.506343]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[138,315,318],"location":[-122.242977,37.502159]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[137,142,317],"location":[-122.239937,37.499488]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,284,290],"location":[-122.231907,37.495907]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,283,290],"location":[-122.228972,37.495072]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.218915,37.491223]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.205884,37.487457]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[107,110,285],"location":[-122.185632,37.484733]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[120,285,300],"location":[-122.179679,37.482856]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[126,302,307],"location":[-122.177095,37.481497]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.155045,37.468654]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[126,305,307],"location":[-122.152581,37.467179]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.144516,37.462442]},{"classes":["motorway"],"out":0,"in":1,"entry":[true,false,false],"bearings":[126,304,306],"location":[-122.136462,37.457738]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[131,141,308],"location":[-122.12693,37.452112]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[140,317,320],"location":[-122.118132,37.444081]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.103307,37.429953]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.101751,37.428459]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[135,300,315],"location":[-122.092643,37.42097]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,315],"location":[-122.09244,37.420823]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[133,309,312],"location":[-122.089184,37.418478]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[120,285,300],"location":[-122.081848,37.413404]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[120,135,300],"location":[-122.081263,37.413111]},{"classes":["motorway"],"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["right"]}],"out":1,"in":2,"entry":[true,true,false],"bearings":[105,120,300],"location":[-122.078361,37.411892]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[118,124,297],"location":[-122.076323,37.411054]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.067607,37.407809]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,110,286],"location":[-122.067189,37.407713]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.063708,37.406961]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.056615,37.405407]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.047017,37.403049]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.036066,37.400658]},{"classes":["motorway"],"out":0,"in":3,"entry":[true,true,false,false],"bearings":[105,120,270,285],"location":[-122.03242,37.39989]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,279,286],"location":[-122.027075,37.398693]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,280,285],"location":[-122.024811,37.398202]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,111,285],"location":[-122.017288,37.396552]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-122.012976,37.395607]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.012709,37.395542]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[107,280,285],"location":[-122.008838,37.394702]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-122.000135,37.392318]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[111,284,291],"location":[-121.994151,37.390522]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,282,290],"location":[-121.991164,37.389654]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.983628,37.387548]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,287,290],"location":[-121.974838,37.385032]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.972437,37.384341]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.969543,37.383509]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[110,284,290],"location":[-121.957291,37.380021]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.945834,37.377446]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.941787,37.376663]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.941403,37.376591]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[105,270,285],"location":[-121.939052,37.376128]}],"driving_side":"right","geometry":"wvg`gAj`vnhFb@sMZeMd@cX^mX`Da~DHoIJaJNsIRqIZgI^}I`@uHj@mIt@iJ|@uJdGwq@pJ_l@xAgKnAsKjAyLn@gJj@eKb@eLj@iL`AeLtA_LnBmK|BaJrB}G|BsGtCmHxAcD|AcDlBsDdBwCbCuDrCaEfD}D|DuDrEaDrFmCzCgAnD_A~GkAvBS|c@_DzLuA~WsEzqA}FvJ]`IAtKF`K\\dKv@vJhAvJ|A`KzBbJjCnJdDzIxD|InEvIlE~\\|QhHlDhInDnHjCbIzBdI`B`IjA~Hr@dIZpIBjIWrIq@dJqA`JgBfJqCfIcDzImEzH{EhIiGdImHbHyHdHeJpG_JfGoJtN_UfF{H`GmIlF{GxFmG|FkF~F_FvGqE`HyDtIyDjIsCjIwB~IaBfJiAdK{@dKm@vJc@pbCqK~Ni@rO]rNKdN\\lOp@pNnAzOjBvLnBnL~B`nAzWlcBp^~nAbX|_Bl]rNdDrOrEbN`FlMbG~MhH`MdIfMdJz_Apu@xFhEbFvD|MxInN`IfN`HnN|FhPjFvMlDfQlDfOjCjPnBlPtApUrA`OXlOGrOWrOm@tO}@hMyAbOwBtOqCnOkDnNuDrMgE`MqEzMqFlOiHvJiEdWgM|w@{_@pYwNjr@u\\tm@w\\zQ{IfRuIxVsKrQoHhTqIl^aNhK{DvYcKxVqIzVgHl`Ag[xHaCvdAg]|hAk[|t@oSzb@eMfYyId{Age@n^{Jhf@yLdP_E`QwDnz@sOdk@wJtKoBdvAgWxMgChNgD~NeE`N}EbUaJjOyH|MkH`NyIzNmKdUoP~p@ui@jFoDxEaDxLkHbMaHvLuG|L{FfL{E~NiFhMwDtNoDdNsCzMsB~UkDd^iF`l@_Iva@qFv_@cFvEo@||@mLrcBwSbmEym@pdP}{B~oIskAddKowA|i@oIpv@sLvXkE`XkDrUeCvVeBxPc@~RO`RNjSb@xSrApS~BtRxC|P|CzQrEzTzGzSlHrP|FfR~GbQxGjRvHfQjHnChAbd@lTvSpKrMbHnMfHhMvH`MxH|LdIjMvIjLhI|LbJlL|IzLlJdLfJpLzJ`L|JpNtMnkC~eCzr@zp@b`@z^vKfKnKjK`KrKpKpLtLzMlJfLvJbM`K`NvI~L~IrMxIhNpIrN|IhOfItNtIrO|oBdoDjI~NxJzOnJhNhKnNnMvOpLfMhMrLxNvL|LhJpMlIrL~G`NdH`NfGlNzFl\\bNjlArf@|NzFxNfFhOnErOxDlO|CnPrC`NdBlOzAdNbAdOx@jN\\zNRfPAfO[`Pi@taAyDlXcAjqAeFrRu@fw@{CrSy@xyFmR`vCsLhr@mFjKaA`YuDr\\_G~YiGxRkFrVoHdYsJp[qLdyAco@hWmJhSaHjT}G~QkFzPiE~RmEvSaE~RaDdTwCpSaCdTiBx]{Bty@uEnwAqKftAsHvXuBbZeD`\\uEdU{DfWqFtaAgUbl@yNhKw@fZiG`wDy~@hqAa[~gDyw@`h@qLxF{ApUiGfXwIhZwLxXmMhZmPdWmP~XyS|VkT~SoQ`VwVnSyU|SeXne@}o@loB{mDpzAiqC~[uh@fp@qgAtiBehDhuB{uDrbCuhErtAqaCpn@mgAteAwiB~u@_sAlxEslI~o@mlA~Vkd@jk@gcA~{Bg~DbRy\\xP_\\dQa^vOo_@zMk_@jM{`@bLeb@`T_gAzHsk@~Fcj@`De_@jCkc@bB}f@r@ef@Rme@tAyqB~FgmHnDcrElDmwEjEi_Fl@yr@nB}e@tBoXxEe`@nG}^fJs_@pLy^tN{\\`OyXpPiVxPwSrk@io@~wCseDzeDetDfhDqvDrzDkjEpcAwiA~nGkfHngE_xEjlEm|Ef`@ac@|Zg]rHmI|TiUfVoT`YkVlxAwlAh^_[vn@sk@ht@_q@j^y[|a@k`@lt@ms@jZcYj\\eZpbCeyBfj@sg@pv@gs@dNwLhlDy~Cb_Au|@rh@ae@jmBudBl`@_^bNaMnN_M|x@is@fc@e`@vcCsyBrcFurEhR{PpwBqnBxTaSfTiSdW}V`UqUdSaTdT}UdSuUtl@qr@|sDwmE|oDqgEhcBspBjBwB~FaHbmBg{Bva@gf@|z@gcA|pAm{AbYw\\pc@kh@x|AciBha@me@~dBirBpjByxB~y@q`Ax{DmtE~iA}sAtlAawAxkBizBfqAc{Azn@yu@xc@aj@tPmS~O}SlO{TbOoVnMcVpM{WpCsGzBiFzEcLbM_]hJoXfIyXfIi[xGyZjGkZ`p@glDds@mvDzPq}@vGa^lHq_@~FyXbGgX~F{V|Jq`@lH}XzIw[~IsZhJgZjJiYjKk[`eBsdFvp@anBzJiZtJiZdJwZzI{ZdE{ObCgJjD{MzCmL`I_\\fGmXtGiZhHm^fEqTbGo\\pF}[lF_]|Ey\\nEy\\bEg]|Dc]hDc]`Dq]vCo]bLieBzuBa_]xB{]fCw_@`Cm]jCk]|Cy]hDc]tD_]xDi]jEy\\vEe]fEsZnFq\\rFm\\~Fo\\nGa\\tG_\\zG{[jH{[vHw[`Ia[fIwZ~I}ZlJsZ~JcZpKqYfLoYpLwXjMqXlMwWvCgDptEesJfq@}uAxxBkpEpzFijLpj@}gA|xBkpEbuAqrC`EmExiEm{If|AszCxhBuuDh~CmnGz[gp@htH{mOfGkMjPg[tOgYhSg\\dK{OfPqUpPyTbQ_TpQkS`iEksE|cByhB|}AybBbz@w|@l_EsiEhIwI`yD_bEvkHszHnG}Gx|B{bCpf@mh@xt@yv@rxBa_CjXqY~WwYlVcYzUiYtWw\\lVy\\|Zqd@h[gf@jpCafEdHuKdvAqxBjz@}pAt}B}lDhcBaiClJcObIuMjI}NlNaWzMaXjMkXnLgXzK}XlDsIjRqk@zk@akB|Jw[js@k~Bvg@gaBx_BulFxFcSxFySxFcTzEgStEoSxE{UfDqQrDySbDiSlDmV~DcYrLm~@j`@cyCfx@qcGzf@wuDxHgi@pImj@tJcj@fc@e`CnMev@~Hwg@lHwh@xGkf@hc@ycDpsBwuOhNkdApPioA~n@{bF~_As`HxHmk@t]olCbfBeuM`z@olG`CuOns@}pFhUuyAzo@iqDxlA}qGd`@arBd]}`Bzo@_`DjIga@xR{bA`WqsAdNos@nTgjAf[acBtaAerFhlBg~J|n@ceDdj@auC~r@{sDfMqp@jD_SbjAufGvkAskGnm@{bDv`@cvBpUswAvb@odDpb@amDh`@wgD|o@}{FnC_W|[}qCvj@o{ExKa}@fGyf@vGce@pL_x@tHag@","mode":"driving","maneuver":{"bearing_after":94,"bearing_before":73,"location":[-122.416662,37.769596],"modifier":"slight left","type":"merge","instruction":"Merge left onto US 101 South"},"ref":"US 101 South","weight":2842.4,"duration":2831.4,"name":"Central Freeway (US 101 South)","distance":70046.4,"voiceInstructions":[{"distanceAlongGeometry":70046.4,"announcement":"Continue on US 101 South for 44 miles","ssmlAnnouncement":"Continue on US 101 South for 44 miles"},{"distanceAlongGeometry":3219,"announcement":"In 2 miles, take exit 390 towards CA 87 South: Guadalupe Parkway","ssmlAnnouncement":"In 2 miles, take exit 390 towards CA 87 South: Guadalupe Parkway"},{"distanceAlongGeometry":804,"announcement":"In a half mile, take exit 390 towards CA 87 South: Guadalupe Parkway","ssmlAnnouncement":"In a half mile, take exit 390 towards CA 87 South: Guadalupe Parkway"},{"distanceAlongGeometry":402,"announcement":"Take exit 390 towards CA 87 South: Guadalupe Parkway","ssmlAnnouncement":"Take exit 390 towards CA 87 South: Guadalupe Parkway"}],"bannerInstructions":[{"distanceAlongGeometry":70046.4,"primary":{"text":"Exit 390 CA 87 South","components":[{"text":"Exit","type":"exit"},{"text":"390","type":"exit-number"},{"text":"CA 87","type":"icon","imageBaseURL":"https://s3.amazonaws.com/mapbox/shields/v3/ca-87"},{"text":"South","type":"text","abbr":"S","abbr_priority":0}],"type":"off ramp","modifier":"right"},"secondary":{"text":"Guadalupe Parkway","components":[{"text":"Guadalupe Parkway","type":"text","abbr":"Guadalupe Pky","abbr_priority":0}],"type":"off ramp","modifier":"right"}}]},{"distance":4798.2,"name":"","maneuver":{"bearing_after":112,"bearing_before":106,"location":[-121.931731,37.374579],"modifier":"slight right","type":"off ramp","instruction":"Take exit 390 towards CA 87 South: Guadalupe Parkway"},"destinations":"CA 87 South: Guadalupe Parkway","exits":"390","intersections":[{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,120,285],"location":[-121.931731,37.374579]},{"classes":["motorway"],"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,300,330],"location":[-121.926597,37.37012]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[128,138,308],"location":[-121.923722,37.367884]},{"classes":["motorway"],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[0,150,180,330],"location":[-121.918933,37.364245]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,315,330],"location":[-121.915678,37.359877]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,true,false],"bearings":[135,150,330],"location":[-121.908322,37.349121]},{"classes":["motorway"],"out":0,"in":2,"entry":[true,false,false],"bearings":[150,330,345],"location":[-121.901664,37.343143]}],"duration":192.39999999999998,"driving_side":"right","weight":206.7,"mode":"driving","geometry":"efdhfAd|bqgF|Rwy@dFyVxRu_AbLy^|GgNjGcLhSeWtLmLvLaIjFoCdFoBfIkCfHkBvo@aPnXoI~NqEfS{I~G_D|NgJrJ{HtGoGfK_L|IqKzLmQbDiGhKqQ|Vie@`X{g@dkAw{B~NcXhPoWlRmXfSeW|UcXpTcTtYmV`FsDhA{@zQ_NnWmQhbFcgDhoCqkBnbAiq@htAq~@lf@{Zzp@y`@ne@_Ujo@uYpfB}v@hMcGhMeH`P}JhOiKj`@m\\ra@}f@~JuOzI_OtJwQhJcSpIwTzSsh@nT_g@hPkZ~PuVxNmRrNwPfO}NjO{MnKcI~JaHtIaFxKuGdRcJ~^aOrh@aSj]oOlSmKxIcF~pA}v@","voiceInstructions":[{"distanceAlongGeometry":4496.4,"announcement":"Continue straight for 3 miles","ssmlAnnouncement":"Continue straight for 3 miles"},{"distanceAlongGeometry":3219,"announcement":"In 2 miles, take exit 6B towards Julian Street","ssmlAnnouncement":"In 2 miles, take exit 6B towards Julian Street"},{"distanceAlongGeometry":804,"announcement":"In a half mile, take exit 6B towards Julian Street","ssmlAnnouncement":"In a half mile, take exit 6B towards Julian Street"},{"distanceAlongGeometry":402,"announcement":"Take exit 6B towards Julian Street, then continue onto North Almaden Boulevard","ssmlAnnouncement":"Take exit 6B towards Julian Street, then continue onto North Almaden Boulevard"}],"bannerInstructions":[{"distanceAlongGeometry":4798.2,"primary":{"text":"Exit 6B Julian Street","components":[{"text":"Exit","type":"exit"},{"text":"6B","type":"exit-number"},{"text":"Julian Street","type":"text","abbr":"Julian St","abbr_priority":0}],"type":"off ramp","modifier":"right"},"secondary":{"text":"Saint James Street","components":[{"text":"Saint","type":"text","abbr":"St","abbr_priority":0},{"text":"James Street","type":"text","abbr":"James St","abbr_priority":1}],"type":"off ramp","modifier":"right"}},{"distanceAlongGeometry":623.5,"primary":{"text":"Exit 6B Julian Street","components":[{"text":"Exit","type":"exit"},{"text":"6B","type":"exit-number"},{"text":"Julian Street","type":"text","abbr":"Julian St","abbr_priority":0}],"type":"off ramp","modifier":"right"},"secondary":{"text":"Saint James Street","components":[{"text":"Saint","type":"text","abbr":"St","abbr_priority":0},{"text":"James Street","type":"text","abbr":"James St","abbr_priority":1}],"type":"off ramp","modifier":"right"},"sub":{"text":"North Almaden Boulevard","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Almaden Boulevard","type":"text","abbr":"Almaden Blvd","abbr_priority":0}],"type":"turn","modifier":"straight"}}]},{"distance":508.9,"name":"","maneuver":{"bearing_after":171,"bearing_before":150,"location":[-121.900192,37.340845],"modifier":"slight right","type":"off ramp","instruction":"Take exit 6B towards Julian Street"},"destinations":"Julian Street, Saint James Street","exits":"6B","intersections":[{"classes":["motorway"],"out":1,"in":2,"entry":[true,true,false],"bearings":[150,165,330],"location":[-121.900192,37.340845]}],"duration":44.8,"driving_side":"right","weight":57,"mode":"driving","geometry":"yibffA~heogF|Hu@lp@ca@zLsGvr@g[hF{B|GaB|HcAxKKlIp@lOzC|Dh@hKtAzFh@`FDvHy@bG{AjKaEfFuBvEiB","voiceInstructions":[{"distanceAlongGeometry":390.7,"announcement":"Continue onto North Almaden Boulevard","ssmlAnnouncement":"Continue onto North Almaden Boulevard"}],"bannerInstructions":[{"distanceAlongGeometry":508.9,"primary":{"text":"North Almaden Boulevard","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Almaden Boulevard","type":"text","abbr":"Almaden Blvd","abbr_priority":0}],"type":"turn","modifier":"straight"},"secondary":null},{"distanceAlongGeometry":284,"primary":{"text":"North Almaden Boulevard","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Almaden Boulevard","type":"text","abbr":"Almaden Blvd","abbr_priority":0}],"type":"turn","modifier":"straight"},"secondary":null,"sub":{"text":"","components":[{"text":"","type":"lane","active":true,"directions":["left"]},{"text":"","type":"lane","active":true,"directions":["straight","left"]},{"text":"","type":"lane","active":false,"directions":["right"]}]}}]},{"intersections":[{"lanes":[{"valid":true,"indications":["left"]},{"valid":true,"indications":["straight","left"]},{"valid":false,"indications":["right"]}],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[60,150,240,345],"location":[-121.898785,37.336552]},{"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight","left"]},{"valid":false,"indications":["right"]}],"out":1,"in":3,"entry":[true,true,false,false],"bearings":[60,165,240,330],"location":[-121.898691,37.336402]}],"driving_side":"right","geometry":"o}yefA`qbogFjH{DtEkBrTePj^}W|D}E","mode":"driving","maneuver":{"bearing_after":153,"bearing_before":158,"location":[-121.898785,37.336552],"modifier":"straight","type":"new name","instruction":"Continue onto North Almaden Boulevard"},"weight":75.1,"pronunciation":"ˈnoɹθ ˈɔlmədən ˈbʊləvɑɹd","duration":43.5,"name":"North Almaden Boulevard","distance":157.5,"voiceInstructions":[{"distanceAlongGeometry":157.5,"announcement":"In 600 feet, turn right onto West Saint John Street","ssmlAnnouncement":"In 600 feet, turn right onto West Saint John Street"},{"distanceAlongGeometry":54.3,"announcement":"Turn right onto West Saint John Street","ssmlAnnouncement":"Turn right onto West Saint John Street"}],"bannerInstructions":[{"distanceAlongGeometry":157.5,"primary":{"text":"West Saint John Street","components":[{"text":"West","type":"text","abbr":"W","abbr_priority":1},{"text":"Saint John Street","type":"text","abbr":"St John St","abbr_priority":0}],"type":"turn","modifier":"right"},"secondary":null}]},{"intersections":[{"out":1,"in":2,"entry":[true,true,false],"bearings":[105,240,315],"location":[-121.897852,37.335352]}],"driving_side":"right","geometry":"orwefAvv`ogFhCrF`Qtc@vDzJtFlOv@`CdJrWlCvItShi@pBfF","mode":"driving","maneuver":{"bearing_after":236,"bearing_before":136,"location":[-121.897852,37.335352],"modifier":"right","type":"turn","instruction":"Turn right onto West Saint John Street"},"weight":56.9,"duration":43.7,"name":"West Saint John Street","distance":267.1,"voiceInstructions":[{"distanceAlongGeometry":267.1,"announcement":"In 900 feet, turn left onto North Autumn Street","ssmlAnnouncement":"In 900 feet, turn left onto North Autumn Street"},{"distanceAlongGeometry":91.7,"announcement":"Turn left onto North Autumn Street, then you will arrive at your destination","ssmlAnnouncement":"Turn left onto North Autumn Street, then you will arrive at your destination"}],"bannerInstructions":[{"distanceAlongGeometry":267.1,"primary":{"text":"North Autumn Street","components":[{"text":"North","type":"text","abbr":"N","abbr_priority":1},{"text":"Autumn Street","type":"text","abbr":"Autumn St","abbr_priority":0}],"type":"turn","modifier":"left"},"secondary":null}]},{"intersections":[{"out":1,"in":0,"entry":[false,true,true,true],"bearings":[60,165,240,315],"location":[-121.900438,37.334113]}],"driving_side":"right","geometry":"aeuefAjxeogFpFi@vFeAla@sA","mode":"driving","maneuver":{"bearing_after":171,"bearing_before":237,"location":[-121.900438,37.334113],"modifier":"left","type":"turn","instruction":"Turn left onto North Autumn Street"},"weight":15.2,"duration":15.2,"name":"North Autumn Street","distance":89.1,"voiceInstructions":[{"distanceAlongGeometry":58.6,"announcement":"You have arrived at your destination","ssmlAnnouncement":"You have arrived at your destination"}],"bannerInstructions":[{"distanceAlongGeometry":89.1,"primary":{"text":"You will arrive","components":[{"text":"You will arrive","type":"text"}],"type":"arrive","modifier":"straight"},"secondary":null},{"distanceAlongGeometry":58.6,"primary":{"text":"You have arrived","components":[{"text":"You have arrived","type":"text"}],"type":"arrive","modifier":"straight"},"secondary":null}]},{"intersections":[{"in":0,"entry":[true],"bearings":[357],"location":[-121.90034,37.333317]}],"driving_side":"right","geometry":"issefAfreogF","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":177,"location":[-121.90034,37.333317],"type":"arrive","instruction":"You have arrived at your destination"},"weight":0,"duration":0,"name":"North Autumn Street","distance":0,"voiceInstructions":[],"bannerInstructions":[]}],"distance":78168.7}],"weight_name":"routability","weight":3999.4,"duration":3713.3,"distance":78168.7,"voiceLocale":"en-US"}],"waypoints":[{"name":"Eddy Street","location":[-122.416686,37.783425]},{"name":"North Autumn Street","location":[-121.90034,37.333317]}],"code":"Ok","uuid":"cjhs6f53025wr3poa74lkjod4"} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/long_step.json b/libandroid-navigation/src/test/resources/long_step.json deleted file mode 100644 index 8234a689..00000000 --- a/libandroid-navigation/src/test/resources/long_step.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "waypoints": [ - { - "name": "Kendree Street", - "location": [ - -121.848098, - 38.002812 - ] - }, - { - "name": "Mountain Wood Lane", - "location": [ - -122.261111, - 37.420639 - ] - } - ], - "routes": [ - { - "legs": [ - { - "steps": [ - { - "intersections": [ - { - "out": 0, - "entry": [ - true - ], - "location": [ - -121.848098, - 38.002812 - ], - "bearings": [ - 19 - ] - } - ], - "geometry": "}jongAx``lgF|bpb@z`eX", - "duration": 4986.5, - "distance": 119541.2, - "name": "Kendree Street", - "weight": 5012.2, - "mode": "driving", - "maneuver": { - "bearing_after": 19, - "location": [ - -121.848098, - 38.002812 - ], - "type": "depart", - "bearing_before": 0, - "modifier": "left", - "instruction": "Head north on Kendree Street" - } - } - ], - "weight": 5012.2, - "distance": 119541.2, - "summary": "CA 24, Junipero Serra Freeway", - "duration": 4986.5 - } - ], - "weight_name": "routability", - "geometry": "}jongAx``lgF|bpb@z`eX", - "weight": 5012.2, - "distance": 119541.2, - "duration": 4986.5 - } - ], - "code": "Ok" -} diff --git a/libandroid-navigation/src/test/resources/mobile-event-schemas.jsonl.gz b/libandroid-navigation/src/test/resources/mobile-event-schemas.jsonl.gz deleted file mode 100644 index 7e6b9dea10ebb88db0e0d3eecccd05ca93764578..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11925 zcmY+}b95ey_BZgPY0%hcY}>YNKCx}Pv2CZZZCg(oCyi~}Z_j(rJ->U_XV&cR?3ur3 z?U{`q2?fPCcxD6wW@Be)VQoTd;%Z{+OzUK1ZenBLL}%$_XKM{|?qlV&#@2lP_{ywv zOW0;qMzi9kelIB6{RYKFM4M{aT9gp5s(r!WXzSix=eFn-at1DjRpE<#Q{) zv=a&LC0vck`|*r@0DZ?TVOP99-o|#7)gn(N@RvdBh=_PzllZ+~24ho|kx9-q6h*#l z?ArN$u0QV%?T(e0ndPp;o^2)`zJ+2x3~+vKlRpf&CFA>kz9+qZ)@*veoQ@q9%uheh z@qa#_xA;{no-!<`S|L#zY+lOP&2C4mk$xk#YTF?ey9mR-z9zEvp2bQ4z8;Dj6gL%W zHzvM^cVQ;P^*k*a*t9XHzSnVjRB8x(pmc!dcFRAXnK=P~)*D8eMU~gTbmNMOP&ZNN z3SvJGV~gXsNl0|5YK6bKE1D=b67~>}+HrmuP1x$iPkB|NFJTb^=j-htQI`s&!cGqc zlcy?iTd9jo=E9sf`D34dN>MF0W@*Rl-fU=Z)C5NTOlT>FH`XIo4}PmyDBsd{yI9-t zc^Ptpn1@um466N}53enFdD3`+8>HTDN7T6#j|Mx&*ZLG9nT@zb3uDjKWE6G<@vBX? zGci^f#{Fnbj)x0jDb5<|{31TikSjJKXiu*S={7%GyftQZ@S+Z9q(r`3soi_TbLX4< zE!W~9iD4IXysZO616Qaisb&+EDO2>hHnLzhJN;(=S&^)d-R@+dQl;L;iM(*E4#y1 zXgs(7aHSe!1wGY?)seJQ!YSa0b>vrjwbsbtX%$X?*!1BdXEdhCmcSE1QijqA(!}A= z(;ZXnuUtL;AS6wy;f>pbbeGX=D-<8B;dT?La*7vzEzPlU+A?JWEz$6z(;ngv9xa~d zV;bz}NDs0CT9ed8OR1iDsfq88rP=P27!Hkj0j~>6HFm#UaWo!&6#T5d(VHDhkXLla z?op)_Rf>7Gw%VGn(utF~067pcS-HKO0x8MKx>3 zplS9yi8}MJW>+2kVldE}w3q|-Gh5`Nez97{8{$Br43SOfGJ6bXUYJ-wva~EgGc-Vq zVEiW9t)e&?G_V&0ho0+4zk_!E}IFTB%ODkqGBmAbOF&ejSy$Lw`KI z`S~=kGJ(PG{W)-Z*&5tzbd{5Lnw=(08xUAc($Dl8fo~ktt_N@by(~Dl<{MJIFH&$C{!gtQC z#9x`1`vow{=dLrt&U}3;#7QUr*d0ld?fgJJCLj6eAyp#j#hT-yf zT=V$6^V`4$6%)HT>LT@t;C<}6;&(99ox{>&2I_LSrRd#*!=7?{Uh|xH89>SbfjN-_ zx47&bY77nU7tze;ULFs;pU~4jfBO&uc^^Rqrk)t-i}!BiEl(%h@gL;y0oxtaH$R7 z5V1$#K644|IM(55Z-^dHN{i=@sU+Rb-46#ahi)fZqcXxV*NtD*` zP+o_We;!sG@KXpd}oqa}hlM$~2NT5-LM8Jf=$ z&eYK39=#LoF0KatdG3Ye}r*61Ms!7k&h8tj?a zQvCUCAlcI+3Mp_Py3)oty5AeO=sKUQf(nqrw%iC1mpOuqP%Ba3?we8+ajw#KK35Fb z=j2lb(TNVR6rpF&%q4q;ki2BcMV_5#C-+zfFaTzobo1!WD(r+nu5h2=y&=0VA-X5> zq~Pym<5&hg+qG<9Pv_c~hF{KH^m%LXG!QB``PZ?)PEq1ijC>?2dv#%_kLNs>c5a*K z?qyiETtHU?&U;<;Ux9{RxW#*|y5PfH#oTJGTS(b@Az>}I4r2Ne^(g znkvN-yX)98m9&%RlNb3}>gG&Su3~6(R*5gGvNFNpN+qv>`%u8%K2Ojyqc}BR19&R?KnJ zH{o@kcXS1B#P6uFDPfb;*{v?r5apIetE9}T{q`Y8lS$>D2U9>;lO~aT4_q=zpxJR} zO~R#5nH;Fpb&AxzR3wTxo>on#6=kd0VZDDsd>??GeP5HqAyMs0wed4?5=^B&k^V+U z!}7Pg0B!S`dKK6ZbG&BjUMqA(%kf)gQbPZ)IDwDeH4Bm5~@q=V<+23o;`i^Qp=*xv#b{|k?yFe;HHBx`+{%DkS)jr8eS~BI%3yDfO&{p6cma^iVaa^-rRqLfv$oA>9f=$n>@ycEw8Z zt*#TR*!7nksnntPNlBF#lNodD@nVr?9mxo#jI){+EDq@3w&OU37RbWUOM#%xW{1q! zRIKN9UKt@v5R4af++&u^ESDy?xsj^W$KFhhdX46$_YCmH!o4H|{~vy)B;DD{1C6c0 zq6!;(_5pY58iI*i@b@X3nkOYf@7b};;cnt`F!+Yw>_5IL!~cKX^2I#N654G0MakA_ zPC1*XwVwUTkv{Xnd%w3CS_G3>meRw z-;h18~{HMj*n{>6bpdJS)hthx}7@tJTy8@7Fh; z6q^~w=-{(y=Ge$8qb1|mX5mR8c)@>Gf>YAH&a{ldy|e0r2<~2`666IWfn8N%oNBd=G@0gFpCbh->Bv~T#~s_ zRBbQbxp_eV{C!!`6e=vdpY+NPrf_S?&Gx*m%hCnO98eY1ua031~! zswDcujjApnemmB`b;#2MtXnW9$oTQPFr=ovOg#)HaL0%g=3T07!=Kl$b6#1yQb+2~ z-Lbqn6Vwq>vAnB5QE55!f02npJhZsY=k_@KU^wC0duz79`nY{9A$3UCvQl4sH;22K z%uvL}-rprM%~N9ugP7Z^2I$A86}!LfmFqzSC$VzvC=~PV?OMBvh6XLOdMe3Ct3ow% zGq0XY+c-9_V#VdpjK*EEqlbM5?L7$;G_p|rj;}*(tjp*uE3Lwc21kR@*9__@dsP>QCAU_#6U*`Zo&R|@NgUnM{@4Kq%c5zO@uuvRg8NRjzd$h~Ad+tx-9(e$um3`~9?2?S&dQDom?pQRhlz2y3fzUn%xTdvtimbvIbYNr zqt3K|H;CL-X4HRSwZtSeH7zBQ|B=?WmNzQ11ybUhp5C(KUGwpcc{V&W$7P`*Za9E; zra&yB3iUog=^{b?YHY&njQv#lWp%=gN&r=l^HtG1^nJK#E^>{+b?;z7t18XASp2xm z7Psm?bArUH@2}Ax_8hICFVPRX#uUppejl*>XLxtr=Lp;J$|xHKD76isl|fr8+IeW; zW){XBO^_^@cW71sE6;G%%{xp$B4(LmBgUL=hTqeqdOR@EwMo#?VKpkVOn&|ggNARKj*%G(s*LrnP70STA?sGv5PMXyi3o5lt>+T+QscOM0Ze5angkLbvEdejG)00R(YSCh+Rq^#lXXT zL}W4XVTvpV!%OWdK;)67waRm*en!XR+FLHG#diWD{YNV@6YOl9G!kL}Q6>x$Jv3Ss z3Wsv9IWOE-f6!hK{U}h(HyXXn#E`PnwwVF!VaA#YaZWXKec_X#rW$&D`U*3ta*txl z8T>?}*qAK1^8K&qnM`I-^~vfcAvvNJTZd^+7XC8Y;?qVU!@gm^BEZrY$2gL(kTL5h z2teaNBtQ}xVMxlrNZ3Xd9mgL)CMn8BU}5J9eBu#iy&71O({*2)gm(yg~t1ugwUs4SXLa&Ck^(ur-G#Tem@oFhP=Yc9f_kV`cc+? zdRW(fytUi2y>^aTd|s8NM<+E!rj53C1fVZQbmsSsI8#-R>VON%6nvINXfYrv^1&2B z#=g1U%V}90`I6$BsgtPwykZ4Z^C+bY<`>_U#5Q0rSy6wdx&S*p)SQ5&!_py%ds<6_a-pwL%`lma>b&;X8u6D~|PHcJbwU zQm*pd(&!e7bhEl3LpaK`W69ba16-adQKtrZKHVEt^}{1vtKyS(4VADXjh8d}Uv`r8 zdaBee7JG`QtBe`qb|F#LQ;it6LV4obA^et&-r>jM-M=$sB z{8^9W=%bc+NIJQDUerBh-uHE-jU;~Gvz;bA>5B#NMzZev$E(Zl^nBsVWVLROhr^PF z#8jP!4|MG^b5WwMdG0Ve>N^#+*_eSaI{FrGcI_5Y9I=n$JLxLtP!mHJ#}t+q zTFeN%hYDU(kXP`3B>Uo^14&^H%Y7g+86VA%o#=HwxV|L}RIqn$(AuGk`Gpe6WP{Q6 zN7D_^XO0;$C^0H2Xw|7CEx#J{Gf#OgC48Q#n)hCqg9w%G)P*KsPoq7;9D{QlCdz1q z`YaXuTg(Ku~@806o zuos%%Gp60+<>W#Oi3Am^#S@g9vh0$4W5&cG)iqsb8S)o3%b3i|DWYJaxp8ZUk9B%= z4z51x&0SQ~n2?fs+Atr{3f*ZRd6tZRA0hHTRe(33T8wBe&xkVJ(hSU>=dUz@(rV|+ zCzvkWx^>4!2>dE>x*_ZyV~_KUVfEGZ!lj!pXPVaHHrtCCA^V4#(ywQjQ#u=9xAfW# zH6FrM72x+aI+_iD&52d!%rG5TV{Vd}bud&TZb%hOVW@An;yHUvjLn`UT+t?!H z1!q?o_kE3#$~8rLUF3T;3u;%LasgEX$KuK0aEj=s2Y>LotcAdru?)*rqD7n8*yWyk ztQC~CIQ0N-J(0?+H=<-#HiCw+=5#g3XRlLcOM!zZ4b_V|H0unF2lej^WJglNZ*|M^ zA68B!?WMr;!x4o|GsEKzRl886=6*=$15ZbiJnKrG;h-rBO??%r8s&+mli(NR>dtN} zvCahQ;-5yWOD-0C1dqyY0sKCv+|Rv(nPbd` z9WF~JYTlK6p63mj@Je&F=SYYH_w-zZ>7P?yP6EQr=gDX$EerKY4i?ygx0e{oAVqL}I0%L{dCwSrq&I3t>d{V?-zga&e}G?A7bmW8dYEO~@Vu zU;H<|C!ed=hv7?U&YYto+;Z{a8-%?{%|o)U;ffb+HcEHUH_)$bAcB2pwGC#S*}Tx> zVZ2D(d%bBnkIN@VNA43KateKUO~xS|kRjgU1NnOvl-UunLu=f1EqYN$A`Oi(1+cw) zlNvEtMq0V?$LTpaqz`+-5ND2>|+5R21O*4ElVn-rFcW}X!V-rtnV?KUsQ zue2U*er%tk8G#Of{g2hf@!kMBCpbAk@(MQD{5{V6eO@VMDfPdc=FQ(*0C&ypZH&LX zT)JXs(dIrHOicHsAVjwGZC;VrsM5gE6BN+3wN zU_3>dA>lJDMrWP5;{7UU5V=E8*=yCO229^N9+DY{ctw-h|6-GGUJY{!l?Cb(mh?ygO?wkUbKUA(oU@Dsp^ zO8Ka$$_ZqvS+TlS?AYVLKzq1RY|!$2E*)#p&Y=?^?ie|D_a=vT`_@lEG3-bQx7CY3 zl)=21Rd*1@YNl#Y$!Ro&Wd+oZ^o4EeO-xXbeQ8DVxJclGzv+}81mDBj^H^nqx`F*i z6kKMz%T-_37gf{lc=cbT%=o%}e2h%);8)Piv_Gz(x6pd2{nbHgKy*Pn197Eyzpo*2 zUhalDbKZf(jPk_`a1hyx{CUt`WGk!}DS-Hk_}3UHoOoO(5&N8=tcER~@a)V)BM$k3 zt3%a8NzCV405EYG*AMSd@~>OH-?PXAZb=}B)FGu+9C8M)Jpdf?{WQZrZb{gX#`-*v zIpn__N}lz4AP2{m^T`wGSKka+m?~&xE!aXzld#I)WN^QfF4%4l`c%eU^tzuX&4r;U zRmLrT`L01Y1bxgUgG2pu^>!gtJEl~D?3@t_z@gW2i`e_@nmyou8}L7Dtb7gxFtFLh zO&3;P0i)I}EWU9o0CF>ehJX8!u+jx&t+_RGnf1WD%oaYTbfIJ+lwK}h=0gULnfVKep zW58j^*6hE%0*l<7rfq}csawv64Mb9VjLCTsT&JX!PD%I$+BZ$;g%A=W#i>r{qV8Tq zx~v7Ktyx?uD`)-7ytc0qR&4vek7;guWIr0ww78?|ED1?Nb+)fz+(a-Oi}?v3wIs*M6n0HKtmjmZ zv@0IvhwB=K`T6iRl20^FsXR;aiN)AS_svh=y<=LV_v(K&HwoG2O#pr-@iO&)867O2ffpr9w9lQ zo4^~1Me_qq3FED+q8rV;Aoi`KGe#J zYIjjuTgz0I!^TB|il)>WD%aZ7fs@2nY2vdT@aU~bG;1wxN*kksMIgl#1G8@3w(+0& z=BcD|p_61z4h$h^rGYzjcw0M{H}YJ9ci7Qybg=%YhvqWiIkjqKsWU&t-8V7cY|7P# z-fr5O2&akEj>&5fy!I}($dBgT=onx66U<9p<7H&_GsgHDhR>fYd2=oKIAIz=9ikdm z2dkCI-sHiwb8EaeIe;4MKfNAF<8syWse6 zeBZrU{@b%!@9SwftXEm@zumAkNJY`wLhq*y(uQh5wB6o_!dMe(4Yr5b{<~-YxF&=n zKypaK;ctF;U|b0nW{(I=gWN_fe2=KbBE-Cyf_IZhb8zXmN_EKp^Dh!m#3S}Q0PFPS z&*svkWCC@bL`NY##)fRIlq-e$(n7kjPI=f#)1*hhNOzhc)JafU44gF0A4#kOSRxuF z7=}%F5gpXpv{=#Tvw$ZJtur$BqP|ZM@27%G^A&r=&=9x3{kS^mLTHqrFXgU=F%Ig8 zI4{a64p*|5?BgTKo{1I+%bP=2f|8FqaETrRb zk^*YlAIt-%#x%_2NJnXW67KQ}1y=+#8V<*}=@A!2^56`n0N6G`tVoM%O|_=l0uGS< zIbnc@7=S79L(WUmCjjqdIh{b)%HGx=MCVw2Otd;F$FB~_*CKn8PHw~dV^^F{aKDDW z{ms+$iGVwe&eLzDp0geGn2Gz6~! z```0xI(MXb0#nA%$OCMVU%|5(y=_0`3OQVL!=g`S6WY7mXc#i|J9G}nH%Y0|J|BFT z?!gAD55ZhS@%0u*ikD(NGKc1;c5a2mN~g@drc1pZ8CnIix=A56IByg){EI6#uf$-e z3}maBKkU`D-gDZEZJ9P|!W7JhvvU z2Gr!SDVwy5USZ+P)#E|oWu4_U+&PXvGMb%J-Aj3~hTDd3&^X-FWQCUc$O zD^{`=-e)P4O}@peWD$A`Fv(5$Wz-pLhd%I)oTc+!(22C)zd8_*B`9#mEoOX#P8U9pRtZn>-*K6+4eI|6~!fjTPRf$5rUTx-v2wu-77H+6! zTTnEEH`)H}z`+ROac(S<4j@PZQ&obCHbfkP$54`?^|3!F91Rww(zEnr{v4{k^| z+nzPf0Dg2C1?L<1g*N5Z?_cPbo-r!LVguM-?;`i^wtUUXoo{hYY#tr)1=byIVQhW- zrs!LrMYX=O_iP;OP*lJsWK(^;K z2?EQxzLyi5*>Dp=XSqOfVscRb%V}O#(=8I-JA0!|99b^4xnnUGFUIK*Zl6hX7aQ2& z!d(Hdl?EeqAMeck)b{KCk>~||bR`qLxv{CHAnhv5w+1vh_w#zPO-%#m@C`di${Mj*+(_6<{Kg7tVIY5!) z!~SjiY2Z3^wF07mLUBpY%^FAZ$1fDVkRfmhuP1`;B1xnsh9|_)PmfQ~^O)AOUnB1ysSAkphSy z>Q_ZX5kW-o{|1xI9~7OCYzF)jT%Lnj`y1-89)FJ!iHBhu$l;izT==9P?zrAT-(;Z> z+<#ijwf+W7hSOu+heRCw&nQ8P5E@IxcZsHY=6Fd`5Fw6zD5T;rIrA{qwNm7?JAx5> z*mW5wT#B486-4!z%(N|KphL+M7wca8!B&mR*S&>Qjmie2x+}FU`}LzBPb8eeMvfYOt)>ZRlXby;@KypiSaY)$L?Yh_BYmWS1AHcP&p?Hc>;!2*#Vv1c8R{!jVG z8JDdlIBxJvIj}@Ka|Yg%ofVT7^V~KT<4^fN=NJ1k(Lx2&sw5eS#W1mnL=U0dj;!{& zib|h@RM=^-31%dhuJrvrB;i;R%>wm9VhOZcwM3a;R!~Qa1=zsrDdS`Vtf7sSE74w; z9odF7%8(_(1cU~mz9G$W1d#C(5#ebvu5##q6)CM(A1y2`u}d;4;L0HODCU3x+raJQ zc6YnF*jn%F_~8b53BR$P0kL*5g>pm)1`_YS9S%76z6pTe!qdnqkDpUT)&E z4(0c(g+E+F5U`_5K9)nX%~4V=_;q zsMB#7SZ%d&*SeVNZ6dW4HGP=P|Fc{%iB!+jhfkglh|>t@;+VP=JI5xJuE<1PXmSei zgp4!hE^orOBBduVI1@ej#XUerh6#O_(BE2i{vt0E7Y=IuUixz!0nTe7Avq@%4H$c5Vfhmt*xGr+FBBDxYo9(`=N=op@T%tg535NjC~`@r$9(N z#0Hkzau&%a;So7X+sFr3sQvlVnG#p^;f&QQ{p)4BmF@Ed7nQd(UhzD1mRppByGTGC zCqiQyl9GKCEcBk*FReC9H#rM9vlI*}^oj9(1|+C*|9M2nG3)UIIhJNtZZ(8{*M^3w zYxQN#f2?euTi;wnybwOqx{hr8PKW6|@{(G=3fXQVqATd}pus&^N`ipjq$LrCiiTHn z-r|W5-D%<7eW{>wja)b|fAUmbf_W9l{!55j{YEEPEANVF0j5v=uDe(Vg zb4IDV1k0gKO6-XtZ2R^;+~Cv$halwN#N}Y)If&QoYNTRU=<(i#`U|nd>SOa;x?&qg z!<;p9857ZUL6iAJsNl+B%X!FDAttHG z2MqiEc3v|SxZ2Lz(v%yJYI9rMkbd~G=PdTai%cDivskk#u~W^+NbeF}=A)D>SNv2( z+~0WGxwUtXM<3a9*Rw#7%3seU6#17|Cf{C&`}nkab6{xqy)*MCa;7SD8zxxgMEyyv z?=$FUZ0xhgP^O)@P2Sv-x|hBhy13sYqri;--e__{Me$mro0%Zi`)izU@O+~WMA+$-e-uqCzN&BO8Anv)=fMzUxWYa#Ad z^C==L7vk|7t2Gi73-4XiD$hP8EUH z;O|t$nVG=OMPPA*J5n)9vD3Qei5wv;>L2s&5L65N(H7$h-9s!zJ8WZISvomPKcg*G zHdi!Qt^5}P7qnXN;M!x3*1=PDhi`D1Yb|Rn#jO{ZIFXv_6fmNzDzL-R3o&Xm2G#;H zN~+*3uFGBA*xZ_y3{D?L7cK0GPfS|aifw}-e!kC{YlzaJog@#+kUazv4lC5fNF@)C ztN6fh1@VFc9=<9}Kikm>K#2M{+G(MBL0W=@c7eTixe*91VYl_nOzWdTQ&6OBKUg9? zziLy?@mkd?{g;LH5 zc$>~8o{!Xe{fc;@wUJBlDk!0=u4dAc082U4jf(hu=6h{}BmKX{%>C*E#hU@ei@}h< z-5Q04xb;hHpVSo8!uh#{CKDX;ZX7^ES$0!skaChEh#QCsh+oxrE>##nOCZ-oC7~kT0@QuaPoRs8C#p zz!Lk;G1%5flzz`UJA(`%CO8$0OxsCJ>6D!zXp_E~K!TRYlPNQe7dqKc1|{@f-!-v$=jHf52wn$^G;OzCNGpF#+Ua8dDExrfHUlfvSaJlVIWI#vU@ll~zPe$2`{y za~Q2=G#c7@=DX$F4HCa+(8pJ2(d*SJ{4`ofbjL!;6_bNR-lPJZPn?NW(ESpltfaHq z-;A`!J6rasU*OxEZ0bWsGP*PZjD+1-eeOfTFHE+8s6+yP7QQ{>7bm|E)Kj+*oEl61 z?1mceb|4Sc&|wr%ZPMs9+wMB@SDx_}V!WCzob5kpb~qE0a+RwCC9qB`++jnW-d1$88yzWKR*M zUMtIu_2J}mhTC;JA_3g>_BOE;dh|Ke8`I?o>ovxXms~RiP4j{HsQFdaqQZc(x6a@( zn!JhdsbRj_y{BEx2x4p@w+s0T8hWzXkv!UU^GKxtW!%~0n$kwc^SCnGO7G)Hbosy8?n3q!L1F_K@60aRjTx=);A5L)vs-y*)wr=R7fzIPywFgU-BUH<&E=~e Nw3%)nk%q4z{|~_TL5BbU diff --git a/libandroid-navigation/src/test/resources/navigation.json b/libandroid-navigation/src/test/resources/navigation.json deleted file mode 100644 index 34db5a96..00000000 --- a/libandroid-navigation/src/test/resources/navigation.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"cmyagAxeonhFbl@_H`v@_JrZsDnZoD`LreBnElr@bBrWlBxYxAdU`IpnAD`@B`@zKvdB`LveBxDtl@\\lFd@hHrBr[ZzEf@pHjC[hn@qH`CYzC_@lBUho@wHhDc@bD_@jW}C`Fm@fOgBlDc@~C_@`W{CdW{CzC_@|C_@hW{CxVyCjDc@rC]ho@wH`D_@zC_@hW}CdW{CzC]~Ca@dW{Cj\\_E|AQzXeD|Ek@nIcAxJmAfEg@xUsCjW{C|C_@pC]v[yDtR_CdD_@zC_@f]cEfQuBvDe@tH}@tn@sHl[wD`R{BxH}@t@rEnBlZjDfi@z@|MZrEZ~ElB|YxGxcAfExp@r@vKbDng@~KpeBvFz{@|@bNjBvYd\\{D`\\{Dd\\{D~[{Df\\{Dd\\}D~[yD`\\{DdG`_AzCre@bLveBbL|eBpGnbA","legs":[{"summary":"Sacramento Street, Grove Street","weight":1565.3,"duration":1185.5,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[171],"location":[-122.413165,37.795042]},{"out":1,"in":3,"entry":[true,true,false,false],"bearings":[75,165,255,345],"location":[-122.413021,37.79432]},{"out":1,"in":3,"entry":[true,true,false,false],"bearings":[75,165,255,345],"location":[-122.412845,37.793439]}],"driving_side":"right","geometry":"cmyagAxeonhFbl@_H`v@_JrZsDnZoD","mode":"driving","maneuver":{"bearing_after":171,"bearing_before":0,"location":[-122.413165,37.795042],"type":"depart","instruction":"Head south on Taylor Street"},"weight":100.80000000000001,"duration":88,"name":"Taylor Street","distance":279.8},{"intersections":[{"out":2,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.412667,37.792557]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.414309,37.792348]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.415955,37.792139]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.4176,37.79193]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.419245,37.791722]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.420889,37.791513]}],"driving_side":"right","geometry":"yqtagAtfnnhF`LreBnElr@bBrWlBxYxAdU`IpnAD`@B`@zKvdB`LveBxDtl@\\lFd@hHrBr[ZzE","mode":"driving","maneuver":{"bearing_after":260,"bearing_before":170,"location":[-122.412667,37.792557],"modifier":"right","type":"turn","instruction":"Turn right onto Sacramento Street"},"weight":313,"duration":276.4,"name":"Sacramento Street","distance":871.5},{"intersections":[{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.422456,37.791314]},{"out":1,"in":0,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.422609,37.791294]},{"out":0,"in":1,"entry":[true,false],"bearings":[165,345],"location":[-122.422595,37.791224]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.422429,37.790402]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.422413,37.790324]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.422228,37.789411]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.42204,37.788479]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.421852,37.787549]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.421663,37.786614]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.421476,37.785686]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[165,255,345],"location":[-122.421381,37.785219]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.421288,37.784754]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.421097,37.783817]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.42091,37.782888]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.420722,37.781954]},{"out":1,"in":3,"entry":[false,true,false,false],"bearings":[75,165,255,345],"location":[-122.420534,37.781023]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[90,165,255,345],"location":[-122.420342,37.780077]}],"driving_side":"right","geometry":"cdragAnjaohFf@pHjC[hn@qH`CYzC_@lBUho@wHhDc@bD_@jW}C`Fm@fOgBlDc@~C_@`W{CdW{CzC_@|C_@hW{CxVyCjDc@rC]ho@wH`D_@zC_@hW}CdW{CzC]~Ca@dW{Cj\\_E|AQzXeD|Ek@nIcAxJmAfEg@xUsCjW{C|C_@pC]v[yDtR_CdD_@zC_@f]cEfQuBvDe@tH}@tn@sHl[wD`R{BxH}@","mode":"driving","maneuver":{"bearing_after":260,"bearing_before":260,"location":[-122.422456,37.791314],"modifier":"left","type":"turn","instruction":"Turn left onto Lincoln Highway (Third Generation) (US 101 South)"},"ref":"US 101 South","weight":506.6,"duration":270.20000000000005,"name":"Lincoln Highway (Third Generation) (US 101 South)","distance":1483.8},{"intersections":[{"out":2,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.419972,37.778242]},{"out":2,"in":0,"entry":[false,false,true,true],"bearings":[75,165,255,345],"location":[-122.421538,37.778029]},{"out":2,"in":0,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.423182,37.777819]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.424831,37.777611]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.426472,37.777403]}],"driving_side":"right","geometry":"csx`gAfo|nhFt@rEnBlZjDfi@z@|MZrEZ~ElB|YxGxcAfExp@r@vKbDng@~KpeBvFz{@|@bNjBvY","mode":"driving","maneuver":{"bearing_after":258,"bearing_before":170,"location":[-122.419972,37.778242],"modifier":"right","type":"turn","instruction":"Turn right onto Grove Street"},"weight":320.1,"duration":263.20000000000005,"name":"Grove Street","distance":725.5},{"intersections":[{"out":1,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.428116,37.777194]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.428022,37.776727]},{"out":1,"in":3,"entry":[true,true,true,false],"bearings":[75,165,255,345],"location":[-122.427928,37.776262]},{"out":1,"in":3,"entry":[true,true,true,false],"bearings":[75,165,255,345],"location":[-122.427834,37.775795]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[75,165,255,345],"location":[-122.42774,37.775331]},{"out":1,"in":3,"entry":[true,true,false,false],"bearings":[75,165,255,345],"location":[-122.427646,37.774863]},{"out":1,"in":3,"entry":[true,true,false,false],"bearings":[75,165,255,345],"location":[-122.427551,37.774396]},{"out":1,"in":3,"entry":[true,true,true,false],"bearings":[75,165,255,345],"location":[-122.427458,37.773932]}],"driving_side":"right","geometry":"sqv`gAfllohFd\\{D`\\{Dd\\{D~[{Df\\{Dd\\}D~[yD`\\{D","mode":"driving","maneuver":{"bearing_after":170,"bearing_before":260,"location":[-122.428116,37.777194],"modifier":"left","type":"turn","instruction":"Turn left onto Buchanan Street"},"weight":206.09999999999997,"duration":169.1,"name":"Buchanan Street","distance":419.8},{"intersections":[{"out":2,"in":3,"entry":[true,true,true,false],"bearings":[75,165,255,345],"location":[-122.427364,37.773467]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.429007,37.773258]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.430651,37.773048]},{"out":2,"in":0,"entry":[false,true,true,true],"bearings":[75,165,255,345],"location":[-122.432298,37.772838]}],"driving_side":"right","geometry":"uho`gAf}johFdG`_AzCre@bLveBbL|eBpGnbA","mode":"driving","maneuver":{"bearing_after":260,"bearing_before":170,"location":[-122.427364,37.773467],"modifier":"right","type":"turn","instruction":"Turn right onto Page Street"},"weight":118.7,"duration":118.59999999999998,"name":"Page Street","distance":535.6},{"intersections":[{"in":0,"entry":[true],"bearings":[81],"location":[-122.433378,37.772701]}],"driving_side":"right","geometry":"yxm`gAbuvohF","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":261,"location":[-122.433378,37.772701],"type":"arrive","instruction":"You have arrived at your destination"},"weight":0,"duration":0,"name":"Page Street","distance":0}],"distance":4315.9}],"weight_name":"routability","weight":1565.3,"duration":1185.5,"distance":4315.9}],"waypoints":[{"name":"Taylor Street","location":[-122.413165,37.795042]},{"name":"Page Street","location":[-122.433378,37.772701]}],"code":"Ok","uuid":"cjhs6f42418lv3ppbao4rnht9"} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/reroute.json b/libandroid-navigation/src/test/resources/reroute.json deleted file mode 100644 index b2cafe8f..00000000 --- a/libandroid-navigation/src/test/resources/reroute.json +++ /dev/null @@ -1,355 +0,0 @@ -{ - "locations": [{ - "lng": 11.579233823791801, - "horizontalAccuracy": 40, - "course": 277.0355517432898, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.1776966801359, - "altitude": 0, - "timestamp": "2018-06-25T18:16:11.005+0000" - }, { - "lng": 11.579037109773616, - "horizontalAccuracy": 40, - "course": 277.3048420107052, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.17771306903845, - "altitude": 0, - "timestamp": "2018-06-25T18:16:12.026+0000" - }, { - "lng": 11.578840471720559, - "horizontalAccuracy": 40, - "course": 277.30469546363236, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.17772987732808, - "altitude": 0, - "timestamp": "2018-06-25T18:16:13.038+0000" - }, { - "lng": 11.578643833538571, - "horizontalAccuracy": 40, - "course": 277.3045489263966, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.17774668528237, - "altitude": 0, - "timestamp": "2018-06-25T18:16:14.064+0000" - }, { - "lng": 11.578447195227648, - "horizontalAccuracy": 40, - "course": 277.30440238753647, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.1777634929013, - "altitude": 0, - "timestamp": "2018-06-25T18:16:15.072+0000" - }, { - "lng": 11.578250556787797, - "horizontalAccuracy": 40, - "course": 277.30425584242937, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.177780300184864, - "altitude": 0, - "timestamp": "2018-06-25T18:16:16.084+0000" - }, { - "lng": 11.57805391821902, - "horizontalAccuracy": 40, - "course": 277.30410931764175, - "verticalAccuracy": 10, - "speed": 14.704089336389941, - "lat": 48.17779710713307, - "altitude": 0, - "timestamp": "2018-06-25T18:16:17.099+0000" - }, { - "lng": 11.577857279521318, - "horizontalAccuracy": 40, - "course": 277.3039627829298, - "verticalAccuracy": 10, - "speed": 14.706585219942085, - "lat": 48.17781391374592, - "altitude": 0, - "timestamp": "2018-06-25T18:16:18.125+0000" - }, { - "lng": 11.577660607317055, - "horizontalAccuracy": 40, - "course": 277.3038162095172, - "verticalAccuracy": 10, - "speed": 14.706585219942085, - "lat": 48.1778307228761, - "altitude": 0, - "timestamp": "2018-06-25T18:16:19.152+0000" - }, { - "lng": 11.577463934983832, - "horizontalAccuracy": 40, - "course": 277.3036696400822, - "verticalAccuracy": 10, - "speed": 14.706585219942085, - "lat": 48.17784753167082, - "altitude": 0, - "timestamp": "2018-06-25T18:16:20.165+0000" - }, { - "lng": 11.577267262521646, - "horizontalAccuracy": 40, - "course": 277.3035230828386, - "verticalAccuracy": 10, - "speed": 14.706585219942085, - "lat": 48.17786434013005, - "altitude": 0, - "timestamp": "2018-06-25T18:16:21.175+0000" - }, { - "lng": 11.577070589930504, - "horizontalAccuracy": 40, - "course": 277.3033765175093, - "verticalAccuracy": 10, - "speed": 14.706585219942085, - "lat": 48.17788114825381, - "altitude": 0, - "timestamp": "2018-06-25T18:16:22.195+0000" - }, { - "lng": 11.574359352291717, - "horizontalAccuracy": 48, - "course": 268.312124335552, - "verticalAccuracy": 78.20085144042969, - "speed": 17.91221046447754, - "lat": 48.177918933802175, - "altitude": 48.968618182176954, - "timestamp": "2018-06-25T18:16:22.994+0000" - }, { - "lng": 11.576873917210403, - "horizontalAccuracy": 40, - "course": 278.450736782001, - "verticalAccuracy": 10, - "speed": 14.706585219942085, - "lat": 48.177897956042095, - "altitude": 0, - "timestamp": "2018-06-25T18:16:23.214+0000" - }, { - "lng": 11.574522629071382, - "horizontalAccuracy": 48, - "course": 264.0482831235232, - "verticalAccuracy": 46.24095916748047, - "speed": 17.91221046447754, - "lat": 48.17801775561044, - "altitude": 145.58279171356196, - "timestamp": "2018-06-25T18:16:23.994+0000" - }, { - "lng": 11.574331268061316, - "horizontalAccuracy": 48, - "course": 268.1751927030716, - "verticalAccuracy": 32.8426399230957, - "speed": 15.196555137634277, - "lat": 48.17804684917256, - "altitude": 221.20309180182414, - "timestamp": "2018-06-25T18:16:24.994+0000" - }, { - "lng": 11.56516, - "horizontalAccuracy": 40, - "course": 0, - "verticalAccuracy": 10, - "speed": 30, - "lat": 48.17766000000002, - "altitude": 0, - "timestamp": "2018-06-25T18:16:25.487+0000" - }, { - "lng": 11.574178106389212, - "horizontalAccuracy": 48, - "course": 270.8357153093317, - "verticalAccuracy": 26.84093475341797, - "speed": 14.339875221252441, - "lat": 48.178080277991555, - "altitude": 280.8462253177666, - "timestamp": "2018-06-25T18:16:25.994+0000" - }, { - "lng": 11.574008059553593, - "horizontalAccuracy": 32, - "course": 270.5562786100081, - "verticalAccuracy": 22.006803512573242, - "speed": 13.635870933532715, - "lat": 48.17809862228263, - "altitude": 328.0323720022608, - "timestamp": "2018-06-25T18:16:26.994+0000" - }, { - "lng": 11.57386211241843, - "horizontalAccuracy": 32, - "course": 270.3645415396275, - "verticalAccuracy": 18.102466583251953, - "speed": 8.865394592285156, - "lat": 48.17810865942336, - "altitude": 365.45081994813916, - "timestamp": "2018-06-25T18:16:27.994+0000" - }, { - "lng": 11.57376567902112, - "horizontalAccuracy": 32, - "course": 270.5847741592254, - "verticalAccuracy": 14.9990873336792, - "speed": 8.865394592285156, - "lat": 48.17811604817344, - "altitude": 395.29102788875264, - "timestamp": "2018-06-25T18:16:28.996+0000" - }, { - "lng": 11.573712332853994, - "horizontalAccuracy": 32, - "course": 268.90924679355123, - "verticalAccuracy": 12.552094459533691, - "speed": 6.171590328216553, - "lat": 48.17812282827704, - "altitude": 419.11699633027285, - "timestamp": "2018-06-25T18:16:29.996+0000" - }, { - "lng": 11.57367408373014, - "horizontalAccuracy": 32, - "course": 267.3676457771227, - "verticalAccuracy": 10.65554141998291, - "speed": 4.660297870635986, - "lat": 48.17812949968013, - "altitude": 438.10093661880165, - "timestamp": "2018-06-25T18:16:30.997+0000" - }, { - "lng": 11.573650791666006, - "horizontalAccuracy": 32, - "course": 265.38418616290767, - "verticalAccuracy": 9.199372291564941, - "speed": 1.1029866933822632, - "lat": 48.17813414073155, - "altitude": 453.3387505254847, - "timestamp": "2018-06-25T18:16:31.997+0000" - }, { - "lng": 11.573651032411707, - "horizontalAccuracy": 32, - "course": 264.96953903877454, - "verticalAccuracy": 8.089214324951172, - "speed": 0.24953123927116394, - "lat": 48.178135350891466, - "altitude": 465.50988790699057, - "timestamp": "2018-06-25T18:16:32.997+0000" - }, { - "lng": 11.57366355967202, - "horizontalAccuracy": 16, - "course": 264.6807313199097, - "verticalAccuracy": 7.259465217590332, - "speed": 0.08760471642017365, - "lat": 48.17813549408713, - "altitude": 475.2478246602212, - "timestamp": "2018-06-25T18:16:33.997+0000" - }, { - "lng": 11.573666459152962, - "horizontalAccuracy": 16, - "course": 264.40372616793064, - "verticalAccuracy": 6.654788017272949, - "speed": 0.06893076002597809, - "lat": 48.178135725029186, - "altitude": 483.0984814692704, - "timestamp": "2018-06-25T18:16:34.997+0000" - }, { - "lng": 11.573665270949899, - "horizontalAccuracy": 16, - "course": 264.0772704463607, - "verticalAccuracy": 6.2912917137146, - "speed": 0.04840405657887459, - "lat": 48.17813554458974, - "altitude": 489.4621804169076, - "timestamp": "2018-06-25T18:16:35.998+0000" - }, { - "lng": 11.57366498578763, - "horizontalAccuracy": 16, - "course": 262.7757095981231, - "verticalAccuracy": 6.068527698516846, - "speed": 0.538252055644989, - "lat": 48.17813584106783, - "altitude": 494.632077626026, - "timestamp": "2018-06-25T18:16:36.998+0000" - }, { - "lng": 11.57365252827095, - "horizontalAccuracy": 16, - "course": 264.68313554649757, - "verticalAccuracy": 5.916316509246826, - "speed": 0.538252055644989, - "lat": 48.178129500360306, - "altitude": 498.6311698715431, - "timestamp": "2018-06-25T18:16:37.998+0000" - }, { - "lng": 11.573622826101186, - "horizontalAccuracy": 16, - "course": 262.68096121395666, - "verticalAccuracy": 5.802955627441406, - "speed": 1.4058953523635864, - "lat": 48.178127452657506, - "altitude": 501.79815496262916, - "timestamp": "2018-06-25T18:16:38.998+0000" - }, { - "lng": 11.573593990589218, - "horizontalAccuracy": 16, - "course": 261.5483246042718, - "verticalAccuracy": 5.709236145019531, - "speed": 2.158074378967285, - "lat": 48.17812510064344, - "altitude": 504.3031565362038, - "timestamp": "2018-06-25T18:16:39.998+0000" - }, { - "lng": 11.573570600866708, - "horizontalAccuracy": 16, - "course": 262.657110193375, - "verticalAccuracy": 5.625188827514648, - "speed": 2.158074378967285, - "lat": 48.17812390326735, - "altitude": 506.29452861168886, - "timestamp": "2018-06-25T18:16:40.998+0000" - }, { - "lng": 11.573544222281482, - "horizontalAccuracy": 16, - "course": 262.5914037735595, - "verticalAccuracy": 5.543359279632568, - "speed": 2.087489366531372, - "lat": 48.178122375982795, - "altitude": 507.8819353829481, - "timestamp": "2018-06-25T18:16:41.998+0000" - }, { - "lng": 11.573522864491215, - "horizontalAccuracy": 16, - "course": 263.9457756444597, - "verticalAccuracy": 5.4844794273376465, - "speed": 1.5718590021133423, - "lat": 48.17812073885602, - "altitude": 509.1104736675136, - "timestamp": "2018-06-25T18:16:42.998+0000" - }, { - "lng": 11.573514355033776, - "horizontalAccuracy": 16, - "course": 260.36009025474306, - "verticalAccuracy": 5.441601753234863, - "speed": 0.6080191135406494, - "lat": 48.178121038726324, - "altitude": 510.08266092409417, - "timestamp": "2018-06-25T18:16:43.998+0000" - }, { - "lng": 11.573509069339542, - "horizontalAccuracy": 16, - "course": 258.3632707905115, - "verticalAccuracy": 5.428653240203857, - "speed": 0.057707976549863815, - "lat": 48.17812058973181, - "altitude": 510.8631459842678, - "timestamp": "2018-06-25T18:16:44.998+0000" - }, { - "lng": 11.573520048732512, - "horizontalAccuracy": 16, - "course": 257.633642662614, - "verticalAccuracy": 5.434919357299805, - "speed": 0.005837027449160814, - "lat": 48.178126701948436, - "altitude": 511.493896722867, - "timestamp": "2018-06-25T18:16:45.998+0000" - }, { - "lng": 11.573521553454881, - "horizontalAccuracy": 16, - "course": 257.14487432560793, - "verticalAccuracy": 5.454024791717529, - "speed": 0.015429791994392872, - "lat": 48.17812728496367, - "altitude": 511.9823615713549, - "timestamp": "2018-06-25T18:16:46.999+0000" - }], - "route": "https://api.mapbox.com/directions/v5/mapbox/driving-traffic/11.579233823791801,48.1776966801359;11.573521553454881,48.17812728496367.json?access_token=pk.eyJ1IjoibWFwYm94LW5hdmlnYXRpb24iLCJhIjoiY2plZzkxZnl4MW9tZDMzb2R2ZXlkeHlhbCJ9.L1c9Wo-gk6d3cR3oi1n9SQ&steps=true&overview=full&geometries=geojson" -} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/single_intersection.json b/libandroid-navigation/src/test/resources/single_intersection.json deleted file mode 100644 index 585396d7..00000000 --- a/libandroid-navigation/src/test/resources/single_intersection.json +++ /dev/null @@ -1 +0,0 @@ -{"routes":[{"geometry":"uvac_Azcz~`EZuhj@","legs":[{"summary":"Adams Street","weight":1137.3,"duration":568.5,"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[90],"location":[-101.70939,33.621371]},{"out":1,"in":3,"entry":[true,true,true,false],"bearings":[0,90,180,270],"location":[-101.697066,33.621352]}],"driving_side":"right","geometry":"uvac_Azcz~`Ed@gaWImfR","mode":"driving","maneuver":{"bearing_after":90,"bearing_before":0,"location":[-101.70939,33.621371],"modifier":"left","type":"depart","instruction":"Head east on Adams Street"},"weight":1137.3000000000002,"duration":568.5,"name":"Adams Street","distance":2053.5},{"intersections":[{"in":0,"entry":[true],"bearings":[270],"location":[-101.687219,33.621357]}],"driving_side":"right","geometry":"yuac_Adzn}`E","mode":"driving","maneuver":{"bearing_after":0,"bearing_before":90,"location":[-101.687219,33.621357],"type":"arrive","instruction":"You have arrived at your destination"},"weight":0,"duration":0,"name":"Adams Street","distance":0}],"distance":2053.5}],"weight_name":"routability","weight":1137.3,"duration":568.5,"distance":2053.5}],"waypoints":[{"name":"Adams Street","location":[-101.70939,33.621371]},{"name":"Adams Street","location":[-101.687219,33.621357]}],"code":"Ok","uuid":"cjhs6f4nc25wp3poaj6yazlxz"} \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/test.gpx b/libandroid-navigation/src/test/resources/test.gpx deleted file mode 100644 index 27cf92b0..00000000 --- a/libandroid-navigation/src/test/resources/test.gpx +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Garmin International - - - - - Example GPX Document - - - 4.46 - - - - 4.94 - - - - 6.87 - - - - - \ No newline at end of file diff --git a/libandroid-navigation/src/test/resources/test_invalid.gpx b/libandroid-navigation/src/test/resources/test_invalid.gpx deleted file mode 100644 index 49527655..00000000 --- a/libandroid-navigation/src/test/resources/test_invalid.gpx +++ /dev/null @@ -1,4919 +0,0 @@ - - - - - - - 2015-04-05T12:33:42Z - - 0 - - - - 34.0 - 2015-04-05T12:33:48Z - - 0 - - - - 44.0 - 2015-04-05T12:33:56Z - - 2.37836508857840289721252702292986214160919189453125 - - - - 47.0 - 2015-04-05T12:34:10Z - - 1.470284415275907807796329507254995405673980712890625 - - - - 42.0 - 2015-04-05T12:34:23Z - - 1.5537107775601610715199285550625063478946685791015625 - - - - 41.0 - 2015-04-05T12:34:37Z - - 1.5694173896682086510878662011236883699893951416015625 - - - - 41.0 - 2015-04-05T12:34:46Z - - 1.4887607411448586791635761983343400061130523681640625 - - - - 37.0 - 2015-04-05T12:34:59Z - - 1.3490901619078552453601105298730544745922088623046875 - - - - 34.0 - 2015-04-05T12:35:09Z - - 1.546521191254912164225743254064582288265228271484375 - - - - 39.0 - 2015-04-05T12:35:22Z - - 1.4824014595606735955612975885742343962192535400390625 - - - - 39.0 - 2015-04-05T12:35:39Z - - 1.39865034092600470927436617785133421421051025390625 - - - - 40.0 - 2015-04-05T12:35:54Z - - 1.1098178111916696675365301416604779660701751708984375 - - - - 42.0 - 2015-04-05T12:36:07Z - - 1.1823119233830248209216051691328175365924835205078125 - - - - 45.0 - 2015-04-05T12:36:25Z - - 1.3819523932818980060943658827454783022403717041015625 - - - - 47.0 - 2015-04-05T12:36:41Z - - 1.5745462195452153419950036550289951264858245849609375 - - - - 45.0 - 2015-04-05T12:36:55Z - - 1.3086592319168952602836952792131341993808746337890625 - - - - 40.0 - 2015-04-05T12:37:13Z - - 0.974230421980040173224324462353251874446868896484375 - - - - 40.0 - 2015-04-05T12:37:30Z - - 1.4283713740286805293777661063359118998050689697265625 - - - - 40.0 - 2015-04-05T12:37:40Z - - 1.5286871514484643430620280923903919756412506103515625 - - - - 40.0 - 2015-04-05T12:37:53Z - - 1.187863408730079672892543385387398302555084228515625 - - - - 39.0 - 2015-04-05T12:38:10Z - - 1.37533173491679061584136434248648583889007568359375 - - - - 39.0 - 2015-04-05T12:38:23Z - - 1.276693986789774637458094730391167104244232177734375 - - - - 39.0 - 2015-04-05T12:38:36Z - - 1.363140696298704934719125958508811891078948974609375 - - - - 37.0 - 2015-04-05T12:38:54Z - - 1.31243867897500532393451067036949098110198974609375 - - - - 37.0 - 2015-04-05T12:39:12Z - - 1.007319149883700415415432871668599545955657958984375 - - - - 28.0 - 2015-04-05T12:39:30Z - - 1.8023210716449906687586235420894809067249298095703125 - - - - 30.0 - 2015-04-05T12:39:43Z - - 1.19504184345927644272933321190066635608673095703125 - - - - 33.0 - 2015-04-05T12:39:55Z - - 1.4754967383320101159682735669775865972042083740234375 - - - - 37.0 - 2015-04-05T12:40:05Z - - 1.995187767355447672201762543409131467342376708984375 - - - - 41.0 - 2015-04-05T12:40:16Z - - 1.97599012712260968527289151097647845745086669921875 - - - - 42.0 - 2015-04-05T12:40:29Z - - 1.431015920949047615096105801058001816272735595703125 - - - - 43.0 - 2015-04-05T12:40:42Z - - 1.498758480541284132669943574001081287860870361328125 - - - - 44.0 - 2015-04-05T12:40:55Z - - 1.23399337620228077838646640884689986705780029296875 - - - - 44.0 - 2015-04-05T12:41:14Z - - 1.3569982548255794529978857099195010960102081298828125 - - - - 45.0 - 2015-04-05T12:41:31Z - - 1.398008339286504142506828429759480059146881103515625 - - - - 43.0 - 2015-04-05T12:41:51Z - - 1.1439298744895116666242529390729032456874847412109375 - - - - 41.0 - 2015-04-05T12:42:02Z - - 1.475845568820806530396794187254272401332855224609375 - - - - 41.0 - 2015-04-05T12:42:16Z - - 1.2487897608488245371205493938759900629520416259765625 - - - - 42.0 - 2015-04-05T12:42:33Z - - 1.53075169743472461192368427873589098453521728515625 - - - - 46.0 - 2015-04-05T12:42:49Z - - 1.0341452820492327280277322643087245523929595947265625 - - - - 45.0 - 2015-04-05T12:43:03Z - - 1.305498455352941622464868487440980970859527587890625 - - - - 44.0 - 2015-04-05T12:43:17Z - - 1.348667399019917834124271394102834165096282958984375 - - - - 47.0 - 2015-04-05T12:43:27Z - - 1.936836396489133971243745691026560962200164794921875 - - - - 42.0 - 2015-04-05T12:43:40Z - - 1.268937880589948719034509849734604358673095703125 - - - - 42.0 - 2015-04-05T12:43:54Z - - 1.2488558283600592613282742604496888816356658935546875 - - - - 40.0 - 2015-04-05T12:44:13Z - - 1.4645471446785893743225415164488367736339569091796875 - - - - 40.0 - 2015-04-05T12:44:22Z - - 1.4072161786952592787969251730828545987606048583984375 - - - - 43.0 - 2015-04-05T12:44:40Z - - 1.3756139724356450937392537525738589465618133544921875 - - - - 42.0 - 2015-04-05T12:44:55Z - - 1.2551578799501090788481860727188177406787872314453125 - - - - 40.0 - 2015-04-05T12:45:11Z - - 1.178607522586194722435948278871364891529083251953125 - - - - 39.0 - 2015-04-05T12:45:29Z - - 1.0683319034345106768313371503609232604503631591796875 - - - - 43.0 - 2015-04-05T12:45:49Z - - 1.4939588186840364603114039709907956421375274658203125 - - - - 41.0 - 2015-04-05T12:46:03Z - - 1.491111802403331854094403752242214977741241455078125 - - - - 45.0 - 2015-04-05T12:46:10Z - - 1.6433343754403022529686495545320212841033935546875 - - - - 43.0 - 2015-04-05T12:46:22Z - - 1.2336495278891981275393163741682656109333038330078125 - - - - 42.0 - 2015-04-05T12:46:36Z - - 1.6445224144666441556950076119392178952693939208984375 - - - - 43.0 - 2015-04-05T12:46:54Z - - 1.5084079647103394439255907855113036930561065673828125 - - - - 44.0 - 2015-04-05T12:47:02Z - - 1.6173824574658863806320141520700417459011077880859375 - - - - 49.0 - 2015-04-05T12:47:22Z - - 1.2694704888650825136409139304305426776409149169921875 - - - - 55.0 - 2015-04-05T12:47:33Z - - 1.6796032952307962116123007945134304463863372802734375 - - - - 59.0 - 2015-04-05T12:47:44Z - - 1.2285224579635685149270329930004663765430450439453125 - - - - 53.0 - 2015-04-05T12:47:55Z - - 1.206435859831834545019546567345969378948211669921875 - - - - 47.0 - 2015-04-05T12:48:12Z - - 1.53255381680049485026984257274307310581207275390625 - - - - 51.0 - 2015-04-05T12:48:29Z - - 1.3046907648566248294486058512120507657527923583984375 - - - - 49.0 - 2015-04-05T12:48:45Z - - 1.201310772291205974937611244968138635158538818359375 - - - - 45.0 - 2015-04-05T12:48:53Z - - 0.5272266449584421810214962533791549503803253173828125 - - - - 40.0 - 2015-04-05T12:49:32Z - - 0.61468042947634404793433304803329519927501678466796875 - - - - 42.0 - 2015-04-05T12:49:43Z - - 1.0466785698855269881590857039554975926876068115234375 - - - - 43.0 - 2015-04-05T12:50:01Z - - 1.383912842369111384499547057203017175197601318359375 - - - - 41.0 - 2015-04-05T12:50:13Z - - 1.3182108126973106632107146651833318173885345458984375 - - - - 41.0 - 2015-04-05T12:50:20Z - - 1.143227734860059019439404437434859573841094970703125 - - - - 45.0 - 2015-04-05T12:50:32Z - - 0.76060481948469471635831951061845757067203521728515625 - - - - 43.0 - 2015-04-05T12:50:45Z - - 1.5091167417476596401826327564776875078678131103515625 - - - - 37.0 - 2015-04-05T12:50:57Z - - 2.764227614931786813912140132742933928966522216796875 - - - - 31.0 - 2015-04-05T12:51:07Z - - 3.105980862696436251013665241771377623081207275390625 - - - - 29.0 - 2015-04-05T12:51:13Z - - 3.308559388311345994537759906961582601070404052734375 - - - - 38.0 - 2015-04-05T12:51:21Z - - 4.089611605569142938065851922146975994110107421875 - - - - 47.0 - 2015-04-05T12:51:31Z - - 4.3330499228488807972325957962311804294586181640625 - - - - 45.0 - 2015-04-05T12:51:38Z - - 3.122742746202492813978324193158186972141265869140625 - - - - 38.0 - 2015-04-05T12:51:46Z - - 2.99105864967943180232623490155674517154693603515625 - - - - 43.0 - 2015-04-05T12:51:59Z - - 3.41058661198227586197617711150087416172027587890625 - - - - 48.0 - 2015-04-05T12:52:07Z - - 4.43296770073009138712905041757039725780487060546875 - - - - 48.0 - 2015-04-05T12:52:12Z - - 2.48992313618678284825591617845930159091949462890625 - - - - 44.0 - 2015-04-05T12:52:20Z - - 3.14784149161743886935482805711217224597930908203125 - - - - 43.0 - 2015-04-05T12:52:27Z - - 1.450780379555042021166855192859657108783721923828125 - - - - 40.0 - 2015-04-05T12:52:43Z - - 1.0668690662578679262395553450915031135082244873046875 - - - - 33.0 - 2015-04-05T12:52:58Z - - 1.2619867809074165609928286357899196445941925048828125 - - - - 36.0 - 2015-04-05T12:53:06Z - - 2.33668461118409620524971614941023290157318115234375 - - - - 39.0 - 2015-04-05T12:53:15Z - - 2.037528494326471761866059750900603830814361572265625 - - - - 48.0 - 2015-04-05T12:53:25Z - - 4.3140437646474918409467136370949447154998779296875 - - - - 45.0 - 2015-04-05T12:53:31Z - - 3.615824814806853471083059048396535217761993408203125 - - - - 49.0 - 2015-04-05T12:53:40Z - - 3.045310604332967852059255164931528270244598388671875 - - - - 51.0 - 2015-04-05T12:53:48Z - - 4.51402191917702833023895436781458556652069091796875 - - - - 48.0 - 2015-04-05T12:53:56Z - - 2.7692584768311601095547302975319325923919677734375 - - - - 46.0 - 2015-04-05T12:54:05Z - - 2.20360611722217480945573697681538760662078857421875 - - - - 43.0 - 2015-04-05T12:54:14Z - - 2.242098318612623319978638392058201134204864501953125 - - - - 47.0 - 2015-04-05T12:54:22Z - - 2.55708185883009964101120203849859535694122314453125 - - - - 50.0 - 2015-04-05T12:54:28Z - - 2.63142646123323853402098393416963517665863037109375 - - - - 53.0 - 2015-04-05T12:54:33Z - - 1.1706466667521755464775878863292746245861053466796875 - - - - 50.0 - 2015-04-05T12:54:48Z - - 0.684859756908535732833342990488745272159576416015625 - - - - 51.0 - 2015-04-05T12:55:14Z - - 1.016782770728879459198878976167179644107818603515625 - - - - 37.0 - 2015-04-05T12:55:29Z - - 1.977039854333794810514746131957508623600006103515625 - - - - 41.0 - 2015-04-05T12:55:44Z - - 1.9372238485400690155557867910829372704029083251953125 - - - - 50.0 - 2015-04-05T12:55:59Z - - 1.742493021940447750495195577968843281269073486328125 - - - - 50.0 - 2015-04-05T12:56:17Z - - 1.4042125146839572469303902835235930979251861572265625 - - - - 50.0 - 2015-04-05T12:56:28Z - - 0.95028165673933784329818763580988161265850067138671875 - - - - 46.0 - 2015-04-05T12:56:41Z - - 1.3634180442706005376152234020992182195186614990234375 - - - - 38.0 - 2015-04-05T12:56:58Z - - 1.2060917512304987209148521287715993821620941162109375 - - - - 42.0 - 2015-04-05T12:57:17Z - - 1.53980667774091362076660516322590410709381103515625 - - - - 39.0 - 2015-04-05T12:57:28Z - - 1.2791179713051528121781075242324732244014739990234375 - - - - 38.0 - 2015-04-05T12:57:40Z - - 0.510761896223771660885404344298876821994781494140625 - - - - 38.0 - 2015-04-05T12:57:52Z - - 1.3015546863652855957838028189144097268581390380859375 - - - - 45.0 - 2015-04-05T12:58:10Z - - 1.8591282396647967889435903998673893511295318603515625 - - - - 49.0 - 2015-04-05T12:58:23Z - - 1.7089035182269627366480335695086978375911712646484375 - - - - 50.0 - 2015-04-05T12:58:33Z - - 1.430697781395093404199769793194718658924102783203125 - - - - 45.0 - 2015-04-05T12:58:45Z - - 1.4708143306852938803075403484399430453777313232421875 - - - - 38.0 - 2015-04-05T12:59:04Z - - 1.3256070474614787269018734150449745357036590576171875 - - - - 41.0 - 2015-04-05T12:59:21Z - - 1.1907913343887466250947682055993936955928802490234375 - - - - 41.0 - 2015-04-05T12:59:25Z - - 1.379173502989715860422847981681115925312042236328125 - - - - 47.0 - 2015-04-05T12:59:38Z - - 1.1490095646795805972573134567937813699245452880859375 - - - - 47.0 - 2015-04-05T12:59:52Z - - 1.4139183102851882178896403274848125874996185302734375 - - - - 49.0 - 2015-04-05T13:00:07Z - - 1.5028087985419371630513296622666530311107635498046875 - - - - 44.0 - 2015-04-05T13:00:21Z - - 1.3291343551879652995495462164399214088916778564453125 - - - - 36.0 - 2015-04-05T13:00:38Z - - 1.3777897179401590310732217403710819780826568603515625 - - - - 37.0 - 2015-04-05T13:00:57Z - - 0.84804445606808365187845311083947308361530303955078125 - - - - 35.0 - 2015-04-05T13:01:03Z - - 1.6647400916137071735789731974364258348941802978515625 - - - - 31.0 - 2015-04-05T13:01:17Z - - 1.4389025879862613610526977936387993395328521728515625 - - - - 27.0 - 2015-04-05T13:01:32Z - - 1.3759590716539660260053778984001837670803070068359375 - - - - 26.0 - 2015-04-05T13:01:45Z - - 1.4843614675602505581508694376680068671703338623046875 - - - - 30.0 - 2015-04-05T13:02:04Z - - 1.3252700423209926583467677119188010692596435546875 - - - - 32.0 - 2015-04-05T13:02:20Z - - 1.657655291819969622935104780481196939945220947265625 - - - - 40.0 - 2015-04-05T13:02:36Z - - 1.7001048164806060736253812137874774634838104248046875 - - - - 38.0 - 2015-04-05T13:02:55Z - - 1.2716479967252218852280520877684466540813446044921875 - - - - 37.0 - 2015-04-05T13:03:13Z - - 1.001170200880019844902335535152815282344818115234375 - - - - 39.0 - 2015-04-05T13:03:30Z - - 1.7249463510308640223911424982361495494842529296875 - - - - 36.0 - 2015-04-05T13:03:49Z - - 1.1440404010062505957279199719778262078762054443359375 - - - - 44.0 - 2015-04-05T13:04:12Z - - 0.9671674082530572480465025364537723362445831298828125 - - - - 44.0 - 2015-04-05T13:04:19Z - - 2.745184439600266035341746828635223209857940673828125 - - - - 44.0 - 2015-04-05T13:04:29Z - - 1.206585650535291875939947203733026981353759765625 - - - - 37.0 - 2015-04-05T13:04:49Z - - 1.114543672162958021232270766631700098514556884765625 - - - - 39.0 - 2015-04-05T13:05:07Z - - 1.294257330100665459582387484260834753513336181640625 - - - - 32.0 - 2015-04-05T13:05:19Z - - 1.6446119260237550552261609482229687273502349853515625 - - - - 32.0 - 2015-04-05T13:05:30Z - - 1.5579339313616884510338422842323780059814453125 - - - - 37.0 - 2015-04-05T13:05:39Z - - 1.738257669202540878217178033082745969295501708984375 - - - - 39.0 - 2015-04-05T13:05:55Z - - 1.3227876513514382761371734886779449880123138427734375 - - - - 40.0 - 2015-04-05T13:06:11Z - - 1.416742894716219947071067508659325540065765380859375 - - - - 37.0 - 2015-04-05T13:06:15Z - - 1.1500587487247890816632889254833571612834930419921875 - - - - 39.0 - 2015-04-05T13:06:28Z - - 0.8218550256043695156904504983685910701751708984375 - - - - 42.0 - 2015-04-05T13:06:39Z - - 1.2526265045372266815348893942427821457386016845703125 - - - - 41.0 - 2015-04-05T13:06:53Z - - 1.232076731340278730186810207669623196125030517578125 - - - - 44.0 - 2015-04-05T13:07:09Z - - 1.1293128780808878719454924066667445003986358642578125 - - - - 40.0 - 2015-04-05T13:07:26Z - - 1.25185622606340896112442351295612752437591552734375 - - - - 38.0 - 2015-04-05T13:07:41Z - - 1.0267848411241462525111955983447842299938201904296875 - - - - 32.0 - 2015-04-05T13:08:24Z - - 0.75698239227793584493753087372169829905033111572265625 - - - - 33.0 - 2015-04-05T13:08:42Z - - 0.79837423597477374936914884528960101306438446044921875 - - - - 31.0 - 2015-04-05T13:08:55Z - - 1.2715009265259784587698277391609735786914825439453125 - - - - 35.0 - 2015-04-05T13:09:16Z - - 1.37135561804951056075196902384050190448760986328125 - - - - 44.0 - 2015-04-05T13:10:00Z - - 0.7394810529521482767023599080857820808887481689453125 - - - - 38.0 - 2015-04-05T13:10:13Z - - 1.275222464916422548952823490253649652004241943359375 - - - - 40.0 - 2015-04-05T13:10:25Z - - 1.5537049945238512460576885132468305528163909912109375 - - - - 37.0 - 2015-04-05T13:10:38Z - - 1.26310732834976846561403363011777400970458984375 - - - - 42.0 - 2015-04-05T13:10:54Z - - 1.3404975671933681002911953328293748199939727783203125 - - - - 43.0 - 2015-04-05T13:11:12Z - - 1.715981530523588816095070797018706798553466796875 - - - - 43.0 - 2015-04-05T13:11:20Z - - 0 - - - - 44.0 - 2015-04-05T13:11:34Z - - 1.1715347819495611769724519035662524402141571044921875 - - - - 44.0 - 2015-04-05T13:13:57Z - - 0 - - - - 36.0 - 2015-04-05T13:14:06Z - - 3.518077110884767488840907390112988650798797607421875 - - - - 38.0 - 2015-04-05T13:14:22Z - - 1.389430977727509120001059272908605635166168212890625 - - - - 37.0 - 2015-04-05T13:14:28Z - - 1.2227371138951090845381486360565759241580963134765625 - - - - 35.0 - 2015-04-05T13:14:37Z - - 0.57380061340722632312605355764389969408512115478515625 - - - - 35.0 - 2015-04-05T13:14:52Z - - 1.008859806959918170576884222100488841533660888671875 - - - - 35.0 - 2015-04-05T13:15:08Z - - 1.477407282523195863888076928560622036457061767578125 - - - - 39.0 - 2015-04-05T13:15:22Z - - 1.7572018899159715932256631276686675846576690673828125 - - - - 39.0 - 2015-04-05T13:15:30Z - - 0 - - - - 32.0 - 2015-04-05T13:15:35Z - - 2.69142688009450825603607881930656731128692626953125 - - - - 30.0 - 2015-04-05T13:15:49Z - - 1.3885960463913387119561093641095794737339019775390625 - - - - 30.0 - 2015-04-05T13:16:00Z - - 0 - - - - 33.0 - 2015-04-05T13:16:14Z - - 1.200183532139657227588713794830255210399627685546875 - - - - 30.0 - 2015-04-05T13:16:25Z - - 1.368148884688110911156400106847286224365234375 - - - - 33.0 - 2015-04-05T13:16:38Z - - 1.480927480808728713412847355357371270656585693359375 - - - - 36.0 - 2015-04-05T13:16:57Z - - 1.2529857531017050131794121625716798007488250732421875 - - - - 35.0 - 2015-04-05T13:17:13Z - - 2.281939538264003086709408307797275483608245849609375 - - - - 40.0 - 2015-04-05T13:17:22Z - - 3.0369984541728616278533081640489399433135986328125 - - - - 44.0 - 2015-04-05T13:17:33Z - - 3.31852269522228748854786317679099738597869873046875 - - - - 44.0 - 2015-04-05T13:17:40Z - - 2.421863788404067907578109952737577259540557861328125 - - - - 46.0 - 2015-04-05T13:17:54Z - - 1.3770266097463146337531725293956696987152099609375 - - - - 46.0 - 2015-04-05T13:18:12Z - - 1.192798554030028324035583864315412938594818115234375 - - - - 43.0 - 2015-04-05T13:18:32Z - - 1.19888840636770854786163909011520445346832275390625 - - - - 45.0 - 2015-04-05T13:18:40Z - - 1.6526274554979973885338040417991578578948974609375 - - - - 48.0 - 2015-04-05T13:18:54Z - - 1.620356300532485693821627137367613613605499267578125 - - - - 51.0 - 2015-04-05T13:19:06Z - - 1.6598646413710607117053541514906100928783416748046875 - - - - 48.0 - 2015-04-05T13:19:18Z - - 1.6390138357260799484294011563179083168506622314453125 - - - - 49.0 - 2015-04-05T13:19:29Z - - 1.7744953556469817979035497046425007283687591552734375 - - - - 52.0 - 2015-04-05T13:19:38Z - - 1.628406983051029488507310816203244030475616455078125 - - - - 50.0 - 2015-04-05T13:19:49Z - - 1.0459415007373367156873200656264089047908782958984375 - - - - 47.0 - 2015-04-05T13:19:58Z - - 1.3530551240747301644518074681400321424007415771484375 - - - - 47.0 - 2015-04-05T13:20:08Z - - 1.094290137554617903248299626284278929233551025390625 - - - - 45.0 - 2015-04-05T13:20:24Z - - 0.40402005535700025173895255647948943078517913818359375 - - - - 46.0 - 2015-04-05T13:20:33Z - - 1.3452495492023455181396229818346910178661346435546875 - - - - 39.0 - 2015-04-05T13:20:50Z - - 1.1508536402152433897327910017338581383228302001953125 - - - - 40.0 - 2015-04-05T13:20:59Z - - 1.4188155469611576364741267752833664417266845703125 - - - - 38.0 - 2015-04-05T13:21:14Z - - 1.3905808709171958437167404554202221333980560302734375 - - - - 37.0 - 2015-04-05T13:21:24Z - - 1.577686698942667664624650569749064743518829345703125 - - - - 40.0 - 2015-04-05T13:21:34Z - - 1.827221941857071652037802778067998588085174560546875 - - - - 40.0 - 2015-04-05T13:21:38Z - - 1.7177282795117694291775478632189333438873291015625 - - - - 33.0 - 2015-04-05T13:21:48Z - - 1.072758267638338924854224387672729790210723876953125 - - - - 33.0 - 2015-04-05T13:22:03Z - - 1.90551953415704389271922991611063480377197265625 - - - - 37.0 - 2015-04-05T13:22:13Z - - 1.7431568004534743199229751553502865135669708251953125 - - - - 39.0 - 2015-04-05T13:22:28Z - - 1.6587409658453038385772515539429150521755218505859375 - - - - 40.0 - 2015-04-05T13:22:38Z - - 1.6273284496513682473306516840239055454730987548828125 - - - - 32.0 - 2015-04-05T13:22:53Z - - 1.1450763580935696683837932141614146530628204345703125 - - - - 33.0 - 2015-04-05T13:23:03Z - - 2.4704235565292460563568965881131589412689208984375 - - - - 34.0 - 2015-04-05T13:23:10Z - - 2.023074755034231397843313970952294766902923583984375 - - - - 39.0 - 2015-04-05T13:23:25Z - - 1.677662546241078356246134717366658151149749755859375 - - - - 42.0 - 2015-04-05T13:23:38Z - - 1.3743999235886914522808410765719600021839141845703125 - - - - 41.0 - 2015-04-05T13:23:49Z - - 1.2873227460954199674603160019614733755588531494140625 - - - - 36.0 - 2015-04-05T13:24:04Z - - 1.9318965531743830243982529282220639288425445556640625 - - - - 31.0 - 2015-04-05T13:24:19Z - - 1.2013081502483171636441738883149810135364532470703125 - - - - 45.0 - 2015-04-05T13:24:35Z - - 1.6272154192600034594562430356745608150959014892578125 - - - - 41.0 - 2015-04-05T13:24:44Z - - 1.4477706478829135416930284918635152280330657958984375 - - - - 44.0 - 2015-04-05T13:24:53Z - - 1.2863268636927542853953809753875248134136199951171875 - - - - 42.0 - 2015-04-05T13:25:08Z - - 1.7274982168321442177472135881544090807437896728515625 - - - - 35.0 - 2015-04-05T13:25:21Z - - 1.84103693300976001268054460524581372737884521484375 - - - - 34.0 - 2015-04-05T13:25:33Z - - 1.81707396301908818969650383223779499530792236328125 - - - - 44.0 - 2015-04-05T13:25:46Z - - 2.19917333527023917127962704398669302463531494140625 - - - - 42.0 - 2015-04-05T13:25:59Z - - 1.405530908909261800232570749358274042606353759765625 - - - - 43.0 - 2015-04-05T13:26:13Z - - 1.540874888745594528671745138126425445079803466796875 - - - - 42.0 - 2015-04-05T13:26:23Z - - 1.7075529718602620032896766133490018546581268310546875 - - - - 44.0 - 2015-04-05T13:26:37Z - - 1.423990602497335000720113384886644780635833740234375 - - - - 41.0 - 2015-04-05T13:26:50Z - - 1.49710934565270736840147947077639400959014892578125 - - - - 39.0 - 2015-04-05T13:26:57Z - - 1.5759070091043181349732549278996884822845458984375 - - - - 38.0 - 2015-04-05T13:27:09Z - - 0.85107785605951402629898439045064151287078857421875 - - - - 37.0 - 2015-04-05T13:27:22Z - - 1.65761018282604677409608484595082700252532958984375 - - - - 39.0 - 2015-04-05T13:27:35Z - - 1.702283889094771129890659722150303423404693603515625 - - - - 41.0 - 2015-04-05T13:27:43Z - - 1.6454464558518020478317112065269611775875091552734375 - - - - 40.0 - 2015-04-05T13:27:51Z - - 1.493227105215886307831851809169165790081024169921875 - - - - 37.0 - 2015-04-05T13:28:02Z - - 1.31710819473969831250315110082738101482391357421875 - - - - 38.0 - 2015-04-05T13:28:19Z - - 1.3760383461578384878265524093876592814922332763671875 - - - - 33.0 - 2015-04-05T13:28:34Z - - 1.034244544564995482716085462016053497791290283203125 - - - - 31.0 - 2015-04-05T13:28:43Z - - 1.0534463611147313333304964544367976486682891845703125 - - - - 39.0 - 2015-04-05T13:28:53Z - - 1.9801311172438420538099990153568796813488006591796875 - - - - 49.0 - 2015-04-05T13:29:02Z - - 1.173122440517315734354042433551512658596038818359375 - - - - 40.0 - 2015-04-05T13:29:25Z - - 1.14884628257100640524868140346370637416839599609375 - - - - 41.0 - 2015-04-05T13:29:32Z - - 1.771997941576912705130553149501793086528778076171875 - - - - 42.0 - 2015-04-05T13:29:43Z - - 5.542741237408403520703359390608966350555419921875 - - - - 31.0 - 2015-04-05T13:29:48Z - - 5.5405689824813695310012917616404592990875244140625 - - - - 31.0 - 2015-04-05T13:29:54Z - - 3.488210452086663249104958595125935971736907958984375 - - - - 35.0 - 2015-04-05T13:30:01Z - - 4.20957561657055645554237344185821712017059326171875 - - - - 40.0 - 2015-04-05T13:30:07Z - - 6.696690446163547250080227968282997608184814453125 - - - - 38.0 - 2015-04-05T13:30:15Z - - 3.9170551233988231132343571516685187816619873046875 - - - - 42.0 - 2015-04-05T13:30:23Z - - 2.496618482574685327080032948288135230541229248046875 - - - - 39.0 - 2015-04-05T13:30:36Z - - 2.19387443046126318080268902122043073177337646484375 - - - - 38.0 - 2015-04-05T13:30:59Z - - 1.2787553801843660750137132708914577960968017578125 - - - - 37.0 - 2015-04-05T13:31:08Z - - 1.98496669581217499711556229158304631710052490234375 - - - - 34.0 - 2015-04-05T13:31:23Z - - 1.4402380715529561339138808762072585523128509521484375 - - - - 30.0 - 2015-04-05T13:31:32Z - - 1.7249729294345355068429626044235192239284515380859375 - - - - 32.0 - 2015-04-05T13:31:45Z - - 1.5715950824965891907680770600563846528530120849609375 - - - - 36.0 - 2015-04-05T13:31:56Z - - 1.9215908995988135732346790973679162561893463134765625 - - - - 40.0 - 2015-04-05T13:32:07Z - - 1.903871996062594718068794463761150836944580078125 - - - - 42.0 - 2015-04-05T13:32:22Z - - 1.84975109975000595596839048084802925586700439453125 - - - - 36.0 - 2015-04-05T13:32:29Z - - 1.842628220828457674684841549606062471866607666015625 - - - - 42.0 - 2015-04-05T13:32:42Z - - 1.523438536186884295631216446054168045520782470703125 - - - - 41.0 - 2015-04-05T13:32:57Z - - 0.89491365492543206716646864151698537170886993408203125 - - - - 41.0 - 2015-04-05T13:33:36Z - - 0.749239852919787008289631558000110089778900146484375 - - - - 42.0 - 2015-04-05T13:33:51Z - - 1.436183056580684347380838516983203589916229248046875 - - - - 43.0 - 2015-04-05T13:34:04Z - - 1.260933628354365954038485142518766224384307861328125 - - - - 44.0 - 2015-04-05T13:34:17Z - - 2.89375708673499776324433696572668850421905517578125 - - - - 42.0 - 2015-04-05T13:34:25Z - - 3.35268098680773274367084013647399842739105224609375 - - - - 43.0 - 2015-04-05T13:34:32Z - - 3.251920287151366384392758845933713018894195556640625 - - - - 43.0 - 2015-04-05T13:34:40Z - - 3.14678166088685973278415985987521708011627197265625 - - - - 42.0 - 2015-04-05T13:34:45Z - - 0.78351975276738361486650319420732557773590087890625 - - - - 43.0 - 2015-04-05T13:34:56Z - - 0.377823313777076508213070837882696650922298431396484375 - - - - 40.0 - 2015-04-05T13:35:11Z - - 2.94111283338093443262550863437354564666748046875 - - - - 40.0 - 2015-04-05T13:35:21Z - - 1.3958069105156500899767024748143739998340606689453125 - - - - 42.0 - 2015-04-05T13:35:36Z - - 2.928287449715402335215230777976103127002716064453125 - - - - 41.0 - 2015-04-05T13:35:44Z - - 3.22421420788781620814233974670059978961944580078125 - - - - 42.0 - 2015-04-05T13:35:52Z - - 3.5554107386882574104447485296986997127532958984375 - - - - 42.0 - 2015-04-05T13:35:58Z - - 3.688198673653548365081178417312912642955780029296875 - - - - 44.0 - 2015-04-05T13:36:05Z - - 3.707738717471893874488841902348212897777557373046875 - - - - 46.0 - 2015-04-05T13:36:12Z - - 3.509086104990019716609594979672692716121673583984375 - - - - 52.0 - 2015-04-05T13:36:19Z - - 3.737975290670072947563085108413361012935638427734375 - - - - 53.0 - 2015-04-05T13:36:26Z - - 3.328758668542246113020155462436378002166748046875 - - - - 55.0 - 2015-04-05T13:36:31Z - - 3.38519011271448011513029996422119438648223876953125 - - - - 51.0 - 2015-04-05T13:36:40Z - - 2.8747686901586693153376472764648497104644775390625 - - - - 53.0 - 2015-04-05T13:36:46Z - - 2.596218116847933909951962050399743020534515380859375 - - - - 53.0 - 2015-04-05T13:36:54Z - - 3.808045855941799118227208964526653289794921875 - - - - 55.0 - 2015-04-05T13:37:00Z - - 4.516717086500388944614314823411405086517333984375 - - - - 58.0 - 2015-04-05T13:37:05Z - - 5.366315021024309572794663836248219013214111328125 - - - - 59.0 - 2015-04-05T13:37:10Z - - 4.695667672928632185858077718876302242279052734375 - - - - 59.0 - 2015-04-05T13:37:14Z - - 3.677814620316997906712686017272062599658966064453125 - - - - 62.0 - 2015-04-05T13:37:23Z - - 2.076234966457574326881285742274485528469085693359375 - - - - 59.0 - 2015-04-05T13:37:32Z - - 1.596091838917583327628335609915666282176971435546875 - - - - 59.0 - 2015-04-05T13:37:40Z - - 1.524538691510489041291975809144787490367889404296875 - - - - 59.0 - 2015-04-05T13:37:50Z - - 1.674717912968544997198705459595657885074615478515625 - - - - 57.0 - 2015-04-05T13:38:01Z - - 1.59652842028431596332893604994751513004302978515625 - - - - 52.0 - 2015-04-05T13:38:14Z - - 1.519826546993098492777107821893878281116485595703125 - - - - 52.0 - 2015-04-05T13:38:25Z - - 1.5233069592008121606596660058130510151386260986328125 - - - - 55.0 - 2015-04-05T13:38:40Z - - 1.7036705654160384515449777609319426119327545166015625 - - - - 56.0 - 2015-04-05T13:38:56Z - - 1.481119076175309690057702027843333780765533447265625 - - - - 56.0 - 2015-04-05T13:39:10Z - - 1.507484051266098301624651867314241826534271240234375 - - - - 57.0 - 2015-04-05T13:39:21Z - - 1.5636867805069967207742820392013527452945709228515625 - - - - 57.0 - 2015-04-05T13:39:35Z - - 1.4933661856708855264486146552371792495250701904296875 - - - - 56.0 - 2015-04-05T13:39:52Z - - 1.4068222691732741314041277291835285723209381103515625 - - - - 59.0 - 2015-04-05T13:40:01Z - - 1.7359275806578435830118678495637141168117523193359375 - - - - 59.0 - 2015-04-05T13:40:09Z - - 0.56585852389488611180468069505877792835235595703125 - - - - 60.0 - 2015-04-05T13:40:29Z - - 0.63816623360394242325810409965924918651580810546875 - - - - 59.0 - 2015-04-05T13:40:41Z - - 1.5884104890055013026284314037184230983257293701171875 - - - - 57.0 - 2015-04-05T13:40:56Z - - 1.5426204035169275297079138908884488046169281005859375 - - - - 60.0 - 2015-04-05T13:41:07Z - - 1.5753385989970405400839581488980911672115325927734375 - - - - 58.0 - 2015-04-05T13:41:17Z - - 1.639993721488942401975918983225710690021514892578125 - - - - 60.0 - 2015-04-05T13:41:24Z - - 1.8890741273878306483169353668927215039730072021484375 - - - - 62.0 - 2015-04-05T13:41:34Z - - 1.647160053835928561483115117880515754222869873046875 - - - - 60.0 - 2015-04-05T13:41:48Z - - 1.495765786103229633141609156155027449131011962890625 - - - - 62.0 - 2015-04-05T13:41:59Z - - 1.6299058485500979021054490658571012318134307861328125 - - - - 61.0 - 2015-04-05T13:42:13Z - - 1.5306780444632657189885094339842908084392547607421875 - - - - 60.0 - 2015-04-05T13:42:22Z - - 1.4799192391259838874617571491398848593235015869140625 - - - - 61.0 - 2015-04-05T13:42:36Z - - 1.6561767548396495453033594458247534930706024169921875 - - - - 54.0 - 2015-04-05T13:42:50Z - - 1.6155324632412149110649579597520641982555389404296875 - - - - 53.0 - 2015-04-05T13:43:05Z - - 1.651203493339223005165194990695454180240631103515625 - - - - 55.0 - 2015-04-05T13:43:17Z - - 1.3187255250797338401724800860392861068248748779296875 - - - - 58.0 - 2015-04-05T13:43:33Z - - 1.7034807336761215168507987982593476772308349609375 - - - - 60.0 - 2015-04-05T13:43:43Z - - 1.808948959991114602274819844751618802547454833984375 - - - - 63.0 - 2015-04-05T13:43:54Z - - 1.7137644680262205110210516068036668002605438232421875 - - - - 62.0 - 2015-04-05T13:44:05Z - - 1.5069671443182011127959185614599846303462982177734375 - - - - 63.0 - 2015-04-05T13:44:21Z - - 1.5297952366359781617433100109337829053401947021484375 - - - - 62.0 - 2015-04-05T13:44:38Z - - 1.5948354303361294004304227200918830931186676025390625 - - - - 59.0 - 2015-04-05T13:44:50Z - - 1.3177554680021696942304743060958571732044219970703125 - - - - 61.0 - 2015-04-05T13:45:03Z - - 1.62769567307538931544286242569796741008758544921875 - - - - 60.0 - 2015-04-05T13:45:17Z - - 1.537572812555434875747550904634408652782440185546875 - - - - 60.0 - 2015-04-05T13:45:32Z - - 1.5860413470441134808908145714667625725269317626953125 - - - - 61.0 - 2015-04-05T13:45:45Z - - 1.6896668362768056947942341139423660933971405029296875 - - - - 60.0 - 2015-04-05T13:45:58Z - - 1.517717282542376810994255720288492739200592041015625 - - - - 60.0 - 2015-04-05T13:46:06Z - - 1.5751558434066399438933103738236241042613983154296875 - - - - 58.0 - 2015-04-05T13:46:19Z - - 1.554837864951783554801068021333776414394378662109375 - - - - 58.0 - 2015-04-05T13:46:26Z - - 1.5773041663965161607308118618675507605075836181640625 - - - - 58.0 - 2015-04-05T13:46:41Z - - 1.6393305599515428649937121008406393229961395263671875 - - - - 58.0 - 2015-04-05T13:46:55Z - - 1.5983753180385857906031787933898158371448516845703125 - - - - 58.0 - 2015-04-05T13:47:06Z - - 1.5805132861089232765294809723854996263980865478515625 - - - - 59.0 - 2015-04-05T13:47:16Z - - 1.668384645142341415890996358939446508884429931640625 - - - - 60.0 - 2015-04-05T13:47:28Z - - 1.5276214411563131534421700052917003631591796875 - - - - 57.0 - 2015-04-05T13:47:43Z - - 1.551802325249572955812027430511079728603363037109375 - - - - 58.0 - 2015-04-05T13:47:58Z - - 1.766021835953266450047749458462931215763092041015625 - - - - 60.0 - 2015-04-05T13:48:07Z - - 2.358498391483296874326924807974137365818023681640625 - - - - 62.0 - 2015-04-05T13:48:14Z - - 2.04704552671896866655742996954359114170074462890625 - - - - 61.0 - 2015-04-05T13:48:20Z - - 1.82526707238623853157832854776643216609954833984375 - - - - 62.0 - 2015-04-05T13:48:33Z - - 1.9109225499884383570048385081463493406772613525390625 - - - - 63.0 - 2015-04-05T13:48:45Z - - 1.56051595730353209745544518227688968181610107421875 - - - - 60.0 - 2015-04-05T13:49:00Z - - 2.687527785672310987052924247109331190586090087890625 - - - - 61.0 - 2015-04-05T13:49:07Z - - 3.82300026845213292148173422901891171932220458984375 - - - - 63.0 - 2015-04-05T13:49:16Z - - 4.3484478183715484789217953220941126346588134765625 - - - - 65.0 - 2015-04-05T13:49:19Z - - 5.590820735416201614498277194797992706298828125 - - - - 63.0 - 2015-04-05T13:49:26Z - - 4.89899252650185257351722611929289996623992919921875 - - - - 59.0 - 2015-04-05T13:49:34Z - - 3.47848376762384337013145341188646852970123291015625 - - - - 60.0 - 2015-04-05T13:49:40Z - - 4.63954059024302978286868892610073089599609375 - - - - 63.0 - 2015-04-05T13:49:47Z - - 4.09664940411912681383910239674150943756103515625 - - - - 64.0 - 2015-04-05T13:49:53Z - - 3.601557199415479804116557716042734682559967041015625 - - - - 65.0 - 2015-04-05T13:50:02Z - - 3.837055006562830161698229858302511274814605712890625 - - - - 67.0 - 2015-04-05T13:50:07Z - - 5.30636753114259818175924010574817657470703125 - - - - 70.0 - 2015-04-05T13:50:12Z - - 4.95201772910441651021073994343169033527374267578125 - - - - 74.0 - 2015-04-05T13:50:17Z - - 5.3936904473608269228179779020138084888458251953125 - - - - 69.0 - 2015-04-05T13:50:23Z - - 3.337035789355656145716011451440863311290740966796875 - - - - 60.0 - 2015-04-05T13:50:30Z - - 2.202680408855666183143284797552041709423065185546875 - - - - 60.0 - 2015-04-05T13:50:39Z - - 4.26729285047227957505810991278849542140960693359375 - - - - 59.0 - 2015-04-05T13:50:45Z - - 4.58143734968901750193026600754819810390472412109375 - - - - 59.0 - 2015-04-05T13:50:50Z - - 4.8409581217003978537150032934732735157012939453125 - - - - 58.0 - 2015-04-05T13:50:56Z - - 4.77083699765079050081340028555132448673248291015625 - - - - 58.0 - 2015-04-05T13:51:02Z - - 4.70378945284091809497795111383311450481414794921875 - - - - 57.0 - 2015-04-05T13:51:08Z - - 4.62109125039260870693169636069796979427337646484375 - - - - 56.0 - 2015-04-05T13:51:13Z - - 4.7089994418721641267211452941410243511199951171875 - - - - 56.0 - 2015-04-05T13:51:19Z - - 5.12858525901845307970461362856440246105194091796875 - - - - 56.0 - 2015-04-05T13:51:25Z - - 4.68506273137702589082209669868461787700653076171875 - - - - 56.0 - 2015-04-05T13:51:31Z - - 4.70577410523816563880927787977270781993865966796875 - - - - 55.0 - 2015-04-05T13:51:36Z - - 4.0875941911069535450451439828611910343170166015625 - - - - 55.0 - 2015-04-05T13:51:43Z - - 3.467313052668759443264434594311751425266265869140625 - - - - 55.0 - 2015-04-05T13:51:49Z - - 3.212818940073621565289840873447246849536895751953125 - - - - 55.0 - 2015-04-05T13:52:00Z - - 1.86535155511510453152368427254259586334228515625 - - - - 54.0 - 2015-04-05T13:52:18Z - - 1.3541502258299644712025155968149192631244659423828125 - - - - 53.0 - 2015-04-05T13:52:41Z - - 0.828898765442825702365325923892669379711151123046875 - - - - 51.0 - 2015-04-05T13:53:01Z - - 1.003527227383077313760395554709248244762420654296875 - - - - 52.0 - 2015-04-05T13:53:13Z - - 1.9308998959071832501876997412182390689849853515625 - - - - 54.0 - 2015-04-05T13:53:24Z - - 2.517472217714317395120815490372478961944580078125 - - - - 52.0 - 2015-04-05T13:53:32Z - - 1.6615253823318034687162025875295512378215789794921875 - - - - 53.0 - 2015-04-05T13:53:44Z - - 1.6260480565554977783193635332281701266765594482421875 - - - - 50.0 - 2015-04-05T13:53:57Z - - 1.569177869987573359367161174304783344268798828125 - - - - 51.0 - 2015-04-05T13:54:13Z - - 1.774621428352650465143369729048572480678558349609375 - - - - 49.0 - 2015-04-05T13:54:29Z - - 0.89428884457128476892506796502857469022274017333984375 - - - - 51.0 - 2015-04-05T13:54:38Z - - 1.4800954628204703311666889931075274944305419921875 - - - - 53.0 - 2015-04-05T13:54:54Z - - 1.7202343837585021280034425217309035360813140869140625 - - - - 53.0 - 2015-04-05T13:55:08Z - - 1.6642970730355697295266281798831187188625335693359375 - - - - 51.0 - 2015-04-05T13:55:21Z - - 1.2522320186294695343320881875115446746349334716796875 - - - - 50.0 - 2015-04-05T13:55:29Z - - 1.2596123660891851425702725464361719787120819091796875 - - - - 48.0 - 2015-04-05T13:55:45Z - - 1.387875965186972759823902379139326512813568115234375 - - - - 47.0 - 2015-04-05T13:55:56Z - - 1.9402435269385527316643447193200699985027313232421875 - - - - 47.0 - 2015-04-05T13:56:04Z - - 2.1657928269590112080322796828113496303558349609375 - - - - 47.0 - 2015-04-05T13:56:13Z - - 2.0208698235663771214376538409851491451263427734375 - - - - 47.0 - 2015-04-05T13:56:23Z - - 0 - - - - 50.0 - 2015-04-05T13:56:36Z - - 1.32566121626626909346668981015682220458984375 - - - - 51.0 - 2015-04-05T13:56:42Z - - 2.1201340363216640838572857319377362728118896484375 - - - - 47.0 - 2015-04-05T13:56:57Z - - 1.107454238154014891648557750158943235874176025390625 - - - - 49.0 - 2015-04-05T13:57:12Z - - 1.650892143799875810827870736829936504364013671875 - - - - 50.0 - 2015-04-05T13:57:22Z - - 1.8427095455454345351853362444671802222728729248046875 - - - - 48.0 - 2015-04-05T13:57:37Z - - 1.703168257416481257138229921110905706882476806640625 - - - - 52.0 - 2015-04-05T13:57:44Z - - 2.698004255883623248024605345563031733036041259765625 - - - - 51.0 - 2015-04-05T13:57:53Z - - 2.163972551118018561311373559874482452869415283203125 - - - - 50.0 - 2015-04-05T13:58:06Z - - 1.599310852353486467336551868356764316558837890625 - - - - 52.0 - 2015-04-05T13:58:21Z - - 1.8008272865875909474198124371469020843505859375 - - - - 55.0 - 2015-04-05T13:58:32Z - - 1.858419339163705163997519775875844061374664306640625 - - - - 54.0 - 2015-04-05T13:58:42Z - - 1.717419719307291980925356256193481385707855224609375 - - - - 56.0 - 2015-04-05T13:59:00Z - - 1.7345992197668120837761307484470307826995849609375 - - - - 55.0 - 2015-04-05T13:59:14Z - - 1.785091230128596606618884834460914134979248046875 - - - - 56.0 - 2015-04-05T13:59:26Z - - 1.9679812912585632478368324882467277348041534423828125 - - - - 57.0 - 2015-04-05T13:59:36Z - - 2.04585094421694702049308034474961459636688232421875 - - - - 56.0 - 2015-04-05T13:59:42Z - - 1.6420757831121743919311484205536544322967529296875 - - - - 56.0 - 2015-04-05T13:59:51Z - - 1.348603475160602638283080523251555860042572021484375 - - - - 56.0 - 2015-04-05T13:59:58Z - - 1.7670244075933843053149985280469991266727447509765625 - - - - 57.0 - 2015-04-05T14:00:11Z - - 1.902782188646345407079252254334278404712677001953125 - - - - 57.0 - 2015-04-05T14:00:20Z - - 2.153629765413022756348482289467938244342803955078125 - - - - 56.0 - 2015-04-05T14:00:25Z - - 1.7621641017203295564996778921340592205524444580078125 - - - - 56.0 - 2015-04-05T14:00:36Z - - 1.75021110156843828775663496344350278377532958984375 - - - - 56.0 - 2015-04-05T14:00:48Z - - 1.4586436317659960959502996047376655042171478271484375 - - - - 58.0 - 2015-04-05T14:01:00Z - - 1.9792976231894130467736658829380758106708526611328125 - - - - 56.0 - 2015-04-05T14:01:09Z - - 1.796498507671508537697491192375309765338897705078125 - - - - 58.0 - 2015-04-05T14:01:24Z - - 1.837000120267073821622716423007659614086151123046875 - - - - 58.0 - 2015-04-05T14:01:35Z - - 1.81508652835177741735606105066835880279541015625 - - - - 56.0 - 2015-04-05T14:01:44Z - - 1.8049375481895693074108066866756416857242584228515625 - - - - 54.0 - 2015-04-05T14:01:54Z - - 1.6625801931178412207401606792700476944446563720703125 - - - - 55.0 - 2015-04-05T14:02:02Z - - 1.8339458365222240932013164638192392885684967041015625 - - - - 54.0 - 2015-04-05T14:02:12Z - - 1.6945224121496256231012011994607746601104736328125 - - - - 57.0 - 2015-04-05T14:02:20Z - - 1.831968927155929183214766453602351248264312744140625 - - - - 62.0 - 2015-04-05T14:02:34Z - - 1.9401213882910994801278548038681037724018096923828125 - - - - 59.0 - 2015-04-05T14:02:46Z - - 1.4652921040643367422973142311093397438526153564453125 - - - - 58.0 - 2015-04-05T14:03:00Z - - 1.7686232750082577780403880751691758632659912109375 - - - - 56.0 - 2015-04-05T14:03:12Z - - 1.6878029594915162636681316143949516117572784423828125 - - - - 55.0 - 2015-04-05T14:03:24Z - - 1.4570146031285009513567274552769958972930908203125 - - - - 55.0 - 2015-04-05T14:03:35Z - - 1.9634546097391336605397782477666623890399932861328125 - - - - 54.0 - 2015-04-05T14:03:47Z - - 1.92163153033161915317350576515309512615203857421875 - - - - 53.0 - 2015-04-05T14:03:59Z - - 1.7036064776621946403878382625407539308071136474609375 - - - - 54.0 - 2015-04-05T14:04:11Z - - 1.8739064557712905578767959013930521905422210693359375 - - - - 53.0 - 2015-04-05T14:04:17Z - - 1.5506280384618638112925737004843540489673614501953125 - - - - 54.0 - 2015-04-05T14:04:30Z - - 1.97109094251633631955655800993554294109344482421875 - - - - 51.0 - 2015-04-05T14:04:43Z - - 1.66263518942245269727209233678877353668212890625 - - - - 52.0 - 2015-04-05T14:04:55Z - - 1.9685798374085357043128396981046535074710845947265625 - - - - 53.0 - 2015-04-05T14:05:02Z - - 1.9669051263310499688685695218737237155437469482421875 - - - - 53.0 - 2015-04-05T14:05:10Z - - 1.874966147688393203196710601332597434520721435546875 - - - - 53.0 - 2015-04-05T14:05:21Z - - 1.6482945621537943292622685476089827716350555419921875 - - - - 55.0 - 2015-04-05T14:05:33Z - - 2.127640851506777064372499808087013661861419677734375 - - - - 53.0 - 2015-04-05T14:05:42Z - - 1.713341411320458806955002728500403463840484619140625 - - - - 53.0 - 2015-04-05T14:05:51Z - - 0 - - - - 51.0 - 2015-04-05T14:06:28Z - - 0.79029555579829391387391979151288978755474090576171875 - - - - 52.0 - 2015-04-05T14:06:41Z - - 1.375735227234786695049706395366229116916656494140625 - - - - 58.0 - 2015-04-05T14:06:55Z - - 1.5256104652675703814423968651681207120418548583984375 - - - - 62.0 - 2015-04-05T14:07:10Z - - 1.2872945867926877117071171596762724220752716064453125 - - - - 52.0 - 2015-04-05T14:07:45Z - - 0.96297404399188890611327451551915146410465240478515625 - - - - 51.0 - 2015-04-05T14:08:03Z - - 1.52885206810294249635262531228363513946533203125 - - - - 51.0 - 2015-04-05T14:08:18Z - - 1.0079743661164151102838104634429328143596649169921875 - - - - 43.0 - 2015-04-05T14:08:40Z - - 0.87693297847217455132096119996276684105396270751953125 - - - - 52.0 - 2015-04-05T14:08:52Z - - 2.08135046855510008612100136815570294857025146484375 - - - - 56.0 - 2015-04-05T14:09:03Z - - 0.835255763224818981171893028658814728260040283203125 - - - - 55.0 - 2015-04-05T14:09:23Z - - 0.9990907964202813129617197773768566548824310302734375 - - - - 49.0 - 2015-04-05T14:10:17Z - - 0.57671638343315356767249113545403815805912017822265625 - - - - 51.0 - 2015-04-05T14:10:29Z - - 1.5368507333680223592153879508259706199169158935546875 - - - - 50.0 - 2015-04-05T14:10:40Z - - 0.54297905017601089117107449055765755474567413330078125 - - - - 45.0 - 2015-04-05T14:10:54Z - - 1.312482304938890731449419035925529897212982177734375 - - - - 51.0 - 2015-04-05T14:11:09Z - - 1.1516086636189271086294638735125772655010223388671875 - - - - 49.0 - 2015-04-05T14:11:26Z - - 1.1188695921431943691715105160255916416645050048828125 - - - - 51.0 - 2015-04-05T14:11:34Z - - 1.2178827372660718797447998440475203096866607666015625 - - - - 51.0 - 2015-04-05T14:11:44Z - - 1.3012543227427137981777605091338045895099639892578125 - - - - 51.0 - 2015-04-05T14:11:58Z - - 1.3991708821287129893562450888566672801971435546875 - - - - 50.0 - 2015-04-05T14:12:11Z - - 1.0690336540911358209626769166789017617702484130859375 - - - - 55.0 - 2015-04-05T14:12:29Z - - 1.759087253032526998453022315516136586666107177734375 - - - - 53.0 - 2015-04-05T14:12:40Z - - 1.5455167997802263801787603370030410587787628173828125 - - - - 53.0 - 2015-04-05T14:12:51Z - - 1.357190131548783984527517532114870846271514892578125 - - - - 53.0 - 2015-04-05T14:13:03Z - - 0 - - - - 50.0 - 2015-04-05T14:13:13Z - - 1.7712074463737366158966324292123317718505859375 - - - - 46.0 - 2015-04-05T14:13:31Z - - 1.6258289887986305810585463405004702508449554443359375 - - - - 42.0 - 2015-04-05T14:13:43Z - - 1.4796086906194478860498975336668081581592559814453125 - - - - 45.0 - 2015-04-05T14:13:57Z - - 2.119461660725975971075740744709037244319915771484375 - - - - 48.0 - 2015-04-05T14:14:08Z - - 1.66731112095866951250400234130211174488067626953125 - - - - 55.0 - 2015-04-05T14:14:23Z - - 1.8621584284262946429322482799761928617954254150390625 - - - - 51.0 - 2015-04-05T14:14:37Z - - 1.4679906691349959846348838254925794899463653564453125 - - - - 46.0 - 2015-04-05T14:14:51Z - - 1.4858147523903759701369153845007531344890594482421875 - - - - 43.0 - 2015-04-05T14:15:03Z - - 1.7586494374895613734821608886704780161380767822265625 - - - - 40.0 - 2015-04-05T14:15:11Z - - 1.5338196733828055595694195289979688823223114013671875 - - - - 52.0 - 2015-04-05T14:15:19Z - - 3.14815578532930206989703947328962385654449462890625 - - - - 55.0 - 2015-04-05T14:15:25Z - - 1.9616148252758733860900974832475185394287109375 - - - - 51.0 - 2015-04-05T14:15:36Z - - 0.97148503305919964301295976838446222245693206787109375 - - - - 45.0 - 2015-04-05T14:15:55Z - - 1.4285273876786630520285825696191750466823577880859375 - - - - 40.0 - 2015-04-05T14:16:08Z - - 1.47926378535154245952298879274167120456695556640625 - - - - 45.0 - 2015-04-05T14:16:23Z - - 1.98505572053853729386219129082746803760528564453125 - - - - 47.0 - 2015-04-05T14:16:31Z - - 1.9533511954390860854147149439086206257343292236328125 - - - - 49.0 - 2015-04-05T14:16:44Z - - 1.33935894637257746353498077951371669769287109375 - - - - 50.0 - 2015-04-05T14:16:59Z - - 1.3007233134631259741098574522766284644603729248046875 - - - - 53.0 - 2015-04-05T14:17:08Z - - 2.038130380992700718678634075331501662731170654296875 - - - - 56.0 - 2015-04-05T14:17:19Z - - 2.2695302712753839813331069308333098888397216796875 - - - - 53.0 - 2015-04-05T14:17:27Z - - 1.8415090418452455534037426332361064851284027099609375 - - - - 52.0 - 2015-04-05T14:17:34Z - - 1.807346828831141838378471220494247972965240478515625 - - - - 53.0 - 2015-04-05T14:17:40Z - - 1.7674918112228061861657124609337188303470611572265625 - - - - 51.0 - 2015-04-05T14:17:52Z - - 1.484407917486532113571229274384677410125732421875 - - - - 49.0 - 2015-04-05T14:18:09Z - - 1.3399653847867079026201508895610459148883819580078125 - - - - 54.0 - 2015-04-05T14:18:22Z - - 1.8578728498045682382411314392811618745326995849609375 - - - - 55.0 - 2015-04-05T14:18:33Z - - 1.811574128329323851716026183567009866237640380859375 - - - - 50.0 - 2015-04-05T14:18:44Z - - 1.150802962450609090439002102357335388660430908203125 - - - - 47.0 - 2015-04-05T14:19:00Z - - 1.430135453952507074149025356746278703212738037109375 - - - - 49.0 - 2015-04-05T14:19:09Z - - 1.71964457213326848972201332799158990383148193359375 - - - - 49.0 - 2015-04-05T14:19:14Z - - 1.6584512553766288522894001289387233555316925048828125 - - - - 53.0 - 2015-04-05T14:19:26Z - - 1.5476972749084028091459686038433574140071868896484375 - - - - 53.0 - 2015-04-05T14:19:38Z - - 1.5992197208739733493843004907830618321895599365234375 - - - - 45.0 - 2015-04-05T14:19:55Z - - 1.19675421899465650454885690123774111270904541015625 - - - - 46.0 - 2015-04-05T14:20:09Z - - 1.3379462270921094191322708866209723055362701416015625 - - - - 43.0 - 2015-04-05T14:20:20Z - - 1.4452706443167817607076131025678478181362152099609375 - - - - 51.0 - 2015-04-05T14:20:38Z - - 1.6736015796009924283538339295773766934871673583984375 - - - - 52.0 - 2015-04-05T14:20:50Z - - 1.46225518211087379683021936216391623020172119140625 - - - - 53.0 - 2015-04-05T14:21:02Z - - 1.6767803793550049018534764400101266801357269287109375 - - - - 58.0 - 2015-04-05T14:21:17Z - - 1.6980324690715680180375102281686849892139434814453125 - - - - 60.0 - 2015-04-05T14:21:27Z - - 1.8734521170287485869465626819874159991741180419921875 - - - - 55.0 - 2015-04-05T14:21:39Z - - 1.4613667586920542351691665317048318684101104736328125 - - - - 54.0 - 2015-04-05T14:21:48Z - - 1.6991625542005641680276539773331023752689361572265625 - - - - 57.0 - 2015-04-05T14:22:05Z - - 1.4366978637344554048382860855781473219394683837890625 - - - - 62.0 - 2015-04-05T14:22:19Z - - 1.7967750601996119730330292441067285835742950439453125 - - - - 67.0 - 2015-04-05T14:22:28Z - - 1.9761837194074851620229082982405088841915130615234375 - - - - 67.0 - 2015-04-05T14:22:37Z - - 1.811020465258739609026861216989345848560333251953125 - - - - 73.0 - 2015-04-05T14:22:45Z - - 1.89297767887140278020297046168707311153411865234375 - - - - 64.0 - 2015-04-05T14:23:00Z - - 1.31584773400577415003454007091931998729705810546875 - - - - 62.0 - 2015-04-05T14:23:19Z - - 1.5978677797316702680063826846890151500701904296875 - - - - 60.0 - 2015-04-05T14:23:34Z - - 1.6153978286939219000117873292765580117702484130859375 - - - - 61.0 - 2015-04-05T14:23:45Z - - 1.4573103386302628248216706197126768529415130615234375 - - - - 57.0 - 2015-04-05T14:23:57Z - - 1.7314834298929528966226598640787415206432342529296875 - - - - 55.0 - 2015-04-05T14:24:09Z - - 1.60188678938228346027017323649488389492034912109375 - - - - 59.0 - 2015-04-05T14:24:22Z - - 1.954867834005124205276615612092427909374237060546875 - - - - 55.0 - 2015-04-05T14:24:35Z - - 1.1235463346845484533531589477206580340862274169921875 - - - - 48.0 - 2015-04-05T14:24:55Z - - 1.452389437875639455199916483252309262752532958984375 - - - - 44.0 - 2015-04-05T14:25:12Z - - 1.4003113771918034302643718547187745571136474609375 - - - - 54.0 - 2015-04-05T14:25:31Z - - 1.8819654647147141535157288672053255140781402587890625 - - - - 49.0 - 2015-04-05T14:25:47Z - - 1.2483755832625984538708507898263633251190185546875 - - - - 47.0 - 2015-04-05T14:25:57Z - - 1.5314224805636269532982396412990055978298187255859375 - - - - 52.0 - 2015-04-05T14:26:10Z - - 1.925427419355023150870920289889909327030181884765625 - - - - 57.0 - 2015-04-05T14:26:17Z - - 2.514968321403298734395548308384604752063751220703125 - - - - 58.0 - 2015-04-05T14:26:25Z - - 1.3238010330301694938981427185353823006153106689453125 - - - - 48.0 - 2015-04-05T14:26:41Z - - 1.315399616468273080727158230729401111602783203125 - - - - 46.0 - 2015-04-05T14:26:55Z - - 1.459912437954972386222607383388094604015350341796875 - - - - 49.0 - 2015-04-05T14:27:02Z - - 1.8291508867962209539115292500355280935764312744140625 - - - - 47.0 - 2015-04-05T14:27:17Z - - 1.187105162992475815286752549582161009311676025390625 - - - - 47.0 - 2015-04-05T14:27:35Z - - 1.4139631274595700904939121755887754261493682861328125 - - - - 52.0 - 2015-04-05T14:27:49Z - - 1.548000835136900565913720129174180328845977783203125 - - - - 57.0 - 2015-04-05T14:28:06Z - - 1.89058566912157655082182827754877507686614990234375 - - - - 59.0 - 2015-04-05T14:28:20Z - - 1.6442629943522308888503857815521769225597381591796875 - - - - 56.0 - 2015-04-05T14:28:31Z - - 1.19159003734869894941539314459078013896942138671875 - - - - 64.0 - 2015-04-05T14:28:49Z - - 1.4028475468486953925406623966409824788570404052734375 - - - - 64.0 - 2015-04-05T14:29:02Z - - 1.27123689737629153029274675645865499973297119140625 - - - - 61.0 - 2015-04-05T14:29:19Z - - 1.651556525775772943376296097994782030582427978515625 - - - - 55.0 - 2015-04-05T14:29:31Z - - 1.4345666261073588554353364088456146419048309326171875 - - - - 58.0 - 2015-04-05T14:29:47Z - - 1.4581490774785546005176684047910384833812713623046875 - - - - 58.0 - 2015-04-05T14:29:55Z - - 1.5713073865162439091136548086069524288177490234375 - - - - 55.0 - 2015-04-05T14:30:04Z - - 1.748269090391244784399304990074597299098968505859375 - - - - 55.0 - 2015-04-05T14:30:17Z - - 1.2699638921944151892517993474029935896396636962890625 - - - - 52.0 - 2015-04-05T14:30:30Z - - 1.281430424187342875796957741840742528438568115234375 - - - - 49.0 - 2015-04-05T14:30:45Z - - 1.1491560292032119150462676770985126495361328125 - - - - 45.0 - 2015-04-05T14:31:00Z - - 1.513558105334533276931097134365700185298919677734375 - - - - 45.0 - 2015-04-05T14:31:08Z - - 1.5469319907007756942363130292505957186222076416015625 - - - - 45.0 - 2015-04-05T14:31:21Z - - 1.46527889504092012629143937374465167522430419921875 - - - - 49.0 - 2015-04-05T14:31:32Z - - 1.463493453662509491408627582131884992122650146484375 - - - - 49.0 - 2015-04-05T14:31:49Z - - 1.5626023485579898508746055085794068872928619384765625 - - - - 43.0 - 2015-04-05T14:32:07Z - - 1.4416038341783508069937624895828776061534881591796875 - - - - 41.0 - 2015-04-05T14:32:22Z - - 1.5824485673684154374285526500898413360118865966796875 - - - - 40.0 - 2015-04-05T14:32:35Z - - 1.5748411352238977922723961455631069839000701904296875 - - - - 46.0 - 2015-04-05T14:32:51Z - - 1.5927604077876240662448026341735385358333587646484375 - - - - 52.0 - 2015-04-05T14:33:01Z - - 2.1063627792288475149007354048080742359161376953125 - - - - 55.0 - 2015-04-05T14:33:12Z - - 1.84772355227900053620260223397053778171539306640625 - - - - 57.0 - 2015-04-05T14:33:24Z - - 1.3412358056699751340801185506279580295085906982421875 - - - - 57.0 - 2015-04-05T14:33:33Z - - 1.41038524661705100271547053125686943531036376953125 - - - - 54.0 - 2015-04-05T14:33:48Z - - 1.4982132992898165024797663136268965899944305419921875 - - - - 55.0 - 2015-04-05T14:34:02Z - - 1.629628220908934554955749263172037899494171142578125 - - - - 54.0 - 2015-04-05T14:34:14Z - - 1.4026687952147540716651974435080774128437042236328125 - - - - 54.0 - 2015-04-05T14:34:29Z - - 1.646366585414892114158647018484771251678466796875 - - - - 51.0 - 2015-04-05T14:34:37Z - - 1.339435980580680141116545200929976999759674072265625 - - - - 50.0 - 2015-04-05T14:34:50Z - - 1.003717130106378530030042384169064462184906005859375 - - - - 47.0 - 2015-04-05T14:35:02Z - - 1.3574421426254474898343005406786687672138214111328125 - - - - 46.0 - 2015-04-05T14:35:12Z - - 1.3881389728997621801909190253354609012603759765625 - - - - 47.0 - 2015-04-05T14:35:20Z - - 1.74269257604467586730834227637387812137603759765625 - - - - 48.0 - 2015-04-05T14:35:29Z - - 1.84311626270592920917579249362461268901824951171875 - - - - 48.0 - 2015-04-05T14:35:40Z - - 1.3580871655536943531927818185067735612392425537109375 - - - - 45.0 - 2015-04-05T14:35:51Z - - 0.70902360185940349612820909896981902420520782470703125 - - - - 46.0 - 2015-04-05T14:35:57Z - - 1.45244080852226442601704547996632754802703857421875 - - - - 43.0 - 2015-04-05T14:36:09Z - - 0.443022642909578212577770273128408007323741912841796875 - - - - 44.0 - 2015-04-05T14:36:21Z - - 1.6420703418283313368419840116985142230987548828125 - - - - 44.0 - 2015-04-05T14:36:35Z - - 1.4922560656982357674138484071590937674045562744140625 - - - - 45.0 - 2015-04-05T14:36:49Z - - 1.4884736077388449615455101593397557735443115234375 - - - - 44.0 - 2015-04-05T14:36:58Z - - 1.48168107930527792603925263392738997936248779296875 - - - - 44.0 - 2015-04-05T14:37:12Z - - 0 - - - - 41.0 - 2015-04-05T14:37:23Z - - 1.47426169948492979955290138605050742626190185546875 - - - - 42.0 - 2015-04-05T14:37:39Z - - 1.5804279753440024780530848147463984787464141845703125 - - - - 44.0 - 2015-04-05T14:37:57Z - - 1.524308639238368900947762085706926882266998291015625 - - - - 43.0 - 2015-04-05T14:38:13Z - - 1.1669443605168989819276248454116284847259521484375 - - - - 38.0 - 2015-04-05T14:38:25Z - - 1.0926705691303684186976852288353256881237030029296875 - - - - 36.0 - 2015-04-05T14:38:42Z - - 1.15062894433240447966682040714658796787261962890625 - - - - 39.0 - 2015-04-05T14:38:59Z - - 1.5784254482793793616934863166534341871738433837890625 - - - - 39.0 - 2015-04-05T14:39:05Z - - 0 - - - - 50.0 - 2015-04-05T14:39:15Z - - 2.025433424219079459049908109591342508792877197265625 - - - - 53.0 - 2015-04-05T14:39:26Z - - 1.4525191961421988207092681477661244571208953857421875 - - - - 48.0 - 2015-04-05T14:39:41Z - - 1.3429737890376152176230561963166110217571258544921875 - - - - 50.0 - 2015-04-05T14:39:49Z - - 1.7215206766679969074829159580986015498638153076171875 - - - - 49.0 - 2015-04-05T14:39:59Z - - 1.2614679360974425659236430874443612992763519287109375 - - - - 46.0 - 2015-04-05T14:40:12Z - - 1.4945724879212833879904565037577413022518157958984375 - - - - 41.0 - 2015-04-05T14:40:22Z - - 1.46641698257685337836164762848056852817535400390625 - - - - 40.0 - 2015-04-05T14:40:35Z - - 1.4303975084413924623305547356721945106983184814453125 - - - - 44.0 - 2015-04-05T14:40:50Z - - 1.892076914746315008386545741814188659191131591796875 - - - - 46.0 - 2015-04-05T14:40:58Z - - 1.6563968107610145263919321223511360585689544677734375 - - - - 41.0 - 2015-04-05T14:41:07Z - - 0.8055123103043519972032981968368403613567352294921875 - - - - 42.0 - 2015-04-05T14:41:14Z - - 1.7286768437500743544887882308103144168853759765625 - - - - 42.0 - 2015-04-05T14:41:25Z - - 1.561057040709433518799187368131242692470550537109375 - - - - 41.0 - 2015-04-05T14:41:37Z - - 1.5446109008388066996531051700003445148468017578125 - - - - 42.0 - 2015-04-05T14:41:46Z - - 1.5538952560375041134221874017384834587574005126953125 - - - - 42.0 - 2015-04-05T14:41:58Z - - 1.64405959328015871534489633631892502307891845703125 - - - - 43.0 - 2015-04-05T14:42:05Z - - 1.660951466056703740292732618399895727634429931640625 - - - - 40.0 - 2015-04-05T14:42:17Z - - 1.1887292071045367780612878050305880606174468994140625 - - - - 41.0 - 2015-04-05T14:42:20Z - - 1.71115763469033055343970772810280323028564453125 - - - - 41.0 - 2015-04-05T14:42:28Z - - 0.156517979077210711569279055765946395695209503173828125 - - - - 41.0 - 2015-04-05T14:44:41Z - - 0.1853209142850810453584387005321332253515720367431640625 - - - - 47.0 - 2015-04-05T14:44:54Z - - 1.5761464210933293639271823849412612617015838623046875 - - - - 48.0 - 2015-04-05T14:45:06Z - - 1.2639829294327789011020968246157281100749969482421875 - - - - 43.0 - 2015-04-05T14:45:22Z - - 1.3570909861090341141931503443629480898380279541015625 - - - - 43.0 - 2015-04-05T14:45:39Z - - 1.4806922288399320120078073159675113856792449951171875 - - - - 43.0 - 2015-04-05T14:45:52Z - - 1.21988263303582744612185706500895321369171142578125 - - - - 47.0 - 2015-04-05T14:45:59Z - - 2.089170982849311908324807518511079251766204833984375 - - - - 49.0 - 2015-04-05T14:46:07Z - - 2.055684393023607281492104448261670768260955810546875 - - - - 50.0 - 2015-04-05T14:46:15Z - - 1.4909859515942347485406571649946272373199462890625 - - - - 49.0 - 2015-04-05T14:46:29Z - - 1.411472692415959073741760221309959888458251953125 - - - - 48.0 - 2015-04-05T14:46:43Z - - 1.1758732135361646964355486488784663379192352294921875 - - - - 42.0 - 2015-04-05T14:46:59Z - - 1.1770108892012787205061385975568555295467376708984375 - - - - 46.0 - 2015-04-05T14:47:16Z - - 1.746663896211374744638078482239507138729095458984375 - - - - 41.0 - 2015-04-05T14:47:28Z - - 1.3854036338040887077482921085902489721775054931640625 - - - - 39.0 - 2015-04-05T14:47:43Z - - 1.1374587209855626657173388593946583569049835205078125 - - - - 40.0 - 2015-04-05T14:47:48Z - - 1.470938218221979010280620059347711503505706787109375 - - - - 43.0 - 2015-04-05T14:47:56Z - - 0.68009517155800758292372165669803507626056671142578125 - - - - 42.0 - 2015-04-05T14:48:40Z - - 0.50140389795840245579228167116525582969188690185546875 - - - - 46.0 - 2015-04-05T14:48:55Z - - 1.6249778807722543572111817411496303975582122802734375 - - - - 46.0 - 2015-04-05T14:49:10Z - - 1.169138234766720518820193319697864353656768798828125 - - - - 42.0 - 2015-04-05T14:49:21Z - - 1.3681092788988029607111229779548011720180511474609375 - - - - 45.0 - 2015-04-05T14:49:40Z - - 1.561462136945463985426840736181475222110748291015625 - - - - 45.0 - 2015-04-05T14:49:59Z - - 1.4124114061716976920024535502307116985321044921875 - - - - 45.0 - 2015-04-05T14:50:06Z - - 0 - - - - 46.0 - 2015-04-05T14:50:18Z - - 1.0422188012649022947897492485935799777507781982421875 - - - - 45.0 - 2015-04-05T14:50:24Z - - 0.602046075480584530481564797810278832912445068359375 - - - - 45.0 - 2015-04-05T14:50:39Z - - 0.447450517196568531286260395063436590135097503662109375 - - - - 45.0 - 2015-04-05T14:50:44Z - - 2.24760332878785629162621262366883456707000732421875 - - - - 46.0 - 2015-04-05T14:50:50Z - - 1.2808420740394013126461913998355157673358917236328125 - - - - 42.0 - 2015-04-05T14:51:02Z - - 0.85802808161177634982408335417858324944972991943359375 - - - - 40.0 - 2015-04-05T14:51:12Z - - 1.5031742661631144475364862955757416784763336181640625 - - - - 43.0 - 2015-04-05T14:51:19Z - - 1.5123140967405868106965272090747021138668060302734375 - - - - 45.0 - 2015-04-05T14:51:32Z - - 0.683630231560385936973034404218196868896484375 - - - - 48.0 - 2015-04-05T14:51:41Z - - 1.2911577990643297031425618115463294088840484619140625 - - - - 40.0 - 2015-04-05T14:51:54Z - - 1.3609444018615095561841599192121066153049468994140625 - - - - 39.0 - 2015-04-05T14:52:09Z - - 1.6201286981510258922156708649708889424800872802734375 - - - - 40.0 - 2015-04-05T14:52:19Z - - 1.5040874978690592644881007799995131790637969970703125 - - - - 43.0 - 2015-04-05T14:52:30Z - - 1.630593143288043389560471041477285325527191162109375 - - - - 46.0 - 2015-04-05T14:52:40Z - - 1.7350311509272575705153940361924469470977783203125 - - - - 43.0 - 2015-04-05T14:52:47Z - - 1.2041366604188763478333612511050887405872344970703125 - - - - 45.0 - 2015-04-05T14:53:04Z - - 1.45891272119264403528404727694578468799591064453125 - - - - 47.0 - 2015-04-05T14:53:15Z - - 1.6716640866328515979688518200418911874294281005859375 - - - - 48.0 - 2015-04-05T14:53:28Z - - 1.473122143671701689271458235452882945537567138671875 - - - - 43.0 - 2015-04-05T14:53:43Z - - 1.4454866727658564062863888466381467878818511962890625 - - - - 46.0 - 2015-04-05T14:54:00Z - - 1.5764593610197101813952258453355170786380767822265625 - - - - 46.0 - 2015-04-05T14:54:07Z - - 1.5215635561809739417782338932738639414310455322265625 - - - - 46.0 - 2015-04-05T14:54:16Z - - 1.494731213918289558506558023509569466114044189453125 - - - - 46.0 - 2015-04-05T14:54:30Z - - 1.5609424864740224503378840381628833711147308349609375 - - - - 45.0 - 2015-04-05T14:54:46Z - - 1.455301600871254041891234010108746588230133056640625 - - - - 46.0 - 2015-04-05T14:55:00Z - - 1.443944519019544348026329316780902445316314697265625 - - - - 43.0 - 2015-04-05T14:55:18Z - - 1.394216301621600262450328955310396850109100341796875 - - - - 38.0 - 2015-04-05T14:55:34Z - - 1.265988120263646710128568884101696312427520751953125 - - - - 40.0 - 2015-04-05T14:55:48Z - - 1.5122746755835247967070245067588984966278076171875 - - - - 44.0 - 2015-04-05T14:56:05Z - - 1.7719029332519464770001604847493581473827362060546875 - - - - 44.0 - 2015-04-05T14:56:13Z - - 3.925331647601533635594250881695188581943511962890625 - - - - 45.0 - 2015-04-05T14:56:20Z - - 3.075662343012783850326741230674088001251220703125 - - - - 43.0 - 2015-04-05T14:56:31Z - - 1.5431123867806790794787730192183516919612884521484375 - - - - 46.0 - 2015-04-05T14:56:47Z - - 2.244455210004003387069815289578400552272796630859375 - - - - 47.0 - 2015-04-05T14:56:55Z - - 3.13348221818709316011108967359177768230438232421875 - - - - 46.0 - 2015-04-05T14:57:02Z - - 3.741537930544088563777904710150323808193206787109375 - - - - 48.0 - 2015-04-05T14:57:09Z - - 3.752814721146296772502637395518831908702850341796875 - - - - 48.0 - 2015-04-05T14:57:17Z - - 3.166272660430101471007446889416314661502838134765625 - - - - 47.0 - 2015-04-05T14:57:24Z - - 2.83396677867534751982248053536750376224517822265625 - - - - 46.0 - 2015-04-05T14:57:34Z - - 3.211240458232476502331564915948547422885894775390625 - - - - 48.0 - 2015-04-05T14:57:41Z - - 3.668883484228680824656976255937479436397552490234375 - - - - 48.0 - 2015-04-05T14:57:49Z - - 3.064401780734543390138924223720096051692962646484375 - - - - 48.0 - 2015-04-05T14:57:54Z - - 3.425328842966381071022397009073756635189056396484375 - - - - 47.0 - 2015-04-05T14:58:02Z - - 3.464625571058015385261796836857683956623077392578125 - - - - 49.0 - 2015-04-05T14:58:09Z - - 3.386213540778640673778454583953134715557098388671875 - - - - 48.0 - 2015-04-05T14:58:14Z - - 3.76637860091178300336878237430937588214874267578125 - - - - 49.0 - 2015-04-05T14:58:23Z - - 2.726315662405471851315041931229643523693084716796875 - - - - 47.0 - 2015-04-05T14:58:37Z - - 1.3448713987232745470379313701414503157138824462890625 - - - - 49.0 - 2015-04-05T14:58:51Z - - 2.574107888190229065372705008485354483127593994140625 - - - - 50.0 - 2015-04-05T14:58:57Z - - 3.553487011762692215910419690771959722042083740234375 - - - - 49.0 - 2015-04-05T14:59:03Z - - 3.3088037025319021466884805704466998577117919921875 - - - - 48.0 - 2015-04-05T14:59:09Z - - 2.224834249156304455397048513987101614475250244140625 - - - - 45.0 - 2015-04-05T14:59:19Z - - 3.62867261991785294839019115897826850414276123046875 - - - - 43.0 - 2015-04-05T14:59:28Z - - 2.253602415337159659003418710199184715747833251953125 - - - - 45.0 - 2015-04-05T14:59:39Z - - 1.528610186437374895973562161088921129703521728515625 - - - - 44.0 - 2015-04-05T14:59:48Z - - 1.4097794069210152212434650209615938365459442138671875 - - - - 43.0 - 2015-04-05T15:00:04Z - - 1.4447933985574195059342628155718557536602020263671875 - - - - 43.0 - 2015-04-05T15:00:19Z - - 1.2086985397333609437708901168662123382091522216796875 - - - - 43.0 - 2015-04-05T15:00:27Z - - 0 - - - - 2015-04-05T15:10:57Z - - 0 - - - - 2015-04-05T15:11:01Z - - 0 - - - - - \ No newline at end of file