-
Notifications
You must be signed in to change notification settings - Fork 319
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
Added safety for NONE_SPECIFIED type for voice units #811
Conversation
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.
After addressing these minor issues, this should be ready to go 🚀
@@ -14,7 +14,8 @@ | |||
public class LocaleUtils { | |||
|
|||
/** | |||
* Returns the unit type for the specified locale | |||
* Returns the unit type for the specified locale. Try to avoid using this unnecessarily because | |||
* all methods consuming unit type are able to handle the NONE_SPECIFIED type | |||
* @param locale for which to return the default unit type | |||
* @return unit type for specified locale | |||
*/ |
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.
Minor thing annotations normally are on top of the method definition like 👇
@NavigationUnitType.UnitType
public static int getUnitTypeForLocale(@NonNull Locale locale) {
👇
@@ -20,7 +22,11 @@ | |||
public static final int TYPE_IMPERIAL = 0; |
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.
NIT Empty lines #15
and #17
☝️
unitType = NavigationUnitType.getDirectionsCriteriaUnitType(options.navigationOptions().unitType()); | ||
MapboxNavigationOptions navigationOptions = options.navigationOptions(); | ||
unitType = NavigationUnitType.getDirectionsCriteriaUnitType( | ||
navigationOptions.unitType(), locale); |
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.
NIT Why is this in a new line?
@@ -20,7 +22,11 @@ | |||
public static final int TYPE_IMPERIAL = 0; | |||
public static final int TYPE_METRIC = 1; | |||
|
|||
public static String getDirectionsCriteriaUnitType(int unitType) { | |||
public static String getDirectionsCriteriaUnitType(int unitType, Locale locale) { |
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.
We're missing @NavigationUnitType.UnitType
👇
public static String getDirectionsCriteriaUnitType(@NavigationUnitType.UnitType int unitType, Locale locale) {
Fixes #810