Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Move classes to internal package #3074

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ import com.mapbox.navigation.core.trip.session.TripSessionStateObserver
import com.mapbox.navigation.examples.R
import com.mapbox.navigation.examples.utils.Utils
import com.mapbox.navigation.examples.utils.extensions.toPoint
import com.mapbox.navigation.ui.NavigationConstants
import com.mapbox.navigation.ui.camera.NavigationCamera
import com.mapbox.navigation.ui.feedback.FeedbackBottomSheet
import com.mapbox.navigation.ui.feedback.FeedbackBottomSheetListener
import com.mapbox.navigation.ui.feedback.FeedbackItem
import com.mapbox.navigation.ui.legacy.NavigationConstants
import com.mapbox.navigation.ui.internal.utils.ViewUtils
import com.mapbox.navigation.ui.map.NavigationMapboxMap
import com.mapbox.navigation.ui.utils.ViewUtils
import java.lang.ref.WeakReference
import kotlinx.android.synthetic.main.activity_feedback_button.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ import com.mapbox.navigation.examples.R
import com.mapbox.navigation.examples.utils.Utils
import com.mapbox.navigation.examples.utils.extensions.toPoint
import com.mapbox.navigation.ui.NavigationButton
import com.mapbox.navigation.ui.NavigationConstants
import com.mapbox.navigation.ui.SoundButton
import com.mapbox.navigation.ui.camera.NavigationCamera
import com.mapbox.navigation.ui.feedback.FeedbackBottomSheet
import com.mapbox.navigation.ui.feedback.FeedbackBottomSheetListener
import com.mapbox.navigation.ui.feedback.FeedbackItem
import com.mapbox.navigation.ui.instruction.NavigationAlertView
import com.mapbox.navigation.ui.legacy.NavigationConstants
import com.mapbox.navigation.ui.internal.utils.ViewUtils
import com.mapbox.navigation.ui.map.NavigationMapboxMap
import com.mapbox.navigation.ui.utils.ViewUtils
import com.mapbox.navigation.ui.voice.NavigationSpeechPlayer
import com.mapbox.navigation.ui.voice.SpeechPlayerProvider
import com.mapbox.navigation.ui.voice.VoiceInstructionLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import butterknife.OnClick;
import timber.log.Timber;

import static com.mapbox.navigation.ui.legacy.NavigationConstants.MINIMAL_LOOKAHEAD_LOCATION_TIME_VALUE;
import static com.mapbox.navigation.ui.NavigationConstants.MINIMAL_LOOKAHEAD_LOCATION_TIME_VALUE;

/**
* This activity demonstrates turn by turn navigation using the NavigationMapRoute class. This can
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import com.mapbox.navigation.ui.OnNavigationReadyCallback
import com.mapbox.navigation.ui.camera.Camera
import com.mapbox.navigation.ui.camera.RouteInformation
import com.mapbox.navigation.ui.camera.SimpleCamera
import com.mapbox.navigation.ui.listeners.BannerInstructionsListener
import com.mapbox.navigation.ui.listeners.NavigationListener
import com.mapbox.navigation.ui.internal.listeners.BannerInstructionsListener
import com.mapbox.navigation.ui.internal.listeners.NavigationListener
import com.mapbox.navigation.ui.map.NavigationMapboxMap
import kotlinx.android.synthetic.main.activity_navigation_view.navigationView

Expand All @@ -26,8 +26,9 @@ import kotlinx.android.synthetic.main.activity_navigation_view.navigationView
* the [NavigationViewOptions.Builder] via
* [NavigationViewOptions.Builder.camera].
*/
class CustomCameraActivity : AppCompatActivity(), OnNavigationReadyCallback, NavigationListener,
BannerInstructionsListener {
class CustomCameraActivity : AppCompatActivity(), OnNavigationReadyCallback,
NavigationListener,
BannerInstructionsListener {

private lateinit var mapboxMap: MapboxMap
private lateinit var navigationMapboxMap: NavigationMapboxMap
Expand Down Expand Up @@ -139,7 +140,7 @@ class CustomCameraActivity : AppCompatActivity(), OnNavigationReadyCallback, Nav
}

override fun onNavigationRunning() {
// todo
// todo
}

override fun onNavigationFinished() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import com.mapbox.navigation.examples.R
import com.mapbox.navigation.examples.utils.Utils
import com.mapbox.navigation.ui.NavigationViewOptions
import com.mapbox.navigation.ui.OnNavigationReadyCallback
import com.mapbox.navigation.ui.listeners.BannerInstructionsListener
import com.mapbox.navigation.ui.listeners.NavigationListener
import com.mapbox.navigation.ui.internal.listeners.BannerInstructionsListener
import com.mapbox.navigation.ui.internal.listeners.NavigationListener
import com.mapbox.navigation.ui.map.NavigationMapboxMap
import com.mapbox.navigation.ui.puck.PuckDrawableSupplier
import com.mapbox.navigation.utils.internal.ifNonNull
Expand All @@ -26,8 +26,9 @@ import kotlinx.android.synthetic.main.activity_navigation_view.*
* device location puck's image based on the [RouteProgressState]
* status.
*/
class CustomPuckActivity : AppCompatActivity(), OnNavigationReadyCallback, NavigationListener,
BannerInstructionsListener {
class CustomPuckActivity : AppCompatActivity(), OnNavigationReadyCallback,
NavigationListener,
BannerInstructionsListener {

private lateinit var mapboxMap: MapboxMap
private lateinit var navigationMapboxMap: NavigationMapboxMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ import com.mapbox.navigation.examples.core.InstructionViewActivity
import com.mapbox.navigation.examples.utils.Utils
import com.mapbox.navigation.examples.utils.extensions.toPoint
import com.mapbox.navigation.ui.NavigationButton
import com.mapbox.navigation.ui.NavigationConstants
import com.mapbox.navigation.ui.SoundButton
import com.mapbox.navigation.ui.camera.DynamicCamera
import com.mapbox.navigation.ui.camera.NavigationCamera
import com.mapbox.navigation.ui.feedback.FeedbackBottomSheet
import com.mapbox.navigation.ui.feedback.FeedbackBottomSheetListener
import com.mapbox.navigation.ui.feedback.FeedbackItem
import com.mapbox.navigation.ui.instruction.NavigationAlertView
import com.mapbox.navigation.ui.legacy.NavigationConstants
import com.mapbox.navigation.ui.internal.utils.ViewUtils
import com.mapbox.navigation.ui.map.NavigationMapboxMap
import com.mapbox.navigation.ui.map.OnWayNameChangedListener
import com.mapbox.navigation.ui.summary.SummaryBottomSheet
import com.mapbox.navigation.ui.utils.ViewUtils
import com.mapbox.navigation.ui.voice.NavigationSpeechPlayer
import com.mapbox.navigation.ui.voice.SpeechPlayerProvider
import com.mapbox.navigation.ui.voice.VoiceInstructionLoader
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -88,47 +88,47 @@ class MapRouteLine {
private Handler mainHandler;

MapRouteLine(Context context,
Style style,
int styleRes,
String belowLayer,
MapRouteDrawableProvider drawableProvider,
MapRouteSourceProvider sourceProvider,
MapRouteLayerProvider layerProvider,
Handler handler) {
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<DirectionsRoute>(),
new ArrayList<FeatureCollection>(),
new HashMap<LineString, DirectionsRoute>(),
0,
true,
true,
handler);
style,
styleRes,
belowLayer,
drawableProvider,
sourceProvider,
layerProvider,
FeatureCollection.fromFeatures(new Feature[] {}),
FeatureCollection.fromFeatures(new Feature[] {}),
new ArrayList<DirectionsRoute>(),
new ArrayList<FeatureCollection>(),
new HashMap<LineString, DirectionsRoute>(),
0,
true,
true,
handler);
}

MapRouteLine(Context context,
Style style,
int styleRes,
String belowLayer,
MapRouteDrawableProvider drawableProvider,
MapRouteSourceProvider sourceProvider,
MapRouteLayerProvider layerProvider,
FeatureCollection routesFeatureCollection,
FeatureCollection waypointsFeatureCollection,
List<DirectionsRoute> directionsRoutes,
List<FeatureCollection> routeFeatureCollections,
HashMap<LineString, DirectionsRoute> routeLineStrings,
int primaryRouteIndex,
boolean isVisible,
boolean alternativesVisible,
Handler handler
Style style,
int styleRes,
String belowLayer,
MapRouteDrawableProvider drawableProvider,
MapRouteSourceProvider sourceProvider,
MapRouteLayerProvider layerProvider,
FeatureCollection routesFeatureCollection,
FeatureCollection waypointsFeatureCollection,
List<DirectionsRoute> directionsRoutes,
List<FeatureCollection> routeFeatureCollections,
HashMap<LineString, DirectionsRoute> routeLineStrings,
int primaryRouteIndex,
boolean isVisible,
boolean alternativesVisible,
Handler handler
) {
this.routeLayerIds = new ArrayList<>();
this.mainHandler = handler;
Expand All @@ -137,33 +137,33 @@ class MapRouteLine {
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));
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));
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));
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));
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));
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));
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));
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));
R.styleable.NavigationMapRoute_alternativeRouteShieldColor,
ContextCompat.getColor(context, R.color.mapbox_navigation_route_alternative_shield_color));
alternativeRouteScale = typedArray.getFloat(
R.styleable.NavigationMapRoute_alternativeRouteScale, 1.0f);
R.styleable.NavigationMapRoute_alternativeRouteScale, 1.0f);

GeoJsonOptions wayPointGeoJsonOptions = new GeoJsonOptions().withMaxZoom(16);
drawnWaypointsFeatureCollection = waypointsFeatureCollection;
Expand All @@ -177,9 +177,9 @@ class MapRouteLine {

// Waypoint attributes
int originWaypointIcon = typedArray.getResourceId(
R.styleable.NavigationMapRoute_originWaypointIcon, R.drawable.ic_route_origin);
R.styleable.NavigationMapRoute_originWaypointIcon, R.drawable.ic_route_origin);
int destinationWaypointIcon = typedArray.getResourceId(
R.styleable.NavigationMapRoute_destinationWaypointIcon, R.drawable.ic_route_destination);
R.styleable.NavigationMapRoute_destinationWaypointIcon, R.drawable.ic_route_destination);
typedArray.recycle();

final Drawable originIcon = drawableProvider.retrieveDrawable(originWaypointIcon);
Expand All @@ -199,7 +199,7 @@ class MapRouteLine {
for (int i = style.getLayers().size() - 1; i >= 0; i--) {
String layerId = style.getLayers().get(i).getId();
if (layerId.equals(LocationComponentConstants.SHADOW_LAYER)
|| layerId.equals(RouteConstants.LAYER_ABOVE_UPCOMING_MANEUVER_ARROW)) {
|| layerId.equals(RouteConstants.LAYER_ABOVE_UPCOMING_MANEUVER_ARROW)) {
belowLayer = layerId;
}
}
Expand Down Expand Up @@ -291,7 +291,7 @@ List<DirectionsRoute> retrieveDirectionsRoutes() {

boolean updatePrimaryRouteIndex(int primaryRouteIndex) {
boolean isNewIndex = this.primaryRouteIndex != primaryRouteIndex
&& primaryRouteIndex < directionsRoutes.size() && primaryRouteIndex >= 0;
&& primaryRouteIndex < directionsRoutes.size() && primaryRouteIndex >= 0;
if (isNewIndex) {
this.primaryRouteIndex = primaryRouteIndex;
updateRoutesFor(primaryRouteIndex);
Expand Down Expand Up @@ -320,8 +320,8 @@ private void drawRoutes(List<FeatureCollection> routeFeatureCollections) {

private void clearRouteData() {
clearRouteListData();
setRoutesSource(FeatureCollection.fromFeatures(new Feature[]{}));
setWaypointsSource(FeatureCollection.fromFeatures(new Feature[]{}));
setRoutesSource(FeatureCollection.fromFeatures(new Feature[] {}));
setWaypointsSource(FeatureCollection.fromFeatures(new Feature[] {}));
}

private void clearRouteListData() {
Expand Down Expand Up @@ -368,7 +368,7 @@ private FeatureProcessingTask retrieveFeatureProcessingTask(List<DirectionsRoute
private OnRouteFeaturesProcessedCallback routeFeaturesProcessedCallback = new OnRouteFeaturesProcessedCallback() {
@Override
public void onRouteFeaturesProcessed(List<FeatureCollection> routeFeatureCollections,
HashMap<LineString, DirectionsRoute> routeLineStrings) {
HashMap<LineString, DirectionsRoute> routeLineStrings) {
MapRouteLine.this.routeFeatureCollections.addAll(routeFeatureCollections);
MapRouteLine.this.routeLineStrings.putAll(routeLineStrings);
drawRoutes(routeFeatureCollections);
Expand Down Expand Up @@ -400,8 +400,8 @@ private FeatureCollection buildWayPointFeatureCollectionFrom(DirectionsRoute rou

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()
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;
Expand Down Expand Up @@ -437,7 +437,7 @@ private PrimaryRouteUpdateTask retrievePrimaryRouteUpdateTask(int newPrimaryInde
return primaryRouteUpdateTask;
}
return new PrimaryRouteUpdateTask(newPrimaryIndex,
routeFeatureCollections, primaryRouteUpdatedCallback, mainHandler);
routeFeatureCollections, primaryRouteUpdatedCallback, mainHandler);
}

private OnPrimaryRouteUpdatedCallback primaryRouteUpdatedCallback = new OnPrimaryRouteUpdatedCallback() {
Expand All @@ -453,26 +453,26 @@ OnPrimaryRouteUpdatedCallback retrievePrimaryRouteUpdatedCallback() {
}

private void initializeLayers(Style style, MapRouteLayerProvider layerProvider,
Drawable originIcon, Drawable destinationIcon,
String belowLayer) {
Drawable originIcon, Drawable destinationIcon,
String belowLayer) {
LineLayer routeShieldLayer = layerProvider.initializeRouteShieldLayer(
style, routeScale, alternativeRouteScale,
routeShieldColor, alternativeRouteShieldColor
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
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
style, originIcon, destinationIcon
);
MapUtils.addLayerToMap(style, wayPointLayer, belowLayer);
routeLayerIds.add(wayPointLayer.getId());
Expand Down Expand Up @@ -504,7 +504,7 @@ private void updateAllLayersVisibilityTo(boolean isVisible) {
Layer layer = style.getLayer(layerId);
if (layer != null) {
layer.setProperties(
visibility(isVisible ? VISIBLE : NONE)
visibility(isVisible ? VISIBLE : NONE)
);
}
}
Expand Down
7 changes: 1 addition & 6 deletions libnavigation-ui/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<manifest
package="com.mapbox.libnavigation.ui"
xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name="com.mapbox.navigation.ui.MapboxNavigationActivity"/>
</application>
package="com.mapbox.libnavigation.ui">

</manifest>
Loading