From 43000502e3b1dd5c248e8e42d4551cb19745a0f7 Mon Sep 17 00:00:00 2001 From: Igor Khmurets Date: Thu, 3 Jul 2014 19:44:50 +0300 Subject: [PATCH] [ios] PP logic after switching 'My position' off --- iphone/Maps/Classes/MapViewController.mm | 11 +++++++++-- iphone/Maps/Classes/PlacePageView.h | 6 ++++-- iphone/Maps/Classes/PlacePageView.mm | 21 +++++++++++++-------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index f31076c9c8..9ea9a51592 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -230,6 +230,13 @@ const long long LITE_IDL = 431183278L; [[MapsAppDelegate theApp] enableStandby]; [[MapsAppDelegate theApp].m_locationManager stop:self]; + PlacePageView * placePage = self.containerView.placePage; + [[MapsAppDelegate theApp].m_locationManager stop:placePage]; + if ([placePage isMyPosition]) + [placePage setState:PlacePageStateHidden animated:YES withCallback:YES]; + else + [placePage setState:placePage.state animated:YES withCallback:YES]; + self.toolbarView.locationButton.selected = NO; [self.toolbarView.locationButton setImage:[UIImage imageNamed:@"LocationDefault"] forState:UIControlStateSelected]; } @@ -405,8 +412,8 @@ const long long LITE_IDL = 431183278L; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - [self updatePointsFromEvent:event]; - [self stopCurrentAction]; + [self updatePointsFromEvent:event]; + [self stopCurrentAction]; UITouch * theTouch = (UITouch *)[touches anyObject]; NSUInteger const tapCount = theTouch.tapCount; diff --git a/iphone/Maps/Classes/PlacePageView.h b/iphone/Maps/Classes/PlacePageView.h index cd7d904964..e343a43b05 100644 --- a/iphone/Maps/Classes/PlacePageView.h +++ b/iphone/Maps/Classes/PlacePageView.h @@ -3,6 +3,7 @@ #include "../../map/bookmark.hpp" #include "../../geometry/point2d.hpp" #import "UIKitCategories.h" +#import "LocationManager.h" typedef NS_ENUM(NSUInteger, PlacePageState) { PlacePageStateHidden, @@ -20,7 +21,8 @@ typedef NS_ENUM(NSUInteger, PlacePageState) { @end -@interface PlacePageView : SolidTouchView + +@interface PlacePageView : SolidTouchView - (void)showUserMark:(UserMarkCopy *)mark; @@ -30,8 +32,8 @@ typedef NS_ENUM(NSUInteger, PlacePageState) { @property (nonatomic, weak) id delegate; - (m2::PointD)pinPoint; +- (BOOL)isMyPosition; @property (nonatomic, readonly) NSString * temporaryTitle; - @property (nonatomic) BOOL statusBarIncluded; @end diff --git a/iphone/Maps/Classes/PlacePageView.mm b/iphone/Maps/Classes/PlacePageView.mm index b34de75475..6d3403baee 100644 --- a/iphone/Maps/Classes/PlacePageView.mm +++ b/iphone/Maps/Classes/PlacePageView.mm @@ -21,7 +21,7 @@ typedef NS_ENUM(NSUInteger, CellRow) CellRowShare, }; -@interface PlacePageView () +@interface PlacePageView () { BOOL m_hasSpeed; } @@ -128,7 +128,7 @@ typedef NS_ENUM(NSUInteger, CellRow) PlacePageInfoCell * cell = (PlacePageInfoCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:ROW_COMMON inSection:0]]; [cell updateDistance]; - if ([self isMarkOfType:UserMark::MY_POSITION]) + if ([self isMyPosition]) { BOOL hasSpeed = NO; self.typeLabel.text = [[MapsAppDelegate theApp].m_locationManager formattedSpeedAndAltitude:hasSpeed]; @@ -187,7 +187,7 @@ typedef NS_ENUM(NSUInteger, CellRow) cell.color = [ColorPickerView colorForName:[self colorName]]; cell.selectedColorView.alpha = [self isBookmark] ? 1 : 0; cell.delegate = self; - cell.myPositionMode = [self isMarkOfType:UserMark::MY_POSITION]; + cell.myPositionMode = [self isMyPosition]; return cell; } else if (row == CellRowSet) @@ -219,7 +219,7 @@ typedef NS_ENUM(NSUInteger, CellRow) { CellRow row = [self cellRowForIndexPath:indexPath]; if (row == CellRowCommon) - return [PlacePageInfoCell cellHeightWithAddress:self.address viewWidth:tableView.width inMyPositionMode:[self isMarkOfType:UserMark::MY_POSITION]]; + return [PlacePageInfoCell cellHeightWithAddress:self.address viewWidth:tableView.width inMyPositionMode:[self isMyPosition]]; else if (row == CellRowSet) return [PlacePageEditCell cellHeightWithTextValue:self.setName viewWidth:tableView.width]; else if (row == CellRowInfo) @@ -246,7 +246,7 @@ typedef NS_ENUM(NSUInteger, CellRow) [self.titleLabel sizeToFit]; self.titleLabel.origin = CGPointMake(23, 29); - if ([self isMarkOfType:UserMark::MY_POSITION]) + if ([self isMyPosition]) self.typeLabel.text = [[MapsAppDelegate theApp].m_locationManager formattedSpeedAndAltitude:m_hasSpeed]; else self.typeLabel.text = self.types; @@ -352,7 +352,7 @@ typedef NS_ENUM(NSUInteger, CellRow) else if (self.state == PlacePageStateOpened) { self.titleLabel.userInteractionEnabled = YES; - CGFloat const infoCellHeight = [PlacePageInfoCell cellHeightWithAddress:self.address viewWidth:self.tableView.width inMyPositionMode:[self isMarkOfType:UserMark::MY_POSITION]]; + CGFloat const infoCellHeight = [PlacePageInfoCell cellHeightWithAddress:self.address viewWidth:self.tableView.width inMyPositionMode:[self isMyPosition]]; CGFloat fullHeight = [self headerHeight] + infoCellHeight + [PlacePageShareCell cellHeight]; if ([self isBookmark]) { @@ -656,6 +656,11 @@ typedef NS_ENUM(NSUInteger, CellRow) return m_mark ? [self userMark]->GetMarkType() == type : NO; } +- (BOOL)isMyPosition +{ + return [self isMarkOfType:UserMark::MY_POSITION]; +} + - (BOOL)isBookmark { return [self isMarkOfType:UserMark::BOOKMARK]; @@ -673,7 +678,7 @@ typedef NS_ENUM(NSUInteger, CellRow) - (NSString *)newBookmarkName { - if ([self isMarkOfType:UserMark::MY_POSITION]) + if ([self isMyPosition]) { Framework & f = GetFramework(); search::AddressInfo info; @@ -794,7 +799,7 @@ typedef NS_ENUM(NSUInteger, CellRow) if (needUpdateAddressInfo) { needUpdateAddressInfo = NO; - if ([self isMarkOfType:UserMark::POI] || [self isMarkOfType:UserMark::SEARCH] || [self isMarkOfType:UserMark::MY_POSITION]) + if ([self isMarkOfType:UserMark::POI] || [self isMarkOfType:UserMark::SEARCH] || [self isMyPosition]) { SearchMarkPoint const * mark = static_cast([self userMark]); m_addressInfo = mark->GetInfo();