From 939456efa6e6878b7e195728f292cd91ff191c1b Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Fri, 1 Sep 2017 12:38:55 +0300 Subject: [PATCH] [MAPSME-5513] [ios] Fixed route evelation for iPhone. --- .../MWMNavigationDashboardEntity.h | 1 + .../MWMNavigationDashboardEntity.mm | 12 +++++++ .../MWMNavigationDashboardManager+Entity.mm | 9 +++-- .../RoutePreview/MWMiPadRoutePreview.xib | 31 +++++----------- .../RoutePreview/RoutePreviewStatus.swift | 35 +++++++++++++++++-- 5 files changed, 58 insertions(+), 30 deletions(-) diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h index 42eae1dd33..ec91b505f0 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h @@ -1,6 +1,7 @@ @interface MWMNavigationDashboardEntity : NSObject @property(copy, nonatomic, readonly) NSAttributedString * estimate; +@property(copy, nonatomic, readonly) NSAttributedString * estimateDot; @property(copy, nonatomic, readonly) NSString * distanceToTurn; @property(copy, nonatomic, readonly) NSString * streetName; @property(copy, nonatomic, readonly) NSString * targetDistance; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm index 423fd74b76..48886cf449 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm @@ -9,6 +9,7 @@ @interface MWMNavigationDashboardEntity () @property(copy, nonatomic, readwrite) NSAttributedString * estimate; +@property(copy, nonatomic, readwrite) NSAttributedString * estimateDot; @property(copy, nonatomic, readwrite) NSString * distanceToTurn; @property(copy, nonatomic, readwrite) NSString * streetName; @property(copy, nonatomic, readwrite) NSString * targetDistance; @@ -50,4 +51,15 @@ timeStyle:NSDateFormatterShortStyle]; } +- (NSAttributedString *)estimateDot +{ + if (!_estimateDot) + { + auto attributes = @{NSForegroundColorAttributeName : [UIColor blackSecondaryText], + NSFontAttributeName : [UIFont medium17]}; + _estimateDot = [[NSAttributedString alloc] initWithString:@" • " attributes:attributes]; + } + return _estimateDot; +} + @end diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm index 8ee86d897d..c754ce784a 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm @@ -98,11 +98,10 @@ UIImage * image(routing::turns::CarDirection t, bool isNextTurn) entity.nextTurnImage = image(info.m_nextTurn, true); NSString * eta = [NSDateComponentsFormatter etaStringFrom:entity.timeToTarget]; - NSString * resultString = - [NSString stringWithFormat:@"%@ • %@ %@", eta, entity.targetDistance, entity.targetUnits]; - NSMutableAttributedString * result = - [[NSMutableAttributedString alloc] initWithString:resultString]; - [result addAttributes:self.etaAttributes range:NSMakeRange(0, resultString.length)]; + auto result = [[NSMutableAttributedString alloc] initWithString:eta attributes:self.etaAttributes]; + [result appendAttributedString:entity.estimateDot]; + auto target = [NSString stringWithFormat:@"%@ %@", entity.targetDistance, entity.targetUnits]; + [result appendAttributedString:[[NSAttributedString alloc] initWithString:target attributes:self.etaAttributes]]; entity.estimate = result; using namespace routing::turns; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib index 8ee88aaf59..42787696d6 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib @@ -151,7 +151,7 @@