[ios] Updated download map request from search.

This commit is contained in:
Ilya Grechuhin 2016-02-20 14:48:32 +03:00 committed by Sergey Yershov
parent 44dcdce3ff
commit 364bda91c8
3 changed files with 18 additions and 50 deletions

View file

@ -17,7 +17,6 @@
@property (nonatomic) IBOutlet MWMDownloadMapRequestView * rootView;
@property (nonatomic) IBOutlet UILabel * mapTitleLabel;
@property (nonatomic) IBOutlet UIButton * downloadMapButton;
@property (nonatomic) IBOutlet UIButton * downloadRoutesButton;
@property (nonatomic) IBOutlet UIView * progressViewWrapper;
@property (nonatomic) MWMCircularProgress * progressView;
@ -88,7 +87,7 @@
storage::NodeAttrs attrs;
s.GetNodeAttrs(m_countryId, attrs);
self.mapTitleLabel.text = @(attrs.m_nodeLocalName.c_str());
self.mapAndRouteSize = @(attrs.m_downloadingMwmSize).stringValue;
self.mapAndRouteSize = formattedSize(attrs.m_mwmSize);
[self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)",
L(@"downloader_download_map"), self.mapAndRouteSize]
forState:UIControlStateNormal];
@ -146,15 +145,6 @@
}];
}
- (IBAction)downloadRoutesTouchUpInside:(nonnull UIButton *)sender
{
[[Statistics instance] logEvent:kStatEventName(kStatDownloadRequest, kStatDownloadRoute)];
sender.selected = !sender.selected;
[self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)",
L(@"downloader_download_map"), self.mapAndRouteSize]
forState:UIControlStateNormal];
}
- (IBAction)selectMapTouchUpInside:(nonnull UIButton *)sender
{
[[Statistics instance] logEvent:kStatEventName(kStatDownloadRequest, kStatSelectMap)];

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
@ -8,7 +8,6 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMDownloadMapRequest">
<connections>
<outlet property="downloadMapButton" destination="ANW-J1-K9x" id="8Ul-49-KUb"/>
<outlet property="downloadRoutesButton" destination="Ns9-3f-AnX" id="LQp-vW-Qxs"/>
<outlet property="mapTitleLabel" destination="ldF-A5-Jo3" id="r20-cg-aHn"/>
<outlet property="progressViewWrapper" destination="Axo-F2-0Xb" id="MY3-o4-9hX"/>
<outlet property="rootView" destination="wdy-tr-47e" id="vKe-K9-3Io"/>
@ -65,28 +64,8 @@
<action selector="downloadMapTouchUpInside:" destination="-1" eventType="touchUpInside" id="tMi-t3-4NI"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ns9-3f-AnX">
<rect key="frame" x="40" y="87" width="240" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="FMy-No-TLl"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<inset key="titleEdgeInsets" minX="8" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Автомобильные маршруты" image="radioBtnOff">
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected" image="radioBtnOn"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="search_vehicle_routes"/>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMBlue"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="downloadRoutesTouchUpInside:" destination="-1" eventType="touchUpInside" id="0Zh-cL-WYE"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ваше местоположение не определено" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="288" translatesAutoresizingMaskIntoConstraints="NO" id="0HQ-hc-mvu">
<rect key="frame" x="16" y="117" width="288" height="17"/>
<rect key="frame" x="16" y="97" width="288" height="16"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -97,7 +76,7 @@
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q7R-7R-aMD">
<rect key="frame" x="40" y="155" width="240" height="32"/>
<rect key="frame" x="40" y="135" width="240" height="32"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="Ewk-3H-tDK"/>
</constraints>
@ -129,38 +108,30 @@
<constraints>
<constraint firstItem="ANW-J1-K9x" firstAttribute="top" secondItem="ldF-A5-Jo3" secondAttribute="bottom" constant="10" id="8ct-NO-wGh"/>
<constraint firstItem="ldF-A5-Jo3" firstAttribute="top" secondItem="wdy-tr-47e" secondAttribute="top" id="DSk-Dw-hDB"/>
<constraint firstItem="q7R-7R-aMD" firstAttribute="top" secondItem="ANW-J1-K9x" secondAttribute="bottom" constant="60" id="JVj-Iy-66r"/>
<constraint firstAttribute="trailing" secondItem="ldF-A5-Jo3" secondAttribute="trailing" constant="16" id="KsU-Ev-FCI"/>
<constraint firstItem="q7R-7R-aMD" firstAttribute="top" secondItem="Ns9-3f-AnX" secondAttribute="bottom" constant="44" id="SM5-r0-AS2"/>
<constraint firstItem="Axo-F2-0Xb" firstAttribute="top" secondItem="ldF-A5-Jo3" secondAttribute="bottom" constant="24" id="SnX-Nf-mt9"/>
<constraint firstItem="Ns9-3f-AnX" firstAttribute="centerX" secondItem="ANW-J1-K9x" secondAttribute="centerX" id="fir-kl-M8E"/>
<constraint firstItem="ANW-J1-K9x" firstAttribute="width" secondItem="q7R-7R-aMD" secondAttribute="width" id="gY4-nk-yaY"/>
<constraint firstItem="ANW-J1-K9x" firstAttribute="centerX" secondItem="q7R-7R-aMD" secondAttribute="centerX" id="gfS-3M-5zg"/>
<constraint firstItem="Ns9-3f-AnX" firstAttribute="width" secondItem="ANW-J1-K9x" secondAttribute="width" id="hQI-Kw-RlX"/>
<constraint firstItem="ldF-A5-Jo3" firstAttribute="centerX" secondItem="ANW-J1-K9x" secondAttribute="centerX" id="lWc-tH-1Oi"/>
<constraint firstItem="ldF-A5-Jo3" firstAttribute="leading" secondItem="wdy-tr-47e" secondAttribute="leading" constant="16" id="mFv-Dr-2pb"/>
<constraint firstAttribute="trailing" secondItem="0HQ-hc-mvu" secondAttribute="trailing" constant="16" id="o8v-fv-loA"/>
<constraint firstItem="0HQ-hc-mvu" firstAttribute="leading" secondItem="wdy-tr-47e" secondAttribute="leading" constant="16" id="tED-fC-gYF"/>
<constraint firstItem="q7R-7R-aMD" firstAttribute="top" secondItem="0HQ-hc-mvu" secondAttribute="bottom" constant="22" id="u95-8m-bpq"/>
<constraint firstItem="Ns9-3f-AnX" firstAttribute="top" secondItem="ANW-J1-K9x" secondAttribute="bottom" constant="12" id="uJa-y4-6sW"/>
<constraint firstItem="ldF-A5-Jo3" firstAttribute="centerX" secondItem="Axo-F2-0Xb" secondAttribute="centerX" id="w4N-6B-zSQ"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="betweenButtonsSpace" destination="JVj-Iy-66r" id="if6-aC-dxF"/>
<outlet property="downloadMapButton" destination="ANW-J1-K9x" id="yVE-8n-ezQ"/>
<outlet property="downloadRoutesButton" destination="Ns9-3f-AnX" id="Mh2-Di-igv"/>
<outlet property="mapTitleLabel" destination="ldF-A5-Jo3" id="SCT-Zb-Xxq"/>
<outlet property="progressViewWrapper" destination="Axo-F2-0Xb" id="haF-S7-daI"/>
<outlet property="selectAnotherMapButton" destination="q7R-7R-aMD" id="pyE-n2-tck"/>
<outlet property="undefinedLocationLabel" destination="0HQ-hc-mvu" id="qCF-gw-Ll7"/>
<outlet property="unknownPositionLabelBottomOffset" destination="u95-8m-bpq" id="qXZ-7m-zS1"/>
<outlet property="verticalFreeSpace" destination="SM5-r0-AS2" id="aXL-lW-az3"/>
</connections>
<point key="canvasLocation" x="71" y="403.5"/>
<point key="canvasLocation" x="71" y="403"/>
</view>
</objects>
<resources>
<image name="radioBtnOff" width="22" height="22"/>
<image name="radioBtnOn" width="22" height="22"/>
</resources>
</document>

View file

@ -2,6 +2,12 @@
#import "UIButton+RuntimeAttributes.h"
#import "UIColor+MapsMeColor.h"
namespace
{
CGFloat const kButtonsCompactSpacing = 22.0;
CGFloat const kButtonsLooseSpacing = 60.0;
}
@interface MWMDownloadMapRequestView ()
@property (weak, nonatomic) IBOutlet UILabel * mapTitleLabel;
@ -10,11 +16,12 @@
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * unknownPositionLabelBottomOffset;
@property (weak, nonatomic) IBOutlet UIButton * downloadMapButton;
@property (weak, nonatomic) IBOutlet UIButton * downloadRoutesButton;
@property (weak, nonatomic) IBOutlet UILabel * undefinedLocationLabel;
@property (weak, nonatomic) IBOutlet UIButton * selectAnotherMapButton;
@property (weak, nonatomic) IBOutlet UIView * progressViewWrapper;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * betweenButtonsSpace;
@end
@implementation MWMDownloadMapRequestView
@ -69,15 +76,14 @@
self.progressViewWrapper.hidden = NO;
self.mapTitleLabel.hidden = NO;
self.downloadMapButton.hidden = YES;
self.downloadRoutesButton.hidden = YES;
self.undefinedLocationLabel.hidden = YES;
self.selectAnotherMapButton.hidden = YES;
self.betweenButtonsSpace.constant = kButtonsCompactSpacing;
break;
case MWMDownloadMapRequestStateRequestLocation:
self.progressViewWrapper.hidden = YES;
self.mapTitleLabel.hidden = NO;
self.downloadMapButton.hidden = NO;
self.downloadRoutesButton.hidden = NO;
self.undefinedLocationLabel.hidden = YES;
self.selectAnotherMapButton.hidden = NO;
[self.selectAnotherMapButton setTitle:L(@"search_select_other_map") forState:UIControlStateNormal];
@ -85,12 +91,12 @@
[self.selectAnotherMapButton setTitleColor:[UIColor white] forState:UIControlStateHighlighted];
[self.selectAnotherMapButton setBackgroundColor:[UIColor white] forState:UIControlStateNormal];
[self.selectAnotherMapButton setBackgroundColor:[UIColor linkBlue] forState:UIControlStateHighlighted];
self.betweenButtonsSpace.constant = kButtonsCompactSpacing;
break;
case MWMDownloadMapRequestStateRequestUnknownLocation:
self.progressViewWrapper.hidden = YES;
self.mapTitleLabel.hidden = YES;
self.downloadMapButton.hidden = YES;
self.downloadRoutesButton.hidden = YES;
self.undefinedLocationLabel.hidden = NO;
self.selectAnotherMapButton.hidden = NO;
[self.selectAnotherMapButton setTitle:L(@"search_select_map") forState:UIControlStateNormal];
@ -98,6 +104,7 @@
[self.selectAnotherMapButton setTitleColor:[UIColor white] forState:UIControlStateNormal];
[self.selectAnotherMapButton setBackgroundColor:[UIColor linkBlue] forState:UIControlStateNormal];
[self.selectAnotherMapButton setBackgroundColor:[UIColor linkBlueDark] forState:UIControlStateHighlighted];
self.betweenButtonsSpace.constant = kButtonsLooseSpacing;
break;
}
}