From 0d7388ea42ab25404bf0aad95dca43526ad2fdef Mon Sep 17 00:00:00 2001 From: "v.mikhaylenko" Date: Tue, 4 Aug 2015 15:17:38 +0300 Subject: [PATCH] [ios] Added routing progress to UI. --- .../CircularProgress/MWMCircularProgress.h | 1 + .../CircularProgress/MWMCircularProgress.m | 5 +- .../MWMMapViewControlsManager.h | 1 + .../MWMMapViewControlsManager.mm | 5 ++ .../MWMNavigationDashboardManager.h | 2 +- .../MWMNavigationDashboardManager.mm | 13 +++-- .../Views/MWMNavigationView.m | 10 ++-- .../RoutePreview/MWMLandscapeRoutePreview.xib | 44 ++++++++++------ .../RoutePreview/MWMPortraitRoutePreview.xib | 50 +++++++++++-------- .../Views/RoutePreview/MWMRoutePreview.h | 2 +- .../Views/RoutePreview/MWMRoutePreview.mm | 43 ++++++++++------ iphone/Maps/Classes/MapViewController.mm | 6 ++- .../xcdebugger/Breakpoints_v2.xcbkptlist | 2 +- 13 files changed, 123 insertions(+), 61 deletions(-) diff --git a/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.h b/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.h index 7f2674e289..4e291a6191 100644 --- a/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.h +++ b/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.h @@ -23,5 +23,6 @@ - (nonnull instancetype)init __attribute__((unavailable("init is not available"))); - (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id )delegate; +- (void)reset; @end diff --git a/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.m b/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.m index c3c6bbe4ca..0b4762e8f2 100644 --- a/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.m +++ b/iphone/Maps/Classes/CustomViews/CircularProgress/MWMCircularProgress.m @@ -30,13 +30,14 @@ [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil]; [parentView addSubview:self.rootView]; self.delegate = delegate; - [self setup]; + [self reset]; } return self; } -- (void)setup +- (void)reset { + [self.rootView updatePath:0.]; self.nextProgressToAnimate = nil; } diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h index 3e08ab84c2..a812d2ecd4 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h @@ -50,5 +50,6 @@ - (void)routingReady; - (void)routingNavigation; - (void)handleRoutingError; +- (void)setRouteBuildingProgress:(CGFloat)progress; @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 09bdcd2df7..1eff5d1b9e 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -171,6 +171,11 @@ [[MapsAppDelegate theApp] enableStandby]; } +- (void)setRouteBuildingProgress:(CGFloat)progress +{ + [self.navigationManager setRouteBuildingProgress:progress]; +} + #pragma mark - Properties @synthesize menuState = _menuState; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h index 728b550de7..972c3fe8f2 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h @@ -39,10 +39,10 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState) @property (nonatomic) CGFloat topBound; @property (nonatomic, readonly) CGFloat height; - - (instancetype)init __attribute__((unavailable("init is not available"))); - (instancetype)initWithParentView:(UIView *)view delegate:(id)delegate; - (void)setupDashboard:(location::FollowingInfo const &)info; - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation; +- (void)setRouteBuildingProgress:(CGFloat)progress; @end diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm index 09274eefb1..dee7debe2c 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm @@ -19,7 +19,6 @@ @property (nonatomic) IBOutlet MWMRoutePreview * routePreviewPortrait; @property (weak, nonatomic) MWMRoutePreview * routePreview; - @property (nonatomic) IBOutlet MWMNavigationDashboard * navigationDashboardLandscape; @property (nonatomic) IBOutlet MWMNavigationDashboard * navigationDashboardPortrait; @property (weak, nonatomic) MWMNavigationDashboard * navigationDashboard; @@ -124,6 +123,12 @@ [self.delegate buildRouteWithType:f.GetRouter()]; } +- (void)setRouteBuildingProgress:(CGFloat)progress +{ + [self.routePreviewLandscape setRouteBuildingProgress:progress]; + [self.routePreviewPortrait setRouteBuildingProgress:progress]; +} + #pragma mark - MWMNavigationDashboard - (IBAction)navigationCancelPressed:(UIButton *)sender @@ -150,8 +155,8 @@ - (void)showStatePlanning { - [self.routePreview addToView:self.ownerView]; [self.navigationDashboard remove]; + [self.routePreview addToView:self.ownerView]; [self.routePreviewLandscape statePlaning]; [self.routePreviewPortrait statePlaning]; auto const state = GetFramework().GetRouter(); @@ -204,11 +209,11 @@ [self showStatePlanning]; break; case MWMNavigationDashboardStateError: - NSAssert(_state == MWMNavigationDashboardStatePlanning, @"Invalid state change"); + NSAssert(_state == MWMNavigationDashboardStatePlanning, @"Invalid state change (error)"); [self handleError]; break; case MWMNavigationDashboardStateReady: - NSAssert(_state == MWMNavigationDashboardStatePlanning, @"Invalid state change"); + NSAssert(_state == MWMNavigationDashboardStatePlanning, @"Invalid state change (ready)"); [self showStateReady]; break; case MWMNavigationDashboardStateNavigation: diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m index 6d6496b8ea..55bb76b1c9 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m @@ -33,9 +33,13 @@ static CGFloat const kStatusbarHeight = 20.0; - (void)addToView:(UIView *)superview { - [superview insertSubview:self atIndex:0]; - self.frame = self.defaultFrame; - dispatch_async(dispatch_get_main_queue(), ^{ self.isVisible = YES; }); + NSAssert(superview != nil, @"Superview can't be nil"); + dispatch_async(dispatch_get_main_queue(), ^ + { + [superview insertSubview:self atIndex:0]; + self.frame = self.defaultFrame; + self.isVisible = YES; + }); } - (void)remove diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMLandscapeRoutePreview.xib b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMLandscapeRoutePreview.xib index 4ac773fc78..0c9bcb52c2 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMLandscapeRoutePreview.xib +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMLandscapeRoutePreview.xib @@ -43,19 +43,30 @@ - + +