[MAPSME-3077] [ios] Updated traffic & location buttons layout & visibility.

This commit is contained in:
Ilya Grechuhin 2016-11-29 11:02:59 +03:00
parent 9d72d1a969
commit 38deb3297c
9 changed files with 43 additions and 24 deletions

View file

@ -221,7 +221,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
}
- (IBAction)routingStartTouchUpInside { [MWMRouter startRouting]; }
- (IBAction)routingStopTouchUpInside { [[MWMRouter router] stop]; }
- (IBAction)routingStopTouchUpInside { [MWMRouter stopRouting]; }
- (IBAction)soundTouchUpInside:(MWMButton *)sender
{
BOOL const isEnable = sender.selected;
@ -425,7 +425,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
if (theApp.routingPlaneMode == MWMRoutingPlaneModeSearchDestination ||
theApp.routingPlaneMode == MWMRoutingPlaneModeSearchSource)
self.controller.controlsManager.searchHidden = YES;
[[MWMRouter router] stop];
[MWMRouter stopRouting];
}
}

View file

@ -200,7 +200,7 @@ extern NSString * const kAlohalyticsTapEventKey;
MapsAppDelegate.theApp.routingPlaneMode = MWMRoutingPlaneModeNone;
self.navigationManager.routePreview.alpha = 1.;
[self.navigationManager.routePreview removeFromSuperview];
[[MWMRouter router] stop];
[MWMRouter stopRouting];
self.navigationManager.state = MWMNavigationDashboardStateHidden;
self.menuController.p2pButton.selected = NO;
}];
@ -255,7 +255,7 @@ extern NSString * const kAlohalyticsTapEventKey;
{
if (!self.searchHidden)
self.searchManager.state = MWMSearchManagerStateHidden;
[[MWMRouter router] stop];
[MWMRouter stopRouting];
}
else
{
@ -306,7 +306,9 @@ extern NSString * const kAlohalyticsTapEventKey;
if (!IPAD)
{
CGFloat const bound = newFrame.origin.y + newFrame.size.height;
self.placePageManager.topBound = self.sideButtons.topBound = bound;
self.placePageManager.topBound = bound;
self.sideButtons.topBound = bound;
self.trafficButton.topBound = bound;
return;
}
@ -413,6 +415,7 @@ extern NSString * const kAlohalyticsTapEventKey;
self.hidden = NO;
self.sideButtons.zoomHidden = self.zoomHidden;
self.sideButtonsHidden = NO;
self.trafficButtonHidden = YES;
self.disableStandbyOnRouteFollowing = YES;
self.navigationManager.state = MWMNavigationDashboardStateNavigation;
}
@ -420,6 +423,7 @@ extern NSString * const kAlohalyticsTapEventKey;
- (void)onRouteStop
{
self.sideButtons.zoomHidden = self.zoomHidden;
self.trafficButtonHidden = NO;
self.navigationManager.state = MWMNavigationDashboardStateHidden;
self.disableStandbyOnRouteFollowing = NO;
self.menuState = MWMBottomMenuStateInactive;
@ -533,8 +537,11 @@ extern NSString * const kAlohalyticsTapEventKey;
{
if (IPAD)
return;
_topBound = self.placePageManager.topBound = self.sideButtons.topBound =
self.navigationManager.topBound = topBound;
_topBound = topBound;
self.placePageManager.topBound = topBound;
self.sideButtons.topBound = topBound;
self.navigationManager.topBound = topBound;
self.trafficButton.topBound = topBound;
}
- (void)setLeftBound:(CGFloat)leftBound

View file

@ -2,7 +2,6 @@
#import "Common.h"
#import "MWMButton.h"
#import "MWMMapViewControlsManager.h"
#import "MWMRouter.h"
#import "MWMSettings.h"
#import "MWMSideButtonsView.h"
#import "Statistics.h"
@ -99,7 +98,6 @@ NSArray<UIImage *> * animationImages(NSString * animationTemplate, NSUInteger im
- (void)processMyPositionStateModeEvent:(location::EMyPositionMode)mode
{
UIButton * locBtn = self.locationButton;
locBtn.hidden = GetFramework().IsOnRoute() && mode == location::FollowAndRotate;
[locBtn.imageView stopAnimating];
NSArray<UIImage *> * images =

View file

@ -3,6 +3,7 @@
+ (MWMTrafficButtonViewController *)controller;
@property(nonatomic) BOOL hidden;
@property(nonatomic) CGFloat topBound;
@property(nonatomic) CGFloat leftBound;
- (void)mwm_refreshUI;

View file

@ -25,6 +25,7 @@ CGFloat const kTopOffset = 16;
@interface MWMTrafficButtonViewController ()
@property(nonatomic) NSLayoutConstraint * topOffset;
@property(nonatomic) NSLayoutConstraint * leftOffset;
@property(nonatomic) MWMTrafficButtonState state;
@ -62,13 +63,13 @@ CGFloat const kTopOffset = 16;
UIView * sv = self.view;
UIView * ov = sv.superview;
NSLayoutConstraint * top = [NSLayoutConstraint constraintWithItem:sv
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:ov
attribute:NSLayoutAttributeTop
multiplier:1
constant:kTopOffset];
self.topOffset = [NSLayoutConstraint constraintWithItem:sv
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:ov
attribute:NSLayoutAttributeTop
multiplier:1
constant:kTopOffset];
self.leftOffset = [NSLayoutConstraint constraintWithItem:sv
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
@ -77,7 +78,7 @@ CGFloat const kTopOffset = 16;
multiplier:1
constant:kViewControlsOffsetToBounds];
[ov addConstraints:@[ top, self.leftOffset ]];
[ov addConstraints:@[ self.topOffset, self.leftOffset ]];
}
- (void)mwm_refreshUI
@ -92,8 +93,18 @@ CGFloat const kTopOffset = 16;
[self refreshLayout];
}
- (void)setTopBound:(CGFloat)topBound
{
if (_topBound == topBound)
return;
_topBound = topBound;
[self refreshLayout];
}
- (void)setLeftBound:(CGFloat)leftBound
{
if (_leftBound == leftBound)
return;
_leftBound = leftBound;
[self refreshLayout];
}
@ -107,11 +118,13 @@ CGFloat const kTopOffset = 16;
- (void)refreshLayout
{
runAsyncOnMainQueue(^{
CGFloat const offset =
CGFloat const topOffset = self.topBound + kTopOffset;
CGFloat const leftOffset =
self.hidden ? -self.view.width : self.leftBound + kViewControlsOffsetToBounds;
UIView * ov = self.view.superview;
[ov layoutIfNeeded];
self.leftOffset.constant = offset;
self.topOffset.constant = topOffset;
self.leftOffset.constant = leftOffset;
[UIView animateWithDuration:kDefaultAnimationDuration
animations:^{
[ov layoutIfNeeded];

View file

@ -70,7 +70,7 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
{
if (GetFramework().IsRouteFinished())
{
[[MWMRouter router] stop];
[MWMRouter stopRouting];
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
return;
}
@ -109,7 +109,7 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
{
if (IPAD && self.state != MWMNavigationDashboardStateNavigation)
[self.delegate routePreviewDidChangeFrame:{}];
[[MWMRouter router] stop];
[MWMRouter stopRouting];
self.taxiDataSource = nil;
}

View file

@ -522,7 +522,7 @@ BOOL gIsFirstMyPositionMode = YES;
{
[self.navigationController popToRootViewControllerAnimated:NO];
self.controlsManager.searchHidden = YES;
[[MWMRouter router] stop];
[MWMRouter stopRouting];
if ([action isEqualToString:@"me.maps.3daction.bookmarks"])
[self openBookmarks];
else if ([action isEqualToString:@"me.maps.3daction.search"])

View file

@ -11,6 +11,7 @@ typedef void (^MWMImageHeightBlock)(UIImage *, NSString *);
+ (BOOL)hasRouteAltitude;
+ (BOOL)isTaxi;
+ (void)startRouting;
+ (void)stopRouting;
@property(nonatomic, readonly) MWMRoutePoint startPoint;
@property(nonatomic, readonly) MWMRoutePoint finishPoint;
@ -23,8 +24,6 @@ typedef void (^MWMImageHeightBlock)(UIImage *, NSString *);
toPoint:(MWMRoutePoint const &)finish
bestRouter:(BOOL)bestRouter;
- (void)rebuildWithBestRouter:(BOOL)bestRouter;
- (void)start;
- (void)stop;
- (void)routeAltitudeImageForSize:(CGSize)size completion:(MWMImageHeightBlock)block;
- (instancetype)init __attribute__((unavailable("call +router instead")));

View file

@ -86,6 +86,7 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
[[UIApplication sharedApplication] openURL:taxiDataSource.taxiURL];
}
+ (void)stopRouting { [[MWMRouter router] stop]; }
- (instancetype)initRouter
{
self = [super init];