From 98a51d6c07614eb6bc35c94a2bf87ea8ca9f8916 Mon Sep 17 00:00:00 2001 From: "v.mikhaylenko" Date: Fri, 4 Sep 2015 16:25:06 +0300 Subject: [PATCH] [ios] Replace all animation duration to default. --- iphone/Maps/Classes/Common.h | 2 ++ .../AlertController/MWMAlertViewController.mm | 4 ++-- .../MWMDownloadTransitMapAlert.mm | 4 ++-- .../MWMDownloaderDialogHeader.mm | 3 ++- .../CustomViews/MapViewControls/APIBar/MWMAPIBar.mm | 5 +++-- .../NavigationDashboard/Views/MWMNavigationView.m | 2 +- .../Views/RoutePreview/MWMRoutePreview.mm | 3 ++- .../MWMSearchDownloadMapRequestView.m | 2 +- .../Classes/MWMBookmarkDescriptionViewController.mm | 7 ++++--- iphone/Maps/Classes/MWMPlacePageNavigationBar.mm | 5 +++-- iphone/Maps/Classes/MWMiPadPlacePage.mm | 13 +++++++------ iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm | 5 +++-- iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm | 3 ++- iphone/Maps/Classes/SearchView.mm | 2 +- 14 files changed, 35 insertions(+), 25 deletions(-) diff --git a/iphone/Maps/Classes/Common.h b/iphone/Maps/Classes/Common.h index 0003a0820b..c1426f1962 100644 --- a/iphone/Maps/Classes/Common.h +++ b/iphone/Maps/Classes/Common.h @@ -15,6 +15,8 @@ static NSString * const kDownloadingProgressUpdateNotificationId = @"Downloading static NSString * const kHaveAppleWatch = @"HaveAppleWatch"; +static CGFloat const kDefaultAnimationDuration = .2; + static inline NSString * const kApplicationGroupIdentifier() { static NSString * const productionGroupIdentifier = @"group.mapsme.watchkit.production"; diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index 9334163968..8aed09fa94 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -129,7 +129,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController CGFloat const scale = 1.1; alert.transform = CGAffineTransformMakeScale(scale, scale); } - [UIView animateWithDuration:.15 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.view.alpha = 1.; alert.alpha = 1.; @@ -141,7 +141,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController - (void)closeAlertWithCompletion:(nullable CloseAlertCompletion)completion { MWMAlert * alert = self.view.subviews.firstObject; - [UIView animateWithDuration:.15 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { alert.alpha = 0.; self.view.alpha = 0.; diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm index ee95d889b4..de66c24575 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm @@ -218,7 +218,7 @@ static NSString * const kStatisticsEvent = @"Map download Alert"; }]; [self.dialogsTableView beginUpdates]; [self.dialogsTableView endUpdates]; - [UIView animateWithDuration:0.05 animations:^ + [UIView animateWithDuration:.05 animations:^ { [self layoutSubviews]; }]; @@ -239,7 +239,7 @@ static NSString * const kStatisticsEvent = @"Map download Alert"; } completion:^(BOOL finished) { - [UIView animateWithDuration:.3 animations:^{ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ [self.dialogsTableView beginUpdates]; [self.dialogsTableView.visibleCells enumerateObjectsUsingBlock:^(MWMDownloaderDialogCell * obj, NSUInteger idx, BOOL *stop) { diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloaderDialogHeader.mm b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloaderDialogHeader.mm index a29b4a5d84..b01f6672ec 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloaderDialogHeader.mm +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloaderDialogHeader.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMDownloaderDialogHeader.h" #import "MWMDownloadTransitMapAlert.h" @@ -38,7 +39,7 @@ static NSString * const kDownloaderDialogHeaderNibName = @"MWMDownloaderDialogHe BOOL const currentState = sender.selected; sender.selected = !currentState; self.dividerView.hidden = currentState; - [UIView animateWithDuration:.15 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.expandImage.transform = sender.selected ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformIdentity; }]; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm index c0a1863d73..2cc8a1bde2 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMAPIBar.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMAPIBar.h" #import "MWMAPIBarView.h" #import "SearchView.h" @@ -42,7 +43,7 @@ [self.delegate.view insertSubview:self.rootView belowSubview:self.delegate.searchView]; self.rootView.width = self.delegate.view.width; self.rootView.maxY = 0.0; - [UIView animateWithDuration:0.2 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.rootView.targetY = 0.0; self.isVisible = YES; @@ -51,7 +52,7 @@ - (void)hideAnimated:(BOOL)animated { - [UIView animateWithDuration:animated ? 0.2 : 0.0 animations:^ + [UIView animateWithDuration:animated ? kDefaultAnimationDuration : 0.0 animations:^ { self.rootView.targetY = -self.rootView.height; self.isVisible = NO; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m index 55bb76b1c9..188315ce9d 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationView.m @@ -49,7 +49,7 @@ static CGFloat const kStatusbarHeight = 20.0; - (void)layoutSubviews { - [UIView animateWithDuration:0.2 animations:^ + [UIView animateWithDuration:0.2f animations:^ { if (!CGRectEqualToRect(self.frame, self.defaultFrame)) self.frame = self.defaultFrame; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm index 6c6373b5cf..657275e389 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMCircularProgress.h" #import "MWMNavigationDashboardEntity.h" #import "MWMRoutePreview.h" @@ -77,7 +78,7 @@ { [self layoutIfNeeded]; self.showGoButton = show; - [UIView animateWithDuration:0.2 animations:^{ [self layoutIfNeeded]; }]; + [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ [self layoutIfNeeded]; }]; } #pragma mark - Properties diff --git a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m index c0836c0208..fdfede4b07 100644 --- a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m +++ b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m @@ -39,7 +39,7 @@ [self layoutIfNeeded]; self.state = state; [self update]; - [UIView animateWithDuration:0.3 animations:^{ [self layoutIfNeeded]; }]; + [UIView animateWithDuration:0.2f animations:^{ [self layoutIfNeeded]; }]; } - (void)layoutSubviews diff --git a/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm index 5a34d9b097..b187826dd8 100644 --- a/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm +++ b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMBookmarkDescriptionViewController.h" #import "MWMPlacePageViewManager.h" #import "MWMPlacePage.h" @@ -106,7 +107,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState) { self.textView.hidden = NO; self.textView.text = text; - [UIView animateWithDuration:0.2f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.webView.alpha = 0.; self.textView.alpha = 1.; @@ -122,7 +123,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState) { self.webView.hidden = NO; [self.webView loadHTMLString:text baseURL:nil]; - [UIView animateWithDuration:0.2f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.webView.alpha = 1.; self.textView.alpha = 0.; @@ -193,7 +194,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState) return; } [self.iPadOwnerNavigationController setNavigationBarHidden:YES]; - [UIView animateWithDuration:0.1 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight; } diff --git a/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm b/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm index a3d18cd017..3aa69e725c 100644 --- a/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm +++ b/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMPlacePageNavigationBar.h" #import "MWMiPhonePortraitPlacePage.h" #import "MWMPlacePageViewManager.h" @@ -77,7 +78,7 @@ static inline CGPoint const dismissCenter(CGFloat xPosition) - (void)dismiss { - [UIView animateWithDuration:.1 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.center = dismissCenter(self.center.x); }]; @@ -85,7 +86,7 @@ static inline CGPoint const dismissCenter(CGFloat xPosition) - (void)show { - [UIView animateWithDuration:.1 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.center = openCenter(self.center.x); }]; diff --git a/iphone/Maps/Classes/MWMiPadPlacePage.mm b/iphone/Maps/Classes/MWMiPadPlacePage.mm index 67cb39e1c1..0eea8ac5f6 100644 --- a/iphone/Maps/Classes/MWMiPadPlacePage.mm +++ b/iphone/Maps/Classes/MWMiPadPlacePage.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMiPadPlacePage.h" #import "MWMPlacePageViewManager.h" #import "MWMPlacePageActionBar.h" @@ -77,7 +78,7 @@ static CGFloat const kBottomOffset = 12.; NSUInteger const count = self.viewControllers.count; CGFloat const height = count > 1 ? ((UIViewController *)self.viewControllers[count - 2]).view.height : 0.0; - [UIView animateWithDuration:0.1 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.view.height = height; } @@ -119,7 +120,7 @@ static CGFloat const kBottomOffset = 12.; - (void)show { UIView * view = self.navigationController.view; - [UIView animateWithDuration:0.2f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { view.minX = kLeftOffset; view.alpha = 1.0; @@ -130,7 +131,7 @@ static CGFloat const kBottomOffset = 12.; { UIView * view = self.navigationController.view; UIViewController * controller = self.navigationController; - [UIView animateWithDuration:0.2f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { view.maxX = 0.0; view.alpha = 0.0; @@ -158,7 +159,7 @@ static CGFloat const kBottomOffset = 12.; - (void)addBookmark { [super addBookmark]; - [UIView animateWithDuration:0.1 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { [self updatePlacePageLayout]; }]; @@ -167,7 +168,7 @@ static CGFloat const kBottomOffset = 12.; - (void)removeBookmark { [super removeBookmark]; - [UIView animateWithDuration:0.1 animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { [self updatePlacePageLayout]; }]; @@ -278,7 +279,7 @@ static CGFloat const kBottomOffset = 12.; - (void)setTopBound:(CGFloat)topBound { super.topBound = topBound; - [UIView animateWithDuration:0.2f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.navigationController.view.minY = topBound + kTopOffset; }]; diff --git a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm index 62f4a655b9..6802fce632 100644 --- a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMiPhoneLandscapePlacePage.h" #import "MWMBasePlacePageView.h" #import "MWMPlacePageActionBar.h" @@ -133,7 +134,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) CGFloat const headerViewHeight = baseViewHeight - tableHeight; CGFloat const titleOriginY = tableHeight - kBookmarkCellHeight - tableView.contentOffset.y; - [UIView animateWithDuration:0.3f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., statusBarHeight - headerViewHeight - titleOriginY); }]; @@ -142,7 +143,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) - (void)willFinishEditingBookmarkTitle:(NSString *)title { [super willFinishEditingBookmarkTitle:title]; - [UIView animateWithDuration:0.3f animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration animations:^ { self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., 0.); }]; diff --git a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm index 554560f78d..5487626c66 100644 --- a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMiPhonePortraitPlacePage.h" #import "MWMSpringAnimation.h" #import "UIKitCategories.h" @@ -75,7 +76,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState) self.actionBar.width = width; self.actionBar.center = CGPointMake(width / 2., height + self.actionBar.height / 2.); [self.manager addSubviews:@[ppv, self.actionBar] withNavigationController:nil]; - [UIView animateWithDuration:0.3f delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^ + [UIView animateWithDuration:kDefaultAnimationDuration delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^ { self.actionBar.center = CGPointMake(width / 2., height - self.actionBar.height / 2.); } diff --git a/iphone/Maps/Classes/SearchView.mm b/iphone/Maps/Classes/SearchView.mm index 09e0a3a8b1..f50827dc5d 100644 --- a/iphone/Maps/Classes/SearchView.mm +++ b/iphone/Maps/Classes/SearchView.mm @@ -180,7 +180,7 @@ static BOOL keyboardLoaded = NO; [self showDownloadMapRequestIfRequired]; if (keyboardLoaded && !self.downloadRequest) [self.searchBar.textField becomeFirstResponder]; - [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.tableView.alpha = 1; } completion:nil]; [UIView animateWithDuration:duration delay:0 damping:damping initialVelocity:0 options:options animations:^{