forked from organicmaps/organicmaps
[ios] Added api bar layout.
This commit is contained in:
parent
edb49ef550
commit
5430c7cf2e
22 changed files with 382 additions and 163 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment version="2048" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hay-Qx-kVw" userLabel="ContainerView">
|
||||
<rect key="frame" x="20" y="168.5" width="280" height="230"/>
|
||||
<rect key="frame" x="20" y="169" width="280" height="230"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MvX-7q-CIH" userLabel="Title">
|
||||
<rect key="frame" x="20" y="20" width="240" height="29"/>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// MWMAPIBar.h
|
||||
// Maps
|
||||
//
|
||||
// Created by Ilya Grechuhin on 27.07.15.
|
||||
// Copyright (c) 2015 MapsWithMe. All rights reserved.
|
||||
//
|
||||
|
||||
@class SearchView;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMAPIBarState)
|
||||
{
|
||||
MWMAPIBarStateHidden,
|
||||
MWMAPIBarStateVisible
|
||||
};
|
||||
|
||||
@protocol MWMAPIBarProtocol <NSObject>
|
||||
|
||||
@property (nonnull, nonatomic) SearchView * searchView;
|
||||
|
||||
- (void)apiBarDidEnterState:(MWMAPIBarState)state;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMAPIBar : NSObject
|
||||
|
||||
@property (nonatomic, readonly) MWMAPIBarState state;
|
||||
@property (nonatomic, readonly) CGRect frame;
|
||||
|
||||
- (nonnull instancetype)init __attribute__((unavailable("init is not available")));
|
||||
- (nonnull instancetype)initWithDelegate:(nonnull UIViewController<MWMAPIBarProtocol> *)delegate;
|
||||
|
||||
- (void)show;
|
||||
|
||||
@end
|
|
@ -0,0 +1,98 @@
|
|||
//
|
||||
// MWMAPIBar.m
|
||||
// Maps
|
||||
//
|
||||
// Created by Ilya Grechuhin on 27.07.15.
|
||||
// Copyright (c) 2015 MapsWithMe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MWMAPIBar.h"
|
||||
#import "MWMAPIBarView.h"
|
||||
#import "SearchView.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
@interface MWMAPIBar ()
|
||||
|
||||
@property (nonatomic) IBOutlet MWMAPIBarView * rootView;
|
||||
@property (nonatomic) IBOutlet UILabel * titleLabel;
|
||||
|
||||
@property (weak, nonatomic) UIViewController<MWMAPIBarProtocol> * delegate;
|
||||
@property (nonatomic) MWMAPIBarState state;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMAPIBar
|
||||
|
||||
- (instancetype)initWithDelegate:(nonnull UIViewController<MWMAPIBarProtocol> *)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
[[NSBundle mainBundle] loadNibNamed:@"MWMAPIBarView" owner:self options:nil];
|
||||
self.delegate = delegate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)show
|
||||
{
|
||||
self.titleLabel.text = [NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()];
|
||||
[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:^
|
||||
{
|
||||
self.rootView.targetY = 0.0;
|
||||
self.state = MWMAPIBarStateVisible;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)hideAnimated:(BOOL)animated
|
||||
{
|
||||
[UIView animateWithDuration:animated ? 0.2 : 0.0 animations:^
|
||||
{
|
||||
self.rootView.targetY = -self.rootView.height;
|
||||
self.state = MWMAPIBarStateHidden;
|
||||
}
|
||||
completion:^(BOOL finished)
|
||||
{
|
||||
[self.rootView removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)backButtonTouchUpInside:(UIButton *)sender
|
||||
{
|
||||
NSURL * url = [NSURL URLWithString:[NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetGlobalBackUrl().c_str()]];
|
||||
[[UIApplication sharedApplication] openURL:url];
|
||||
[self hideAnimated:NO];
|
||||
}
|
||||
|
||||
- (IBAction)clearButtonTouchUpInside:(UIButton *)sender
|
||||
{
|
||||
[self hideAnimated:YES];
|
||||
auto & f = GetFramework();
|
||||
auto & bm = f.GetBalloonManager();
|
||||
bm.RemovePin();
|
||||
bm.Dismiss();
|
||||
f.GetBookmarkManager().UserMarksClear(UserMarkContainer::API_MARK);
|
||||
f.Invalidate();
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setState:(MWMAPIBarState)state
|
||||
{
|
||||
_state = state;
|
||||
[self.delegate apiBarDidEnterState:state];
|
||||
}
|
||||
|
||||
- (CGRect)frame
|
||||
{
|
||||
return self.rootView.frame;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// MWMAPIBarView.h
|
||||
// Maps
|
||||
//
|
||||
// Created by Ilya Grechuhin on 27.07.15.
|
||||
// Copyright (c) 2015 MapsWithMe. All rights reserved.
|
||||
//
|
||||
|
||||
@interface MWMAPIBarView : UIView
|
||||
|
||||
@property (nonatomic) CGFloat targetY;
|
||||
|
||||
- (nonnull instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame is not available")));
|
||||
- (nonnull instancetype)init __attribute__((unavailable("init is not available")));
|
||||
|
||||
@end
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// MWMAPIBarView.m
|
||||
// Maps
|
||||
//
|
||||
// Created by Ilya Grechuhin on 27.07.15.
|
||||
// Copyright (c) 2015 MapsWithMe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MWMAPIBarView.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
@interface MWMAPIBarView ()
|
||||
|
||||
@property (nonatomic) CGFloat defaulhHeight;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMAPIBarView
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder:aDecoder];
|
||||
if (self)
|
||||
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
self.defaulhHeight = self.height;
|
||||
self.targetY = 0.0;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
self.width = self.superview.width;
|
||||
self.height = self.defaulhHeight;
|
||||
self.minX = 0.0;
|
||||
self.minY = self.targetY;
|
||||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setTargetY:(CGFloat)targetY
|
||||
{
|
||||
_targetY = targetY;
|
||||
[self layoutSubviews];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMAPIBar">
|
||||
<connections>
|
||||
<outlet property="rootView" destination="FkZ-Iu-xPb" id="DQP-Ee-MI0"/>
|
||||
<outlet property="titleLabel" destination="mDA-8R-aH7" id="9PC-fQ-84Y"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="FkZ-Iu-xPb" customClass="MWMAPIBarView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="64"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="o1J-lP-Bbl" userLabel="BackButton">
|
||||
<rect key="frame" x="0.0" y="20" width="60" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="0Xq-E4-45k"/>
|
||||
<constraint firstAttribute="height" constant="44" id="TaT-76-6ui"/>
|
||||
</constraints>
|
||||
<state key="normal" image="BackArrow">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="backButtonTouchUpInside:" destination="-1" eventType="touchUpInside" id="OwO-sp-Vwp"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cCi-Af-Nr1" userLabel="ClearButton">
|
||||
<rect key="frame" x="252" y="20" width="60" height="44"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="Skq-Xm-OYz"/>
|
||||
<constraint firstAttribute="height" constant="44" id="vGD-rd-i7L"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" title="Clear">
|
||||
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="whiteColor"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="light17"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="lightGrayColor"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="clear"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="clearButtonTouchUpInside:" destination="-1" eventType="touchUpInside" id="f5W-0D-ymT"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mDA-8R-aH7" userLabel="TitleLabel">
|
||||
<rect key="frame" x="68" y="28" width="176" height="26"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="26" id="3vv-UQ-sav"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="whiteColor"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.094117647058823528" green="0.50196078431372548" blue="0.26666666666666666" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="mDA-8R-aH7" firstAttribute="leading" secondItem="o1J-lP-Bbl" secondAttribute="trailing" constant="8" symbolic="YES" id="CSJ-dm-eKC"/>
|
||||
<constraint firstAttribute="trailing" secondItem="cCi-Af-Nr1" secondAttribute="trailing" constant="8" id="GTn-Gx-70T"/>
|
||||
<constraint firstAttribute="bottom" secondItem="o1J-lP-Bbl" secondAttribute="bottom" id="J7l-Z3-qSu"/>
|
||||
<constraint firstItem="cCi-Af-Nr1" firstAttribute="leading" secondItem="mDA-8R-aH7" secondAttribute="trailing" constant="8" symbolic="YES" id="aIR-Mn-d3d"/>
|
||||
<constraint firstAttribute="bottom" secondItem="mDA-8R-aH7" secondAttribute="bottom" constant="10" id="f1R-8X-PcY"/>
|
||||
<constraint firstItem="o1J-lP-Bbl" firstAttribute="leading" secondItem="FkZ-Iu-xPb" secondAttribute="leading" id="n6Z-RQ-VZB"/>
|
||||
<constraint firstAttribute="bottom" secondItem="cCi-Af-Nr1" secondAttribute="bottom" id="yqM-Sn-bts"/>
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="primaryDark"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<point key="canvasLocation" x="322" y="352"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="BackArrow" width="12" height="20"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -144,7 +144,7 @@
|
|||
auto const state = GetFramework().GetRouter();
|
||||
switch (state)
|
||||
{
|
||||
case routing::RouterType::Pedestrian :
|
||||
case routing::RouterType::Pedestrian:
|
||||
self.routePreviewLandscape.pedestrian.selected = YES;
|
||||
self.routePreviewPortrait.pedestrian.selected = YES;
|
||||
self.routePreviewPortrait.vehicle.selected = NO;
|
||||
|
|
|
@ -79,7 +79,7 @@ static CGFloat const kStatusbarHeight = 20.0;
|
|||
|
||||
- (CGRect)defaultFrame
|
||||
{
|
||||
return CGRectMake(0.0, self.topBound - (self.isVisible ? 0.0 : self.defaultHeight), self.superview.width, self.defaultHeight);
|
||||
return CGRectMake(0.0, self.isVisible ? self.topBound : -self.defaultHeight, self.superview.width, self.defaultHeight);
|
||||
}
|
||||
|
||||
- (void)setTopBound:(CGFloat)topBound
|
||||
|
|
|
@ -44,11 +44,11 @@ namespace search { struct AddressInfo; }
|
|||
|
||||
- (void)addPlacePageViews:(NSArray *)views;
|
||||
|
||||
- (void)showAPIBar;
|
||||
|
||||
@property (nonatomic) UIPopoverController * popoverVC;
|
||||
@property (nonatomic, readonly) BOOL apiMode;
|
||||
@property (nonatomic) SearchView * searchView;
|
||||
@property (nonatomic) ShareActionSheet * shareActionSheet;
|
||||
- (void)setApiMode:(BOOL)apiMode animated:(BOOL)animated;
|
||||
@property (nonatomic, readonly) MWMMapViewControlsManager * controlsManager;
|
||||
@property (nonatomic) m2::PointD restoreRouteDestination;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#import "MapsObservers.h"
|
||||
#import "MapViewController.h"
|
||||
#import "MWMAlertViewController.h"
|
||||
#import "MWMAPIBar.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "RouteState.h"
|
||||
#import "RouteView.h"
|
||||
|
@ -48,7 +49,8 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
|
|||
|
||||
typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
||||
{
|
||||
MapInfoViewSearch = 1 << 0
|
||||
MapInfoViewSearch = 1 << 0,
|
||||
MapInfoViewAPIBar = 1 << 1
|
||||
};
|
||||
|
||||
@interface NSValueWrapper : NSObject
|
||||
|
@ -82,12 +84,10 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
|
||||
@end
|
||||
|
||||
@interface MapViewController () <RouteViewDelegate, SearchViewDelegate, ActiveMapsObserverProtocol>
|
||||
@interface MapViewController () <RouteViewDelegate, SearchViewDelegate, ActiveMapsObserverProtocol, MWMAPIBarProtocol>
|
||||
|
||||
@property (nonatomic) UIView * routeViewWrapper;
|
||||
@property (nonatomic) RouteView * routeView;
|
||||
@property (nonatomic) UIImageView * apiBar;
|
||||
@property (nonatomic) UILabel * apiTitleLabel;
|
||||
@property (nonatomic, readwrite) MWMMapViewControlsManager * controlsManager;
|
||||
@property (nonatomic) MWMSideMenuState menuRestoreState;
|
||||
|
||||
|
@ -103,6 +103,8 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
|
||||
@property (nonatomic) BOOL haveMap;
|
||||
|
||||
@property (nonatomic) MWMAPIBar * apiBar;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MapViewController
|
||||
|
@ -582,12 +584,6 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
- (void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
static BOOL firstTime = YES;
|
||||
if (firstTime)
|
||||
{
|
||||
firstTime = NO;
|
||||
[self setApiMode:_apiMode animated:NO];
|
||||
}
|
||||
self.menuRestoreState = self.controlsManager.menuState;
|
||||
}
|
||||
|
||||
|
@ -609,7 +605,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
if (self.apiMode)
|
||||
if (self.apiBar.state == MWMAPIBarStateVisible)
|
||||
{
|
||||
return UIStatusBarStyleLightContent;
|
||||
}
|
||||
|
@ -759,6 +755,38 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - API bar
|
||||
|
||||
- (MWMAPIBar *)apiBar
|
||||
{
|
||||
if (!_apiBar)
|
||||
_apiBar = [[MWMAPIBar alloc] initWithDelegate:self];
|
||||
return _apiBar;
|
||||
}
|
||||
|
||||
- (void)showAPIBar
|
||||
{
|
||||
[self.apiBar show];
|
||||
}
|
||||
|
||||
- (void)apiBarDidEnterState:(MWMAPIBarState)state
|
||||
{
|
||||
if (state == MWMAPIBarStateVisible)
|
||||
{
|
||||
[self setMapInfoViewFlag:MapInfoViewAPIBar];
|
||||
CGRect const apiRect = self.apiBar.frame;
|
||||
self.searchView.topBound = apiRect.origin.y + apiRect.size.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self clearMapInfoViewFlag:MapInfoViewAPIBar];
|
||||
self.searchView.topBound = 0.0;
|
||||
}
|
||||
[self dismissPopover];
|
||||
[self.searchView setState:SearchViewStateHidden animated:YES];
|
||||
[self updateStatusBarStyle];
|
||||
}
|
||||
|
||||
#pragma mark - ShowDialog callback
|
||||
|
||||
- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)type countries:(vector<storage::TIndex> const &)countries routes:(vector<storage::TIndex> const &)routes
|
||||
|
@ -835,72 +863,6 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
return _searchView;
|
||||
}
|
||||
|
||||
- (UIImageView *)apiBar
|
||||
{
|
||||
if (!_apiBar)
|
||||
{
|
||||
UIImage * image = [UIImage imageNamed:@"ApiBarBackground7"];
|
||||
_apiBar = [[UIImageView alloc] initWithImage:[image resizableImageWithCapInsets:UIEdgeInsetsZero]];
|
||||
_apiBar.width = self.view.width;
|
||||
_apiBar.userInteractionEnabled = YES;
|
||||
_apiBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
|
||||
UIButton * backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
|
||||
backButton.contentMode = UIViewContentModeCenter;
|
||||
[backButton addTarget:self action:@selector(backToApiApp:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[backButton setImage:[UIImage imageNamed:@"ApiBackButton"] forState:UIControlStateNormal];
|
||||
backButton.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
|
||||
[_apiBar addSubview:backButton];
|
||||
|
||||
UIButton * clearButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
|
||||
[clearButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[clearButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
|
||||
[clearButton setTitle:L(@"clear") forState:UIControlStateNormal];
|
||||
[clearButton addTarget:self action:@selector(clearApiMode:) forControlEvents:UIControlEventTouchUpInside];
|
||||
clearButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
|
||||
clearButton.titleLabel.font = [UIFont light17];
|
||||
[_apiBar addSubview:clearButton];
|
||||
|
||||
[_apiBar addSubview:self.apiTitleLabel];
|
||||
|
||||
backButton.minX = -4;
|
||||
backButton.maxY = _apiBar.height;
|
||||
clearButton.maxX = _apiBar.width - 5;
|
||||
clearButton.maxY = _apiBar.height;
|
||||
self.apiTitleLabel.midX = _apiBar.width / 2;
|
||||
self.apiTitleLabel.maxY = _apiBar.height - 10;
|
||||
}
|
||||
return _apiBar;
|
||||
}
|
||||
|
||||
- (UILabel *)apiTitleLabel
|
||||
{
|
||||
if (!_apiTitleLabel)
|
||||
{
|
||||
_apiTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 240, 26)];
|
||||
_apiTitleLabel.font = [UIFont light17];
|
||||
_apiTitleLabel.textColor = [UIColor whiteColor];
|
||||
_apiTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_apiTitleLabel.alpha = 0.5;
|
||||
_apiTitleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
}
|
||||
return _apiTitleLabel;
|
||||
}
|
||||
|
||||
#pragma mark - Api methods
|
||||
|
||||
- (void)clearApiMode:(id)sender
|
||||
{
|
||||
[self setApiMode:NO animated:YES];
|
||||
[self cleanUserMarks];
|
||||
}
|
||||
|
||||
- (void)backToApiApp:(id)sender
|
||||
{
|
||||
NSURL * url = [NSURL URLWithString:[NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetGlobalBackUrl().c_str()]];
|
||||
[[UIApplication sharedApplication] openURL:url];
|
||||
}
|
||||
|
||||
#pragma mark - Routing
|
||||
|
||||
- (void)dismissRouting
|
||||
|
@ -1050,53 +1012,6 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
|
||||
#pragma mark - Public methods
|
||||
|
||||
- (void)setApiMode:(BOOL)apiMode animated:(BOOL)animated
|
||||
{
|
||||
if (apiMode)
|
||||
{
|
||||
[self.view addSubview:self.apiBar];
|
||||
self.apiBar.maxY = 0;
|
||||
[UIView animateWithDuration:(animated ? 0.3 : 0) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^
|
||||
{
|
||||
self.apiBar.minY = 0;
|
||||
self.routeViewWrapper.minY = self.apiBar.maxY;
|
||||
}
|
||||
completion:nil];
|
||||
|
||||
[self.view insertSubview:self.searchView aboveSubview:self.apiBar];
|
||||
|
||||
self.apiTitleLabel.text = [NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()];
|
||||
}
|
||||
else
|
||||
{
|
||||
[UIView animateWithDuration:(animated ? 0.3 : 0) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^
|
||||
{
|
||||
self.apiBar.maxY = 0;
|
||||
self.routeViewWrapper.minY = self.apiBar.maxY;
|
||||
}
|
||||
completion:^(BOOL finished)
|
||||
{
|
||||
[self.apiBar removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
[self dismissPopover];
|
||||
[self.searchView setState:SearchViewStateHidden animated:YES];
|
||||
|
||||
_apiMode = apiMode;
|
||||
|
||||
[self updateStatusBarStyle];
|
||||
}
|
||||
|
||||
- (void)cleanUserMarks
|
||||
{
|
||||
Framework & framework = GetFramework();
|
||||
framework.GetBalloonManager().RemovePin();
|
||||
framework.GetBalloonManager().Dismiss();
|
||||
framework.GetBookmarkManager().UserMarksClear(UserMarkContainer::API_MARK);
|
||||
framework.Invalidate();
|
||||
}
|
||||
|
||||
- (void)setupMeasurementSystem
|
||||
{
|
||||
GetFramework().SetupMeasurementSystem();
|
||||
|
@ -1144,6 +1059,11 @@ NSInteger compareAddress(id l, id r, void * context)
|
|||
- (void)updateInfoViews
|
||||
{
|
||||
CGFloat topBound = 0.0;
|
||||
if ([self testMapInfoViewFlag:MapInfoViewAPIBar])
|
||||
{
|
||||
CGRect const apiRect = self.apiBar.frame;
|
||||
topBound = MAX(topBound, apiRect.origin.y + apiRect.size.height);
|
||||
}
|
||||
if ([self testMapInfoViewFlag:MapInfoViewSearch])
|
||||
{
|
||||
CGRect const searchRect = self.searchView.infoRect;
|
||||
|
|
|
@ -292,9 +292,9 @@ void InitLocalizedStrings()
|
|||
{
|
||||
if (f.ShowMapForURL([m_mwmURL UTF8String]))
|
||||
{
|
||||
[self.m_mapViewController setApiMode:YES animated:NO];
|
||||
[[Statistics instance] logApiUsage:m_sourceApplication];
|
||||
[self showMap];
|
||||
[self.m_mapViewController showAPIBar];
|
||||
}
|
||||
}
|
||||
else if (m_fileURL)
|
||||
|
|
|
@ -28,6 +28,8 @@ typedef NS_ENUM(NSUInteger, SearchViewState) {
|
|||
|
||||
@property (nonnull, nonatomic) SearchBar * searchBar;
|
||||
|
||||
@property (nonatomic) CGFloat topBound;
|
||||
|
||||
- (void)setState:(SearchViewState)state animated:(BOOL)animated;
|
||||
- (CGFloat)defaultSearchBarMinY;
|
||||
|
||||
|
|
|
@ -205,16 +205,15 @@ static BOOL keyboardLoaded = NO;
|
|||
self.alpha = 1;
|
||||
self.searchBar.cancelButton.alpha = 0;
|
||||
self.searchBar.alpha = 1;
|
||||
self.topBackgroundView.minY = 0;
|
||||
self.topBackgroundView.minY = self.topBound;
|
||||
self.searchBar.minY = searchBarOffset + self.topBound;
|
||||
self.topBackgroundView.height = [self defaultTopBackgroundHeight];
|
||||
if (self.topBound > 0.0)
|
||||
self.searchBar.minY -= 7.0;
|
||||
if ([self iPhoneInLandscape])
|
||||
{
|
||||
self.searchBar.minY = searchBarOffset - 3;
|
||||
self.topBackgroundView.height = [self defaultTopBackgroundHeight] - 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.searchBar.minY = searchBarOffset;
|
||||
self.topBackgroundView.height = [self defaultTopBackgroundHeight];
|
||||
self.searchBar.minY -= 3;
|
||||
self.topBackgroundView.height -= 10;
|
||||
}
|
||||
self.tableView.alpha = 0;
|
||||
self.searchBar.fieldBackgroundView.width = textFieldBackgroundWidth;
|
||||
|
@ -867,4 +866,10 @@ static BOOL keyboardLoaded = NO;
|
|||
return [self convertRect:self.topBackgroundView.frame toView:self.superview];
|
||||
}
|
||||
|
||||
- (void)setTopBound:(CGFloat)topBound
|
||||
{
|
||||
_topBound = topBound;
|
||||
[self setState:self.state animated:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "ApiBarBackground7@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
iphone/Maps/Images.xcassets/BackArrow.imageset/BackArrow.png
vendored
Normal file
BIN
iphone/Maps/Images.xcassets/BackArrow.imageset/BackArrow.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 B |
BIN
iphone/Maps/Images.xcassets/BackArrow.imageset/BackArrow@2x.png
vendored
Normal file
BIN
iphone/Maps/Images.xcassets/BackArrow.imageset/BackArrow@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 B |
BIN
iphone/Maps/Images.xcassets/BackArrow.imageset/BackArrow@3x.png
vendored
Normal file
BIN
iphone/Maps/Images.xcassets/BackArrow.imageset/BackArrow@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 413 B |
|
@ -2,17 +2,18 @@
|
|||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
"scale" : "1x",
|
||||
"filename" : "BackArrow.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "ApiBackButton@2x.png"
|
||||
"filename" : "BackArrow@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "ApiBackButton@3x.png"
|
||||
"filename" : "BackArrow@3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 244 B |
|
@ -14,6 +14,7 @@
|
|||
288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765070DF74369002DB57D /* CoreGraphics.framework */; };
|
||||
28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD73870D9D96C1002E5188 /* MainWindow.xib */; };
|
||||
340F24631B14910500F874CD /* RouteState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 340F24621B14910500F874CD /* RouteState.mm */; };
|
||||
341522BF1B666A550077AA8F /* MWMAPIBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 341522BE1B666A550077AA8F /* MWMAPIBarView.m */; };
|
||||
34287FDC1B3D7C4800F9959C /* libFlurry_6.4.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34287FDB1B3D7C4800F9959C /* libFlurry_6.4.0.a */; };
|
||||
3428BC131B55477E00C85B30 /* MWMSideMenuDownloadBadge.m in Sources */ = {isa = PBXBuildFile; fileRef = 3428BC121B55477E00C85B30 /* MWMSideMenuDownloadBadge.m */; };
|
||||
342AD76F1B53D30C00E0B997 /* UIButton+RuntimeAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 342AD76E1B53D30C00E0B997 /* UIButton+RuntimeAttributes.m */; };
|
||||
|
@ -33,6 +34,8 @@
|
|||
345C31721AE798DD00EA0CC2 /* MWMCategoriesInterfaceController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 345C31701AE798DD00EA0CC2 /* MWMCategoriesInterfaceController.mm */; };
|
||||
345C31781AE799B600EA0CC2 /* MWMSearchResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 345C31751AE799B600EA0CC2 /* MWMSearchResultCell.m */; };
|
||||
345C31791AE799B600EA0CC2 /* MWMSearchResultController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 345C31771AE799B600EA0CC2 /* MWMSearchResultController.mm */; };
|
||||
3465E7D81B6658C000854C4D /* MWMAPIBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3465E7D71B6658C000854C4D /* MWMAPIBar.mm */; };
|
||||
3465E7DD1B6658EB00854C4D /* MWMAPIBarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3465E7DC1B6658EB00854C4D /* MWMAPIBarView.xib */; };
|
||||
347274731B0F4EE000756B37 /* me.maps.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274721B0F4EE000756B37 /* me.maps.entitlements */; };
|
||||
347274771B0F4F3900756B37 /* me.maps.watchkitextension.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274761B0F4F3900756B37 /* me.maps.watchkitextension.entitlements */; };
|
||||
347274791B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274781B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements */; };
|
||||
|
@ -366,6 +369,8 @@
|
|||
340F24611B14910500F874CD /* RouteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RouteState.h; sourceTree = "<group>"; };
|
||||
340F24621B14910500F874CD /* RouteState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RouteState.mm; sourceTree = "<group>"; };
|
||||
340F24641B15F01D00F874CD /* MWMSideMenuDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMSideMenuDelegate.h; sourceTree = "<group>"; };
|
||||
341522BD1B666A550077AA8F /* MWMAPIBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAPIBarView.h; sourceTree = "<group>"; };
|
||||
341522BE1B666A550077AA8F /* MWMAPIBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMAPIBarView.m; sourceTree = "<group>"; };
|
||||
34287FDB1B3D7C4800F9959C /* libFlurry_6.4.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libFlurry_6.4.0.a; path = Statistics/libFlurry_6.4.0.a; sourceTree = "<group>"; };
|
||||
3428BC111B55477E00C85B30 /* MWMSideMenuDownloadBadge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSideMenuDownloadBadge.h; sourceTree = "<group>"; };
|
||||
3428BC121B55477E00C85B30 /* MWMSideMenuDownloadBadge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMSideMenuDownloadBadge.m; sourceTree = "<group>"; };
|
||||
|
@ -393,6 +398,9 @@
|
|||
345C31751AE799B600EA0CC2 /* MWMSearchResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMSearchResultCell.m; sourceTree = "<group>"; };
|
||||
345C31761AE799B600EA0CC2 /* MWMSearchResultController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchResultController.h; sourceTree = "<group>"; };
|
||||
345C31771AE799B600EA0CC2 /* MWMSearchResultController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSearchResultController.mm; sourceTree = "<group>"; };
|
||||
3465E7D61B6658C000854C4D /* MWMAPIBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAPIBar.h; sourceTree = "<group>"; };
|
||||
3465E7D71B6658C000854C4D /* MWMAPIBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMAPIBar.mm; sourceTree = "<group>"; };
|
||||
3465E7DC1B6658EB00854C4D /* MWMAPIBarView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMAPIBarView.xib; sourceTree = "<group>"; };
|
||||
347274721B0F4EE000756B37 /* me.maps.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.entitlements; sourceTree = "<group>"; };
|
||||
347274761B0F4F3900756B37 /* me.maps.watchkitextension.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.watchkitextension.entitlements; sourceTree = "<group>"; };
|
||||
347274781B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.watchkitextension.production.entitlements; sourceTree = "<group>"; };
|
||||
|
@ -1088,6 +1096,18 @@
|
|||
path = SearchResult;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3465E7D51B66589900854C4D /* APIBar */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3465E7D61B6658C000854C4D /* MWMAPIBar.h */,
|
||||
3465E7D71B6658C000854C4D /* MWMAPIBar.mm */,
|
||||
341522BD1B666A550077AA8F /* MWMAPIBarView.h */,
|
||||
341522BE1B666A550077AA8F /* MWMAPIBarView.m */,
|
||||
3465E7DC1B6658EB00854C4D /* MWMAPIBarView.xib */,
|
||||
);
|
||||
path = APIBar;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
347274711B0F4EB300756B37 /* Entitlements */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1170,6 +1190,7 @@
|
|||
34BC72091B0DECAE0012A34B /* MapViewControls */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3465E7D51B66589900854C4D /* APIBar */,
|
||||
34BC72101B0DECAE0012A34B /* MWMMapViewControlsManager.h */,
|
||||
34BC72111B0DECAE0012A34B /* MWMMapViewControlsManager.mm */,
|
||||
34BC720A1B0DECAE0012A34B /* LocationButton */,
|
||||
|
@ -2291,6 +2312,7 @@
|
|||
B08AA8CE1A24C7BC00810B1C /* LocalNotificationInfoProvider.m in Sources */,
|
||||
1D3623260D0F684500981E51 /* MapsAppDelegate.mm in Sources */,
|
||||
F67BBB571AC54A7800D162C7 /* MWMFeedbackAlert.mm in Sources */,
|
||||
341522BF1B666A550077AA8F /* MWMAPIBarView.m in Sources */,
|
||||
349A35831B53E967009677EE /* MWMDownloadMapRequest.mm in Sources */,
|
||||
A32B6D4C1A14980500E54A65 /* iosOGLContext.mm in Sources */,
|
||||
B0E1FCDF1A2343BC00A8E08B /* NextTurnPhoneView.m in Sources */,
|
||||
|
@ -2336,6 +2358,7 @@
|
|||
F65243351B0B634F00BFA9D4 /* MWMPlacePage+Animation.mm in Sources */,
|
||||
976D86F519CB21BD00C920EF /* RouteView.mm in Sources */,
|
||||
349A357C1B53D4C9009677EE /* MWMCircularProgressView.m in Sources */,
|
||||
3465E7D81B6658C000854C4D /* MWMAPIBar.mm in Sources */,
|
||||
FA29FDAA141E77F8004ADF66 /* Preferences.mm in Sources */,
|
||||
F6588E371B15D87A00EE1E58 /* MWMBookmarkColorCell.mm in Sources */,
|
||||
F6D409FA1B319BD70041730F /* ContextViews.mm in Sources */,
|
||||
|
|
Loading…
Add table
Reference in a new issue