Skip to content

Commit

Permalink
add eta support for the notification back
Browse files Browse the repository at this point in the history
  • Loading branch information
Guardiola31337 committed Aug 3, 2018
1 parent 9b141f2 commit f3b4271
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class MapboxNavigationNotification implements NavigationNotification {
private String instructionText;
private int currentManeuverId;
private boolean isTwentyFourHourFormat;
private String etaFormat;

private BroadcastReceiver endNavigationBtnReceiver = new BroadcastReceiver() {
@Override
Expand Down Expand Up @@ -83,6 +84,7 @@ void unregisterReceiver(Context context) {

private void initialize(Context context, MapboxNavigation mapboxNavigation) {
this.mapboxNavigation = mapboxNavigation;
etaFormat = context.getString(R.string.eta_format);
RouteOptions routeOptions = mapboxNavigation.getRoute().routeOptions();
distanceFormatter = new DistanceFormatter(context, routeOptions.language(), routeOptions.voiceUnits());
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Expand Down Expand Up @@ -187,8 +189,9 @@ private void updateArrivalTime(RouteProgress routeProgress) {
double durationRemaining = routeProgress.durationRemaining();
int timeFormatType = options.timeFormatType();
String arrivalTime = formatTime(time, durationRemaining, timeFormatType, isTwentyFourHourFormat);
collapsedNotificationRemoteViews.setTextViewText(R.id.notificationArrivalText, arrivalTime);
expandedNotificationRemoteViews.setTextViewText(R.id.notificationArrivalText, arrivalTime);
String formattedArrivalTime = String.format(etaFormat, arrivalTime);
collapsedNotificationRemoteViews.setTextViewText(R.id.notificationArrivalText, formattedArrivalTime);
expandedNotificationRemoteViews.setTextViewText(R.id.notificationArrivalText, formattedArrivalTime);
}

private void updateManeuverImage(LegStep step) {
Expand Down

0 comments on commit f3b4271

Please sign in to comment.