[ios] Added largets towns display.

This commit is contained in:
Ilya Grechuhin 2016-04-20 16:34:41 +03:00
parent 241a1ca279
commit 81edaa14e2
4 changed files with 25 additions and 17 deletions

View file

@ -18,7 +18,7 @@ namespace
@interface MWMMapDownloaderPlaceTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel * area;
@property (weak, nonatomic) IBOutlet UILabel * descriptionLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * titleBottomOffset;
@end
@ -35,7 +35,7 @@ namespace
[super layoutSubviews];
if (isIOS7)
{
self.area.preferredMaxLayoutWidth = self.area.width;
self.descriptionLabel.preferredMaxLayoutWidth = self.descriptionLabel.width;
[super layoutSubviews];
}
}
@ -45,18 +45,25 @@ namespace
- (void)config:(storage::NodeAttrs const &)nodeAttrs
{
[super config:nodeAttrs];
BOOL isAreaVisible = NO;
BOOL isDescriptionVisible = NO;
if (self.needDisplayArea && nodeAttrs.m_topmostParentInfo.size() == 1)
{
string const & areaName = nodeAttrs.m_topmostParentInfo[0].m_localName;
isAreaVisible = (areaName != GetFramework().Storage().GetRootId());
if (isAreaVisible)
self.area.attributedText = [self matchedString:@(areaName.c_str())
selectedAttrs:kSelectedAreaAttrs
unselectedAttrs:kUnselectedAreaAttrs];
isDescriptionVisible = (areaName != GetFramework().Storage().GetRootId());
if (isDescriptionVisible)
self.descriptionLabel.attributedText = [self matchedString:@(areaName.c_str())
selectedAttrs:kSelectedAreaAttrs
unselectedAttrs:kUnselectedAreaAttrs];
}
self.area.hidden = !isAreaVisible;
self.titleBottomOffset.priority = isAreaVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
else if (!nodeAttrs.m_nodeLocalDescription.empty())
{
isDescriptionVisible = YES;
self.descriptionLabel.attributedText = [self matchedString:@(nodeAttrs.m_nodeLocalDescription.c_str())
selectedAttrs:kSelectedAreaAttrs
unselectedAttrs:kUnselectedAreaAttrs];
}
self.descriptionLabel.hidden = !isDescriptionVisible;
self.titleBottomOffset.priority = isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
}
@end

View file

@ -11,7 +11,7 @@
<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="61.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="61"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yb5-r1-Z2X">
@ -76,7 +76,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="area" destination="fev-4l-MY3" id="6xU-Oo-rem"/>
<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"/>

View file

@ -11,7 +11,7 @@
<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="81.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="81"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yb5-r1-Z2X">
@ -89,7 +89,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="area" destination="fev-4l-MY3" id="3BY-9T-0E9"/>
<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"/>

View file

@ -28,10 +28,8 @@ using namespace storage;
{
if (![cell isKindOfClass:[MWMMapDownloaderTableViewCell class]])
return;
MWMMapDownloaderTableViewCell * tCell = static_cast<MWMMapDownloaderTableViewCell *>(cell);
NSString * countryId = [self countryIdForIndexPath:indexPath];
[tCell setCountryId:countryId searchQuery:[self searchQuery]];
NSString * countryId = [self countryIdForIndexPath:indexPath];
if ([cell isKindOfClass:[MWMMapDownloaderPlaceTableViewCell class]])
{
MWMMapDownloaderPlaceTableViewCell * placeCell = static_cast<MWMMapDownloaderPlaceTableViewCell *>(cell);
@ -43,6 +41,9 @@ using namespace storage;
MWMMapDownloaderSubplaceTableViewCell * subplaceCell = static_cast<MWMMapDownloaderSubplaceTableViewCell *>(cell);
[subplaceCell setSubplaceText:[self searchMatchedResultForCountryId:countryId]];
}
MWMMapDownloaderTableViewCell * tCell = static_cast<MWMMapDownloaderTableViewCell *>(cell);
[tCell setCountryId:countryId searchQuery:[self searchQuery]];
}
#pragma mark - UITableViewDataSource