-
Notifications
You must be signed in to change notification settings - Fork 318
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
Add Imperial / Metric support for UI & Notification #501
Conversation
*/ | ||
public static void startNavigation(Activity activity, DirectionsRoute route, | ||
String awsPoolId, boolean simulateRoute) { | ||
public static void startNavigation(Activity activity, DirectionsRoute route, NavigationViewOptions options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
*/ | ||
public static void startNavigation(Activity activity, Point origin, Point destination, | ||
String awsPoolId, boolean simulateRoute) { | ||
NavigationViewOptions options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
*/ | ||
public void startNavigation(Activity activity) { | ||
routeViewModel.extractLaunchData(activity); | ||
public void startNavigation(NavigationViewOptions options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
private boolean shouldShowThenStep; | ||
|
||
public InstructionModel(RouteProgress progress, DecimalFormat decimalFormat) { | ||
public InstructionModel(RouteProgress progress, DecimalFormat decimalFormat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
* @since 0.6.2 | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public void update(RouteProgress routeProgress) { | ||
public void update(RouteProgress routeProgress, @NavigationUnitType.UnitType int unitType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
*/ | ||
public void extractLaunchData(Activity activity) { | ||
public void extractLaunchData(NavigationViewOptions options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public void update(RouteProgress routeProgress) { | ||
public void update(RouteProgress routeProgress, @NavigationUnitType.UnitType int unitType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
public SummaryModel(RouteProgress progress, DecimalFormat decimalFormat) { | ||
distanceRemaining = distanceFormatterBold(progress.distanceRemaining(), decimalFormat, false); | ||
public SummaryModel(RouteProgress progress, DecimalFormat decimalFormat, | ||
@NavigationUnitType.UnitType int unitType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok here breaking SemVer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are fine breaking SemVer
The rest of the comments are minor details.
int unitType) { | ||
|
||
boolean isImperialUnitType = unitType == NavigationUnitType.TYPE_IMPERIAL; | ||
String largeUnitFormat = isImperialUnitType ? " mi" : " km"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers.
|
||
boolean isImperialUnitType = unitType == NavigationUnitType.TYPE_IMPERIAL; | ||
String largeUnitFormat = isImperialUnitType ? " mi" : " km"; | ||
String smallUnitFormat = isImperialUnitType ? " ft" : " m"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here ☝️
return TurfConversion.convertDistance(distance, TurfConstants.UNIT_METERS, TurfConstants.UNIT_MILES) < 10 | ||
&& TurfConversion.convertDistance(distance, TurfConstants.UNIT_METERS, TurfConstants.UNIT_FEET) > 401; | ||
private static boolean mediumDistance(double distance, String largeFinalUnit, String smallFinalUnit) { | ||
return TurfConversion.convertDistance(distance, TurfConstants.UNIT_METERS, largeFinalUnit) < 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers.
private static boolean longDistance(double distance) { | ||
return TurfConversion.convertDistance(distance, TurfConstants.UNIT_METERS, TurfConstants.UNIT_MILES) > 10; | ||
private static boolean longDistance(double distance, String largeFinalUnit) { | ||
return TurfConversion.convertDistance(distance, TurfConstants.UNIT_METERS, largeFinalUnit) > 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here ☝️
@@ -37,6 +37,7 @@ public void setUp() throws Exception { | |||
route = response.routes().get(0); | |||
} | |||
|
|||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove sanity
test if it's not worth it anymore?
2a24720
to
a713254
Compare
a713254
to
85839ad
Compare
NavigationViewOptions
to consolidate variables passed into the drop-in UIViewModel
s now look for unit type in preferencesRouteProgress
+NavigationUnitType
(if you want to use the views individually)int unitType
toMapboxNavigationOptions
to set the correct distance in the notificationTODO:
NavigationViewOptions
for transferringDirectionsRoute
orPoint
datacc @ericrwolfe