forked from organicmaps/organicmaps
Search Screen. Check if location is valid in "near me" screen, if not tell about it to user.
Search Screen. Check if location is valid in "near me" screen, if not tell about it to user.
This commit is contained in:
parent
105c34e4a2
commit
55b4389716
3 changed files with 14 additions and 6 deletions
|
@ -363,7 +363,7 @@ static void OnSearchResultCallback(search::Results const & res)
|
|||
static NSString *CellIdentifier = @"categoryCell";
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
||||
if (cell == nil)
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
|
||||
}
|
||||
|
@ -377,12 +377,18 @@ static void OnSearchResultCallback(search::Results const & res)
|
|||
if ([m_searchBar.text length] != 0 && ![[_searchResults objectAtIndex:scopeSection] getCount] && numberOfRowsInEmptySearch)
|
||||
{
|
||||
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"NoResultsCell"];
|
||||
if (cell == nil)
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"NoResultsCell"] autorelease];
|
||||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||||
cell.textLabel.text = NSLocalizedString(@"no_search_results_found", nil);
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"NoResultsCell"] autorelease];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
cell.textLabel.text = NSLocalizedString(@"no_search_results_found", nil);
|
||||
|
||||
// check if we have no position in "near me" screen
|
||||
if (![m_locationManager lastLocationIsValid] && scopeSection == 0)
|
||||
cell.detailTextLabel.text = NSLocalizedString(@"unknown_current_position", nil);
|
||||
else
|
||||
cell.detailTextLabel.text = @"";
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,4 +35,6 @@
|
|||
- (bool)getNorthRad:(double &)rad;
|
||||
|
||||
+ (NSString *)formatDistance:(double)meters;
|
||||
|
||||
- (bool)lastLocationIsValid;
|
||||
@end
|
||||
|
|
|
@ -245,7 +245,7 @@
|
|||
return [NSString stringWithUTF8String:s.c_str()];
|
||||
}
|
||||
|
||||
-(bool)lastLocationIsValid
|
||||
- (bool)lastLocationIsValid
|
||||
{
|
||||
return (([self lastLocation] != nil) && ([m_lastLocationTime timeIntervalSinceNow] > -300.0));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue