diff --git a/iphone/Maps/Classes/SearchBar.mm b/iphone/Maps/Classes/SearchBar.mm index 86f1b492c1..df2033a2de 100644 --- a/iphone/Maps/Classes/SearchBar.mm +++ b/iphone/Maps/Classes/SearchBar.mm @@ -41,6 +41,11 @@ if ([self.textField respondsToSelector:@selector(setTintColor:)]) self.textField.tintColor = [UIColor whiteColor]; + UIImageView * shadowImageView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"SearchBarShadow"] resizableImageWithCapInsets:UIEdgeInsetsZero]]; + shadowImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + shadowImageView.minY = self.height; + [self addSubview:shadowImageView]; + return self; } diff --git a/iphone/Maps/Classes/SearchSuggestCell.h b/iphone/Maps/Classes/SearchSuggestCell.h new file mode 100644 index 0000000000..c8fa9ca5fb --- /dev/null +++ b/iphone/Maps/Classes/SearchSuggestCell.h @@ -0,0 +1,18 @@ + +#import + +typedef NS_ENUM(NSUInteger, SearchSuggestCellPosition) +{ + SearchSuggestCellPositionMiddle, + SearchSuggestCellPositionBottom +}; + +@interface SearchSuggestCell : UITableViewCell + +@property (nonatomic) SearchSuggestCellPosition position; +@property (nonatomic, readonly) UILabel * titleLabel; +@property (nonatomic, readonly) UIImageView * iconImageView; + ++ (CGFloat)cellHeightWithPosition:(SearchSuggestCellPosition)position; + +@end diff --git a/iphone/Maps/Classes/SearchSuggestCell.m b/iphone/Maps/Classes/SearchSuggestCell.m new file mode 100644 index 0000000000..bfb7666fc9 --- /dev/null +++ b/iphone/Maps/Classes/SearchSuggestCell.m @@ -0,0 +1,87 @@ + +#import "SearchSuggestCell.h" +#import "UIKitCategories.h" + +@interface SearchSuggestCell () + +@property (nonatomic) UILabel * titleLabel; +@property (nonatomic) UIImageView * iconImageView; + +@end + +@implementation SearchSuggestCell + +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + + [self.contentView addSubview:self.titleLabel]; + [self.contentView addSubview:self.iconImageView]; + + self.backgroundColor = [UIColor clearColor]; + + UIImageView * backgroundImageView = [[UIImageView alloc] initWithFrame:self.bounds]; + self.backgroundView = backgroundImageView; + + UIImageView * selectedBackgroundImageView = [[UIImageView alloc] initWithFrame:self.bounds]; + self.selectedBackgroundView = selectedBackgroundImageView; + + return self; +} + +- (void)layoutSubviews +{ + UIImage * image; + UIImage * selectedImage; + if (self.position == SearchSuggestCellPositionMiddle) + { + image = [UIImage imageNamed:@"SearchSuggestBackgroundMiddle"]; + selectedImage = [UIImage imageNamed:@"SearchSuggestSelectedBackgroundMiddle"]; + } + else + { + image = [UIImage imageNamed:@"SearchSuggestBackgroundBottom"]; + selectedImage = [UIImage imageNamed:@"SearchSuggestSelectedBackgroundBottom"]; + } + + UIEdgeInsets insets = UIEdgeInsetsMake(10, 40, 10, 40); + + ((UIImageView *)self.backgroundView).image = [image resizableImageWithCapInsets:insets]; + self.backgroundView.frame = self.bounds; + + ((UIImageView *)self.selectedBackgroundView).image = [selectedImage resizableImageWithCapInsets:insets]; + self.selectedBackgroundView.frame = self.bounds; + + self.titleLabel.width = self.width - self.titleLabel.minX - 20; +} + ++ (CGFloat)cellHeightWithPosition:(SearchSuggestCellPosition)position +{ + return position == SearchSuggestCellPositionMiddle ? 44 : 46; +} + +- (UILabel *)titleLabel +{ + if (!_titleLabel) + { + _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(44, 8.5, 0, 24)]; + _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + _titleLabel.backgroundColor = [UIColor clearColor]; + _titleLabel.textColor = [UIColor whiteColor]; + _titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:17.5]; + } + return _titleLabel; +} + +- (UIImageView *)iconImageView +{ + if (!_iconImageView) + { + _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(17, 13, 18, 18)]; + _iconImageView.contentMode = UIViewContentModeCenter; + } + return _iconImageView; +} + + +@end diff --git a/iphone/Maps/Classes/SearchView.mm b/iphone/Maps/Classes/SearchView.mm index f125be0318..721fbfff48 100644 --- a/iphone/Maps/Classes/SearchView.mm +++ b/iphone/Maps/Classes/SearchView.mm @@ -8,6 +8,7 @@ #import "MapViewController.h" #import "LocationManager.h" #import "ToastView.h" +#import "SearchSuggestCell.h" #include "Framework.h" @@ -29,6 +30,7 @@ - (id)initWithResults:(search::Results const &)res; - (search::Result const &)resultWithPosition:(NSInteger)position; +- (NSInteger)suggestsCount; - (NSInteger)count; - (BOOL)isEndMarker; - (BOOL)isEndedNormal; @@ -67,6 +69,11 @@ return m_results.GetCount(); } +- (NSInteger)suggestsCount +{ + return m_results.GetSuggestsCount(); +} + - (search::Result const &)resultWithPosition:(NSInteger)position { return m_results.GetResult(position); @@ -85,11 +92,21 @@ @end +typedef NS_ENUM(NSUInteger, CellType) +{ + CellTypeResult, + CellTypeSuggest, + CellTypeShowOnMap, + CellTypeCategory +}; + + @interface SearchView () @property (nonatomic) UITableView * tableView; @property (nonatomic) SolidTouchImageView * topBackgroundView; @property (nonatomic) UILabel * emptyResultLabel; +@property (nonatomic) UIImageView * suggestsTopImageView; @property (nonatomic) SearchResultsWrapper * wrapper; @property (nonatomic) NSArray * categoriesNames; @@ -126,6 +143,7 @@ __weak SearchView * selfPointer; self.isShowingCategories = YES; [self.tableView registerClass:[SearchUniversalCell class] forCellReuseIdentifier:[SearchUniversalCell className]]; + [self.tableView registerClass:[SearchSuggestCell class] forCellReuseIdentifier:[SearchSuggestCell className]]; return self; } @@ -276,7 +294,7 @@ __weak SearchView * selfPointer; search::SearchParams params; params.SetSearchMode(search::SearchParams::ALL); params.m_query = [[self.searchBar.textField.text precomposedStringWithCompatibilityMapping] UTF8String]; - params.m_callback = bind(&OnSearchResultCallback, _1); + params.m_callback = bind(&onSearchResultCallback, _1); params.SetInputLanguage([[UITextInputMode currentInputMode].primaryLanguage UTF8String]); params.SetForceSearch(force == YES); @@ -294,7 +312,7 @@ __weak SearchView * selfPointer; GetFramework().Search(params); } -static void OnSearchResultCallback(search::Results const & results) +static void onSearchResultCallback(search::Results const & results) { SearchResultsWrapper * wrapper = [[SearchResultsWrapper alloc] initWithResults:results]; [selfPointer performSelectorOnMainThread:@selector(frameworkDidAddSearchResult:) withObject:wrapper waitUntilDone:NO]; @@ -313,8 +331,9 @@ static void OnSearchResultCallback(search::Results const & results) } else { - self.emptyResultLabel.hidden = self.isShowingCategories ? YES : ([wrapper count] > 0); + self.emptyResultLabel.hidden = self.isShowingCategories ? YES : ([self rowsCount] > 0); self.wrapper = wrapper; + self.suggestsTopImageView.hidden = ![wrapper suggestsCount]; [self.tableView reloadData]; [self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top) animated:YES]; } @@ -343,9 +362,7 @@ static void OnSearchResultCallback(search::Results const & results) { self.searchBar.textField.text = nil; self.isShowingCategories = YES; - [self.searchBar setSearching:NO]; - [self.tableView reloadData]; - self.emptyResultLabel.alpha = 0; + [self processTextChanging]; [self setState:SearchViewStateHidden animated:YES withCallback:YES]; } @@ -366,6 +383,8 @@ static void OnSearchResultCallback(search::Results const & results) self.isShowingCategories = !self.searchBar.textField.text.length; if (self.isShowingCategories) { + [self.searchBar setSearching:NO]; + self.suggestsTopImageView.hidden = YES; self.emptyResultLabel.hidden = YES; [self.tableView reloadData]; } @@ -428,25 +447,40 @@ static void OnSearchResultCallback(search::Results const & results) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - SearchUniversalCell * cell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]]; - - if (self.isShowingCategories) + UITableViewCell * cell; + CellType cellType = [self cellTypeForIndexPath:indexPath]; + switch (cellType) { - // initial categories - cell.iconImageView.image = [UIImage imageNamed:@"SearchCellSpotIcon"]; - cell.distanceLabel.text = nil; - cell.typeLabel.text = nil; - [cell setTitle:NSLocalizedString(self.categoriesNames[indexPath.row], nil) selectedRanges:nil]; - [cell setSubtitle:nil selectedRange:NSMakeRange(0, 0)]; - } - else - { - if ([self indexPathIsForSearchResultItem:indexPath]) + case CellTypeCategory: { - NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; - SearchResultsWrapper * wrapper = self.wrapper; - search::Result const & result = [wrapper resultWithPosition:position]; + SearchUniversalCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]]; + [customCell setTitle:NSLocalizedString(self.categoriesNames[indexPath.row], nil) selectedRange:NSMakeRange(0, 0)]; + [customCell setSubtitle:nil selectedRange:NSMakeRange(0, 0)]; + customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellSpotIcon"]; + customCell.distanceLabel.text = nil; + customCell.typeLabel.text = nil; + cell = customCell; + break; + } + case CellTypeShowOnMap: + { + SearchUniversalCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]]; + + [customCell setTitle:NSLocalizedString(@"search_show_on_map", nil) selectedRange:NSMakeRange(0, 0)]; + [customCell setSubtitle:nil selectedRange:NSMakeRange(0, 0)]; + customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinsIcon"]; + customCell.distanceLabel.text = nil; + customCell.typeLabel.text = nil; + cell = customCell; + break; + } + case CellTypeResult: + { + SearchUniversalCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]]; + + NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; + search::Result const & result = [self.wrapper resultWithPosition:position]; NSMutableArray * ranges = [[NSMutableArray alloc] init]; for (size_t i = 0; i < result.GetHighlightRangesCount(); i++) { @@ -455,42 +489,27 @@ static void OnSearchResultCallback(search::Results const & results) [ranges addObject:[NSValue valueWithRange:range]]; } NSString * title = [NSString stringWithUTF8String:result.GetString()]; - [cell setTitle:title selectedRanges:ranges]; - - if (result.GetResultType() == search::Result::RESULT_SUGGESTION) - { - // suggest item - cell.iconImageView.image = [UIImage imageNamed:@"SearchCellSpotIcon"]; - cell.distanceLabel.text = nil; - cell.typeLabel.text = nil; - [cell setSubtitle:nil selectedRange:NSMakeRange(0, 0)]; - } - else if (result.GetResultType() == search::Result::RESULT_POI_SUGGEST) - { - // poi suggest item - cell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinsIcon"]; - cell.distanceLabel.text = nil; - cell.typeLabel.text = nil; - [cell setSubtitle:nil selectedRange:NSMakeRange(0, 0)]; - } - else - { - // final search result item - cell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinIcon"]; - cell.distanceLabel.text = wrapper.distances[@(position)]; - cell.typeLabel.text = [NSString stringWithUTF8String:result.GetFeatureType()]; - NSString * subtitle = [NSString stringWithUTF8String:result.GetRegionString()]; - [cell setSubtitle:subtitle selectedRange:NSMakeRange(0, 0)]; - } + [customCell setTitle:title selectedRanges:ranges]; + NSString * subtitle = [NSString stringWithUTF8String:result.GetRegionString()]; + [customCell setSubtitle:subtitle selectedRange:NSMakeRange(0, 0)]; + customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinIcon"]; + customCell.distanceLabel.text = self.wrapper.distances[@(position)]; + customCell.typeLabel.text = [NSString stringWithUTF8String:result.GetFeatureType()]; + cell = customCell; + break; } - else + case CellTypeSuggest: { - // 'show on map' cell - cell.iconImageView.image = [UIImage imageNamed:@"SearchCellSpotIcon"]; - cell.distanceLabel.text = nil; - cell.typeLabel.text = nil; - [cell setTitle:NSLocalizedString(@"search_show_on_map", nil) selectedRanges:nil]; - [cell setSubtitle:nil selectedRange:NSMakeRange(0, 0)]; + SearchSuggestCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchSuggestCell className]]; + + NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; + search::Result const & result = [self.wrapper resultWithPosition:position]; + + customCell.titleLabel.text = [NSString stringWithUTF8String:result.GetString()]; + customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellSpotIcon"]; + customCell.position = [self suggestPositionForIndexPath:indexPath]; + cell = customCell; + break; } } return cell; @@ -498,13 +517,18 @@ static void OnSearchResultCallback(search::Results const & results) - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - if (self.isShowingCategories) + CellType cellType = [self cellTypeForIndexPath:indexPath]; + switch (cellType) { - return [SearchUniversalCell cellHeightWithTitle:self.categoriesNames[indexPath.row] type:nil subtitle:nil distance:nil viewWidth:tableView.width]; - } - else - { - if ([self indexPathIsForSearchResultItem:indexPath]) + case CellTypeCategory: + { + return [SearchUniversalCell cellHeightWithTitle:self.categoriesNames[indexPath.row] type:nil subtitle:nil distance:nil viewWidth:tableView.width]; + } + case CellTypeShowOnMap: + { + return [SearchUniversalCell cellHeightWithTitle:NSLocalizedString(@"search_show_on_map", nil) type:nil subtitle:nil distance:nil viewWidth:tableView.width]; + } + case CellTypeResult: { NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; SearchResultsWrapper * wrapper = self.wrapper; @@ -517,12 +541,15 @@ static void OnSearchResultCallback(search::Results const & results) subtitle = [NSString stringWithUTF8String:result.GetRegionString()]; type = [NSString stringWithUTF8String:result.GetFeatureType()]; } - return [SearchUniversalCell cellHeightWithTitle:title type:type subtitle:subtitle distance:wrapper.distances[@(position)] viewWidth:tableView.width]; } - else + case CellTypeSuggest: { - return [SearchUniversalCell cellHeightWithTitle:NSLocalizedString(@"search_show_on_map", nil) type:nil subtitle:nil distance:nil viewWidth:tableView.width]; + return [SearchSuggestCell cellHeightWithPosition:[self suggestPositionForIndexPath:indexPath]]; + } + default: + { + return 0; } } } @@ -532,59 +559,81 @@ static void OnSearchResultCallback(search::Results const & results) return [self rowsCount]; } +- (void)startInteractiveSearch +{ + search::SearchParams params; + params.m_query = [[self.searchBar.textField.text precomposedStringWithCompatibilityMapping] UTF8String]; + params.SetInputLanguage([[UITextInputMode currentInputMode].primaryLanguage UTF8String]); + + Framework & f = GetFramework(); + f.StartInteractiveSearch(params); + f.UpdateUserViewportChanged(); +} + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - if (self.isShowingCategories) + + CellType cellType = [self cellTypeForIndexPath:indexPath]; + + switch (cellType) { - [[Statistics instance] logEvent:@"Category Selection" withParameters:@{@"Category" : self.categoriesNames[indexPath.row]}]; - self.searchBar.textField.text = [NSLocalizedString(self.categoriesNames[indexPath.row], nil) stringByAppendingString:@" "]; - - search::SearchParams params; - params.m_query = [[self.searchBar.textField.text precomposedStringWithCompatibilityMapping] UTF8String]; - params.SetInputLanguage([[UITextInputMode currentInputMode].primaryLanguage UTF8String]); - - Framework & f = GetFramework(); - f.StartInteractiveSearch(params); - f.UpdateUserViewportChanged(); - - self.isShowingCategories = YES; - - [self setState:SearchViewStateResults animated:YES withCallback:YES]; - } - else if ([self indexPathIsForSearchResultItem:indexPath]) - { - NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; - search::Result const & result = [self.wrapper resultWithPosition:position]; - if (result.GetResultType() == search::Result::RESULT_SUGGESTION) - { - self.searchBar.textField.text = [NSString stringWithUTF8String:result.GetSuggestionString()]; - [self search]; - } - else if (result.GetResultType() == search::Result::RESULT_POI_SUGGEST) - { - needToScroll = YES; - self.searchBar.textField.text = [NSString stringWithUTF8String:result.GetSuggestionString()]; - [self search]; - } - else + case CellTypeCategory: { if (GetPlatform().IsPro()) { - GetFramework().ShowSearchResult(result); - [self setState:SearchViewStateHidden animated:YES withCallback:YES]; + [[Statistics instance] logEvent:@"Category Selection" withParameters:@{@"Category" : self.categoriesNames[indexPath.row]}]; + self.searchBar.textField.text = [NSLocalizedString(self.categoriesNames[indexPath.row], nil) stringByAppendingString:@" "]; + [self setState:SearchViewStateResults animated:YES withCallback:YES]; + self.isShowingCategories = YES; + [self startInteractiveSearch]; } else { [self showBuyProMessage]; } + + break; + } + case CellTypeShowOnMap: + { + if (GetPlatform().IsPro()) + { + [self setState:SearchViewStateResults animated:YES withCallback:YES]; + [self startInteractiveSearch]; + } + else + { + [self showBuyProMessage]; + } + + break; + } + case CellTypeResult: + { + NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; + search::Result const & result = [self.wrapper resultWithPosition:position]; + if (GetPlatform().IsPro()) + { + [self setState:SearchViewStateHidden animated:YES withCallback:YES]; + GetFramework().ShowSearchResult(result); + } + else + { + [self showBuyProMessage]; + } + + break; + } + case CellTypeSuggest: + { + NSInteger const position = [self searchResultPositionForIndexPath:indexPath]; + search::Result const & result = [self.wrapper resultWithPosition:position]; + self.searchBar.textField.text = [NSString stringWithUTF8String:result.GetSuggestionString()]; + [self search]; + + break; } - } - else - { - GetFramework().ShowAllSearchResults(); - needToScroll = YES; - [self setState:SearchViewStateResults animated:YES withCallback:YES]; } } @@ -607,29 +656,37 @@ static void OnSearchResultCallback(search::Results const & results) [self.searchBar.textField resignFirstResponder]; } -- (BOOL)indexPathIsForSearchResultItem:(NSIndexPath *)indexPath +- (SearchSuggestCellPosition)suggestPositionForIndexPath:(NSIndexPath *)indexPath { - return YES;//indexPath.row || [self rowsCount] == 1; + return (indexPath.row == [self.wrapper suggestsCount] - 1) ? SearchSuggestCellPositionBottom : SearchSuggestCellPositionMiddle; +} + +- (CellType)cellTypeForIndexPath:(NSIndexPath *)indexPath +{ + if (self.isShowingCategories) + { + return CellTypeCategory; + } + else + { + if ([self.wrapper suggestsCount]) + return indexPath.row < [self.wrapper suggestsCount] ? CellTypeSuggest : CellTypeResult; + else + return indexPath.row == 0 ? CellTypeShowOnMap : CellTypeResult; + } } - (NSInteger)searchResultPositionForIndexPath:(NSIndexPath *)indexPath { - return indexPath.row;//([self rowsCount] == 1) ? 0 : indexPath.row - 1; + return [self.wrapper suggestsCount] ? indexPath.row : indexPath.row - 1; } - (NSInteger)rowsCount { - SearchResultsWrapper * wrapper = self.wrapper; - NSInteger const wrapperCount = [wrapper count]; - NSInteger resultsCount; - if (wrapperCount) - resultsCount = (wrapperCount == 1) ? 1 : wrapperCount + 1; + if (self.isShowingCategories) + return [self.categoriesNames count]; else - resultsCount = 0; - - resultsCount = wrapperCount; - - return self.isShowingCategories ? [self.categoriesNames count] : resultsCount; + return [self.wrapper suggestsCount] ? [self.wrapper count] : [self.wrapper count] + 1; } - (NSArray *)categoriesNames @@ -654,10 +711,25 @@ static void OnSearchResultCallback(search::Results const & results) _tableView.dataSource = self; _tableView.backgroundColor = [UIColor colorWithColorCode:@"414451"]; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + [_tableView addSubview:self.suggestsTopImageView]; + self.suggestsTopImageView.maxY = 0; } return _tableView; } +- (UIImageView *)suggestsTopImageView +{ + if (!_suggestsTopImageView) + { + UIImage * image = [[UIImage imageNamed:@"SearchSuggestBackgroundMiddle"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 40, 10, 40)]; + _suggestsTopImageView = [[UIImageView alloc] initWithImage:image]; + _suggestsTopImageView.frame = CGRectMake(0, 0, self.width, 600); + _suggestsTopImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + _suggestsTopImageView.hidden = YES; + } + return _suggestsTopImageView; +} + - (SolidTouchImageView *)topBackgroundView { if (!_topBackgroundView) diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal.png b/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal.png index 65d575954d..2eec1501b0 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal.png and b/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal@2x.png b/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal@2x.png index 6193daecc6..bc171b5f37 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal@2x.png and b/iphone/Maps/Images.xcassets/Location Button/LocationDefault.imageset/my-position-normal@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow.png b/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow.png index 8c0aa8cc30..b3b662296a 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow.png and b/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow@2x.png b/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow@2x.png index 6d989d2d26..97a369d1ae 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow@2x.png and b/iphone/Maps/Images.xcassets/Location Button/LocationFollow.imageset/my-position-auto-follow@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search.png b/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search.png index f8e5642f50..aaa7da5d2f 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search.png and b/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search@2x.png b/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search@2x.png index 1a4948a5bc..cf4b67d1ee 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search@2x.png and b/iphone/Maps/Images.xcassets/Location Button/LocationSearch.imageset/my-position-search@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed.png b/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed.png index 16db495b93..c0448f27e0 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed.png and b/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed.png differ diff --git a/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed@2x.png b/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed@2x.png index 33093e9459..3c31408337 100644 Binary files a/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed@2x.png and b/iphone/Maps/Images.xcassets/Location Button/LocationSelected.imageset/my-position-pressed@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Arrow.png b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Arrow.png new file mode 100644 index 0000000000..65942b8492 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Arrow.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Arrow@2x.png b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Arrow@2x.png new file mode 100644 index 0000000000..7304b56cc5 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Arrow@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Contents.json b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Contents.json index b826d372ef..386cf9590b 100644 --- a/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Contents.json +++ b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/Contents.json @@ -2,12 +2,13 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x" + "scale" : "1x", + "filename" : "Arrow.png" }, { "idiom" : "universal", "scale" : "2x", - "filename" : "PlacePageArrow@2x.png" + "filename" : "Arrow@2x.png" } ], "info" : { diff --git a/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/PlacePageArrow@2x.png b/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/PlacePageArrow@2x.png deleted file mode 100644 index 8fa06d8434..0000000000 Binary files a/iphone/Maps/Images.xcassets/Place Page/PlacePageArrow.imageset/PlacePageArrow@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/SearchBarShadow.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/SearchBarShadow.imageset/Contents.json new file mode 100644 index 0000000000..1ffa05a7f4 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/SearchBarShadow.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "SearchBarShadow@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/SearchBarShadow.imageset/SearchBarShadow@2x.png b/iphone/Maps/Images.xcassets/Search/SearchBarShadow.imageset/SearchBarShadow@2x.png new file mode 100644 index 0000000000..4771f37ea4 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/SearchBarShadow.imageset/SearchBarShadow@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundBottom.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundBottom.imageset/Contents.json new file mode 100644 index 0000000000..d573753ea4 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundBottom.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "SearchSuggestBackgroundBottom@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundBottom.imageset/SearchSuggestBackgroundBottom@2x.png b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundBottom.imageset/SearchSuggestBackgroundBottom@2x.png new file mode 100644 index 0000000000..3d380e2559 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundBottom.imageset/SearchSuggestBackgroundBottom@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundMiddle.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundMiddle.imageset/Contents.json new file mode 100644 index 0000000000..ea829c49bf --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundMiddle.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "SearchSuggestBackgroundMiddle@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundMiddle.imageset/SearchSuggestBackgroundMiddle@2x.png b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundMiddle.imageset/SearchSuggestBackgroundMiddle@2x.png new file mode 100644 index 0000000000..d272bd4962 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/SearchSuggestBackgroundMiddle.imageset/SearchSuggestBackgroundMiddle@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundBottom.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundBottom.imageset/Contents.json new file mode 100644 index 0000000000..ed7616c493 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundBottom.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "SearchSuggestSelectedBackgroundBottom@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundBottom.imageset/SearchSuggestSelectedBackgroundBottom@2x.png b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundBottom.imageset/SearchSuggestSelectedBackgroundBottom@2x.png new file mode 100644 index 0000000000..ae785cab0b Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundBottom.imageset/SearchSuggestSelectedBackgroundBottom@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundMiddle.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundMiddle.imageset/Contents.json new file mode 100644 index 0000000000..36cb95bdf4 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundMiddle.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "SearchSuggestSelectedBackgroundMiddle@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundMiddle.imageset/SearchSuggestSelectedBackgroundMiddle@2x.png b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundMiddle.imageset/SearchSuggestSelectedBackgroundMiddle@2x.png new file mode 100644 index 0000000000..3e4ee46c49 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/SearchSuggestSelectedBackgroundMiddle.imageset/SearchSuggestSelectedBackgroundMiddle@2x.png differ diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 6a548e01e7..4d1a8871d6 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -90,6 +90,8 @@ 97C98652186C5EF000AF7E9E /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97C98651186C5EF000AF7E9E /* iAd.framework */; }; 97C98654186C5F0500AF7E9E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97C98653186C5F0500AF7E9E /* AudioToolbox.framework */; }; 97C98656186C734000AF7E9E /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97C98655186C734000AF7E9E /* AVFoundation.framework */; }; + 97CC93BB19599F4700369B42 /* SearchSuggestCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97CC93BA19599F4700369B42 /* SearchSuggestCell.m */; }; + 97CC93BC19599F4700369B42 /* SearchSuggestCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97CC93BA19599F4700369B42 /* SearchSuggestCell.m */; }; 97D092B1190A681F00FF645B /* PlacePageInfoCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97D092B0190A681F00FF645B /* PlacePageInfoCell.mm */; }; 97D092B2190A681F00FF645B /* PlacePageInfoCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97D092B0190A681F00FF645B /* PlacePageInfoCell.mm */; }; 97D092B5190A6E1D00FF645B /* PlacePageEditCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97D092B4190A6E1D00FF645B /* PlacePageEditCell.mm */; }; @@ -1408,6 +1410,8 @@ 97C98651186C5EF000AF7E9E /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iAd.framework; path = System/Library/Frameworks/iAd.framework; sourceTree = SDKROOT; }; 97C98653186C5F0500AF7E9E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 97C98655186C734000AF7E9E /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 97CC93B919599F4700369B42 /* SearchSuggestCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchSuggestCell.h; sourceTree = ""; }; + 97CC93BA19599F4700369B42 /* SearchSuggestCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchSuggestCell.m; sourceTree = ""; }; 97D092AF190A681F00FF645B /* PlacePageInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlacePageInfoCell.h; sourceTree = ""; }; 97D092B0190A681F00FF645B /* PlacePageInfoCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePageInfoCell.mm; sourceTree = ""; }; 97D092B3190A6E1D00FF645B /* PlacePageEditCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlacePageEditCell.h; sourceTree = ""; }; @@ -2370,6 +2374,8 @@ 97A8002618B2741C000C07A2 /* SearchCell.m */, 97A8001218B2140A000C07A2 /* SearchUniversalCell.h */, 97A8001318B2140A000C07A2 /* SearchUniversalCell.m */, + 97CC93B919599F4700369B42 /* SearchSuggestCell.h */, + 97CC93BA19599F4700369B42 /* SearchSuggestCell.m */, ); name = Search; sourceTree = ""; @@ -4432,6 +4438,7 @@ FA36B80D15403A4F004560CC /* BookmarksVC.mm in Sources */, 9769D6EF1912BF3000CA6158 /* ContainerView.mm in Sources */, FAF457E715597D4600DCCC49 /* Framework.cpp in Sources */, + 97CC93BB19599F4700369B42 /* SearchSuggestCell.m in Sources */, FA054612155C465E001F4E37 /* SelectSetVC.mm in Sources */, FAA614B8155F16950031C345 /* AddSetVC.mm in Sources */, FAAEA7D5161D8D3100CCD661 /* BookmarksRootVC.mm in Sources */, @@ -4497,6 +4504,7 @@ 97A8002818B2741C000C07A2 /* SearchCell.m in Sources */, 974386DE19373EA400FD5659 /* ToastView.m in Sources */, FA054613155C465E001F4E37 /* SelectSetVC.mm in Sources */, + 97CC93BC19599F4700369B42 /* SearchSuggestCell.m in Sources */, FAA614B9155F16950031C345 /* AddSetVC.mm in Sources */, FAAEA7D6161D8D3100CCD661 /* BookmarksRootVC.mm in Sources */, 97D092B6190A6E1D00FF645B /* PlacePageEditCell.mm in Sources */, diff --git a/search/result.cpp b/search/result.cpp index f365673ebf..4547e12cd1 100644 --- a/search/result.cpp +++ b/search/result.cpp @@ -115,6 +115,19 @@ bool Results::AddResultCheckExisting(Result const & r) return false; } +size_t Results::GetSuggestsCount() const +{ + size_t suggestsCount = 0; + for (size_t i = 0; i < GetCount(); i++) + { + if (m_vec[i].GetResultType() == search::Result::RESULT_SUGGESTION) + suggestsCount++; + else + break; + } + return suggestsCount; +} + //////////////////////////////////////////////////////////////////////////////////// // AddressInfo implementation //////////////////////////////////////////////////////////////////////////////////// diff --git a/search/result.hpp b/search/result.hpp index ca00891cb5..e1a663be7f 100644 --- a/search/result.hpp +++ b/search/result.hpp @@ -124,6 +124,7 @@ public: inline IterT End() const { return m_vec.end(); } inline size_t GetCount() const { return m_vec.size(); } + size_t GetSuggestsCount() const; inline Result const & GetResult(size_t i) const {