Merge pull request #1097 from VladiMihaylenko/master

Recent Track to master(only UI).
This commit is contained in:
igrechuhin 2015-12-22 14:52:44 +03:00
commit 1f5e069c22
5 changed files with 362 additions and 70 deletions

View file

@ -0,0 +1,5 @@
#import "TableViewController.h"
@interface MWMRecentTrackSettingsController : TableViewController
@end

View file

@ -0,0 +1,40 @@
#import "MWMRecentTrackSettingsController.h"
#import "SelectableCell.h"
@interface MWMRecentTrackSettingsController ()
@property (weak, nonatomic) IBOutlet SelectableCell * none;
@property (weak, nonatomic) IBOutlet SelectableCell * oneHour;
@property (weak, nonatomic) IBOutlet SelectableCell * twoHours;
@property (weak, nonatomic) IBOutlet SelectableCell * sixHours;
@property (weak, nonatomic) IBOutlet SelectableCell * twelveHours;
@property (weak, nonatomic) IBOutlet SelectableCell * oneDay;
@property (weak, nonatomic) SelectableCell * selectedCell;
@end
@implementation MWMRecentTrackSettingsController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"recent_track");
self.none.accessoryType = UITableViewCellAccessoryCheckmark;
self.selectedCell = self.none;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.selectedCell.accessoryType = UITableViewCellAccessoryNone;
self.selectedCell = [tableView cellForRowAtIndexPath:indexPath];
self.selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
self.selectedCell.selected = NO;
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
if (section != 0)
NSAssert(false, @"Incorrect sections count");
return L(@"recent_track_help_text");
}
@end

View file

@ -706,6 +706,7 @@
F6BD33811B62403B00F2CE18 /* MWMRoutePreview.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6BD337E1B62403B00F2CE18 /* MWMRoutePreview.mm */; };
F6BD33841B6240F200F2CE18 /* MWMNavigationView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6BD33831B6240F200F2CE18 /* MWMNavigationView.mm */; };
F6BD33871B62412E00F2CE18 /* MWMNavigationDashboardEntity.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6BD33861B62412E00F2CE18 /* MWMNavigationDashboardEntity.mm */; };
F6C641B01C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6C641AF1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm */; };
F6C6FE201AD6BEA0009FDED7 /* MWMWatchLocationTracker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6C6FE1F1AD6BEA0009FDED7 /* MWMWatchLocationTracker.mm */; };
F6C7B7121BA840A4004233F4 /* resources-xhdpi_clear in Resources */ = {isa = PBXBuildFile; fileRef = 4A23D1591B8B4DD700D4EB6F /* resources-xhdpi_clear */; };
F6C7B7131BA840A4004233F4 /* resources-xhdpi_dark in Resources */ = {isa = PBXBuildFile; fileRef = 4A7D89C31B2EBF3B00AC843E /* resources-xhdpi_dark */; };
@ -734,6 +735,7 @@
F6ED13911B1EF96B0095C6DE /* MWMBookmarkDescriptionViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6ED13901B1EF96B0095C6DE /* MWMBookmarkDescriptionViewController.mm */; };
F6ED13931B1EFA2F0095C6DE /* MWMBookmarkDescriptionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6ED13921B1EFA2F0095C6DE /* MWMBookmarkDescriptionViewController.xib */; };
F6F533A31B3C248900C1940B /* UIColor+MapsMeColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6F533A21B3C248900C1940B /* UIColor+MapsMeColor.mm */; };
F6F6ACFC1C15C1010060FDD0 /* MWMRecentTrackSettingsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6C641AF1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm */; };
F6F722F81AE1572400DA3DA1 /* MWMiPhonePortraitPlacePage.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6F722F71AE1572400DA3DA1 /* MWMiPhonePortraitPlacePage.mm */; };
F6FE2C0F1B03A006009814AA /* MWMPlacePageNavigationBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6FE2C0E1B03A006009814AA /* MWMPlacePageNavigationBar.mm */; };
F6FE2C111B03A016009814AA /* PlacePageNavigationBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6FE2C101B03A015009814AA /* PlacePageNavigationBar.xib */; };
@ -1295,6 +1297,8 @@
F6BD33831B6240F200F2CE18 /* MWMNavigationView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNavigationView.mm; sourceTree = "<group>"; };
F6BD33851B62412E00F2CE18 /* MWMNavigationDashboardEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMNavigationDashboardEntity.h; sourceTree = "<group>"; };
F6BD33861B62412E00F2CE18 /* MWMNavigationDashboardEntity.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNavigationDashboardEntity.mm; sourceTree = "<group>"; };
F6C641AE1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRecentTrackSettingsController.h; sourceTree = "<group>"; };
F6C641AF1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMRecentTrackSettingsController.mm; sourceTree = "<group>"; };
F6C6FE1E1AD6BEA0009FDED7 /* MWMWatchLocationTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMWatchLocationTracker.h; sourceTree = "<group>"; };
F6C6FE1F1AD6BEA0009FDED7 /* MWMWatchLocationTracker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMWatchLocationTracker.mm; sourceTree = "<group>"; };
F6C9343A1AE4F94A00DDC624 /* MWMAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAnimator.h; sourceTree = "<group>"; };
@ -2796,6 +2800,8 @@
F668F6551BCD4507002D6FFC /* MWMTTSSettingsViewController.mm */,
F63BA36F1BCD5B520044C504 /* MWMTTSLanguageViewController.h */,
F63BA3701BCD5B520044C504 /* MWMTTSLanguageViewController.mm */,
F6C641AE1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.h */,
F6C641AF1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm */,
97508421199522D300A7457D /* SettingsAndMoreVC.h */,
97508422199522D300A7457D /* SettingsAndMoreVC.mm */,
978D4A231996B0EC00D72CA7 /* CommunityVC.h */,
@ -3467,6 +3473,7 @@
34B16C451B72655D000D3A0D /* MWMPedestrianShareAlert.mm in Sources */,
347BAC6E1B736BA70010FF78 /* MWMSharePedestrianRoutesToastActivityItem.mm in Sources */,
34B82AD61B84746E00180497 /* MWMSearchSuggestionCell.mm in Sources */,
F6C641B01C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm in Sources */,
F6588E2F1B15D2BC00EE1E58 /* MWMBookmarkColorViewController.mm in Sources */,
349A358E1B53EABC009677EE /* MWMSearchDownloadMapRequestView.mm in Sources */,
A32B6D4D1A14980500E54A65 /* iosOGLContextFactory.mm in Sources */,
@ -3618,6 +3625,7 @@
6741A9DC1BF340DE002C974C /* MWMRoutePointLayout.mm in Sources */,
6741A9DD1BF340DE002C974C /* CountryTreeVC.mm in Sources */,
6741A9DE1BF340DE002C974C /* BadgeView.mm in Sources */,
F6F6ACFC1C15C1010060FDD0 /* MWMRecentTrackSettingsController.mm in Sources */,
6741A9DF1BF340DE002C974C /* MWMSearchHistoryClearCell.mm in Sources */,
6741A9E01BF340DE002C974C /* MWMDownloaderDialogHeader.mm in Sources */,
6741A9E11BF340DE002C974C /* MWMSearchTableView.mm in Sources */,

View file

@ -146,7 +146,6 @@
</tableViewCellContentView>
<connections>
<outlet property="titleLabel" destination="8jb-wX-P4h" id="swZ-rt-c36"/>
<segue destination="XDU-iY-yV9" kind="custom" customClass="MWMSegue" id="6P4-k0-wZ3"/>
</connections>
</tableViewCell>
</prototypes>
@ -158,11 +157,216 @@
</tableView>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<connections>
<segue destination="XDU-iY-yV9" kind="custom" identifier="SettingsToTTSSegue" customClass="MWMSegue" id="3NT-hq-Oex"/>
<segue destination="NP0-s9-34g" kind="custom" identifier="SettingsToRecentTrackSegue" customClass="MWMSegue" id="Fny-RS-ueu"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="I90-hv-hTP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1143" y="-338"/>
</scene>
<!--Recent Track Settings Controller-->
<scene sceneID="YrW-fi-4QL">
<objects>
<tableViewController id="NP0-s9-34g" customClass="MWMRecentTrackSettingsController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="Ai6-eS-WuL">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection id="0dw-og-Sit">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SelectableCell" id="HL5-jQ-yNK" customClass="SelectableCell">
<rect key="frame" x="0.0" y="35" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="HL5-jQ-yNK" id="DYw-KH-oDU">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="None" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2i3-c9-tdU">
<rect key="frame" x="16" y="11" width="477" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="2i3-c9-tdU" secondAttribute="bottom" constant="3.5" id="15b-Ci-PLU"/>
<constraint firstItem="2i3-c9-tdU" firstAttribute="leading" secondItem="DYw-KH-oDU" secondAttribute="leadingMargin" constant="8" id="ACL-4X-KDJ"/>
<constraint firstAttribute="trailingMargin" secondItem="2i3-c9-tdU" secondAttribute="trailing" constant="99" id="MeP-W4-fXQ"/>
<constraint firstItem="2i3-c9-tdU" firstAttribute="top" secondItem="DYw-KH-oDU" secondAttribute="topMargin" constant="3" id="NN8-hB-oG8"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="titleLabel" destination="2i3-c9-tdU" id="enq-hG-Uv3"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SelectableCell" id="8Cq-dm-roX" customClass="SelectableCell">
<rect key="frame" x="0.0" y="79" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8Cq-dm-roX" id="62b-vT-xng">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1 hour" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J1O-iW-GF3">
<rect key="frame" x="16" y="11" width="477" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="J1O-iW-GF3" secondAttribute="bottom" constant="3.5" id="O3s-Ln-bmV"/>
<constraint firstAttribute="trailingMargin" secondItem="J1O-iW-GF3" secondAttribute="trailing" constant="99" id="c3w-aI-7Se"/>
<constraint firstItem="J1O-iW-GF3" firstAttribute="leading" secondItem="62b-vT-xng" secondAttribute="leadingMargin" constant="8" id="cDB-yp-TEw"/>
<constraint firstItem="J1O-iW-GF3" firstAttribute="top" secondItem="62b-vT-xng" secondAttribute="topMargin" constant="3" id="l65-YD-2Ix"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="titleLabel" destination="J1O-iW-GF3" id="aMM-LR-032"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SelectableCell" id="DIL-q2-mUp" customClass="SelectableCell">
<rect key="frame" x="0.0" y="123" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DIL-q2-mUp" id="IqW-Xu-xVP">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2 hours" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="55i-C3-b9S">
<rect key="frame" x="16" y="11" width="477" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="55i-C3-b9S" secondAttribute="trailing" constant="99" id="a80-KJ-Rds"/>
<constraint firstItem="55i-C3-b9S" firstAttribute="leading" secondItem="IqW-Xu-xVP" secondAttribute="leadingMargin" constant="8" id="aqW-v2-APZ"/>
<constraint firstItem="55i-C3-b9S" firstAttribute="top" secondItem="IqW-Xu-xVP" secondAttribute="topMargin" constant="3" id="kQk-6L-0ta"/>
<constraint firstAttribute="bottomMargin" secondItem="55i-C3-b9S" secondAttribute="bottom" constant="3.5" id="qwE-hz-7Kj"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="titleLabel" destination="55i-C3-b9S" id="BqS-iD-fzu"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SelectableCell" id="1Mm-WA-eyt" customClass="SelectableCell">
<rect key="frame" x="0.0" y="167" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1Mm-WA-eyt" id="lNb-wL-PFo">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="6 hours" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QrP-xT-fcM">
<rect key="frame" x="16" y="11" width="477" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="QrP-xT-fcM" secondAttribute="trailing" constant="99" id="LGl-zl-LbM"/>
<constraint firstItem="QrP-xT-fcM" firstAttribute="top" secondItem="lNb-wL-PFo" secondAttribute="topMargin" constant="3" id="i7j-o0-evj"/>
<constraint firstItem="QrP-xT-fcM" firstAttribute="leading" secondItem="lNb-wL-PFo" secondAttribute="leadingMargin" constant="8" id="izB-1C-ti2"/>
<constraint firstAttribute="bottomMargin" secondItem="QrP-xT-fcM" secondAttribute="bottom" constant="3.5" id="rFT-cJ-n4M"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="titleLabel" destination="QrP-xT-fcM" id="UYW-6c-FWG"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SelectableCell" id="JLY-Qt-y88" customClass="SelectableCell">
<rect key="frame" x="0.0" y="211" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="JLY-Qt-y88" id="jPr-Kt-mLi">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12 hours" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HyC-if-zpD">
<rect key="frame" x="16" y="11" width="477" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstItem="HyC-if-zpD" firstAttribute="top" secondItem="jPr-Kt-mLi" secondAttribute="topMargin" constant="3" id="8Ew-4b-PdU"/>
<constraint firstAttribute="bottomMargin" secondItem="HyC-if-zpD" secondAttribute="bottom" constant="3.5" id="ICD-kw-Pge"/>
<constraint firstItem="HyC-if-zpD" firstAttribute="leading" secondItem="jPr-Kt-mLi" secondAttribute="leadingMargin" constant="8" id="Y2y-Fz-Msv"/>
<constraint firstAttribute="trailingMargin" secondItem="HyC-if-zpD" secondAttribute="trailing" constant="99" id="mah-ig-QAM"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="titleLabel" destination="HyC-if-zpD" id="BMT-M4-hk7"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SelectableCell" id="mbv-1J-wSI" customClass="SelectableCell">
<rect key="frame" x="0.0" y="255" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mbv-1J-wSI" id="oPS-HW-hfW">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1 day" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uhN-0k-BL7">
<rect key="frame" x="16" y="11" width="477" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstItem="uhN-0k-BL7" firstAttribute="leading" secondItem="oPS-HW-hfW" secondAttribute="leadingMargin" constant="8" id="6nm-GE-v4t"/>
<constraint firstAttribute="trailingMargin" secondItem="uhN-0k-BL7" secondAttribute="trailing" constant="99" id="ALP-yD-Gwx"/>
<constraint firstItem="uhN-0k-BL7" firstAttribute="top" secondItem="oPS-HW-hfW" secondAttribute="topMargin" constant="3" id="UE6-bN-KTl"/>
<constraint firstAttribute="bottomMargin" secondItem="uhN-0k-BL7" secondAttribute="bottom" constant="3.5" id="nz1-ZZ-q4U"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="titleLabel" destination="uhN-0k-BL7" id="9Mv-uo-A5S"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="NP0-s9-34g" id="0gf-2t-NTT"/>
<outlet property="delegate" destination="NP0-s9-34g" id="Mi0-Y0-Tt2"/>
</connections>
</tableView>
<connections>
<outlet property="none" destination="HL5-jQ-yNK" id="uen-cX-Fx0"/>
<outlet property="oneDay" destination="mbv-1J-wSI" id="COD-tw-8gd"/>
<outlet property="oneHour" destination="8Cq-dm-roX" id="th5-s5-8wh"/>
<outlet property="sixHours" destination="1Mm-WA-eyt" id="lsg-lo-4YV"/>
<outlet property="twelveHours" destination="JLY-Qt-y88" id="uvV-xr-gOM"/>
<outlet property="twoHours" destination="DIL-q2-mUp" id="GBk-7j-k2T"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6Yt-k4-tuz" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1881" y="-1002"/>
</scene>
<!--Settings View Controller-->
<scene sceneID="9aS-r5-1zA">
<objects>

View file

@ -24,7 +24,7 @@ extern NSString * const kTTSStatusWasChangedNotification = @"TTFStatusWasChanged
typedef NS_ENUM(NSUInteger, Section)
{
SectionMetrics,
SectionZoomButtons,
SectionMap,
SectionRouting,
SectionCalibration,
SectionAd,
@ -49,19 +49,9 @@ typedef NS_ENUM(NSUInteger, Section)
bool adServerForbidden = false;
(void)Settings::Get(kAdServerForbiddenKey, adServerForbidden);
if (isIOSVersionLessThan(8) || adServerForbidden)
sections = {SectionMetrics, SectionZoomButtons, SectionRouting, SectionCalibration, SectionStatistics};
sections = {SectionMetrics, SectionMap, SectionRouting, SectionCalibration, SectionStatistics};
else
sections = {SectionMetrics, SectionZoomButtons, SectionRouting, SectionCalibration, SectionAd, SectionStatistics};
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
sections = {SectionMetrics, SectionMap, SectionRouting, SectionCalibration, SectionAd, SectionStatistics};
}
#pragma mark - Table view data source
@ -73,28 +63,36 @@ typedef NS_ENUM(NSUInteger, Section)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (sections[section] == SectionMetrics || sections[section] == SectionRouting)
switch (sections[section])
{
case SectionMetrics:
case SectionRouting:
return 2;
else
case SectionMap:
case SectionAd:
case SectionStatistics:
case SectionCalibration:
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = nil;
Section section = sections[indexPath.section];
if (section == SectionMetrics)
switch (sections[indexPath.section])
{
case SectionMetrics:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SelectableCell className]];
Settings::Units units = Settings::Metric;
(void)Settings::Get("Units", units);
BOOL selected = units == unitsForIndex(indexPath.row);
BOOL const selected = units == unitsForIndex(indexPath.row);
SelectableCell * customCell = (SelectableCell *)cell;
customCell.accessoryType = selected ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
customCell.titleLabel.text = indexPath.row == 0 ? L(@"kilometres") : L(@"miles");
break;
}
else if (section == SectionAd)
case SectionAd:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
@ -103,8 +101,9 @@ typedef NS_ENUM(NSUInteger, Section)
customCell.switchButton.on = !forbidden;
customCell.titleLabel.text = L(@"showcase_settings_title");
customCell.delegate = self;
break;
}
else if (section == SectionStatistics)
case SectionStatistics:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
@ -113,28 +112,29 @@ typedef NS_ENUM(NSUInteger, Section)
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"allow_statistics");
customCell.delegate = self;
break;
}
else if (section == SectionZoomButtons)
case SectionMap:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool on = true;
(void)Settings::Get("ZoomButtonsEnabled", on);
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"pref_zoom_title");
customCell.delegate = self;
// if (indexPath.row == 0)
// {
// cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
// LinkCell * linkCell = static_cast<LinkCell *>(cell);
// linkCell.titleLabel.text = L(@"recent_track");
// }
// else
// {
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool on = true;
(void)Settings::Get("ZoomButtonsEnabled", on);
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"pref_zoom_title");
customCell.delegate = self;
// }
break;
}
else if (section == SectionCalibration)
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool on = false;
(void)Settings::Get("CompassCalibrationEnabled", on);
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"pref_calibration_title");
customCell.delegate = self;
}
else if (section == SectionRouting)
case SectionRouting:
{
if (indexPath.row == 0)
{
@ -150,6 +150,19 @@ typedef NS_ENUM(NSUInteger, Section)
LinkCell * customCell = (LinkCell *)cell;
customCell.titleLabel.text = L(@"pref_tts_language_title");
}
break;
}
case SectionCalibration:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool on = false;
(void)Settings::Get("CompassCalibrationEnabled", on);
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"pref_calibration_title");
customCell.delegate = self;
break;
}
}
return cell;
}
@ -158,8 +171,6 @@ typedef NS_ENUM(NSUInteger, Section)
{
if (section == SectionStatistics)
return L(@"allow_statistics_hint");
else if (section == SectionZoomButtons)
return L(@"pref_zoom_summary");
return nil;
}
@ -167,44 +178,46 @@ typedef NS_ENUM(NSUInteger, Section)
{
NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];
Statistics * stat = [Statistics instance];
Section section = sections[indexPath.section];
if (section == SectionAd)
switch (sections[indexPath.section])
{
case SectionAd:
[stat logEvent:kStatSettings
withParameters:@{kStatAction : kStatMoreApps, kStatValue : (value ? kStatOn : kStatOff)}];
withParameters:@{kStatAction : kStatMoreApps, kStatValue : (value ? kStatOn : kStatOff)}];
Settings::Set(kAdForbiddenSettingsKey, (bool)!value);
}
else if (section == SectionStatistics)
{
break;
case SectionStatistics:
[stat logEvent:kStatEventName(kStatSettings, kStatToggleStatistics)
withParameters:
@{kStatAction : kStatToggleStatistics, kStatValue : (value ? kStatOn : kStatOff)}];
withParameters: @{kStatAction : kStatToggleStatistics, kStatValue : (value ? kStatOn : kStatOff)}];
if (value)
[stat enableOnNextAppLaunch];
else
[stat disableOnNextAppLaunch];
}
else if (section == SectionZoomButtons)
{
break;
case SectionMap:
[stat logEvent:kStatEventName(kStatSettings, kStatToggleZoomButtonsVisibility)
withParameters:@{kStatValue : (value ? kStatVisible : kStatHidden)}];
Settings::Set("ZoomButtonsEnabled", (bool)value);
[MapsAppDelegate theApp].mapViewController.controlsManager.zoomHidden = !value;
}
else if (section == SectionCalibration)
{
break;
case SectionCalibration:
[stat logEvent:kStatEventName(kStatSettings, kStatToggleCompassCalibration)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
Settings::Set("CompassCalibrationEnabled", (bool)value);
}
else if (section == SectionRouting)
{
break;
case SectionRouting:
[[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatValue : value ? kStatOn : kStatOff}];
[[MWMTextToSpeech tts] setNeedToEnable:value];
[[NSNotificationCenter defaultCenter] postNotificationName:kTTSStatusWasChangedNotification
object:nil
userInfo:@{@"on" : @(value)}];
object:nil userInfo:@{@"on" : @(value)}];
break;
case SectionMetrics:
break;
}
}
@ -215,8 +228,9 @@ Settings::Units unitsForIndex(NSInteger index)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Section section = sections[indexPath.section];
if (section == SectionMetrics)
switch (sections[indexPath.section])
{
case SectionMetrics:
{
Settings::Units units = unitsForIndex(indexPath.row);
[[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatChangeMeasureUnits)
@ -224,22 +238,43 @@ Settings::Units unitsForIndex(NSInteger index)
Settings::Set("Units", units);
[tableView reloadSections:[NSIndexSet indexSetWithIndex:SectionMetrics] withRowAnimation:UITableViewRowAnimationFade];
GetFramework().SetupMeasurementSystem();
break;
}
else if (section == SectionRouting && indexPath.row == 1)
{
[[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS)
case SectionRouting:
if (indexPath.row == 1)
{
[[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatAction : kStatChangeLanguage}];
[self performSegueWithIdentifier:@"SettingsToTTSSegue" sender:nil];
}
break;
case SectionMap:
// if (indexPath.row == 0)
// [self performSegueWithIdentifier:@"SettingsToRecentTrackSegue" sender:nil];
// break;
case SectionAd:
case SectionCalibration:
case SectionStatistics:
break;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (section == SectionMetrics)
switch (sections[section])
{
case SectionMetrics:
return L(@"measurement_units");
else if (section == SectionRouting)
case SectionRouting:
return L(@"prefs_group_route");
else
case SectionMap:
return L(@"prefs_group_map");
case SectionCalibration:
case SectionAd:
case SectionStatistics:
return nil;
}
}
@end