Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorИлья Гречухин <i.grechuhin@gmail.com>2016-10-24 14:27:45 +0300
committerGitHub <noreply@github.com>2016-10-24 14:27:45 +0300
commitca68ae9ee236236284a89855e72c4bde2512f26d (patch)
tree991c88e3d418b2e3d5dcdf66de948d48e6cda04b
parent2243590024f661ec22aa14bc88e4098ff41a3865 (diff)
parent485e6d9fefce78c09599f47c79b226ddbc4b2278 (diff)
Merge pull request #4547 from VladiMihaylenko/vm-master
[ios] Place page bugfix.
-rw-r--r--iphone/Maps/Classes/MWMOpeningHoursCell.mm53
-rw-r--r--iphone/Maps/Classes/MWMPlacePageData.mm2
-rw-r--r--iphone/Maps/Classes/MWMPlacePageLayout.mm15
-rw-r--r--iphone/Maps/Classes/_MWMOHHeaderCell.xib94
-rw-r--r--map/place_page_info.cpp5
5 files changed, 81 insertions, 88 deletions
diff --git a/iphone/Maps/Classes/MWMOpeningHoursCell.mm b/iphone/Maps/Classes/MWMOpeningHoursCell.mm
index 3d88c25dd2..6667caa636 100644
--- a/iphone/Maps/Classes/MWMOpeningHoursCell.mm
+++ b/iphone/Maps/Classes/MWMOpeningHoursCell.mm
@@ -2,6 +2,8 @@
#import "Common.h"
#import "MWMOpeningHours.h"
#import "MWMPlacePageCellUpdateProtocol.h"
+#import "UIColor+MapsMeColor.h"
+#import "UIFont+MapsMeFonts.h"
#include "std/array.hpp"
@@ -11,17 +13,49 @@ array<NSString *, 2> kOHClasses = {{@"_MWMOHHeaderCell", @"_MWMOHSubCell"}};
void * kContext = &kContext;
NSString * const kTableViewContentSizeKeyPath = @"contentSize";
+NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
+{
+ auto const richString = ^NSMutableAttributedString * (NSString * str, UIFont * font, UIColor * color)
+ {
+ return [[NSMutableAttributedString alloc] initWithString:str
+ attributes:@{NSFontAttributeName : font,
+ NSForegroundColorAttributeName : color}];
+ };
+
+ auto str = richString(day.TodayTime(), [UIFont regular17], day.m_isOpen ? [UIColor blackPrimaryText] :
+ [UIColor red]);
+ if (day.m_isOpen)
+ {
+ auto lineBreak = [[NSAttributedString alloc] initWithString:@"\n"];
+
+ if (day.m_breaks.length)
+ {
+ [str appendAttributedString:lineBreak];
+ [str appendAttributedString:richString(day.m_breaks, [UIFont regular13], [UIColor blackSecondaryText])];
+ }
+
+ if (isClosedNow)
+ {
+ [str appendAttributedString:lineBreak];
+ [str appendAttributedString:richString(L(@"closed_now"), [UIFont regular13], [UIColor red])];
+ }
+
+ auto paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineSpacing = 4;
+
+ [str addAttributes:@{NSParagraphStyleAttributeName : paragraphStyle} range:{0, str.length}];
+ }
+ return str;
+}
+
} // namespace
#pragma mark - _MWMOHHeaderCell
@interface _MWMOHHeaderCell : MWMTableViewCell
-@property(weak, nonatomic) IBOutlet UILabel * today;
-@property(weak, nonatomic) IBOutlet UILabel * breaks;
-@property(weak, nonatomic) IBOutlet UILabel * closedNow;
+@property(weak, nonatomic) IBOutlet UILabel * text;
@property(weak, nonatomic) IBOutlet UIImageView * arrowIcon;
-@property(weak, nonatomic) IBOutlet UIImageView * separator;
@property(copy, nonatomic) TMWMVoidBlock tapAction;
@@ -120,15 +154,13 @@ NSString * const kTableViewContentSizeKeyPath = @"contentSize";
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
auto const & day = m_days[indexPath.row];
- BOOL const isSeparatorHidden =
- self.isExtended ? indexPath.row == 0 : indexPath.row == m_days.size() - 1;
+
if (indexPath.row == 0)
{
_MWMOHHeaderCell * cell =
[tableView dequeueReusableCellWithIdentifier:[_MWMOHHeaderCell className]];
- cell.today.text = day.TodayTime();
- cell.breaks.text = day.m_breaks;
- cell.closedNow.text = self.isClosedNow ? L(@"closed_now") : nil;
+ cell.text.attributedText = richStringFromDay(day, self.isClosedNow);
+
if (m_days.size() > 1)
{
cell.tapAction = ^{
@@ -153,7 +185,6 @@ NSString * const kTableViewContentSizeKeyPath = @"contentSize";
cell.tapAction = nil;
cell.arrowIcon.hidden = YES;
}
- cell.separator.hidden = isSeparatorHidden;
return cell;
}
else
@@ -162,7 +193,7 @@ NSString * const kTableViewContentSizeKeyPath = @"contentSize";
cell.days.text = day.m_workingDays;
cell.schedule.text = day.m_workingTimes ? day.m_workingTimes : L(@"closed");
cell.breaks.text = day.m_breaks;
- cell.separator.hidden = isSeparatorHidden;
+ cell.separator.hidden = indexPath.row == m_days.size() - 1;
return cell;
}
}
diff --git a/iphone/Maps/Classes/MWMPlacePageData.mm b/iphone/Maps/Classes/MWMPlacePageData.mm
index b323d98c88..5e3a0128fb 100644
--- a/iphone/Maps/Classes/MWMPlacePageData.mm
+++ b/iphone/Maps/Classes/MWMPlacePageData.mm
@@ -294,7 +294,7 @@ using namespace place_page;
case MetainfoRows::Website: return @(m_info.GetWebsite().c_str());
case MetainfoRows::Email: return @(m_info.GetEmail().c_str());
case MetainfoRows::Cuisine:
- return @(strings::JoinStrings(m_info.GetCuisines(), Info::kSubtitleSeparator).c_str());
+ return @(strings::JoinStrings(m_info.GetLocalizedCuisines(), Info::kSubtitleSeparator).c_str());
case MetainfoRows::Operator: return @(m_info.GetOperator().c_str());
case MetainfoRows::Internet: return L(@"WiFi_available");
case MetainfoRows::Coordinate:
diff --git a/iphone/Maps/Classes/MWMPlacePageLayout.mm b/iphone/Maps/Classes/MWMPlacePageLayout.mm
index 1f24cb3138..525c51c6a0 100644
--- a/iphone/Maps/Classes/MWMPlacePageLayout.mm
+++ b/iphone/Maps/Classes/MWMPlacePageLayout.mm
@@ -266,10 +266,14 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
return s.height > s.width;
}
+- (CGFloat)openContentOffset
+{
+ return self.isPortrait ? self.portraitOpenContentOffset : self.landscapeOpenContentOffset;
+}
+
- (CGFloat)topContentOffset
{
- auto const target =
- self.isPortrait ? self.portraitOpenContentOffset : self.landscapeOpenContentOffset;
+ auto const target = self.openContentOffset;
if (target > self.placePageView.height)
return self.placePageView.height;
@@ -448,11 +452,6 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
: CGAffineTransformIdentity;
}
-- (CGFloat)openContentOffset
-{
- return self.isPortrait ? self.portraitOpenContentOffset : self.landscapeOpenContentOffset;
-}
-
#pragma mark - UITableViewDelegate & UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
@@ -503,7 +502,7 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
else
{
self.state = State::Top;
- offset = self.openContentOffset;
+ offset = self.topContentOffset;
}
animate(^{ [self.scrollView setContentOffset:{0, offset} animated:YES]; });
}];
diff --git a/iphone/Maps/Classes/_MWMOHHeaderCell.xib b/iphone/Maps/Classes/_MWMOHHeaderCell.xib
index efa188bfad..71c771f6ef 100644
--- a/iphone/Maps/Classes/_MWMOHHeaderCell.xib
+++ b/iphone/Maps/Classes/_MWMOHHeaderCell.xib
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
@@ -8,66 +8,36 @@
<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="_MWMOHHeaderCell" rowHeight="100" id="LXG-cP-akO" customClass="_MWMOHHeaderCell">
- <rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="_MWMOHHeaderCell" id="LXG-cP-akO" customClass="_MWMOHHeaderCell">
+ <rect key="frame" x="0.0" y="0.0" width="375" height="48"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LXG-cP-akO" id="WuT-dc-opP">
- <frame key="frameInset" width="375" height="99.5"/>
+ <frame key="frameInset" width="375" height="47"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_placepage_open_hours" translatesAutoresizingMaskIntoConstraints="NO" id="nwH-Nj-buF">
<constraints>
- <constraint firstAttribute="width" constant="24" id="LjC-Sp-k5X"/>
- <constraint firstAttribute="height" constant="24" id="gWH-Yu-u9h"/>
+ <constraint firstAttribute="height" constant="24" id="AU3-h8-Jf3"/>
+ <constraint firstAttribute="width" constant="24" id="RuT-UD-d6E"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
</imageView>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Сегодня 8:00 – 18:00" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qDh-SU-MHG" userLabel="Today">
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Сегодня 8:00 – 18:00" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qDh-SU-MHG" userLabel="Text">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
- <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/>
- </userDefinedRuntimeAttributes>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Перерыв 12:00 – 13:00" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SUY-kO-lcA" userLabel="Break">
- <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="17"/>
- <nil key="textColor"/>
- <nil key="highlightedColor"/>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
- <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular13"/>
- </userDefinedRuntimeAttributes>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Сейчас закрыто" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VBz-au-4xa" userLabel="Closed now">
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
- <nil key="textColor"/>
- <nil key="highlightedColor"/>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="colorName" value="red"/>
- <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular13"/>
- </userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_arrow_gray_down" translatesAutoresizingMaskIntoConstraints="NO" id="VHY-FB-giE">
<constraints>
- <constraint firstAttribute="width" constant="28" id="OgV-so-hOI"/>
- <constraint firstAttribute="height" constant="28" id="dBd-ZI-bu4"/>
+ <constraint firstAttribute="height" constant="28" id="GMF-Az-vGZ"/>
+ <constraint firstAttribute="width" constant="28" id="qap-Cz-ia0"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
</imageView>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="byE-X8-YBC">
- <constraints>
- <constraint firstAttribute="height" constant="1" id="FoK-zb-Rvr"/>
- </constraints>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMSeparator"/>
- </userDefinedRuntimeAttributes>
- </imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Mvv-gY-euE">
<connections>
<action selector="extendTap" destination="LXG-cP-akO" eventType="touchUpInside" id="yMy-04-GCs"/>
@@ -75,44 +45,32 @@
</button>
</subviews>
<constraints>
- <constraint firstItem="Mvv-gY-euE" firstAttribute="leading" secondItem="WuT-dc-opP" secondAttribute="leading" id="0K0-8b-LPL"/>
- <constraint firstItem="byE-X8-YBC" firstAttribute="leading" secondItem="WuT-dc-opP" secondAttribute="leading" constant="60" id="1lE-nc-fFl"/>
- <constraint firstItem="Mvv-gY-euE" firstAttribute="top" secondItem="WuT-dc-opP" secondAttribute="top" id="9LV-xR-rNC"/>
- <constraint firstItem="SUY-kO-lcA" firstAttribute="top" secondItem="qDh-SU-MHG" secondAttribute="bottom" constant="4" id="F8Z-l6-buM"/>
- <constraint firstItem="SUY-kO-lcA" firstAttribute="top" secondItem="qDh-SU-MHG" secondAttribute="bottom" constant="4" id="FDA-zq-wb6"/>
- <constraint firstItem="qDh-SU-MHG" firstAttribute="leading" secondItem="nwH-Nj-buF" secondAttribute="trailing" constant="20" id="GdL-ps-Aya"/>
- <constraint firstAttribute="trailing" secondItem="VHY-FB-giE" secondAttribute="trailing" constant="8" id="JLG-1w-IGN"/>
- <constraint firstItem="nwH-Nj-buF" firstAttribute="leading" secondItem="WuT-dc-opP" secondAttribute="leading" constant="16" id="N1J-dg-rdb"/>
- <constraint firstItem="VHY-FB-giE" firstAttribute="leading" secondItem="qDh-SU-MHG" secondAttribute="trailing" constant="8" id="SeW-Tz-hIt"/>
- <constraint firstAttribute="trailing" secondItem="byE-X8-YBC" secondAttribute="trailing" id="THx-yW-0Pg"/>
- <constraint firstAttribute="trailing" secondItem="Mvv-gY-euE" secondAttribute="trailing" id="VO5-tR-Gb5"/>
- <constraint firstAttribute="bottom" secondItem="Mvv-gY-euE" secondAttribute="bottom" id="XA5-h1-bvn"/>
- <constraint firstItem="nwH-Nj-buF" firstAttribute="centerY" secondItem="WuT-dc-opP" secondAttribute="centerY" id="YyY-wo-k3r"/>
- <constraint firstItem="byE-X8-YBC" firstAttribute="top" secondItem="VBz-au-4xa" secondAttribute="bottom" constant="14" id="bCS-Xw-0sP"/>
- <constraint firstItem="VHY-FB-giE" firstAttribute="leading" secondItem="SUY-kO-lcA" secondAttribute="trailing" constant="8" id="cJk-pF-MWB"/>
- <constraint firstItem="VHY-FB-giE" firstAttribute="centerY" secondItem="WuT-dc-opP" secondAttribute="centerY" id="dF7-VZ-wCm"/>
- <constraint firstAttribute="bottom" secondItem="byE-X8-YBC" secondAttribute="bottom" id="eyh-D3-PL4"/>
- <constraint firstItem="VBz-au-4xa" firstAttribute="top" secondItem="SUY-kO-lcA" secondAttribute="bottom" constant="4" id="fam-HS-q2G"/>
- <constraint firstItem="qDh-SU-MHG" firstAttribute="top" secondItem="WuT-dc-opP" secondAttribute="top" constant="14" id="rgx-8A-sEE"/>
- <constraint firstItem="VHY-FB-giE" firstAttribute="leading" secondItem="VBz-au-4xa" secondAttribute="trailing" constant="8" id="rsi-Hp-ORw"/>
- <constraint firstItem="SUY-kO-lcA" firstAttribute="leading" secondItem="nwH-Nj-buF" secondAttribute="trailing" constant="20" id="sNc-db-hOj"/>
- <constraint firstItem="VBz-au-4xa" firstAttribute="leading" secondItem="nwH-Nj-buF" secondAttribute="trailing" constant="20" id="vEF-OR-sIn"/>
+ <constraint firstAttribute="bottom" secondItem="qDh-SU-MHG" secondAttribute="bottom" constant="14" id="0DZ-az-Lhs"/>
+ <constraint firstItem="nwH-Nj-buF" firstAttribute="leading" secondItem="WuT-dc-opP" secondAttribute="leading" constant="16" id="6Pu-RX-aEk"/>
+ <constraint firstItem="Mvv-gY-euE" firstAttribute="leading" secondItem="WuT-dc-opP" secondAttribute="leading" id="8P4-c4-MZD"/>
+ <constraint firstItem="VHY-FB-giE" firstAttribute="leading" secondItem="qDh-SU-MHG" secondAttribute="trailing" constant="8" id="9t0-oW-VAo"/>
+ <constraint firstItem="qDh-SU-MHG" firstAttribute="top" secondItem="WuT-dc-opP" secondAttribute="top" constant="14" id="EEt-O9-WgL"/>
+ <constraint firstAttribute="bottom" secondItem="Mvv-gY-euE" secondAttribute="bottom" id="Gbe-0R-FgZ"/>
+ <constraint firstAttribute="trailing" secondItem="Mvv-gY-euE" secondAttribute="trailing" id="fbo-mH-Bi6"/>
+ <constraint firstAttribute="trailing" secondItem="VHY-FB-giE" secondAttribute="trailing" constant="8" id="jQX-bd-gBc"/>
+ <constraint firstItem="qDh-SU-MHG" firstAttribute="leading" secondItem="nwH-Nj-buF" secondAttribute="trailing" constant="20" id="rcw-Eo-aHO"/>
+ <constraint firstItem="Mvv-gY-euE" firstAttribute="top" secondItem="WuT-dc-opP" secondAttribute="top" id="zyW-ZM-u0d"/>
</constraints>
</tableViewCellContentView>
+ <constraints>
+ <constraint firstItem="nwH-Nj-buF" firstAttribute="centerY" secondItem="LXG-cP-akO" secondAttribute="centerY" id="Fk1-cA-KAh"/>
+ <constraint firstItem="VHY-FB-giE" firstAttribute="centerY" secondItem="LXG-cP-akO" secondAttribute="centerY" id="x8c-sP-BJ3"/>
+ </constraints>
<connections>
<outlet property="arrowIcon" destination="VHY-FB-giE" id="j5m-f3-Wv6"/>
- <outlet property="breaks" destination="SUY-kO-lcA" id="hEd-dx-xLq"/>
- <outlet property="closedNow" destination="VBz-au-4xa" id="5b6-WK-hzS"/>
- <outlet property="separator" destination="byE-X8-YBC" id="oyA-s8-BPp"/>
- <outlet property="today" destination="qDh-SU-MHG" id="jYZ-La-UfJ"/>
+ <outlet property="text" destination="qDh-SU-MHG" id="OTq-0N-S6b"/>
</connections>
- <point key="canvasLocation" x="45.5" y="71"/>
+ <point key="canvasLocation" x="45.5" y="43"/>
</tableViewCell>
</objects>
<resources>
<image name="ic_arrow_gray_down" width="28" height="28"/>
<image name="ic_placepage_open_hours" width="28" height="28"/>
- <image name="separator_image" width="1" height="1"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp
index 2d5e30b1bf..9cd2997405 100644
--- a/map/place_page_info.cpp
+++ b/map/place_page_info.cpp
@@ -72,6 +72,11 @@ string Info::GetSubtitle() const
// Type.
values.push_back(GetLocalizedType());
+ // Flats.
+ string const flats = GetFlats();
+ if (!flats.empty())
+ values.push_back(flats);
+
// Cuisines.
for (string const & cuisine : GetLocalizedCuisines())
values.push_back(cuisine);