forked from organicmaps/organicmaps
Adding one minute to estimated route time to prevent displaying zero minutes are left. Changing estimated route time format on Android.
This commit is contained in:
parent
a353df32f9
commit
b59b4c22f6
2 changed files with 11 additions and 7 deletions
|
@ -1197,9 +1197,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
else
|
||||
ViewHelper.setScaleX(mIvTurn, 1);
|
||||
|
||||
final long hours = TimeUnit.SECONDS.toHours(info.mTotalTimeInSeconds);
|
||||
final String time = String.format("%02d:%02d", hours,
|
||||
TimeUnit.SECONDS.toMinutes(info.mTotalTimeInSeconds) - TimeUnit.HOURS.toMinutes(hours));
|
||||
// one minute is added to estimated time to destination point
|
||||
// to prevent displaying that zero minutes are left to the finish near destination point
|
||||
final long minutes = TimeUnit.SECONDS.toMinutes(info.mTotalTimeInSeconds) + 1;
|
||||
final long hours = TimeUnit.MINUTES.toHours(minutes);
|
||||
final String time = String.format("%d:%02d", hours, minutes - TimeUnit.HOURS.toMinutes(hours));
|
||||
mTvTotalTime.setText(time);
|
||||
|
||||
builder = new SpannableStringBuilder(info.mDistToTurn).append(" ").append(info.mTurnUnitsSuffix.toUpperCase());
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
|
||||
+ (NSString *)estimatedArrivalTimeWithSeconds:(NSNumber *)seconds
|
||||
{
|
||||
NSInteger ti = [seconds integerValue];
|
||||
NSInteger minutes = (ti / 60) % 60;
|
||||
NSInteger hours = (ti / 3600);
|
||||
return [NSString stringWithFormat:@"%ld:%02ld", (long)hours, (long)minutes];
|
||||
NSInteger const ti = [seconds integerValue];
|
||||
// one minute is added to estimated time to destination point
|
||||
// to prevent displaying that zero minutes are left to the finish near destination point
|
||||
NSInteger const minutes = ti / 60 + 1;
|
||||
NSInteger const hours = minutes / 60;
|
||||
return [NSString stringWithFormat:@"%ld:%02ld", (long)hours, (long)(minutes % 60)];
|
||||
}
|
||||
|
||||
+ (NSDate *)dateWithString:(NSString *)dateString
|
||||
|
|
Loading…
Add table
Reference in a new issue