forked from organicmaps/organicmaps
[ios] Fixed search layout.
This commit is contained in:
parent
b36ab27345
commit
fcc825f8b5
8 changed files with 23 additions and 45 deletions
|
@ -4,6 +4,6 @@
|
|||
|
||||
@interface MWMSearchCell : MWMTableViewCell
|
||||
|
||||
- (void)config:(search::Result &)result;
|
||||
- (void)config:(search::Result const &)result;
|
||||
|
||||
@end
|
||||
|
|
|
@ -25,11 +25,8 @@
|
|||
sl.rasterizationScale = UIScreen.mainScreen.scale;
|
||||
}
|
||||
|
||||
- (void)config:(search::Result &)result
|
||||
- (void)config:(search::Result const &)result
|
||||
{
|
||||
if (result.GetResultType() == search::Result::RESULT_FEATURE)
|
||||
GetFramework().LoadSearchResultMetadata(result);
|
||||
|
||||
NSString * title = @(result.GetString().c_str());
|
||||
if (!title)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
+ (CGFloat)defaultCellHeight;
|
||||
- (CGFloat)cellHeight;
|
||||
|
||||
- (void)config:(search::Result &)result forHeight:(BOOL)forHeight;
|
||||
- (void)config:(search::Result const &)result forHeight:(BOOL)forHeight;
|
||||
|
||||
@end
|
||||
|
|
|
@ -28,10 +28,15 @@
|
|||
|
||||
@implementation MWMSearchCommonCell
|
||||
|
||||
- (void)config:(search::Result &)result forHeight:(BOOL)forHeight
|
||||
- (void)config:(search::Result const &)result forHeight:(BOOL)forHeight
|
||||
{
|
||||
[super config:result];
|
||||
self.typeLabel.text = @(result.GetFeatureType().c_str()).capitalizedString;
|
||||
auto const & ratingStr = result.GetHotelRating();
|
||||
self.ratingLabel.text =
|
||||
ratingStr.empty() ? @"" : [NSString stringWithFormat:L(@"place_page_booking_rating"),
|
||||
ratingStr.c_str()];
|
||||
self.priceLabel.text = @(result.GetHotelApproximatePricing().c_str());
|
||||
self.locationLabel.text = @(result.GetAddress().c_str());
|
||||
[self.locationLabel sizeToFit];
|
||||
|
||||
|
@ -54,11 +59,6 @@
|
|||
case osm::No: self.closedView.hidden = NO; break;
|
||||
}
|
||||
|
||||
auto const & ratingStr = result.GetHotelRating();
|
||||
self.ratingLabel.text =
|
||||
ratingStr.empty() ? @"" : [NSString stringWithFormat:L(@"place_page_booking_rating"),
|
||||
result.GetHotelRating().c_str()];
|
||||
self.priceLabel.text = @(result.GetHotelApproximatePricing().c_str());
|
||||
if (result.HasPoint())
|
||||
{
|
||||
string distanceStr;
|
||||
|
|
|
@ -199,16 +199,6 @@
|
|||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Russia, Moscow & Central, Moscow" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="220" translatesAutoresizingMaskIntoConstraints="NO" id="6pc-4s-GyP" customClass="MWMMultilineLabel">
|
||||
<rect key="frame" x="16" y="82" width="220" height="14"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular12"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rating" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="70N-Lq-mj9">
|
||||
<rect key="frame" x="16" y="54" width="49" height="20"/>
|
||||
<constraints>
|
||||
|
@ -235,6 +225,16 @@
|
|||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Russia, Moscow & Central, Moscow" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="220" translatesAutoresizingMaskIntoConstraints="NO" id="6pc-4s-GyP" customClass="MWMMultilineLabel">
|
||||
<rect key="frame" x="16" y="82" width="220" height="14"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular12"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="P8X-Xp-AaE" firstAttribute="leading" secondItem="6pc-4s-GyP" secondAttribute="trailing" id="0hr-QT-t0D"/>
|
||||
|
@ -247,18 +247,18 @@
|
|||
<constraint firstItem="4FD-RE-ffF" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="Qld-dY-CQN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4FD-RE-ffF" secondAttribute="trailing" constant="84" id="Ugu-lP-b9G"/>
|
||||
<constraint firstAttribute="trailing" secondItem="P8X-Xp-AaE" secondAttribute="trailing" constant="16" id="VJE-wo-TBb"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="top" secondItem="70N-Lq-mj9" secondAttribute="bottom" constant="8" id="aFG-lW-QGv"/>
|
||||
<constraint firstItem="P8X-Xp-AaE" firstAttribute="top" secondItem="70N-Lq-mj9" secondAttribute="bottom" constant="5" id="bqR-Xm-K1t"/>
|
||||
<constraint firstItem="WOF-of-CqB" firstAttribute="centerY" secondItem="70N-Lq-mj9" secondAttribute="centerY" id="drZ-ks-Xr4"/>
|
||||
<constraint firstItem="4FD-RE-ffF" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="hM6-br-iKE"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="leading" secondItem="5UO-MD-Hgx" secondAttribute="leading" id="jvQ-jd-XUJ"/>
|
||||
<constraint firstItem="AXe-5n-maZ" firstAttribute="centerY" secondItem="5UO-MD-Hgx" secondAttribute="centerY" id="kfK-H3-3fw"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="top" secondItem="WOF-of-CqB" secondAttribute="bottom" constant="8" id="lJy-oA-g8U"/>
|
||||
<constraint firstAttribute="trailing" secondItem="V8w-dT-7B1" secondAttribute="trailing" constant="16" id="lr7-cG-wNo"/>
|
||||
<constraint firstItem="HGm-lZ-JNr" firstAttribute="top" secondItem="6pc-4s-GyP" secondAttribute="bottom" constant="12" id="m1K-R2-0LQ"/>
|
||||
<constraint firstItem="5UO-MD-Hgx" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="nGL-Ta-pBZ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6pc-4s-GyP" secondAttribute="trailing" constant="84" id="nfE-NI-LX9"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="bottom" secondItem="P8X-Xp-AaE" secondAttribute="bottom" id="q7E-Jg-MYT"/>
|
||||
<constraint firstItem="HGm-lZ-JNr" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="sq9-C3-M3R"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="top" secondItem="70N-Lq-mj9" secondAttribute="bottom" constant="8" id="u8H-l1-khI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="HGm-lZ-JNr" secondAttribute="bottom" id="vJc-aE-MsA"/>
|
||||
<constraint firstItem="V8w-dT-7B1" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="16" id="x1p-sf-n4c"/>
|
||||
<constraint firstAttribute="trailing" secondItem="HGm-lZ-JNr" secondAttribute="trailing" id="xt0-86-Efu"/>
|
||||
|
|
|
@ -98,7 +98,7 @@ NSString * identifierForType(MWMSearchTableCellType type)
|
|||
}
|
||||
}
|
||||
|
||||
- (search::Result &)searchResultForIndexPath:(NSIndexPath *)indexPath
|
||||
- (search::Result const &)searchResultForIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
MWMSearchTableCellType firstCellType =
|
||||
[self cellTypeForIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
|
||||
|
@ -147,7 +147,7 @@ NSString * identifierForType(MWMSearchTableCellType type)
|
|||
#pragma mark - Config cells
|
||||
|
||||
- (void)configSuggestionCell:(MWMSearchSuggestionCell *)cell
|
||||
result:(search::Result &)result
|
||||
result:(search::Result const &)result
|
||||
isLastCell:(BOOL)isLastCell
|
||||
{
|
||||
[cell config:result];
|
||||
|
|
|
@ -1341,23 +1341,6 @@ bool Framework::QueryMayBeSkipped(search::SearchParams const & params,
|
|||
return true;
|
||||
}
|
||||
|
||||
void Framework::LoadSearchResultMetadata(search::Result & res) const
|
||||
{
|
||||
if (res.m_metadata.m_isInitialized || res.GetResultType() != search::Result::RESULT_FEATURE)
|
||||
return;
|
||||
|
||||
FeatureID const & id = res.GetFeatureID();
|
||||
ASSERT(id.IsValid(), ("Search result doesn't contain valid FeatureID."));
|
||||
// TODO @yunikkk refactor to format search result metadata accordingly with place_page::Info
|
||||
|
||||
FeatureType ft;
|
||||
if (!GetFeatureByID(id, ft))
|
||||
return;
|
||||
|
||||
search::ProcessMetadata(ft, res.m_metadata);
|
||||
// res.m_metadata.m_isInitialized is set to true in ProcessMetadata.
|
||||
}
|
||||
|
||||
void Framework::ShowSearchResult(search::Result const & res)
|
||||
{
|
||||
CancelInteractiveSearch();
|
||||
|
|
|
@ -431,8 +431,6 @@ public:
|
|||
bool SearchInDownloader(storage::DownloaderSearchParams const & params);
|
||||
bool GetCurrentPosition(double & lat, double & lon) const;
|
||||
|
||||
void LoadSearchResultMetadata(search::Result & res) const;
|
||||
|
||||
void ShowSearchResult(search::Result const & res);
|
||||
size_t ShowSearchResults(search::Results const & results);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue