Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMTableViewCell.h"
|
||||
|
||||
@interface MWMMapDownloaderButtonTableViewCell : MWMTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#import "MWMMapDownloaderButtonTableViewCell.h"
|
||||
|
||||
@implementation MWMMapDownloaderButtonTableViewCell
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
[self config];
|
||||
}
|
||||
|
||||
- (void)prepareForReuse
|
||||
{
|
||||
[super prepareForReuse];
|
||||
[self config];
|
||||
}
|
||||
|
||||
- (void)config
|
||||
{
|
||||
if ([self respondsToSelector:@selector(setSeparatorInset:)])
|
||||
[self setSeparatorInset:UIEdgeInsetsZero];
|
||||
if ([self respondsToSelector:@selector(setLayoutMargins:)])
|
||||
[self setLayoutMargins:UIEdgeInsetsZero];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="0.0" shouldIndentWhileEditing="NO" reuseIdentifier="MWMMapDownloaderButtonTableViewCell" id="KGk-i7-Jjw" customClass="MWMMapDownloaderButtonTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add Maps Button" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dOW-mN-UY7">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" systemColor="linkColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:linkBlueText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="download_maps"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<systemColor name="linkColor">
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
@interface MWMMapDownloaderCellHeader : UILabel
|
||||
|
||||
@end
|
||||
23
iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderCellHeader.m
Normal file
23
iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderCellHeader.m
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#import "MWMMapDownloaderCellHeader.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
@implementation MWMMapDownloaderCellHeader
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self)
|
||||
{
|
||||
[self setStyleNameAndApply:@"regular12:blackSecondaryText"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)drawTextInRect:(CGRect)rect
|
||||
{
|
||||
rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(0, 16, 0, 0));
|
||||
rect = UIEdgeInsetsInsetRect(rect, self.safeAreaInsets);
|
||||
[super drawTextInRect:rect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMMapDownloaderTableViewCell.h"
|
||||
|
||||
@interface MWMMapDownloaderLargeCountryTableViewCell : MWMMapDownloaderTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#import "MWMMapDownloaderLargeCountryTableViewCell.h"
|
||||
#import "MWMCircularProgress.h"
|
||||
|
||||
#import <CoreApi/MWMMapNodeAttributes.h>
|
||||
|
||||
@interface MWMMapDownloaderLargeCountryTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * mapsCount;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderLargeCountryTableViewCell
|
||||
|
||||
#pragma mark - Config
|
||||
|
||||
- (void)config:(MWMMapNodeAttributes *)nodeAttrs searchQuery:(NSString *)searchQuery {
|
||||
[super config:nodeAttrs searchQuery:searchQuery];
|
||||
BOOL haveLocalMaps = (nodeAttrs.downloadedMwmCount != 0);
|
||||
NSString *ofMaps = haveLocalMaps ? [NSString stringWithFormat:L(@"downloader_of"), nodeAttrs.downloadedMwmCount, nodeAttrs.totalMwmCount] : @(nodeAttrs.totalMwmCount).stringValue;
|
||||
self.mapsCount.text = [NSString stringWithFormat:@"%@: %@", L(@"downloader_status_maps"), ofMaps];
|
||||
}
|
||||
|
||||
- (void)configProgress:(MWMMapNodeAttributes *)nodeAttrs {
|
||||
[super configProgress:nodeAttrs];
|
||||
if (nodeAttrs.nodeStatus == MWMMapNodeStatusPartly || nodeAttrs.nodeStatus == MWMMapNodeStatusNotDownloaded) {
|
||||
MWMCircularProgressStateVec affectedStates = @[@(MWMCircularProgressStateNormal), @(MWMCircularProgressStateSelected)];
|
||||
[self.progress setImageName:@"ic_folder" forStates:affectedStates];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="MWMMapDownloaderLargeCountryTableViewCell" rowHeight="62" id="4CW-jw-1JP" customClass="MWMMapDownloaderLargeCountryTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4CW-jw-1JP" id="rFT-0r-5zy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3NQ-tT-U9b">
|
||||
<rect key="frame" x="12" y="13" width="36" height="36"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="36" id="3vs-uR-5WA"/>
|
||||
<constraint firstAttribute="width" constant="36" id="WtB-IW-uuH"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="People's Republic of China" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cum-4j-JlQ">
|
||||
<rect key="frame" x="60" y="12" width="167" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="14 maps" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="851-fC-gEN">
|
||||
<rect key="frame" x="60" y="36" width="224" height="14"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular12:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="760" text="405 MB" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Ni-mb-fA5">
|
||||
<rect key="frame" x="235" y="22.5" width="49" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_arrow_gray_right" translatesAutoresizingMaskIntoConstraints="NO" id="7HN-EK-QXO" userLabel="Arrow">
|
||||
<rect key="frame" x="284" y="17" width="28" height="28"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="28" id="OyB-rL-7rb"/>
|
||||
<constraint firstAttribute="height" constant="28" id="dNb-uE-TzF"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMGray"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="cum-4j-JlQ" firstAttribute="leading" secondItem="rFT-0r-5zy" secondAttribute="leading" constant="60" id="6W7-tW-rcf"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9Ni-mb-fA5" secondAttribute="trailing" constant="36" id="C7I-fY-Gfw"/>
|
||||
<constraint firstItem="851-fC-gEN" firstAttribute="trailing" secondItem="9Ni-mb-fA5" secondAttribute="trailing" id="DJE-zo-NaQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7HN-EK-QXO" secondAttribute="trailing" constant="8" id="EZJ-3g-VZ0"/>
|
||||
<constraint firstItem="3NQ-tT-U9b" firstAttribute="leading" secondItem="rFT-0r-5zy" secondAttribute="leading" constant="12" id="Km2-Bp-fFb"/>
|
||||
<constraint firstItem="851-fC-gEN" firstAttribute="leading" secondItem="cum-4j-JlQ" secondAttribute="leading" id="NHY-P5-axf"/>
|
||||
<constraint firstItem="cum-4j-JlQ" firstAttribute="top" secondItem="rFT-0r-5zy" secondAttribute="top" constant="12" id="SEx-Ax-stg"/>
|
||||
<constraint firstAttribute="bottom" secondItem="851-fC-gEN" secondAttribute="bottom" constant="12" id="ZwR-py-AZC"/>
|
||||
<constraint firstItem="851-fC-gEN" firstAttribute="top" secondItem="cum-4j-JlQ" secondAttribute="bottom" constant="4" id="aAE-b0-nwb"/>
|
||||
<constraint firstItem="9Ni-mb-fA5" firstAttribute="leading" secondItem="cum-4j-JlQ" secondAttribute="trailing" constant="8" id="hV0-8P-jwr"/>
|
||||
<constraint firstItem="9Ni-mb-fA5" firstAttribute="centerY" secondItem="rFT-0r-5zy" secondAttribute="centerY" id="tB8-k0-qYw"/>
|
||||
<constraint firstItem="7HN-EK-QXO" firstAttribute="centerY" secondItem="rFT-0r-5zy" secondAttribute="centerY" id="tjc-5f-EBn"/>
|
||||
<constraint firstItem="3NQ-tT-U9b" firstAttribute="centerY" secondItem="rFT-0r-5zy" secondAttribute="centerY" id="zd3-Ex-VJY"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="downloadSize" destination="9Ni-mb-fA5" id="btQ-8t-pIV"/>
|
||||
<outlet property="mapsCount" destination="851-fC-gEN" id="dY0-zX-KS2"/>
|
||||
<outlet property="stateWrapper" destination="3NQ-tT-U9b" id="PJw-9U-8b3"/>
|
||||
<outlet property="title" destination="cum-4j-JlQ" id="f9c-KC-2dR"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="408.69565217391306" y="269.86607142857139"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ic_arrow_gray_right" width="28" height="28"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#import "MWMMapDownloaderTableViewCell.h"
|
||||
|
||||
@interface MWMMapDownloaderPlaceTableViewCell : MWMMapDownloaderTableViewCell
|
||||
|
||||
@property (nonatomic) BOOL needDisplayArea;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#import "MWMMapDownloaderPlaceTableViewCell.h"
|
||||
|
||||
#import <CoreApi/MWMMapNodeAttributes.h>
|
||||
|
||||
@interface MWMMapDownloaderPlaceTableViewCell ()
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UILabel *descriptionLabel;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint *titleBottomOffset;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderPlaceTableViewCell
|
||||
|
||||
#pragma mark - Config
|
||||
|
||||
- (void)config:(MWMMapNodeAttributes *)nodeAttrs searchQuery:(NSString *)searchQuery {
|
||||
[super config:nodeAttrs searchQuery:searchQuery];
|
||||
BOOL isDescriptionVisible = NO;
|
||||
NSDictionary *selectedAreaAttrs = @{NSFontAttributeName : [UIFont bold12]};
|
||||
NSDictionary *unselectedAreaAttrs = @{NSFontAttributeName : [UIFont regular12]};
|
||||
self.needDisplayArea = !nodeAttrs.hasParent;
|
||||
if (self.needDisplayArea && nodeAttrs.topmostParentInfo.count == 1) {
|
||||
isDescriptionVisible = nodeAttrs.hasParent;
|
||||
if (isDescriptionVisible) {
|
||||
self.descriptionLabel.attributedText = [self matchedString:nodeAttrs.topmostParentInfo[0].countryName
|
||||
selectedAttrs:selectedAreaAttrs
|
||||
unselectedAttrs:unselectedAreaAttrs];
|
||||
}
|
||||
}
|
||||
else if (nodeAttrs.nodeDescription.length > 0)
|
||||
{
|
||||
isDescriptionVisible = YES;
|
||||
self.descriptionLabel.attributedText = [self matchedString:nodeAttrs.nodeDescription
|
||||
selectedAttrs:selectedAreaAttrs
|
||||
unselectedAttrs:unselectedAreaAttrs];
|
||||
}
|
||||
self.descriptionLabel.hidden = !isDescriptionVisible;
|
||||
self.titleBottomOffset.priority =
|
||||
isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="MWMMapDownloaderPlaceTableViewCell" rowHeight="62" id="1KI-85-wsU" customClass="MWMMapDownloaderPlaceTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1KI-85-wsU" id="mRF-11-OKU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yb5-r1-Z2X">
|
||||
<rect key="frame" x="12" y="13" width="36" height="36"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="36" id="OjM-Wz-G8P"/>
|
||||
<constraint firstAttribute="width" constant="36" id="vYF-tP-Wtw"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="London" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Db-Yq-FlD">
|
||||
<rect key="frame" x="60" y="12" width="195" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="20" id="fnm-gO-0Fg"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="UK" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fev-4l-MY3">
|
||||
<rect key="frame" x="60" y="36" width="199" height="14"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular12:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="760" text="45 MB" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rqh-iy-Sx9">
|
||||
<rect key="frame" x="263" y="23" width="41" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3Db-Yq-FlD" firstAttribute="leading" secondItem="mRF-11-OKU" secondAttribute="leading" constant="60" id="2CW-BR-iT1"/>
|
||||
<constraint firstItem="Yb5-r1-Z2X" firstAttribute="leading" secondItem="mRF-11-OKU" secondAttribute="leading" constant="12" id="GGp-H1-htH"/>
|
||||
<constraint firstItem="3Db-Yq-FlD" firstAttribute="top" secondItem="mRF-11-OKU" secondAttribute="top" constant="12" id="Jhy-gy-RcP"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="leading" secondItem="3Db-Yq-FlD" secondAttribute="trailing" constant="8" id="NhL-qc-Mcu"/>
|
||||
<constraint firstAttribute="trailing" secondItem="rqh-iy-Sx9" secondAttribute="trailing" constant="16" id="dil-Rw-64e"/>
|
||||
<constraint firstItem="fev-4l-MY3" firstAttribute="top" secondItem="3Db-Yq-FlD" secondAttribute="bottom" priority="500" constant="4" id="ePz-Xy-IoM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="3Db-Yq-FlD" secondAttribute="bottom" priority="250" constant="12" id="ffv-VG-1xY"/>
|
||||
<constraint firstItem="Yb5-r1-Z2X" firstAttribute="centerY" secondItem="mRF-11-OKU" secondAttribute="centerY" id="g72-Dp-9Ky"/>
|
||||
<constraint firstItem="fev-4l-MY3" firstAttribute="leading" secondItem="3Db-Yq-FlD" secondAttribute="leading" id="kP7-cA-GeN"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fev-4l-MY3" secondAttribute="bottom" priority="500" constant="12" id="mJE-YM-1uE"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="centerY" secondItem="mRF-11-OKU" secondAttribute="centerY" id="qZa-yl-a6W"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="leading" secondItem="fev-4l-MY3" secondAttribute="trailing" constant="4" id="rqB-DG-k9N"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="descriptionLabel" destination="fev-4l-MY3" id="lyN-5S-iWE"/>
|
||||
<outlet property="downloadSize" destination="rqh-iy-Sx9" id="g9R-G7-dxQ"/>
|
||||
<outlet property="stateWrapper" destination="Yb5-r1-Z2X" id="iPW-N5-qJi"/>
|
||||
<outlet property="title" destination="3Db-Yq-FlD" id="qtt-YF-a0V"/>
|
||||
<outlet property="titleBottomOffset" destination="ffv-VG-1xY" id="0kL-3a-tKy"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="408.69565217391306" y="269.86607142857139"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#import "MWMMapDownloaderPlaceTableViewCell.h"
|
||||
|
||||
@interface MWMMapDownloaderSubplaceTableViewCell : MWMMapDownloaderPlaceTableViewCell
|
||||
|
||||
- (void)setSubplaceText:(NSString *)text;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#import "MWMMapDownloaderSubplaceTableViewCell.h"
|
||||
|
||||
@interface MWMMapDownloaderSubplaceTableViewCell ()
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UILabel *subPlace;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderSubplaceTableViewCell
|
||||
|
||||
- (void)setSubplaceText:(NSString *)text {
|
||||
self.subPlace.attributedText = [self matchedString:text
|
||||
selectedAttrs:@{NSFontAttributeName : [UIFont bold14]}
|
||||
unselectedAttrs:@{NSFontAttributeName : [UIFont regular14]}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="MWMMapDownloaderSubplaceTableViewCell" rowHeight="82" id="1KI-85-wsU" customClass="MWMMapDownloaderSubplaceTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="82"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1KI-85-wsU" id="mRF-11-OKU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="82"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yb5-r1-Z2X">
|
||||
<rect key="frame" x="12" y="23" width="36" height="36"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="36" id="OjM-Wz-G8P"/>
|
||||
<constraint firstAttribute="width" constant="36" id="vYF-tP-Wtw"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="760" text="Mossel Bay" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x7m-Zm-8y6" propertyAccessControl="none">
|
||||
<rect key="frame" x="60" y="12" width="199" height="16.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="760" text="London" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Db-Yq-FlD">
|
||||
<rect key="frame" x="60" y="32.5" width="195" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="20" id="CiU-uC-JVj"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="UK" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fev-4l-MY3">
|
||||
<rect key="frame" x="60" y="56.5" width="199" height="14"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular12:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="760" text="45 MB" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rqh-iy-Sx9">
|
||||
<rect key="frame" x="263" y="33" width="41" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3Db-Yq-FlD" firstAttribute="leading" secondItem="mRF-11-OKU" secondAttribute="leading" constant="60" id="4Sj-Yh-d4y"/>
|
||||
<constraint firstItem="3Db-Yq-FlD" firstAttribute="top" secondItem="x7m-Zm-8y6" secondAttribute="bottom" constant="4" id="AFW-TD-ADw"/>
|
||||
<constraint firstItem="x7m-Zm-8y6" firstAttribute="top" secondItem="mRF-11-OKU" secondAttribute="top" constant="12" id="E4o-jw-VEZ"/>
|
||||
<constraint firstItem="Yb5-r1-Z2X" firstAttribute="leading" secondItem="mRF-11-OKU" secondAttribute="leading" constant="12" id="GGp-H1-htH"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="leading" secondItem="x7m-Zm-8y6" secondAttribute="trailing" constant="4" id="GsC-fa-5kk"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="leading" secondItem="3Db-Yq-FlD" secondAttribute="trailing" constant="8" id="I7Q-yY-JMS"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fev-4l-MY3" secondAttribute="bottom" priority="500" constant="12" id="Rnj-5e-Hfy"/>
|
||||
<constraint firstItem="fev-4l-MY3" firstAttribute="leading" secondItem="3Db-Yq-FlD" secondAttribute="leading" id="Yk6-jH-hKS"/>
|
||||
<constraint firstAttribute="bottom" secondItem="3Db-Yq-FlD" secondAttribute="bottom" priority="250" constant="12" id="Zic-It-hOL"/>
|
||||
<constraint firstAttribute="trailing" secondItem="rqh-iy-Sx9" secondAttribute="trailing" constant="16" id="dil-Rw-64e"/>
|
||||
<constraint firstItem="Yb5-r1-Z2X" firstAttribute="centerY" secondItem="mRF-11-OKU" secondAttribute="centerY" id="g72-Dp-9Ky"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="leading" secondItem="fev-4l-MY3" secondAttribute="trailing" constant="4" id="oqd-UU-h0T"/>
|
||||
<constraint firstItem="fev-4l-MY3" firstAttribute="top" secondItem="3Db-Yq-FlD" secondAttribute="bottom" constant="4" id="pwP-cL-stJ"/>
|
||||
<constraint firstItem="x7m-Zm-8y6" firstAttribute="leading" secondItem="3Db-Yq-FlD" secondAttribute="leading" id="pxg-tv-fNn"/>
|
||||
<constraint firstItem="rqh-iy-Sx9" firstAttribute="centerY" secondItem="mRF-11-OKU" secondAttribute="centerY" id="qZa-yl-a6W"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="descriptionLabel" destination="fev-4l-MY3" id="1C2-OF-Vhu"/>
|
||||
<outlet property="downloadSize" destination="rqh-iy-Sx9" id="q4T-Pv-DrI"/>
|
||||
<outlet property="stateWrapper" destination="Yb5-r1-Z2X" id="eb8-Ut-gh5"/>
|
||||
<outlet property="subPlace" destination="x7m-Zm-8y6" id="63W-Bc-FdX"/>
|
||||
<outlet property="title" destination="3Db-Yq-FlD" id="JdN-yn-xLw"/>
|
||||
<outlet property="titleBottomOffset" destination="Zic-It-hOL" id="1gW-IS-6Fc"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="408.69565217391306" y="269.86607142857139"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#import "MWMMapDownloaderMode.h"
|
||||
#import "MWMTableViewCell.h"
|
||||
|
||||
@class MWMCircularProgress;
|
||||
@class MWMMapNodeAttributes;
|
||||
@class MWMMapDownloaderTableViewCell;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MWMMapDownloaderTableViewCellDelegate <NSObject>
|
||||
|
||||
- (void)mapDownloaderCellDidPressProgress:(MWMMapDownloaderTableViewCell *)cell;
|
||||
- (void)mapDownloaderCellDidLongPress:(MWMMapDownloaderTableViewCell *)cell;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMMapDownloaderTableViewCell : MWMTableViewCell
|
||||
|
||||
@property(nonatomic) MWMCircularProgress *progress;
|
||||
@property(weak, nonatomic) id<MWMMapDownloaderTableViewCellDelegate> delegate;
|
||||
@property(nonatomic) MWMMapDownloaderMode mode;
|
||||
@property(readonly, nonatomic) MWMMapNodeAttributes *nodeAttrs;
|
||||
|
||||
- (void)config:(MWMMapNodeAttributes *)nodeAttrs searchQuery:(nullable NSString *)searchQuery;
|
||||
- (void)configProgress:(MWMMapNodeAttributes *)nodeAttrs;
|
||||
- (void)setDownloadProgress:(CGFloat)progress;
|
||||
- (NSAttributedString *)matchedString:(NSString *)str
|
||||
selectedAttrs:(NSDictionary *)selectedAttrs
|
||||
unselectedAttrs:(NSDictionary *)unselectedAttrs;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
149
iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.m
Normal file
149
iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.m
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
#import "MWMMapDownloaderTableViewCell.h"
|
||||
#import "MWMCircularProgress.h"
|
||||
#import "NSString+Categories.h"
|
||||
|
||||
#import <CoreApi/MWMCommon.h>
|
||||
#import <CoreApi/MWMFrameworkHelper.h>
|
||||
#import <CoreApi/MWMMapNodeAttributes.h>
|
||||
|
||||
@interface MWMMapDownloaderTableViewCell () <MWMCircularProgressProtocol>
|
||||
|
||||
@property(copy, nonatomic) NSString *searchQuery;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIView *stateWrapper;
|
||||
@property(weak, nonatomic) IBOutlet UILabel *title;
|
||||
@property(weak, nonatomic) IBOutlet UILabel *downloadSize;
|
||||
|
||||
@property(strong, nonatomic) MWMMapNodeAttributes *nodeAttrs;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
UILongPressGestureRecognizer *lpGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self
|
||||
action:@selector(onLongPress:)];
|
||||
[self addGestureRecognizer:lpGR];
|
||||
}
|
||||
|
||||
- (void)prepareForReuse {
|
||||
[super prepareForReuse];
|
||||
self.nodeAttrs = nil;
|
||||
}
|
||||
|
||||
- (void)onLongPress:(UILongPressGestureRecognizer *)sender {
|
||||
if (sender.state != UIGestureRecognizerStateBegan) {
|
||||
return;
|
||||
}
|
||||
[self.delegate mapDownloaderCellDidLongPress:self];
|
||||
}
|
||||
|
||||
#pragma mark - Search matching
|
||||
|
||||
- (NSAttributedString *)matchedString:(NSString *)str
|
||||
selectedAttrs:(NSDictionary *)selectedAttrs
|
||||
unselectedAttrs:(NSDictionary *)unselectedAttrs {
|
||||
NSMutableAttributedString *attrTitle = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
[attrTitle addAttributes:unselectedAttrs range:NSMakeRange(0, str.length)];
|
||||
if (!self.searchQuery)
|
||||
return [attrTitle copy];
|
||||
for (NSValue *range in [str rangesOfString:self.searchQuery])
|
||||
[attrTitle addAttributes:selectedAttrs range:range.rangeValue];
|
||||
return [attrTitle copy];
|
||||
}
|
||||
|
||||
#pragma mark - Config
|
||||
|
||||
- (void)config:(MWMMapNodeAttributes *)nodeAttrs searchQuery:(NSString *)searchQuery {
|
||||
self.searchQuery = searchQuery;
|
||||
self.nodeAttrs = nodeAttrs;
|
||||
[self configProgress:nodeAttrs];
|
||||
|
||||
self.title.attributedText = [self matchedString:nodeAttrs.nodeName
|
||||
selectedAttrs:@{NSFontAttributeName: [UIFont bold17]}
|
||||
unselectedAttrs:@{NSFontAttributeName: [UIFont regular17]}];
|
||||
|
||||
uint64_t size = 0;
|
||||
BOOL isModeDownloaded = self.mode == MWMMapDownloaderModeDownloaded;
|
||||
|
||||
switch (nodeAttrs.nodeStatus) {
|
||||
case MWMMapNodeStatusUndefined:
|
||||
case MWMMapNodeStatusError:
|
||||
case MWMMapNodeStatusOnDiskOutOfDate:
|
||||
case MWMMapNodeStatusNotDownloaded:
|
||||
case MWMMapNodeStatusApplying:
|
||||
case MWMMapNodeStatusInQueue:
|
||||
case MWMMapNodeStatusPartly:
|
||||
size = isModeDownloaded ? nodeAttrs.downloadedSize : nodeAttrs.totalSize;
|
||||
break;
|
||||
case MWMMapNodeStatusDownloading:
|
||||
size = isModeDownloaded ? nodeAttrs.totalUpdateSizeBytes : nodeAttrs.totalSize - nodeAttrs.downloadingSize;
|
||||
break;
|
||||
case MWMMapNodeStatusOnDisk:
|
||||
size = isModeDownloaded ? nodeAttrs.totalSize : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
self.downloadSize.text = formattedSize(size);
|
||||
self.downloadSize.hidden = (size == 0);
|
||||
}
|
||||
|
||||
- (void)configProgress:(MWMMapNodeAttributes *)nodeAttrs {
|
||||
MWMCircularProgress *progress = self.progress;
|
||||
BOOL isModeDownloaded = self.mode == MWMMapDownloaderModeDownloaded;
|
||||
MWMButtonColoring coloring = isModeDownloaded ? MWMButtonColoringBlack : MWMButtonColoringBlue;
|
||||
switch (nodeAttrs.nodeStatus) {
|
||||
case MWMMapNodeStatusNotDownloaded:
|
||||
case MWMMapNodeStatusPartly: {
|
||||
MWMCircularProgressStateVec affectedStates = @[@(MWMCircularProgressStateNormal), @(MWMCircularProgressStateSelected)];
|
||||
[progress setImageName:@"ic_download" forStates:affectedStates];
|
||||
[progress setColoring:coloring forStates:affectedStates];
|
||||
progress.state = MWMCircularProgressStateNormal;
|
||||
break;
|
||||
}
|
||||
case MWMMapNodeStatusDownloading:
|
||||
progress.progress = kMaxProgress * nodeAttrs.downloadedSize / (isModeDownloaded ? nodeAttrs.totalUpdateSizeBytes : nodeAttrs.totalSize - nodeAttrs.downloadingSize);
|
||||
break;
|
||||
case MWMMapNodeStatusApplying:
|
||||
case MWMMapNodeStatusInQueue:
|
||||
progress.state = MWMCircularProgressStateSpinner;
|
||||
break;
|
||||
case MWMMapNodeStatusUndefined:
|
||||
case MWMMapNodeStatusError:
|
||||
progress.state = MWMCircularProgressStateFailed;
|
||||
break;
|
||||
case MWMMapNodeStatusOnDisk:
|
||||
progress.state = MWMCircularProgressStateCompleted;
|
||||
break;
|
||||
case MWMMapNodeStatusOnDiskOutOfDate: {
|
||||
MWMCircularProgressStateVec affectedStates = @[@(MWMCircularProgressStateNormal), @(MWMCircularProgressStateSelected)];
|
||||
[progress setImageName:@"ic_update" forStates:affectedStates];
|
||||
[progress setColoring:MWMButtonColoringOther forStates:affectedStates];
|
||||
progress.state = MWMCircularProgressStateNormal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDownloadProgress:(CGFloat)progress {
|
||||
self.progress.progress = kMaxProgress * progress;
|
||||
}
|
||||
|
||||
#pragma mark - MWMCircularProgressProtocol
|
||||
|
||||
- (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress {
|
||||
[self.delegate mapDownloaderCellDidPressProgress:self];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (MWMCircularProgress *)progress {
|
||||
if (!_progress) {
|
||||
_progress = [MWMCircularProgress downloaderProgressForParentView:self.stateWrapper];
|
||||
_progress.delegate = self;
|
||||
}
|
||||
return _progress;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="760" selectionStyle="default" indentationWidth="10" reuseIdentifier="MWMMapDownloaderTableViewCell" rowHeight="52" id="Igh-sI-4cU" customClass="MWMMapDownloaderTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Igh-sI-4cU" id="hYr-eg-wbg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rTN-aw-5k7">
|
||||
<rect key="frame" x="12" y="8" width="36" height="36"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="36" id="H0T-d1-25M"/>
|
||||
<constraint firstAttribute="height" constant="36" id="aA3-Ok-RSD"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="300" verticalHuggingPriority="251" horizontalCompressionResistancePriority="800" text="30 MB" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lgA-X0-501">
|
||||
<rect key="frame" x="262.5" y="18" width="41.5" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="260" verticalHuggingPriority="249" horizontalCompressionResistancePriority="752" verticalCompressionResistancePriority="752" text="Algeria" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5kc-K7-7K8">
|
||||
<rect key="frame" x="60" y="16" width="194.5" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="lgA-X0-501" firstAttribute="centerY" secondItem="hYr-eg-wbg" secondAttribute="centerY" id="5QG-IM-adn"/>
|
||||
<constraint firstItem="5kc-K7-7K8" firstAttribute="leading" secondItem="hYr-eg-wbg" secondAttribute="leading" constant="60" id="6Dv-Pw-tTy"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lgA-X0-501" secondAttribute="trailing" constant="16" id="Af9-0B-Y6q"/>
|
||||
<constraint firstItem="rTN-aw-5k7" firstAttribute="leading" secondItem="hYr-eg-wbg" secondAttribute="leading" constant="12" id="Jfc-5q-LZI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="5kc-K7-7K8" secondAttribute="bottom" constant="16" id="ZLY-Tp-hnL"/>
|
||||
<constraint firstItem="lgA-X0-501" firstAttribute="leading" secondItem="5kc-K7-7K8" secondAttribute="trailing" constant="8" id="Zwe-tB-xNb"/>
|
||||
<constraint firstItem="5kc-K7-7K8" firstAttribute="top" secondItem="hYr-eg-wbg" secondAttribute="top" constant="16" id="anV-3S-XAR"/>
|
||||
<constraint firstItem="rTN-aw-5k7" firstAttribute="centerY" secondItem="hYr-eg-wbg" secondAttribute="centerY" id="tND-fx-OhO"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="downloadSize" destination="lgA-X0-501" id="Dl4-r1-7lU"/>
|
||||
<outlet property="stateWrapper" destination="rTN-aw-5k7" id="3jJ-Zp-S0C"/>
|
||||
<outlet property="title" destination="5kc-K7-7K8" id="SDA-Yd-DD2"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="413.04347826086962" y="271.875"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Loading…
Add table
Add a link
Reference in a new issue