[ios] Added top navigation info view.

This commit is contained in:
Ilya Grechuhin 2016-07-11 17:35:55 +03:00
parent 450000e501
commit 504bfd4cbe
13 changed files with 493 additions and 184 deletions

View file

@ -41,8 +41,7 @@ NSString * const kCollectionCelllandscape = @"MWMBottomMenuCollectionViewLandsca
static CGFloat const kLayoutThreshold = 420.0;
typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
{
typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
MWMBottomMenuViewCellAddPlace,
MWMBottomMenuViewCellDownload,
MWMBottomMenuViewCellSettings,
@ -51,22 +50,22 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
MWMBottomMenuViewCellCount
};
@interface MWMBottomMenuViewController () <UICollectionViewDataSource, UICollectionViewDelegate>
@interface MWMBottomMenuViewController ()<UICollectionViewDataSource, UICollectionViewDelegate>
@property (weak, nonatomic) MapViewController * controller;
@property (weak, nonatomic) IBOutlet UICollectionView * buttonsCollectionView;
@property(weak, nonatomic) MapViewController * controller;
@property(weak, nonatomic) IBOutlet UICollectionView * buttonsCollectionView;
@property (weak, nonatomic) IBOutlet UICollectionView * additionalButtons;
@property(weak, nonatomic) IBOutlet UICollectionView * additionalButtons;
@property (weak, nonatomic) id<MWMBottomMenuControllerProtocol> delegate;
@property(weak, nonatomic) id<MWMBottomMenuControllerProtocol> delegate;
@property (nonatomic) BOOL searchIsActive;
@property(nonatomic) BOOL searchIsActive;
@property (nonatomic) SolidTouchView * dimBackground;
@property(nonatomic) SolidTouchView * dimBackground;
@property (nonatomic) MWMBottomMenuState restoreState;
@property(nonatomic) MWMBottomMenuState restoreState;
@property (nonatomic, readonly) NSUInteger additionalButtonsCount;
@property(nonatomic, readonly) NSUInteger additionalButtonsCount;
@property(weak, nonatomic) MWMNavigationDashboardEntity * routingInfo;
@ -103,11 +102,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; }
- (void)viewDidLoad
{
[super viewDidLoad];
@ -116,7 +111,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
[self.buttonsCollectionView registerNib:[UINib nibWithNibName:kCollectionCelllandscape bundle:nil]
forCellWithReuseIdentifier:kCollectionCelllandscape];
MWMBottomMenuLayout * cvLayout =
(MWMBottomMenuLayout *)self.buttonsCollectionView.collectionViewLayout;
(MWMBottomMenuLayout *)self.buttonsCollectionView.collectionViewLayout;
cvLayout.layoutThreshold = kLayoutThreshold;
((MWMBottomMenuView *)self.view).layoutThreshold = kLayoutThreshold;
@ -137,13 +132,10 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
[self refreshLayout];
}
- (void)mwm_refreshUI
{
[self.view mwm_refreshUI];
}
- (void)mwm_refreshUI { [self.view mwm_refreshUI]; }
#pragma mark - MWMNavigationDashboardInfoProtocol
- (void)updateRoutingInfo:(MWMNavigationDashboardEntity *)info
- (void)updateNavigationInfo:(MWMNavigationDashboardEntity *)info
{
NSDictionary * routingNumberAttributes = @{
NSForegroundColorAttributeName : [UIColor blackPrimaryText],
@ -176,15 +168,25 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
attributes:routingLegendAttributes]];
self.distanceWithLegendLabel.attributedText = distance;
self.speedLabel.text = info.speed;
self.speedLegendLabel.text = info.speedUnits;
NSMutableAttributedString * speed =
[[NSMutableAttributedString alloc] initWithString:info.speed
attributes:routingNumberAttributes];
[speed
appendAttributedString:[[NSAttributedString alloc] initWithString:info.speedUnits
attributes:routingLegendAttributes]];
self.speedWithLegendLabel.attributedText = speed;
NSString * currentSpeed = info.speed;
if (currentSpeed.length != 0)
{
self.speedLabel.text = currentSpeed;
self.speedLegendLabel.text = info.speedUnits;
NSMutableAttributedString * speed =
[[NSMutableAttributedString alloc] initWithString:currentSpeed
attributes:routingNumberAttributes];
[speed
appendAttributedString:[[NSAttributedString alloc] initWithString:info.speedUnits
attributes:routingLegendAttributes]];
self.speedWithLegendLabel.attributedText = speed;
}
else
{
self.speedLabel.text = @"";
self.speedLegendLabel.text = @"";
self.speedWithLegendLabel.text = @"";
}
[self.progressView layoutIfNeeded];
[UIView animateWithDuration:kDefaultAnimationDuration
@ -200,7 +202,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
{
self.routingInfoPageControl.currentPage =
(self.routingInfoPageControl.currentPage + 1) % self.routingInfoPageControl.numberOfPages;
[self updateRoutingInfo:self.routingInfo];
[self updateNavigationInfo:self.routingInfo];
}
- (IBAction)routingStartTouchUpInside { [[MWMRouter router] start]; }
@ -279,8 +281,9 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
{
case MWMBottomMenuViewCellAddPlace:
{
BOOL const isEnabled = self.controller.controlsManager.navigationState == MWMNavigationDashboardStateHidden &&
GetFramework().CanEditMap();
BOOL const isEnabled =
self.controller.controlsManager.navigationState == MWMNavigationDashboardStateHidden &&
GetFramework().CanEditMap();
[cell configureWithImageName:@"ic_add_place"
label:L(@"placepage_add_place_button")
badgeCount:0
@ -299,20 +302,28 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
}
break;
case MWMBottomMenuViewCellSettings:
[cell configureWithImageName:@"ic_menu_settings" label:L(@"settings") badgeCount:0 isEnabled:YES];
[cell configureWithImageName:@"ic_menu_settings"
label:L(@"settings")
badgeCount:0
isEnabled:YES];
break;
case MWMBottomMenuViewCellShare:
[cell configureWithImageName:@"ic_menu_share" label:L(@"share_my_location") badgeCount:0 isEnabled:YES];
[cell configureWithImageName:@"ic_menu_share"
label:L(@"share_my_location")
badgeCount:0
isEnabled:YES];
break;
case MWMBottomMenuViewCellAd:
{
MTRGNativeAppwallBanner * banner = [self.controller.appWallAd.banners firstObject];
[self.controller.appWallAd handleShow:banner];
[cell configureWithImageName:@"ic_menu_showcase" label:L(@"showcase_more_apps") badgeCount:0 isEnabled:YES];
[cell configureWithImageName:@"ic_menu_showcase"
label:L(@"showcase_more_apps")
badgeCount:0
isEnabled:YES];
}
break;
case MWMBottomMenuViewCellCount:
break;
break;
case MWMBottomMenuViewCellCount: break;
}
return cell;
}
@ -322,28 +333,18 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
- (void)collectionView:(nonnull UICollectionView *)collectionView
didSelectItemAtIndexPath:(nonnull NSIndexPath *)indexPath
{
MWMBottomMenuCollectionViewCell * cell = static_cast<MWMBottomMenuCollectionViewCell *>([collectionView cellForItemAtIndexPath:indexPath]);
MWMBottomMenuCollectionViewCell * cell = static_cast<MWMBottomMenuCollectionViewCell *>(
[collectionView cellForItemAtIndexPath:indexPath]);
if (!cell.isEnabled)
return;
switch (indexPath.item)
{
case MWMBottomMenuViewCellAddPlace:
[self menuActionAddPlace];
break;
case MWMBottomMenuViewCellDownload:
[self menuActionDownloadMaps];
break;
case MWMBottomMenuViewCellSettings:
[self menuActionOpenSettings];
break;
case MWMBottomMenuViewCellShare:
[self menuActionShareLocation];
break;
case MWMBottomMenuViewCellAd:
[self menuActionOpenAd];
break;
case MWMBottomMenuViewCellCount:
break;
case MWMBottomMenuViewCellAddPlace: [self menuActionAddPlace]; break;
case MWMBottomMenuViewCellDownload: [self menuActionDownloadMaps]; break;
case MWMBottomMenuViewCellSettings: [self menuActionOpenSettings]; break;
case MWMBottomMenuViewCellShare: [self menuActionShareLocation]; break;
case MWMBottomMenuViewCellAd: [self menuActionOpenAd]; break;
case MWMBottomMenuViewCellCount: break;
}
}
@ -401,35 +402,38 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
NSAssert(banners.count != 0, @"Banners collection can not be empty!");
[Statistics logEvent:kStatMenu withParameters:@{kStatButton : kStatMoreApps}];
self.state = self.restoreState;
[self.controller.appWallAd showWithController:self.controller onComplete:^
{
[Statistics logEvent:kStatMyTargetAppsDisplayed withParameters:@{kStatCount : @(banners.count)}];
NSMutableArray<NSString *> * appNames = [@[] mutableCopy];
for (MTRGNativeAppwallBanner * banner in banners)
{
[Statistics logEvent:kStatMyTargetAppsDisplayed withParameters:@{kStatName : banner.title}];
[appNames addObject:banner.title];
}
NSString * appNamesString = [appNames componentsJoinedByString:@";"];
[Alohalytics logEvent:kStatMyTargetAppsDisplayed
withDictionary:@{
kStatCount : @(banners.count),
kStatName : appNamesString
}];
}
onError:^(NSError * error)
{
NSMutableArray<NSString *> * appNames = [@[] mutableCopy];
for (MTRGNativeAppwallBanner * banner in banners)
[appNames addObject:banner.title];
NSString * appNamesString = [appNames componentsJoinedByString:@";"];
[Statistics logEvent:kStatMyTargetAppsDisplayed
withParameters:@{
kStatError : error,
kStatCount : @(banners.count),
kStatName : appNamesString
}];
}];
[self.controller.appWallAd showWithController:self.controller
onComplete:^{
[Statistics logEvent:kStatMyTargetAppsDisplayed
withParameters:@{
kStatCount : @(banners.count)
}];
NSMutableArray<NSString *> * appNames = [@[] mutableCopy];
for (MTRGNativeAppwallBanner * banner in banners)
{
[Statistics logEvent:kStatMyTargetAppsDisplayed
withParameters:@{kStatName : banner.title}];
[appNames addObject:banner.title];
}
NSString * appNamesString = [appNames componentsJoinedByString:@";"];
[Alohalytics logEvent:kStatMyTargetAppsDisplayed
withDictionary:@{
kStatCount : @(banners.count),
kStatName : appNamesString
}];
}
onError:^(NSError * error) {
NSMutableArray<NSString *> * appNames = [@[] mutableCopy];
for (MTRGNativeAppwallBanner * banner in banners)
[appNames addObject:banner.title];
NSString * appNamesString = [appNames componentsJoinedByString:@";"];
[Statistics logEvent:kStatMyTargetAppsDisplayed
withParameters:@{
kStatError : error,
kStatCount : @(banners.count),
kStatName : appNamesString
}];
}];
}
- (IBAction)point2PointButtonTouchUpInside:(UIButton *)sender
@ -445,7 +449,8 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
}
else
{
if (theApp.routingPlaneMode == MWMRoutingPlaneModeSearchDestination || theApp.routingPlaneMode == MWMRoutingPlaneModeSearchSource)
if (theApp.routingPlaneMode == MWMRoutingPlaneModeSearchDestination ||
theApp.routingPlaneMode == MWMRoutingPlaneModeSearchSource)
self.controller.controlsManager.searchHidden = YES;
[[MWMRouter router] stop];
}
@ -471,9 +476,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
{
switch (self.state)
{
case MWMBottomMenuStateHidden:
NSAssert(false, @"Incorrect state");
break;
case MWMBottomMenuStateHidden: NSAssert(false, @"Incorrect state"); break;
case MWMBottomMenuStateInactive:
case MWMBottomMenuStatePlanning:
case MWMBottomMenuStateGo:
@ -499,7 +502,9 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
// if dimBackgroundTap is processed first then menuButtonTouchUpInside behaves as if menu is
// inactive this is wrong case, so we postpone dimBackgroundTap to make sure
// menuButtonTouchUpInside processed first
dispatch_async(dispatch_get_main_queue(), ^{ self.state = self.restoreState; });
dispatch_async(dispatch_get_main_queue(), ^{
self.state = self.restoreState;
});
}
- (void)toggleDimBackgroundVisible:(BOOL)visible
@ -507,18 +512,17 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
if (visible)
[self.controller.view insertSubview:self.dimBackground belowSubview:self.view];
self.dimBackground.alpha = visible ? 0.0 : 0.8;
[UIView animateWithDuration:kDefaultAnimationDuration animations:^
{
self.dimBackground.alpha = visible ? 0.8 : 0.0;
}
completion:^(BOOL finished)
{
if (!visible)
{
[self.dimBackground removeFromSuperview];
self.dimBackground = nil;
}
}];
[UIView animateWithDuration:kDefaultAnimationDuration
animations:^{
self.dimBackground.alpha = visible ? 0.8 : 0.0;
}
completion:^(BOOL finished) {
if (!visible)
{
[self.dimBackground removeFromSuperview];
self.dimBackground = nil;
}
}];
}
#pragma mark - Properties
@ -566,42 +570,26 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
view.state = state;
}
- (MWMBottomMenuState)state
{
return ((MWMBottomMenuView *)self.view).state;
}
- (MWMBottomMenuState)state { return ((MWMBottomMenuView *)self.view).state; }
- (void)setRestoreState:(MWMBottomMenuState)restoreState
{
((MWMBottomMenuView *)self.view).restoreState = restoreState;
}
- (MWMBottomMenuState)restoreState
{
return ((MWMBottomMenuView *)self.view).restoreState;
}
- (MWMBottomMenuState)restoreState { return ((MWMBottomMenuView *)self.view).restoreState; }
- (void)setLeftBound:(CGFloat)leftBound
{
((MWMBottomMenuView *)self.view).leftBound = leftBound;
((EAGLView *)self.controller.view).widgetsManager.leftBound = leftBound;
}
- (CGFloat)leftBound
{
return ((MWMBottomMenuView *)self.view).leftBound;
}
- (CGFloat)leftBound { return ((MWMBottomMenuView *)self.view).leftBound; }
- (void)setSearchIsActive:(BOOL)searchIsActive
{
((MWMBottomMenuView *)self.view).searchIsActive = searchIsActive;
}
- (BOOL)searchIsActive
{
return ((MWMBottomMenuView *)self.view).searchIsActive;
}
- (BOOL)searchIsActive { return ((MWMBottomMenuView *)self.view).searchIsActive; }
- (NSUInteger)additionalButtonsCount
{
return MWMBottomMenuViewCellCount - (self.controller.isAppWallAdActive ? 0 : 1);

View file

@ -110,14 +110,14 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UhW-en-7qq">
<rect key="frame" x="0.0" y="0.0" width="72" height="48"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="000 mph" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="azs-RS-4KE">
<rect key="frame" x="0.0" y="4" width="97" height="27"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="azs-RS-4KE">
<rect key="frame" x="36" y="4" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y2P-la-daO">
<rect key="frame" x="14" y="4" width="44" height="27"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y2P-la-daO">
<rect key="frame" x="36" y="4" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -125,8 +125,8 @@
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mph" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P9v-a6-EaA">
<rect key="frame" x="23" y="31" width="27" height="14"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P9v-a6-EaA">
<rect key="frame" x="36" y="11" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -151,13 +151,13 @@
<rect key="frame" x="74" y="0.0" width="112" height="48"/>
<subviews>
<pageControl opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="100" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="2" translatesAutoresizingMaskIntoConstraints="NO" id="7hO-Gk-BGJ">
<rect key="frame" x="44" y="31" width="23" height="13"/>
<rect key="frame" x="44" y="4" width="23" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="a7i-03-Hg1"/>
</constraints>
</pageControl>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="000h 00m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jSU-Ns-SpQ">
<rect key="frame" x="0.0" y="4" width="112" height="27"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jSU-Ns-SpQ">
<rect key="frame" x="56" y="4" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -178,14 +178,14 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mab-rl-ueg">
<rect key="frame" x="188" y="0.0" width="72" height="48"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="000 mi" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LOZ-cm-r9V">
<rect key="frame" x="-3" y="4" width="75" height="27"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LOZ-cm-r9V">
<rect key="frame" x="36" y="4" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LBZ-kD-25J">
<rect key="frame" x="-2" y="4" width="74" height="27"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LBZ-kD-25J">
<rect key="frame" x="36" y="4" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -193,8 +193,8 @@
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mi" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5ad-tg-al9">
<rect key="frame" x="29" y="31" width="15" height="14"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5ad-tg-al9">
<rect key="frame" x="36" y="11" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>

View file

@ -365,14 +365,10 @@ extern NSString * const kAlohalyticsTapEventKey;
- (void)onRouteStart
{
if ([MWMRouter router].startPoint.IsMyPosition())
{
self.hidden = NO;
self.sideButtonsHidden = NO;
self.disableStandbyOnRouteFollowing = YES;
self.navigationManager.state = MWMNavigationDashboardStateNavigation;
}
self.hidden = NO;
self.sideButtonsHidden = NO;
self.disableStandbyOnRouteFollowing = YES;
self.navigationManager.state = MWMNavigationDashboardStateNavigation;
}
- (void)onRouteStop
@ -412,10 +408,12 @@ extern NSString * const kAlohalyticsTapEventKey;
- (MWMNavigationDashboardManager *)navigationManager
{
if (!_navigationManager)
{
_navigationManager =
[[MWMNavigationDashboardManager alloc] initWithParentView:self.ownerController.view
infoDisplay:self.menuController
delegate:self];
[_navigationManager addInfoDisplay:self.menuController];
}
return _navigationManager;
}

View file

@ -0,0 +1,7 @@
#import "MWMNavigationDashboardEntity.h"
@protocol MWMNavigationDashboardInfoProtocol
- (void)updateNavigationInfo:(MWMNavigationDashboardEntity *)info;
@end

View file

@ -2,6 +2,7 @@
#import "MWMCircularProgress.h"
#import "MWMLocationManager.h"
#import "MWMNavigationDashboardEntity.h"
#import "MWMNavigationDashboardInfoProtocol.h"
#import "MWMNavigationViewProtocol.h"
#import "MWMRoutePreview.h"
@ -17,12 +18,6 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState) {
MWMNavigationDashboardStateNavigation
};
@protocol MWMNavigationDashboardInfoProtocol
- (void)updateRoutingInfo:(MWMNavigationDashboardEntity *)info;
@end
@protocol MWMNavigationDashboardManagerProtocol<MWMNavigationViewProtocol>
- (void)didStartEditingRoutePoint:(BOOL)isSource;
@ -44,11 +39,12 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState) {
- (instancetype)init __attribute__((unavailable("init is not available")));
- (instancetype)initWithParentView:(UIView *)view
infoDisplay:(id<MWMNavigationDashboardInfoProtocol>)infoDisplay
delegate:(id<MWMNavigationDashboardManagerProtocol>)delegate;
- (void)updateFollowingInfo:(location::FollowingInfo const &)info;
- (void)updateDashboard;
- (void)setRouteBuilderProgress:(CGFloat)progress;
- (void)mwm_refreshUI;
- (void)addInfoDisplay:(id<MWMNavigationDashboardInfoProtocol>)infoDisplay;
@end

View file

@ -2,6 +2,7 @@
#import "Common.h"
#import "MWMLocationHelpers.h"
#import "MWMMapViewControlsManager.h"
#import "MWMNavigationInfoView.h"
#import "MWMRoutePreview.h"
#import "MWMRouter.h"
#import "MWMTextToSpeech.h"
@ -14,6 +15,10 @@ namespace
{
NSString * const kRoutePreviewXibName = @"MWMRoutePreview";
NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
NSString * const kNavigationInfoViewXibName = @"MWMNavigationInfoView";
using TInfoDisplay = id<MWMNavigationDashboardInfoProtocol>;
using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
} // namespace
@interface MWMMapViewControlsManager ()
@ -25,9 +30,11 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
@interface MWMNavigationDashboardManager ()
@property(nonatomic, readwrite) IBOutlet MWMRoutePreview * routePreview;
@property(nonatomic) IBOutlet MWMNavigationInfoView * navigationInfoView;
@property(nonatomic) TInfoDisplays * infoDisplays;
@property(weak, nonatomic) UIView * ownerView;
@property(weak, nonatomic) id<MWMNavigationDashboardInfoProtocol> infoDisplay;
@property(nonatomic) MWMNavigationDashboardEntity * entity;
@ -41,15 +48,14 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
}
- (instancetype)initWithParentView:(UIView *)view
infoDisplay:(id<MWMNavigationDashboardInfoProtocol>)infoDisplay
delegate:(id<MWMNavigationDashboardManagerProtocol>)delegate
{
self = [super init];
if (self)
{
_ownerView = view;
_infoDisplay = infoDisplay;
_delegate = delegate;
_infoDisplays = [TInfoDisplays weakObjectsHashTable];
}
return self;
}
@ -70,8 +76,8 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
{
if (!self.entity.isValid)
return;
[self.infoDisplay updateRoutingInfo:self.entity];
[self.routePreview configureWithEntity:self.entity];
for (TInfoDisplay infoDisplay in self.infoDisplays)
[infoDisplay updateNavigationInfo:self.entity];
}
#pragma mark - MWMRoutePreview
@ -95,9 +101,18 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
- (IBAction)routingStartTouchUpInside { [[MWMRouter router] start]; }
#pragma mark - State changes
- (void)hideState { [self.routePreview remove]; }
- (void)hideState
{
[self.routePreview remove];
self.routePreview = nil;
[self.navigationInfoView remove];
self.navigationInfoView = nil;
}
- (void)showStatePrepare
{
[self.navigationInfoView remove];
self.navigationInfoView = nil;
[self.routePreview addToView:self.ownerView];
[self.routePreview statePrepare];
[self.routePreview selectRouter:[MWMRouter router].type];
@ -121,9 +136,16 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
{
[self.delegate setMenuState:MWMBottomMenuStateRouting];
[self.routePreview remove];
self.routePreview = nil;
[self.navigationInfoView addToView:self.ownerView];
}
- (void)mwm_refreshUI
{
[self.routePreview mwm_refreshUI];
[self.navigationInfoView mwm_refreshUI];
}
- (void)mwm_refreshUI { [self.routePreview mwm_refreshUI]; }
#pragma mark - Properties
- (void)setState:(MWMNavigationDashboardState)state
@ -165,8 +187,7 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
if (IPAD)
return self.topBound;
return self.routePreview.visibleHeight;
case MWMNavigationDashboardStateNavigation:
return 0.0; // TODO: Replace with real value
case MWMNavigationDashboardStateNavigation: return self.navigationInfoView.visibleHeight;
}
}
@ -193,6 +214,7 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
CGAffineTransform const transform(CGAffineTransformMakeRotation(M_PI_2 - angle));
}
- (void)addInfoDisplay:(TInfoDisplay)infoDisplay { [self.infoDisplays addObject:infoDisplay]; }
#pragma mark - Properties
- (MWMRoutePreview *)routePreview
@ -204,10 +226,21 @@ NSString * const kRoutePreviewIPADXibName = @"MWMiPadRoutePreview";
options:nil];
_routePreview.dashboardManager = self;
_routePreview.delegate = self.delegate;
[self addInfoDisplay:_routePreview];
}
return _routePreview;
}
- (MWMNavigationInfoView *)navigationInfoView
{
if (!_navigationInfoView)
{
[NSBundle.mainBundle loadNibNamed:kNavigationInfoViewXibName owner:self options:nil];
[self addInfoDisplay:_navigationInfoView];
}
return _navigationInfoView;
}
- (MWMNavigationDashboardEntity *)entity
{
if (!_entity)

View file

@ -0,0 +1,11 @@
#import "MWMNavigationDashboardInfoProtocol.h"
@interface MWMNavigationInfoView : UIView<MWMNavigationDashboardInfoProtocol>
@property(nonatomic, readonly) BOOL isVisible;
@property(nonatomic, readonly) CGFloat visibleHeight;
- (void)addToView:(UIView *)superview;
- (void)remove;
@end

View file

@ -0,0 +1,110 @@
#import "MWMNavigationInfoView.h"
#import "Common.h"
#import "UIFont+MapsMeFonts.h"
#import "UIImageView+Coloring.h"
namespace
{
CGFloat constexpr kTurnsiPhoneWidth = 96;
CGFloat constexpr kTurnsiPadWidth = 140;
} // namespace
@interface MWMNavigationInfoView ()
@property(weak, nonatomic) IBOutlet UIView * streetNameView;
@property(weak, nonatomic) IBOutlet UILabel * streetNameLabel;
@property(weak, nonatomic) IBOutlet UIView * turnsView;
@property(weak, nonatomic) IBOutlet UIImageView * nextTurnImageView;
@property(weak, nonatomic) IBOutlet UILabel * distanceToNextTurnLabel;
@property(weak, nonatomic) IBOutlet UIView * secondTurnView;
@property(weak, nonatomic) IBOutlet UIImageView * secondTurnImageView;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * turnsWidth;
@property(nonatomic) BOOL isVisible;
@end
@implementation MWMNavigationInfoView
- (void)addToView:(UIView *)superview
{
self.isVisible = YES;
if (IPAD)
{
self.turnsWidth.constant = kTurnsiPadWidth;
self.distanceToNextTurnLabel.font = [UIFont bold36];
}
else
{
self.turnsWidth.constant = kTurnsiPhoneWidth;
self.distanceToNextTurnLabel.font = [UIFont bold24];
}
NSAssert(superview != nil, @"Superview can't be nil");
if ([superview.subviews containsObject:self])
return;
[superview insertSubview:self atIndex:0];
}
- (void)remove { self.isVisible = NO; }
- (void)layoutSubviews
{
if (!CGRectEqualToRect(self.frame, self.superview.bounds))
{
self.frame = self.superview.bounds;
[self setNeedsLayout];
}
if (!self.isVisible)
[self removeFromSuperview];
[super layoutSubviews];
}
- (void)setIsVisible:(BOOL)isVisible
{
_isVisible = isVisible;
[self setNeedsLayout];
}
- (CGFloat)visibleHeight { return self.streetNameView.maxY; }
#pragma mark - MWMNavigationDashboardInfoProtocol
- (void)updateNavigationInfo:(MWMNavigationDashboardEntity *)info
{
if (info.streetName.length != 0)
{
self.streetNameView.hidden = NO;
self.streetNameLabel.text = info.streetName;
}
else
{
self.streetNameView.hidden = YES;
}
if (info.turnImage)
{
self.turnsView.hidden = NO;
self.nextTurnImageView.image = info.turnImage;
if (isIOS7)
[self.nextTurnImageView makeImageAlwaysTemplate];
self.nextTurnImageView.mwm_coloring = MWMImageColoringWhite;
self.distanceToNextTurnLabel.text =
[NSString stringWithFormat:@"%@%@", info.distanceToTurn, info.turnUnits];
if (info.nextTurnImage)
{
self.secondTurnView.hidden = NO;
self.secondTurnImageView.image = info.nextTurnImage;
if (isIOS7)
[self.secondTurnImageView makeImageAlwaysTemplate];
self.secondTurnImageView.mwm_coloring = MWMImageColoringBlack;
}
else
{
self.secondTurnView.hidden = YES;
}
}
else
{
self.turnsView.hidden = YES;
}
self.hidden = self.streetNameView.hidden && self.turnsView.hidden;
}
@end

View file

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMNavigationDashboardManager">
<connections>
<outlet property="navigationInfoView" destination="iN0-l3-epB" id="jfj-m1-I85"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MWMNavigationInfoView">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YYv-pG-Wkw" userLabel="Street name">
<rect key="frame" x="0.0" y="0.0" width="600" height="65"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ленинградский проспект" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ShI-bz-5g8">
<rect key="frame" x="112" y="32" width="480" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="ShI-bz-5g8" firstAttribute="top" secondItem="YYv-pG-Wkw" secondAttribute="top" constant="32" id="KK1-dA-hII"/>
<constraint firstAttribute="trailing" secondItem="ShI-bz-5g8" secondAttribute="trailing" constant="8" id="ZPY-xp-9Ew"/>
<constraint firstAttribute="bottom" secondItem="ShI-bz-5g8" secondAttribute="bottom" constant="12" id="w0r-Ip-f9E"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Aa6-N8-acP" userLabel="Turns">
<rect key="frame" x="8" y="28" width="96" height="153"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wt8-EO-MKz" userLabel="First turn">
<rect key="frame" x="0.0" y="0.0" width="96" height="117"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tnR-CA-hkI">
<rect key="frame" x="12" y="8" width="72" height="72"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="AJe-8N-rpk">
<rect key="frame" x="0.0" y="0.0" width="72" height="72"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="AJe-8N-rpk" firstAttribute="leading" secondItem="tnR-CA-hkI" secondAttribute="leading" id="Tae-YV-lwB"/>
<constraint firstAttribute="bottom" secondItem="AJe-8N-rpk" secondAttribute="bottom" id="Wwf-8B-PvC"/>
<constraint firstAttribute="width" secondItem="tnR-CA-hkI" secondAttribute="height" multiplier="1:1" id="aPD-g3-T2h"/>
<constraint firstItem="AJe-8N-rpk" firstAttribute="top" secondItem="tnR-CA-hkI" secondAttribute="top" id="uM5-Zp-UMt"/>
<constraint firstAttribute="trailing" secondItem="AJe-8N-rpk" secondAttribute="trailing" id="yRy-fp-msB"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0000 ft" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KuR-1J-VI2">
<rect key="frame" x="4" y="84" width="88" height="29"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="white"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="0.11764705882352941" green="0.58823529411764708" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="tnR-CA-hkI" secondAttribute="trailing" constant="12" id="0ZA-zO-Xxs"/>
<constraint firstAttribute="bottom" secondItem="KuR-1J-VI2" secondAttribute="bottom" constant="4" id="JFV-hc-Pil"/>
<constraint firstItem="tnR-CA-hkI" firstAttribute="leading" secondItem="wt8-EO-MKz" secondAttribute="leading" constant="12" id="OYn-Nn-Osu"/>
<constraint firstAttribute="trailing" secondItem="KuR-1J-VI2" secondAttribute="trailing" constant="4" id="W2n-vT-neW"/>
<constraint firstItem="tnR-CA-hkI" firstAttribute="top" secondItem="wt8-EO-MKz" secondAttribute="top" constant="8" id="YaL-ra-ytk"/>
<constraint firstItem="KuR-1J-VI2" firstAttribute="leading" secondItem="wt8-EO-MKz" secondAttribute="leading" constant="4" id="mx0-ex-eQt"/>
<constraint firstItem="KuR-1J-VI2" firstAttribute="top" secondItem="tnR-CA-hkI" secondAttribute="bottom" constant="4" id="y5u-lH-Ytt"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8Zu-Ff-6p2" userLabel="Second turn">
<rect key="frame" x="0.0" y="121" width="96" height="32"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="CKi-sy-dNO">
<rect key="frame" x="36" y="4" width="24" height="24"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.80000000000000004" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="n57-ET-oyc"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="96" id="6Ja-Xp-g8h"/>
<constraint firstAttribute="trailing" secondItem="wt8-EO-MKz" secondAttribute="trailing" id="AQV-lK-vNF"/>
<constraint firstItem="wt8-EO-MKz" firstAttribute="leading" secondItem="Aa6-N8-acP" secondAttribute="leading" id="KMA-Ox-aG4"/>
<constraint firstItem="8Zu-Ff-6p2" firstAttribute="leading" secondItem="Aa6-N8-acP" secondAttribute="leading" id="Qqb-Gy-k4c"/>
<constraint firstAttribute="trailing" secondItem="8Zu-Ff-6p2" secondAttribute="trailing" id="Zim-Gu-q0F"/>
<constraint firstAttribute="bottom" secondItem="8Zu-Ff-6p2" secondAttribute="bottom" id="lqa-St-hm1"/>
<constraint firstItem="8Zu-Ff-6p2" firstAttribute="top" secondItem="wt8-EO-MKz" secondAttribute="bottom" constant="4" id="r3K-xx-PSf"/>
<constraint firstItem="wt8-EO-MKz" firstAttribute="top" secondItem="Aa6-N8-acP" secondAttribute="top" id="v5F-4v-Sfr"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="YYv-pG-Wkw" secondAttribute="trailing" id="15D-kN-gda"/>
<constraint firstItem="YYv-pG-Wkw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="IBQ-gK-Cpe"/>
<constraint firstItem="YYv-pG-Wkw" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Rd5-Hl-fSF"/>
<constraint firstItem="Aa6-N8-acP" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="28" id="goU-O7-rpS"/>
<constraint firstItem="ShI-bz-5g8" firstAttribute="leading" secondItem="Aa6-N8-acP" secondAttribute="trailing" constant="8" id="mdA-B9-tvQ"/>
<constraint firstItem="Aa6-N8-acP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="pXD-dk-ku2"/>
</constraints>
<connections>
<outlet property="distanceToNextTurnLabel" destination="KuR-1J-VI2" id="n0i-t9-Vj2"/>
<outlet property="nextTurnImageView" destination="AJe-8N-rpk" id="iMm-9u-rPI"/>
<outlet property="secondTurnImageView" destination="CKi-sy-dNO" id="A29-2z-4oh"/>
<outlet property="secondTurnView" destination="8Zu-Ff-6p2" id="yEK-rY-S50"/>
<outlet property="streetNameLabel" destination="ShI-bz-5g8" id="eZd-Es-g0l"/>
<outlet property="streetNameView" destination="YYv-pG-Wkw" id="gbk-SH-idq"/>
<outlet property="turnsView" destination="Aa6-N8-acP" id="daB-uQ-UFM"/>
<outlet property="turnsWidth" destination="6Ja-Xp-g8h" id="kCr-a1-fph"/>
</connections>
</view>
</objects>
</document>

View file

@ -1,4 +1,5 @@
#import "MWMCircularProgress.h"
#import "MWMNavigationDashboardInfoProtocol.h"
#import "MWMNavigationView.h"
#include "routing/router.hpp"
@ -6,7 +7,7 @@
@class MWMNavigationDashboardEntity;
@class MWMNavigationDashboardManager;
@interface MWMRoutePreview : MWMNavigationView
@interface MWMRoutePreview : MWMNavigationView<MWMNavigationDashboardInfoProtocol>
@property(weak, nonatomic, readonly) IBOutlet UIButton * extendButton;
@property(weak, nonatomic) MWMNavigationDashboardManager * dashboardManager;

View file

@ -86,25 +86,6 @@ static CGFloat constexpr kAdditionalHeight = 20.;
[superview bringSubviewToFront:superview];
}
- (void)configureWithEntity:(MWMNavigationDashboardEntity *)entity
{
NSString * eta = [NSDateFormatter estimatedArrivalTimeWithSeconds:@(entity.timeToTarget)];
NSString * resultString =
[NSString stringWithFormat:@"%@ • %@ %@", eta, entity.targetDistance, entity.targetUnits];
NSMutableAttributedString * result =
[[NSMutableAttributedString alloc] initWithString:resultString];
[result addAttributes:self.etaAttributes range:NSMakeRange(0, eta.length)];
self.resultLabel.attributedText = result;
if (!IPAD)
return;
NSString * arriveStr = [NSDateFormatter
localizedStringFromDate:[[NSDate date] dateByAddingTimeInterval:entity.timeToTarget]
dateStyle:NSDateFormatterNoStyle
timeStyle:NSDateFormatterShortStyle];
self.arriveLabel.text = [NSString stringWithFormat:L(@"routing_arrive"), arriveStr.UTF8String];
}
- (void)statePrepare
{
for (auto const & progress : m_progresses)
@ -338,6 +319,27 @@ static CGFloat constexpr kAdditionalHeight = 20.;
};
}
#pragma mark - MWMNavigationDashboardInfoProtocol
- (void)updateNavigationInfo:(MWMNavigationDashboardEntity *)info
{
NSString * eta = [NSDateFormatter estimatedArrivalTimeWithSeconds:@(info.timeToTarget)];
NSString * resultString =
[NSString stringWithFormat:@"%@ • %@ %@", eta, info.targetDistance, info.targetUnits];
NSMutableAttributedString * result =
[[NSMutableAttributedString alloc] initWithString:resultString];
[result addAttributes:self.etaAttributes range:NSMakeRange(0, eta.length)];
self.resultLabel.attributedText = result;
if (!IPAD)
return;
NSString * arriveStr = [NSDateFormatter
localizedStringFromDate:[[NSDate date] dateByAddingTimeInterval:info.timeToTarget]
dateStyle:NSDateFormatterNoStyle
timeStyle:NSDateFormatterShortStyle];
self.arriveLabel.text = [NSString stringWithFormat:L(@"routing_arrive"), arriveStr.UTF8String];
}
#pragma mark - MWMRoutePointCellDelegate
- (void)startEditingCell:(MWMRoutePointCell *)cell

View file

@ -239,7 +239,9 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
self.forceStateChange = ForceStateChange::Rebuild;
}
else
{
[RouteState remove];
}
}
#pragma mark - MWMLocationObserver

View file

@ -193,6 +193,10 @@
349C26B51BB02C6F0005DF2F /* MWMBottomMenuViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349C26B31BB02C6F0005DF2F /* MWMBottomMenuViewController.mm */; };
349C26B61BB02C6F0005DF2F /* MWMBottomMenuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349C26B41BB02C6F0005DF2F /* MWMBottomMenuViewController.xib */; };
349C26B91BB04ED30005DF2F /* MWMBottomMenuView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349C26B81BB04ED30005DF2F /* MWMBottomMenuView.mm */; };
349C3AEC1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349C3AEB1D33A933002AC7A9 /* MWMNavigationInfoView.mm */; };
349C3AED1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349C3AEB1D33A933002AC7A9 /* MWMNavigationInfoView.mm */; };
349C3AEF1D33A96B002AC7A9 /* MWMNavigationInfoView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */; };
349C3AF01D33A96B002AC7A9 /* MWMNavigationInfoView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */; };
34A62D4E1C903533007FDCB7 /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34A62D4C1C903533007FDCB7 /* Fabric.framework */; };
34A62D4F1C903533007FDCB7 /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34A62D4C1C903533007FDCB7 /* Fabric.framework */; };
34A62D501C903533007FDCB7 /* Crashlytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34A62D4D1C903533007FDCB7 /* Crashlytics.framework */; };
@ -1074,6 +1078,10 @@
349C26B41BB02C6F0005DF2F /* MWMBottomMenuViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMBottomMenuViewController.xib; sourceTree = "<group>"; };
349C26B71BB04ED30005DF2F /* MWMBottomMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMBottomMenuView.h; sourceTree = "<group>"; };
349C26B81BB04ED30005DF2F /* MWMBottomMenuView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMBottomMenuView.mm; sourceTree = "<group>"; };
349C3AEA1D33A933002AC7A9 /* MWMNavigationInfoView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMNavigationInfoView.h; sourceTree = "<group>"; };
349C3AEB1D33A933002AC7A9 /* MWMNavigationInfoView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNavigationInfoView.mm; sourceTree = "<group>"; };
349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMNavigationInfoView.xib; sourceTree = "<group>"; };
349C3AF11D33C6EE002AC7A9 /* MWMNavigationDashboardInfoProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMNavigationDashboardInfoProtocol.h; sourceTree = "<group>"; };
34A62D4C1C903533007FDCB7 /* Fabric.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Fabric.framework; sourceTree = "<group>"; };
34A62D4D1C903533007FDCB7 /* Crashlytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Crashlytics.framework; sourceTree = "<group>"; };
34AB04B61CEC95B500CE8B36 /* MWMEditorAdditionalNamePlaceholderTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMEditorAdditionalNamePlaceholderTableViewCell.xib; sourceTree = "<group>"; };
@ -2134,6 +2142,10 @@
3497A9371B5CF8A900F51E55 /* MWMNavigationDashboardManager.mm */,
560634EF1B787EBE00F3D670 /* Sound */,
34D783C71B5F9D7800E0C0EE /* Views */,
349C3AEA1D33A933002AC7A9 /* MWMNavigationInfoView.h */,
349C3AEB1D33A933002AC7A9 /* MWMNavigationInfoView.mm */,
349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */,
349C3AF11D33C6EE002AC7A9 /* MWMNavigationDashboardInfoProtocol.h */,
);
name = NavigationDashboard;
path = ../NavigationDashboard;
@ -3353,6 +3365,7 @@
FA459EB414327AF700B5BB3C /* WorldCoasts.mwm in Resources */,
FA85F633145DDDC20090E1A0 /* packed_polygons.bin in Resources */,
F6ED13561B16439E0095C6DE /* MWMDirectionView.xib in Resources */,
349C3AEF1D33A96B002AC7A9 /* MWMNavigationInfoView.xib in Resources */,
34D15BA91BD8F93C00C8BCBE /* AddSetTableViewCell.xib in Resources */,
34B646C71CEB742500E0C7A5 /* MWMEditorNameFooter.xib in Resources */,
FA99CB73147089B100689A9A /* Localizable.strings in Resources */,
@ -3500,6 +3513,7 @@
6741A9711BF340DE002C974C /* copyright.html in Resources */,
6741A9721BF340DE002C974C /* MWMSearchCommonCell.xib in Resources */,
6741A9731BF340DE002C974C /* MWMSearchHistoryMyPositionCell.xib in Resources */,
349C3AF01D33A96B002AC7A9 /* MWMNavigationInfoView.xib in Resources */,
6741A9741BF340DE002C974C /* resources-6plus_dark in Resources */,
34B646C81CEB742600E0C7A5 /* MWMEditorNameFooter.xib in Resources */,
3401CD6A1C3C03A80028C6F8 /* MWMEditorTextTableViewCell.xib in Resources */,
@ -3730,6 +3744,7 @@
34BC1E561C2ADBD3009BBF51 /* MWMOpeningHoursCommon.mm in Sources */,
F653CE161C71F60200A453F1 /* MWMAddPlaceNavigationBar.mm in Sources */,
A32B6D4D1A14980500E54A65 /* iosOGLContextFactory.mm in Sources */,
349C3AEC1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */,
347FD8671C60B2CE002FB65E /* MWMOpeningHoursAddClosedTableViewCell.mm in Sources */,
FA054612155C465E001F4E37 /* SelectSetVC.mm in Sources */,
FAA614B8155F16950031C345 /* AddSetVC.mm in Sources */,
@ -3954,6 +3969,7 @@
347FD8681C60B2CE002FB65E /* MWMOpeningHoursAddClosedTableViewCell.mm in Sources */,
6741A9FF1BF340DE002C974C /* AddSetVC.mm in Sources */,
6741AA011BF340DE002C974C /* MWMSearchTabbedViewLayout.mm in Sources */,
349C3AED1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */,
6741AA021BF340DE002C974C /* BookmarksRootVC.mm in Sources */,
6741AA031BF340DE002C974C /* MWMActivityViewController.mm in Sources */,
34DDD5341BFDB0B600407F2F /* MWMMapDownloaderViewController.mm in Sources */,