Merge pull request #1414 from VladiMihaylenko/vm-master

[ios] Night mode's fixes.
This commit is contained in:
igrechuhin 2016-01-15 17:48:52 +03:00
commit 7967740412
55 changed files with 218 additions and 162 deletions

View file

@ -3,6 +3,7 @@
#import "Common.h"
#import "MapCell.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
extern NSString * const MapsStatusChangedNotification;
@ -191,6 +192,7 @@ extern NSString * const MapsStatusChangedNotification;
UILabel * label = [[UILabel alloc] initWithFrame:view.bounds];
label.font = [UIFont fontWithName:@"HelveticaNeue" size:13];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor blackPrimaryText];
if (group == ActiveMapsLayout::TGroup::EOutOfDate)
label.text = L(@"downloader_outdated_maps").uppercaseString;

View file

@ -27,16 +27,6 @@ static inline CGFloat LengthCGPoint(CGPoint point)
@end
@interface UIColor (HexColor)
+ (UIColor *)colorWithColorCode:(NSString *)colorCode;
+ (UIColor *)applicationBackgroundColor;
+ (UIColor *)applicationColor;
+ (UIColor *)navigationBarColor;
@end
@interface UIView (Coordinates)
@property (nonatomic) CGFloat minX;

View file

@ -20,43 +20,6 @@
@end
@implementation UIColor (HexColor)
+ (UIColor *)colorWithColorCode:(NSString *)hexString
{
NSString * cleanString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""];
if (cleanString.length == 6)
cleanString = [cleanString stringByAppendingString:@"ff"];
unsigned int baseValue;
[[NSScanner scannerWithString:cleanString] scanHexInt:&baseValue];
float red = ((baseValue >> 24) & 0xFF) / 255.f;
float green = ((baseValue >> 16) & 0xFF) / 255.f;
float blue = ((baseValue >> 8) & 0xFF) / 255.f;
float alpha = ((baseValue >> 0) & 0xFF) / 255.f;
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}
+ (UIColor *)applicationBackgroundColor
{
return [UIColor colorWithColorCode:@"efeff4"];
}
+ (UIColor *)applicationColor
{
return [UIColor colorWithColorCode:@"15c783"];
}
+ (UIColor *)navigationBarColor
{
return [UIColor colorWithColorCode:@"1F9952"];
}
@end
@implementation UIView (Coordinates)
- (void)setMidX:(CGFloat)midX

View file

@ -365,7 +365,7 @@ static NSString * const kStatisticsEvent = @"Map download Alert";
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView * view = [[UIView alloc] init];
view.backgroundColor = self.missedFiles.count == 2 && section == 0 ? UIColor.blackDividers : [UIColor colorWithWhite:0. alpha:0.06];
view.backgroundColor = self.missedFiles.count == 2 && section == 0 ? UIColor.blackDividers : UIColor.blackOpaque;
return view;
}

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="2048" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<customFonts key="customFonts">
<mutableArray key="HelveticaNeue.ttc">
@ -22,7 +22,6 @@
<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"/>
<animations/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="29" id="018-Nz-384"/>
<constraint firstAttribute="width" constant="240" id="cHd-lJ-pXe"/>
@ -33,11 +32,11 @@
<size key="shadowOffset" width="0.0" height="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="routing_download_maps_along"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q3X-9G-3PT">
<rect key="frame" x="23" y="61" width="234" height="17"/>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="234" id="YLG-PG-WHS"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="17" id="iOI-5t-pEY"/>
@ -47,11 +46,11 @@
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="routing_requires_all_map"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="1000" alwaysBounceVertical="YES" scrollEnabled="NO" style="grouped" separatorStyle="none" rowHeight="32" sectionHeaderHeight="44" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="1lL-cj-2oS">
<rect key="frame" x="0.0" y="98" width="280" height="88"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="88" id="92H-Th-Xgt"/>
@ -66,16 +65,17 @@
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2nQ-k3-Rx3" userLabel="hDivider">
<rect key="frame" x="0.0" y="186" width="280" height="1"/>
<animations/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="YGc-0s-8yD"/>
<constraint firstAttribute="height" constant="1" id="l1s-jg-dng"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackDividers"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q87-qQ-0rn">
<rect key="frame" x="140" y="186" width="140" height="44"/>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="140" id="1Io-1t-Odn"/>
<constraint firstAttribute="height" constant="44" id="CeP-fJ-qZs"/>
@ -88,7 +88,7 @@
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="download"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="buttonEnabledBlueText"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="linkBlue"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="downloadButtonTap:" destination="jqI-GQ-yDh" eventType="touchUpInside" id="L2t-kQ-AzL"/>
@ -96,7 +96,6 @@
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dhS-fg-rNl">
<rect key="frame" x="0.0" y="186" width="140" height="44"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="44" id="7gw-Uu-UEK"/>
<constraint firstAttribute="width" constant="140" id="EMA-LM-Zje"/>
@ -109,7 +108,7 @@
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="later"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="buttonEnabledBlueText"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="linkBlue"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="notNowButtonTap:" destination="jqI-GQ-yDh" eventType="touchUpInside" id="6pb-Gg-9sN"/>
@ -117,15 +116,16 @@
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jjh-VP-emP" userLabel="vDivider">
<rect key="frame" x="139" y="186" width="1" height="44"/>
<animations/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="8kQ-Yd-0D3"/>
<constraint firstAttribute="height" constant="44" id="vYd-td-NOl"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackDividers"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="0.88" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="dhS-fg-rNl" firstAttribute="top" secondItem="1lL-cj-2oS" secondAttribute="bottom" id="2aT-au-ilL"/>
@ -164,7 +164,6 @@
</userDefinedRuntimeAttributes>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="Hay-Qx-kVw" secondAttribute="centerY" id="5Z9-NF-BEW"/>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@ -16,16 +16,17 @@
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1B4-T1-g4X">
<rect key="frame" x="20" y="8" width="240" height="17"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="17" id="u5A-6l-INO"/>
</constraints>
<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="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<animations/>
<color key="backgroundColor" red="0.90196078431372551" green="0.90196078431372551" blue="0.90196078431372551" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="1B4-T1-g4X" secondAttribute="centerX" id="2AW-qe-sgg"/>
@ -33,9 +34,14 @@
<constraint firstAttribute="trailing" secondItem="1B4-T1-g4X" secondAttribute="trailing" constant="20" id="ruG-JF-m2y"/>
<constraint firstItem="1B4-T1-g4X" firstAttribute="leading" secondItem="gf8-bS-tvq" secondAttribute="leading" constant="20" id="sZo-pt-LJL"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="pressBackground"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<animations/>
<color key="backgroundColor" red="0.90196078431372551" green="0.90196078431372551" blue="0.90196078431372551" alpha="1" colorSpace="calibratedRGB"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="pressBackground"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="titleLabel" destination="1B4-T1-g4X" id="m4n-H9-1Ta"/>
</connections>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@ -13,7 +13,6 @@
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hh9-2l-gu2">
<rect key="frame" x="20" y="14" width="160" height="16"/>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="160" id="4WE-p5-RdF"/>
<constraint firstAttribute="height" constant="16" id="FQE-Zk-gXr"/>
@ -21,10 +20,12 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_iexpand_more" translatesAutoresizingMaskIntoConstraints="NO" id="eqn-NQ-zOk">
<rect key="frame" x="254" y="19" width="12" height="8"/>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="12" id="CkX-aX-oaf"/>
<constraint firstAttribute="height" constant="8" id="mLX-ow-5er"/>
@ -32,15 +33,16 @@
</imageView>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tqG-fM-g6J">
<rect key="frame" x="0.0" y="43" width="280" height="1"/>
<animations/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Vc3-uM-vHv"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackDividers"/>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="size" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m8f-ps-pFV">
<rect key="frame" x="180" y="14" width="64" height="16"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="16" id="7Hg-8z-e56"/>
<constraint firstAttribute="width" constant="64" id="hct-Jz-zGl"/>
@ -48,10 +50,12 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eIt-Yb-1Yl">
<rect key="frame" x="0.0" y="0.0" width="280" height="44"/>
<animations/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
@ -61,7 +65,6 @@
</connections>
</button>
</subviews>
<animations/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.059999999999999998" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="eIt-Yb-1Yl" secondAttribute="bottom" id="61x-d3-FtO"/>
@ -79,6 +82,9 @@
<constraint firstItem="tqG-fM-g6J" firstAttribute="top" secondItem="m8f-ps-pFV" secondAttribute="bottom" constant="13" id="v0U-Qb-rW1"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackOpaque"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="dividerView" destination="tqG-fM-g6J" id="eOr-3y-kbn"/>
<outlet property="expandImage" destination="eqn-NQ-zOk" id="fGc-MN-ss7"/>

View file

@ -60,12 +60,17 @@ static inline CGFloat angleWithProgress(CGFloat progress)
[self setColor:clearColor forState:MWMCircularProgressStateCompleted];
}
- (void)refresh
{
[self setupColors];
}
- (void)setupAnimationLayers
{
self.backgroundLayer = [CAShapeLayer layer];
self.progressLayer = [CAShapeLayer layer];
[self refresh];
[self refreshProgress];
[self.layer addSublayer:self.backgroundLayer];
[self.layer addSublayer:self.progressLayer];
}
@ -73,18 +78,18 @@ static inline CGFloat angleWithProgress(CGFloat progress)
- (void)setImage:(nonnull UIImage *)image forState:(MWMCircularProgressState)state
{
self.images[@(state)] = image;
[self refresh];
[self refreshProgress];
}
- (void)setColor:(nonnull UIColor *)color forState:(MWMCircularProgressState)state
{
self.colors[@(state)] = color;
[self refresh];
[self refreshProgress];
}
#pragma mark - Progress
- (void)refresh
- (void)refreshProgress
{
self.backgroundLayer.fillColor = self.progressLayer.fillColor = UIColor.clearColor.CGColor;
self.backgroundLayer.lineWidth = self.progressLayer.lineWidth = kLineWidth;
@ -193,7 +198,7 @@ static inline CGFloat angleWithProgress(CGFloat progress)
if (_state == state)
return;
_state = state;
[self refresh];
[self refreshProgress];
}
- (CGColorRef)backgroundColor
@ -215,10 +220,10 @@ static inline CGFloat angleWithProgress(CGFloat progress)
- (void)setFrame:(CGRect)frame
{
BOOL const needRefresh = !CGRectEqualToRect(self.frame, frame);
BOOL const needrefreshProgress = !CGRectEqualToRect(self.frame, frame);
super.frame = frame;
if (needRefresh)
[self refresh];
if (needrefreshProgress)
[self refreshProgress];
}
- (BOOL)animating

View file

@ -463,8 +463,14 @@ extern NSString * const kAlohalyticsTapEventKey;
GetFramework().FollowRoute();
self.disableStandbyOnRouteFollowing = YES;
[self.menuController setStreetName:@""];
MapsAppDelegate.theApp.routingPlaneMode = MWMRoutingPlaneModeNone;
MapsAppDelegate * app = MapsAppDelegate.theApp;
app.routingPlaneMode = MWMRoutingPlaneModeNone;
[RouteState save];
if ([MapsAppDelegate isAutoNightMode])
{
[MapsAppDelegate changeMapStyleIfNedeed];
[app startMapStyleChecker];
}
return YES;
}
@ -473,13 +479,14 @@ extern NSString * const kAlohalyticsTapEventKey;
[[Statistics instance] logEvent:kStatEventName(kStatPointToPoint, kStatClose)];
[[MapsAppDelegate theApp].m_locationManager stop:self.navigationManager];
self.navigationManager.state = MWMNavigationDashboardStateHidden;
GetFramework().CloseRouting();
self.disableStandbyOnRouteFollowing = NO;
[MapsAppDelegate theApp].routingPlaneMode = MWMRoutingPlaneModeNone;
[RouteState remove];
[self.menuController setInactive];
[self resetRoutingPoint];
[self navigationDashBoardDidUpdate];
[MapsAppDelegate resetToDefaultMapStyle];
GetFramework().CloseRouting();
}
- (void)swapPointsAndRebuildRouteIfPossible

View file

@ -18,7 +18,7 @@
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="oZD-Er-6fn">
<rect key="frame" x="0.0" y="0.0" width="320" height="460"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<inset key="separatorInset" minX="15" minY="0.0" maxX="0.0" maxY="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>

View file

@ -375,7 +375,8 @@ extern NSString * const kTTSStatusWasChangedNotification;
- (void)refresh
{
[self.navigationDashboard refresh];
[self.navigationDashboardLandscape refresh];
[self.navigationDashboardPortrait refresh];
[self.routePreview refresh];
}

View file

@ -162,7 +162,7 @@
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="ic_direction" translatesAutoresizingMaskIntoConstraints="NO" id="ZNA-Yu-OG7" customClass="MWMImageView">
<rect key="frame" x="0.0" y="10" width="64" height="64"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMBlack"/>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMBlue"/>
</userDefinedRuntimeAttributes>
</imageView>
</subviews>

View file

@ -28,7 +28,7 @@
if (IPAD)
self.statusbarBackground = nil;
[self.progress setThumbImage:[UIImage imageNamed:@"progress_circle_light"] forState:UIControlStateNormal];
[self.progress setMaximumTrackTintColor:[UIColor colorWithWhite:0. alpha:0.08]];
[self.progress setMaximumTrackTintColor:[UIColor blackOpaque]];
[self.progress setMinimumTrackTintColor:[UIColor blackSecondaryText]];
CALayer * l = self.layer;
l.shouldRasterize = YES;

View file

@ -241,6 +241,6 @@
<image name="ic_nav_bar_close" width="44" height="44"/>
<image name="ic_voice_off" width="28" height="28"/>
<image name="ic_voice_on" width="28" height="28"/>
<image name="slight_left" width="96" height="96"/>
<image name="slight_left" width="64" height="64"/>
</resources>
</document>

View file

@ -146,6 +146,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
- (void)refresh
{
[self.placePage.extendedPlacePageView refresh];
[self.placePage.actionBar refresh];
}
- (void)setPlacePageForiPad

View file

@ -2,6 +2,7 @@
#import "MapCell.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIImageView+Coloring.h"
@interface MapCell () <ProgressViewDelegate>
@ -46,9 +47,9 @@
self.progressView.failedMode = NO;
if (options == MapOptions::Map)
self.routingImageView.image = [UIImage imageNamed:@"DownloadRoutingButton"];
self.routingImageView.mwm_name = @"ic_routing_get";
else
self.routingImageView.image = [UIImage imageNamed:@"RoutingDownloadedButton"];
self.routingImageView.mwm_name = @"ic_routing_ok";
switch (status)
{
@ -59,13 +60,13 @@
else
self.statusLabel.text = L(@"downloader_status_outdated").uppercaseString;
self.statusLabel.textColor = [UIColor colorWithColorCode:@"179E4D"];
self.statusLabel.textColor = [UIColor linkBlue];
[self setProgressMode:NO withAnimatedLayout:animated];
break;
case TStatus::EInQueue:
case TStatus::EDownloading:
self.statusLabel.textColor = [UIColor colorWithColorCode:@"999999"];
self.statusLabel.textColor = [UIColor blackHintText];
[self setDownloadProgress:self.downloadProgress animated:animated];
if (status == TStatus::EInQueue)
self.statusLabel.text = L(@"downloader_queued").uppercaseString;
@ -74,7 +75,7 @@
case TStatus::EOnDisk:
{
self.statusLabel.text = L(@"downloader_downloaded").uppercaseString;
self.statusLabel.textColor = [UIColor colorWithColorCode:@"999999"];
self.statusLabel.textColor = [UIColor blackHintText];
if (animated)
{
[self alignSubviews];
@ -93,7 +94,7 @@
case TStatus::EDownloadFailed:
self.progressView.failedMode = YES;
self.statusLabel.text = L(@"downloader_retry").uppercaseString;
self.statusLabel.textColor = [UIColor colorWithColorCode:@"FF4436"];
self.statusLabel.textColor = [UIColor red];
[self setProgressMode:YES withAnimatedLayout:animated];
break;
@ -156,7 +157,7 @@
CGFloat const sizeLabelMinY = self.statusLabel.maxY;
self.sizeLabel.frame = CGRectMake(self.contentView.width - [self rightOffset] - self.sizeLabel.width, sizeLabelMinY, self.sizeLabel.width, 16);
self.sizeLabel.textColor = [UIColor colorWithColorCode:@"999999"];
self.sizeLabel.textColor = [UIColor blackHintText];
self.sizeLabel.hidden = self.parentMode;
CGFloat const rightLabelsMaxWidth = self.parentMode ? 10 : MAX(self.statusLabel.width, self.sizeLabel.width);
@ -270,7 +271,7 @@
{
_titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = [UIColor blackColor];
_titleLabel.textColor = [UIColor blackPrimaryText];
_titleLabel.font = [UIFont regular17];
}
return _titleLabel;
@ -315,7 +316,10 @@
- (UIImageView *)routingImageView
{
if (!_routingImageView)
_routingImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"DownloadRoutingButton"]];
{
_routingImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_routing_get_light"]];
_routingImageView.mwm_name = @"ic_routing_get";
}
return _routingImageView;
}

View file

@ -36,7 +36,6 @@
extern NSString * const kAlohalyticsTapEventKey = @"$onClick";
extern NSString * const kUDWhatsNewWasShown = @"WhatsNewWith3dAndPerspectiveWasShown";
extern NSString * const kUDAutoNightMode;
extern char const * kAdForbiddenSettingsKey;
extern char const * kAdServerForbiddenKey;
@ -143,12 +142,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
[self showPopover];
[self updateRoutingInfo];
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:kUDAutoNightMode])
[MapsAppDelegate.theApp changeMapStyleIfNedeed];
});
if (self.forceRoutingStateChange == ForceRoutingStateChangeRestoreRoute)
[self restoreRoute];
}
@ -423,6 +416,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
- (void)refresh
{
// [super refresh];
[MapsAppDelegate customizeAppearance];
[self.controlsManager refresh];
}

View file

@ -39,9 +39,12 @@ typedef NS_ENUM(NSUInteger, MWMRoutingPlaneMode)
- (void)enableDownloadIndicator;
- (void)showMap;
- (void)changeMapStyleIfNedeed;
- (void)startMapStyleChecker;
- (void)stopMapStyleChecker;
+ (void)setAutoNightModeOn:(BOOL)on;
+ (BOOL)isAutoNightMode;
+ (void)resetToDefaultMapStyle;
+ (void)changeMapStyleIfNedeed;
- (void)setMapStyle:(MapStyle)mapStyle;

View file

@ -249,37 +249,62 @@ void InitLocalizedStrings()
- (void)determineMapStyle
{
[UIColor setNightMode:GetFramework().GetMapStyle() == MapStyleDark];
if ([[NSUserDefaults standardUserDefaults] boolForKey:kUDAutoNightMode])
GetFramework().SetMapStyle(MapStyleClear);
[UIColor setNightMode:NO];
if ([MapsAppDelegate isAutoNightMode])
[self startMapStyleChecker];
}
+ (void)setAutoNightModeOn:(BOOL)on
{
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
[ud setBool:on forKey:kUDAutoNightMode];
[ud synchronize];
}
+ (BOOL)isAutoNightMode
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kUDAutoNightMode];
}
- (void)startMapStyleChecker
{
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
[ud setBool:YES forKey:kUDAutoNightMode];
[ud synchronize];
self.mapStyleSwitchTimer = [NSTimer scheduledTimerWithTimeInterval:(30 * 60 * 60) target:self selector:@selector(changeMapStyleIfNedeed) userInfo:nil repeats:YES];
NSAssert([MapsAppDelegate isAutoNightMode], @"Invalid auto switcher's state");
self.mapStyleSwitchTimer = [NSTimer scheduledTimerWithTimeInterval:(1 * 60) target:[MapsAppDelegate class]
selector:@selector(changeMapStyleIfNedeed) userInfo:nil
repeats:YES];
}
- (void)stopMapStyleChecker
{
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
[ud setBool:NO forKey:kUDAutoNightMode];
[ud synchronize];
[self.mapStyleSwitchTimer invalidate];
}
- (void)changeMapStyleIfNedeed
+ (void)resetToDefaultMapStyle
{
CLLocation * l = self.m_locationManager.lastLocation;
if (!l)
MapsAppDelegate * app = MapsAppDelegate.theApp;
auto & f = GetFramework();
auto style = f.GetMapStyle();
if (style == MapStyleClear || style == MapStyleLight)
return;
auto const dayTime = GetDayTime(static_cast<time_t>(NSDate.date.timeIntervalSince1970), l.coordinate.latitude, l.coordinate.longitude);
dispatch_async(dispatch_get_main_queue(), ^
f.SetMapStyle(MapStyleClear);
[UIColor setNightMode:NO];
[static_cast<ViewController *>(app.mapViewController.navigationController.topViewController) refresh];
[app stopMapStyleChecker];
}
+ (void)changeMapStyleIfNedeed
{
NSAssert([MapsAppDelegate isAutoNightMode], @"Invalid auto switcher's state");
auto & f = GetFramework();
MapsAppDelegate * app = MapsAppDelegate.theApp;
CLLocation * l = app.m_locationManager.lastLocation;
if (!l || !f.IsRoutingActive())
return;
dispatch_async(dispatch_get_main_queue(), [&f, l, self, app]
{
auto & f = GetFramework();
ViewController * vc = static_cast<ViewController *>(self.mapViewController.navigationController.topViewController);
auto const dayTime = GetDayTime(static_cast<time_t>(NSDate.date.timeIntervalSince1970), l.coordinate.latitude, l.coordinate.longitude);
ViewController * vc = static_cast<ViewController *>(app.mapViewController.navigationController.topViewController);
auto style = f.GetMapStyle();
switch (dayTime)
{

View file

@ -1,5 +1,5 @@
#import "ToastView.h"
#import "UIColor+MapsMeColor.h"
@interface ToastView ()
@ -17,7 +17,7 @@
CGSize textSize = [message sizeWithDrawSize:CGSizeMake(245 - 2 * xOffset, 1000) font:self.messageLabel.font];
self = [super initWithFrame:CGRectMake(0, 0, textSize.width + 2 * xOffset, textSize.height + 2 * yOffset)];
self.backgroundColor = [UIColor colorWithColorCode:@"f2f2f2"];
self.backgroundColor = [UIColor pressBackground];
self.layer.cornerRadius = 4;
self.layer.masksToBounds = NO;
self.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
@ -39,7 +39,7 @@
_messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
_messageLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:12.5];
_messageLabel.textAlignment = NSTextAlignmentCenter;
_messageLabel.textColor = [UIColor blackColor];
_messageLabel.textColor = [UIColor blackPrimaryText];
_messageLabel.numberOfLines = 0;
_messageLabel.lineBreakMode = NSLineBreakByWordWrapping;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 392 B

View file

@ -2,18 +2,18 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Badge.png"
"filename" : "Badge.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "Badge@2x.png"
"filename" : "Badge@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "Badge@3x.png"
"filename" : "Badge@3x.png",
"scale" : "3x"
}
],
"info" : {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -2,18 +2,18 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "ProgressTriangle.png"
"filename" : "ProgressTriangle.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "ProgressTriangle@2x.png"
"filename" : "ProgressTriangle@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "ProgressTriangle@3x.png"
"filename" : "ProgressTriangle@3x.png",
"scale" : "3x"
}
],
"info" : {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -2,18 +2,18 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "routing_ok_mdpi.png"
"filename" : "ic_routing_get_dark.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "routing_ok_xhdpi.png"
"filename" : "ic_routing_get_dark@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "routing_ok_xxhdpi.png"
"filename" : "ic_routing_get_dark@3x.png",
"scale" : "3x"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_routing_get_light.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_routing_get_light@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_routing_get_light@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

View file

@ -2,18 +2,18 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "routing_get_mdpi.png"
"filename" : "ic_routing_ok_dark.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "routing_get_xhdpi.png"
"filename" : "ic_routing_ok_dark@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "routing_get_xxhdpi.png"
"filename" : "ic_routing_ok_dark@3x.png",
"scale" : "3x"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_routing_ok_light.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_routing_ok_light@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_routing_ok_light@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -5,8 +5,6 @@
#include "Framework.h"
extern NSString * const kUDAutoNightMode;
@interface MWMNightModeController ()
@property (weak, nonatomic) IBOutlet SelectableCell * autoSwitch;
@ -22,7 +20,7 @@ extern NSString * const kUDAutoNightMode;
{
[super viewDidLoad];
self.title = L(@"pref_map_style_title");
if ([[NSUserDefaults standardUserDefaults] boolForKey:kUDAutoNightMode])
if ([MapsAppDelegate isAutoNightMode])
{
self.autoSwitch.accessoryType = UITableViewCellAccessoryCheckmark;
_selectedCell = self.autoSwitch;
@ -52,7 +50,6 @@ extern NSString * const kUDAutoNightMode;
_selectedCell = cell;
auto & f = GetFramework();
auto app = MapsAppDelegate.theApp;
auto const style = f.GetMapStyle();
if ([cell isEqual:self.on])
{
@ -60,7 +57,7 @@ extern NSString * const kUDAutoNightMode;
return;
f.SetMapStyle(MapStyleDark);
[UIColor setNightMode:YES];
[app stopMapStyleChecker];
[MapsAppDelegate setAutoNightModeOn:NO];
[self refresh];
}
else if ([cell isEqual:self.off])
@ -69,13 +66,13 @@ extern NSString * const kUDAutoNightMode;
return;
f.SetMapStyle(MapStyleClear);
[UIColor setNightMode:NO];
[app stopMapStyleChecker];
[MapsAppDelegate setAutoNightModeOn:NO];
[self refresh];
}
else if ([cell isEqual:self.autoSwitch])
{
[app startMapStyleChecker];
[app changeMapStyleIfNedeed];
[MapsAppDelegate setAutoNightModeOn:YES];
[MapsAppDelegate changeMapStyleIfNedeed];
}
}

View file

@ -15,7 +15,6 @@
- (void)refresh
{
[MapsAppDelegate customizeAppearance];
[self.navigationController.navigationBar refresh];
for (UIViewController * vc in self.navigationController.viewControllers.reverseObjectEnumerator)
{

View file

@ -24,6 +24,7 @@
+ (UIColor *)buttonDisabledBlueText;
+ (UIColor *)buttonHighlightedBlueText;
+ (UIColor *)alertBackground;
+ (UIColor *)blackOpaque;
+ (UIColor *)colorWithName:(NSString *)colorName;

View file

@ -3,6 +3,7 @@
namespace
{
CGFloat const alpha04 = 0.04;
CGFloat const alpha12 = 0.12;
CGFloat const alpha26 = 0.26;
CGFloat const alpha30 = 0.3;
@ -43,9 +44,10 @@ NSDictionary<NSString *, UIColor *> * night =
@"blackHintText" : [UIColor colorWithWhite:1. alpha:alpha30],
@"blackDividers" : [UIColor colorWithWhite:1. alpha:alpha12],
@"white" : [UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha100],
@"whiteSecondaryText" : [UIColor colorWithWhite:1. alpha:alpha70],
@"whiteSecondaryText" : [UIColor colorWithWhite:0. alpha:alpha70],
@"buttonDisabledBlueText" : [UIColor colorWithRed:scaled(255.) green:scaled(230.) blue:scaled(140.) alpha:alpha30],
@"alertBackground" : [UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha90]
@"alertBackground" : [UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha90],
@"blackOpaque" : [UIColor colorWithWhite:1. alpha:alpha04]
};
NSDictionary<NSString *, UIColor *> * day =
@ -72,7 +74,8 @@ NSDictionary<NSString *, UIColor *> * day =
@"white" : [UIColor colorWithWhite:1. alpha:alpha100],
@"whiteSecondaryText" : [UIColor colorWithWhite:1. alpha:alpha54],
@"buttonDisabledBlueText" :[UIColor colorWithRed:scaled(3.) green:scaled(122.) blue:scaled(255.) alpha:alpha26],
@"alertBackground" : [UIColor colorWithWhite:1. alpha:alpha90]
@"alertBackground" : [UIColor colorWithWhite:1. alpha:alpha90],
@"blackOpaque" : [UIColor colorWithWhite:0. alpha:alpha04]
};
UIColor * color(SEL cmd)
@ -225,6 +228,11 @@ UIColor * color(SEL cmd)
return color(_cmd);
}
+ (UIColor *)blackOpaque
{
return color(_cmd);
}
+ (UIColor *)colorWithName:(NSString *)colorName
{
#pragma clang diagnostic push

View file

@ -12,7 +12,6 @@
- (void)refresh
{
[MapsAppDelegate customizeAppearance];
[self.navigationController.navigationBar refresh];
[self.view refresh];
if (![self isKindOfClass:[MapViewController class]])