forked from organicmaps/organicmaps
[ios] Added speed and altitude to my position.
This commit is contained in:
parent
7ae08600e6
commit
76b9559787
6 changed files with 35 additions and 0 deletions
|
@ -25,5 +25,6 @@
|
|||
- (void)addBookmark;
|
||||
- (void)removeBookmark;
|
||||
- (void)reloadBookmarkCell;
|
||||
- (void)updateAndLayoutMyPositionSpeedAndAltitude:(NSString *)text;
|
||||
|
||||
@end
|
||||
|
|
|
@ -186,6 +186,12 @@ static CGFloat const kTitleBottomOffset = 2.;
|
|||
[self.ownerPlacePage.manager showDirectionViewWithTitle:self.titleLabel.text type:self.typeLabel.text];
|
||||
}
|
||||
|
||||
- (void)updateAndLayoutMyPositionSpeedAndAltitude:(NSString *)text
|
||||
{
|
||||
self.typeLabel.text = text;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMBasePlacePageView (UITableView)
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
- (void)setDirectionArrowTransform:(CGAffineTransform)transform;
|
||||
- (void)setDistance:(NSString *)distance;
|
||||
- (void)updateMyPositionStatus:(NSString *)status;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithManager: instead")));
|
||||
|
||||
|
|
|
@ -111,6 +111,11 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
self.basePlacePageView.distanceLabel.text = distance;
|
||||
}
|
||||
|
||||
- (void)updateMyPositionStatus:(NSString *)status
|
||||
{
|
||||
[self.basePlacePageView updateAndLayoutMyPositionSpeedAndAltitude:status];
|
||||
}
|
||||
|
||||
- (void)changeBookmarkCategory
|
||||
{
|
||||
MWMPlacePageViewManager * manager = self.manager;
|
||||
|
|
|
@ -94,6 +94,11 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
|
||||
- (void)configPlacePage
|
||||
{
|
||||
if (self.entity.type == MWMPlacePageEntityTypeMyPosition)
|
||||
{
|
||||
BOOL hasSpeed;
|
||||
self.entity.category = [[MapsAppDelegate theApp].m_locationManager formattedSpeedAndAltitude:hasSpeed];
|
||||
}
|
||||
[self.placePage configure];
|
||||
[self.placePage show];
|
||||
[self updateDistance];
|
||||
|
@ -105,6 +110,14 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
self.placePage = [[MWMiPadPlacePage alloc] initWithManager:self];
|
||||
}
|
||||
|
||||
- (void)updateMyPositionSpeedAndAltitude
|
||||
{
|
||||
if (self.entity.type != MWMPlacePageEntityTypeMyPosition)
|
||||
return;
|
||||
BOOL hasSpeed = NO;
|
||||
[self.placePage updateMyPositionStatus:[[MapsAppDelegate theApp].m_locationManager formattedSpeedAndAltitude:hasSpeed]];
|
||||
}
|
||||
|
||||
- (void)setPlacePageForiPhoneWithOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
if (self.state == MWMPlacePageManagerStateClosed)
|
||||
|
@ -200,6 +213,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
- (void)onLocationUpdate:(location::GpsInfo const &)info
|
||||
{
|
||||
[self updateDistance];
|
||||
[self updateMyPositionSpeedAndAltitude];
|
||||
}
|
||||
|
||||
- (void)updateDistance
|
||||
|
|
|
@ -109,6 +109,14 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
|
|||
self.state = MWMiPhonePortraitPlacePageStatePreview;
|
||||
}
|
||||
|
||||
- (void)updateMyPositionStatus:(NSString *)status
|
||||
{
|
||||
[super updateMyPositionStatus:status];
|
||||
// Setup current state.
|
||||
MWMiPhonePortraitPlacePageState currentState = self.state;
|
||||
self.state = currentState;
|
||||
}
|
||||
|
||||
- (void)setState:(MWMiPhonePortraitPlacePageState)state
|
||||
{
|
||||
CGSize const size = UIScreen.mainScreen.bounds.size;
|
||||
|
|
Loading…
Add table
Reference in a new issue