Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorv.mikhaylenko <v.mikhaylenko@corp.mail.ru>2015-05-25 16:13:04 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:52:39 +0300
commit279c4e252521359d59d76e533b7cde41a74183e9 (patch)
tree614a5a8462f69c0b81342d7fbcf19f49cf2e8f18 /iphone/Maps/Classes
parent279e4649433bcbc06e888d557f77d7dd8708fa98 (diff)
[ios] Made place page for iPad. Added big compas view. Added bookmarks edit.
Diffstat (limited to 'iphone/Maps/Classes')
-rw-r--r--iphone/Maps/Classes/BookmarkDescriptionVC.mm1
-rw-r--r--iphone/Maps/Classes/ContainerView.h4
-rw-r--r--iphone/Maps/Classes/ContainerView.mm192
-rw-r--r--iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm1
-rw-r--r--iphone/Maps/Classes/MWMAnimator.mm6
-rw-r--r--iphone/Maps/Classes/MWMBasePlacePageView.h11
-rw-r--r--iphone/Maps/Classes/MWMBasePlacePageView.mm181
-rw-r--r--iphone/Maps/Classes/MWMBookmarkColorCell.h19
-rw-r--r--iphone/Maps/Classes/MWMBookmarkColorCell.mm45
-rw-r--r--iphone/Maps/Classes/MWMBookmarkColorCell.xib54
-rw-r--r--iphone/Maps/Classes/MWMBookmarkColorViewController.h18
-rw-r--r--iphone/Maps/Classes/MWMBookmarkColorViewController.mm188
-rw-r--r--iphone/Maps/Classes/MWMBookmarkColorViewController.xib40
-rw-r--r--iphone/Maps/Classes/MWMBookmarkDescriptionViewController.h19
-rw-r--r--iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm184
-rw-r--r--iphone/Maps/Classes/MWMBookmarkDescriptionViewController.xib49
-rw-r--r--iphone/Maps/Classes/MWMDirectionView.h21
-rw-r--r--iphone/Maps/Classes/MWMDirectionView.mm150
-rw-r--r--iphone/Maps/Classes/MWMDirectionView.xib70
-rw-r--r--iphone/Maps/Classes/MWMExtendedPlacePageView.h13
-rw-r--r--iphone/Maps/Classes/MWMExtendedPlacePageView.m22
-rw-r--r--iphone/Maps/Classes/MWMPlacePage.h17
-rw-r--r--iphone/Maps/Classes/MWMPlacePage.mm110
-rw-r--r--iphone/Maps/Classes/MWMPlacePageActionBar.h5
-rw-r--r--iphone/Maps/Classes/MWMPlacePageActionBar.mm99
-rw-r--r--iphone/Maps/Classes/MWMPlacePageBookmarkCell.h9
-rw-r--r--iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm84
-rw-r--r--iphone/Maps/Classes/MWMPlacePageDescriptionView.xib80
-rw-r--r--iphone/Maps/Classes/MWMPlacePageEntity.h29
-rw-r--r--iphone/Maps/Classes/MWMPlacePageEntity.mm194
-rw-r--r--iphone/Maps/Classes/MWMPlacePageInfoCell.h3
-rw-r--r--iphone/Maps/Classes/MWMPlacePageInfoCell.mm53
-rw-r--r--iphone/Maps/Classes/MWMPlacePageNavigationBar.h6
-rw-r--r--iphone/Maps/Classes/MWMPlacePageNavigationBar.mm102
-rw-r--r--iphone/Maps/Classes/MWMPlacePageTypeDescription.h21
-rw-r--r--iphone/Maps/Classes/MWMPlacePageTypeDescription.mm61
-rw-r--r--iphone/Maps/Classes/MWMPlacePageViewManager.h12
-rw-r--r--iphone/Maps/Classes/MWMPlacePageViewManager.mm155
-rw-r--r--iphone/Maps/Classes/MWMSpringAnimation.mm5
-rw-r--r--iphone/Maps/Classes/MWMTextView.h15
-rw-r--r--iphone/Maps/Classes/MWMTextView.mm139
-rw-r--r--iphone/Maps/Classes/MWMiPadPlacePage.mm141
-rw-r--r--iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm60
-rw-r--r--iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm140
-rw-r--r--iphone/Maps/Classes/MapViewController.mm215
-rw-r--r--iphone/Maps/Classes/MapsAppDelegate.mm11
-rw-r--r--iphone/Maps/Classes/PlacePageActionBar.xib48
-rw-r--r--iphone/Maps/Classes/PlacePageBookmarkCell.xib102
-rw-r--r--iphone/Maps/Classes/PlacePageInfoCell.mm1
-rw-r--r--iphone/Maps/Classes/PlacePageInfoCell.xib24
-rw-r--r--iphone/Maps/Classes/PlacePageLinkCell.xib12
-rw-r--r--iphone/Maps/Classes/PlacePageNavigationBar.xib2
-rw-r--r--iphone/Maps/Classes/PlacePageView.mm15
-rw-r--r--iphone/Maps/Classes/PlacePageView.xib56
-rw-r--r--iphone/Maps/Classes/SmallCompassView.mm1
-rw-r--r--iphone/Maps/Classes/UIViewController+Navigation.mm17
56 files changed, 2713 insertions, 619 deletions
diff --git a/iphone/Maps/Classes/BookmarkDescriptionVC.mm b/iphone/Maps/Classes/BookmarkDescriptionVC.mm
index 59dcfe9ce3..42b10d7fea 100644
--- a/iphone/Maps/Classes/BookmarkDescriptionVC.mm
+++ b/iphone/Maps/Classes/BookmarkDescriptionVC.mm
@@ -14,7 +14,6 @@
- (void)viewDidLoad
{
[super viewDidLoad];
-
self.title = L(@"description");
BookmarkCategory const * category = GetFramework().GetBmCategory(self.bookmarkAndCategory.first);
diff --git a/iphone/Maps/Classes/ContainerView.h b/iphone/Maps/Classes/ContainerView.h
index 837310a43a..b972aae344 100644
--- a/iphone/Maps/Classes/ContainerView.h
+++ b/iphone/Maps/Classes/ContainerView.h
@@ -1,9 +1,9 @@
#import <UIKit/UIKit.h>
-#import "PlacePageView.h"
+//#import "PlacePageView.h"
@interface ContainerView : UIView
-@property (nonatomic) PlacePageView * placePage;
+//@property (nonatomic) PlacePageView * placePage;
@end
diff --git a/iphone/Maps/Classes/ContainerView.mm b/iphone/Maps/Classes/ContainerView.mm
index 860b0cc3a9..37f1727342 100644
--- a/iphone/Maps/Classes/ContainerView.mm
+++ b/iphone/Maps/Classes/ContainerView.mm
@@ -1,96 +1,96 @@
-
-#import "ContainerView.h"
-#import "UIKitCategories.h"
-
-@interface ContainerView ()
-
-@property (nonatomic) SolidTouchView * fadeView;
-@property (nonatomic) SolidTouchView * swipeView;
-
-@end
-
-
-@implementation ContainerView
-
-- (id)initWithFrame:(CGRect)frame
-{
- self = [super initWithFrame:frame];
-
- self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- self.clipsToBounds = YES;
-
- [self addSubview:self.fadeView];
- [self addSubview:self.placePage];
- [self addSubview:self.swipeView];
- self.fadeView.alpha = 0;
- self.swipeView.userInteractionEnabled = NO;
-
- return self;
-}
-
-- (void)swipe:(UISwipeGestureRecognizer *)sender
-{
- if (self.placePage.state == PlacePageStateOpened)
- [self.placePage setState:PlacePageStateHidden animated:YES withCallback:YES];
-}
-
-- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
-{
- return (self.placePage.state == PlacePageStateOpened) ? YES : CGRectIntersectsRect(self.placePage.frame, CGRectMake(point.x, point.y, 0, 0));
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
- if (object == self.placePage && [keyPath isEqualToString:@"state"])
- {
- self.swipeView.frame = CGRectMake(0, self.placePage.maxY, self.width, self.height - self.placePage.height);
- self.swipeView.userInteractionEnabled = (self.placePage.state == PlacePageStateOpened) ? YES : NO;
- [UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
- self.fadeView.alpha = (self.placePage.state == PlacePageStateOpened) ? 1 : 0;
- } completion:^(BOOL finished) {}];
- }
-}
-
-- (void)tap:(UITapGestureRecognizer *)sender
-{
- [self.placePage setState:PlacePageStateHidden animated:YES withCallback:YES];
-}
-
-- (PlacePageView *)placePage
-{
- if (!_placePage)
- {
- _placePage = [[PlacePageView alloc] initWithFrame:self.bounds];
- [_placePage addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew context:nil];
- }
- return _placePage;
-}
-
-- (SolidTouchView *)fadeView
-{
- if (!_fadeView)
- {
- _fadeView = [[SolidTouchView alloc] initWithFrame:self.bounds];
- _fadeView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
- _fadeView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
- }
- return _fadeView;
-}
-
-- (SolidTouchView *)swipeView
-{
- if (!_swipeView)
- {
- _swipeView = [[SolidTouchView alloc] initWithFrame:CGRectZero];
-
- UISwipeGestureRecognizer * swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)];
- [_swipeView addGestureRecognizer:swipe];
- swipe.direction = UISwipeGestureRecognizerDirectionUp;
-
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
- [_swipeView addGestureRecognizer:tap];
- }
- return _swipeView;
-}
-
-@end
+//
+//#import "ContainerView.h"
+//#import "UIKitCategories.h"
+//
+//@interface ContainerView ()
+//
+//@property (nonatomic) SolidTouchView * fadeView;
+//@property (nonatomic) SolidTouchView * swipeView;
+//
+//@end
+//
+//
+//@implementation ContainerView
+//
+//- (id)initWithFrame:(CGRect)frame
+//{
+// self = [super initWithFrame:frame];
+//
+// self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+// self.clipsToBounds = YES;
+//
+// [self addSubview:self.fadeView];
+// [self addSubview:self.placePage];
+// [self addSubview:self.swipeView];
+// self.fadeView.alpha = 0;
+// self.swipeView.userInteractionEnabled = NO;
+//
+// return self;
+//}
+//
+////- (void)swipe:(UISwipeGestureRecognizer *)sender
+////{
+//// if (self.placePage.state == PlacePageStateOpened)
+//// [self.placePage setState:PlacePageStateHidden animated:YES withCallback:YES];
+////}
+//
+//- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
+//{
+// return (self.placePage.state == PlacePageStateOpened) ? YES : CGRectIntersectsRect(self.placePage.frame, CGRectMake(point.x, point.y, 0, 0));
+//}
+//
+//- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+//{
+// if (object == self.placePage && [keyPath isEqualToString:@"state"])
+// {
+// self.swipeView.frame = CGRectMake(0, self.placePage.maxY, self.width, self.height - self.placePage.height);
+// self.swipeView.userInteractionEnabled = (self.placePage.state == PlacePageStateOpened) ? YES : NO;
+// [UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
+// self.fadeView.alpha = (self.placePage.state == PlacePageStateOpened) ? 1 : 0;
+// } completion:^(BOOL finished) {}];
+// }
+//}
+//
+//- (void)tap:(UITapGestureRecognizer *)sender
+//{
+// [self.placePage setState:PlacePageStateHidden animated:YES withCallback:YES];
+//}
+//
+//- (PlacePageView *)placePage
+//{
+// if (!_placePage)
+// {
+// _placePage = [[PlacePageView alloc] initWithFrame:self.bounds];
+// [_placePage addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew context:nil];
+// }
+// return _placePage;
+//}
+//
+//- (SolidTouchView *)fadeView
+//{
+// if (!_fadeView)
+// {
+// _fadeView = [[SolidTouchView alloc] initWithFrame:self.bounds];
+// _fadeView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
+// _fadeView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
+// }
+// return _fadeView;
+//}
+//
+//- (SolidTouchView *)swipeView
+//{
+// if (!_swipeView)
+// {
+// _swipeView = [[SolidTouchView alloc] initWithFrame:CGRectZero];
+//
+// UISwipeGestureRecognizer * swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)];
+// [_swipeView addGestureRecognizer:swipe];
+// swipe.direction = UISwipeGestureRecognizerDirectionUp;
+//
+// UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
+// [_swipeView addGestureRecognizer:tap];
+// }
+// return _swipeView;
+//}
+//
+//@end
diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
index 67fc72a512..c0d324ba83 100644
--- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
+++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
@@ -23,7 +23,6 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
{
self = [super initWithNibName:kAlertControllerNibIdentifier bundle:nil];
if (self)
- {
self.ownerViewController = viewController;
return self;
diff --git a/iphone/Maps/Classes/MWMAnimator.mm b/iphone/Maps/Classes/MWMAnimator.mm
index b47974c89f..fcd6f5cc98 100644
--- a/iphone/Maps/Classes/MWMAnimator.mm
+++ b/iphone/Maps/Classes/MWMAnimator.mm
@@ -13,8 +13,8 @@ static int kScreenAnimationKey;
@interface MWMAnimator ()
-@property (nonatomic) CADisplayLink *displayLink;
-@property (nonatomic) NSMutableSet *animations;
+@property (nonatomic) CADisplayLink * displayLink;
+@property (nonatomic) NSMutableSet * animations;
@end
@@ -25,7 +25,7 @@ static int kScreenAnimationKey;
if (!screen)
screen = [UIScreen mainScreen];
- MWMAnimator *animator = objc_getAssociatedObject(screen, &kScreenAnimationKey);
+ MWMAnimator * animator = objc_getAssociatedObject(screen, &kScreenAnimationKey);
if (!animator)
{
animator = [[self alloc] initWithScreen:screen];
diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.h b/iphone/Maps/Classes/MWMBasePlacePageView.h
index 24f22d4866..c042dabda7 100644
--- a/iphone/Maps/Classes/MWMBasePlacePageView.h
+++ b/iphone/Maps/Classes/MWMBasePlacePageView.h
@@ -8,17 +8,24 @@
#import <UIKit/UIKit.h>
-@class MWMPlacePageEntity;
+@class MWMPlacePageEntity, MWMDirectionView;
@interface MWMBasePlacePageView : UIView
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
@property (weak, nonatomic) IBOutlet UILabel * typeLabel;
@property (weak, nonatomic) IBOutlet UILabel * distanceLabel;
-@property (weak, nonatomic) IBOutlet UIImageView * directionArrow;
+@property (nonatomic) IBOutlet UIImageView * directionArrow;
@property (weak, nonatomic) IBOutlet UITableView * featureTable;
+@property (weak, nonatomic) IBOutlet UIView * separatorView;
+@property (weak, nonatomic) IBOutlet UIButton * directionButton;
+@property (nonatomic) UIView * typeDescriptionView;
+@property (nonatomic) MWMDirectionView * directionView;
- (void)configureWithEntity:(MWMPlacePageEntity *)entity;
- (void)addBookmark;
+- (void)removeBookmark;
+- (void)reloadBookmarkCell;
+- (void)layoutDistanceLabel;
@end
diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.mm b/iphone/Maps/Classes/MWMBasePlacePageView.mm
index 51f94594e8..cbedc20880 100644
--- a/iphone/Maps/Classes/MWMBasePlacePageView.mm
+++ b/iphone/Maps/Classes/MWMBasePlacePageView.mm
@@ -11,15 +11,22 @@
#import "MWMPlacePageInfoCell.h"
#import "MWMPlacePageBookmarkCell.h"
#import "MWMPlacePageEntity.h"
+#import "MWMPlacePage.h"
+#import "MWMPlacePageActionBar.h"
+#import "MWMPlacePageViewManager.h"
+#import "MWMDirectionView.h"
+#import "MWMPlacePageTypeDescription.h"
+#import <CoreLocation/CoreLocation.h>
static NSString * const kPlacePageLinkCellIdentifier = @"PlacePageLinkCell";
static NSString * const kPlacePageInfoCellIdentifier = @"PlacePageInfoCell";
static NSString * const kPlacePageBookmarkCellIdentifier = @"PlacePageBookmarkCell";
-static CGFloat const kBookmarkCellHeight = 204.;
+extern CGFloat const kBookmarkCellHeight = 135.;
@interface MWMBasePlacePageView ()
@property (weak, nonatomic) MWMPlacePageEntity * entity;
+@property (weak, nonatomic) IBOutlet MWMPlacePage * ownerPlacePage;
@end
@@ -44,34 +51,163 @@ static CGFloat const kBookmarkCellHeight = 204.;
- (void)configure
{
- self.titleLabel.text = self.entity.title;
- self.typeLabel.text = self.entity.category;
- self.distanceLabel.text = self.entity.distance;
+ MWMPlacePageEntity const * entity = self.entity;
+ MWMPlacePageEntityType type = entity.type;
+
+ if (type == MWMPlacePageEntityTypeBookmark)
+ {
+ self.titleLabel.text = entity.bookmarkTitle.length > 0 ? entity.bookmarkTitle : entity.title;
+ self.typeLabel.text = entity.bookmarkCategory;
+ }
+ else
+ {
+ self.titleLabel.text = entity.title;
+ self.typeLabel.text = entity.category;
+ }
+
+ BOOL const isMyPosition = type == MWMPlacePageEntityTypeMyPosition;
+ BOOL const isHeadingAvaible = [CLLocationManager headingAvailable];
+ self.distanceLabel.hidden = isMyPosition;
+ self.directionArrow.hidden = isMyPosition || !isHeadingAvaible;
+ self.directionButton.hidden = isMyPosition || !isHeadingAvaible;
+
+ self.distanceLabel.text = @"";
+
self.featureTable.delegate = self;
self.featureTable.dataSource = self;
[self.featureTable reloadData];
+ [self layoutSubviews];
+}
+
+static CGFloat placePageWidth;
+static CGFloat const kPlacePageTitleKoefficient = 0.6375f;
+static CGFloat const leftOffset = 16.;
+static CGFloat const directionArrowSide = 32.;
+static CGFloat const offsetFromTitleToDistance = 12.;
+static CGFloat const offsetFromDistanceToArrow = 8.;
+static CGFloat const titleBottomOffset = 2.;
- CGFloat const titleOffset = 4.;
- CGFloat const typeOffset = 10.;
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+ MWMPlacePageEntity const * entity = self.entity;
+ MWMPlacePageEntityType const type = entity.type;
+
+ CGSize const size = [UIScreen mainScreen].bounds.size;
+ CGFloat const maximumWidth = 360.;
+ placePageWidth = size.width > size.height ? (size.height > maximumWidth ? maximumWidth : size.height) : size.width;
+ CGFloat const maximumTitleWidth = kPlacePageTitleKoefficient * placePageWidth;
+ CGFloat topOffset = (self.typeLabel.text.length > 0 || type == MWMPlacePageEntityTypeEle || type == MWMPlacePageEntityTypeHotel) ? 0 : 4.;
+ CGFloat const typeBottomOffset = 10.;
+ self.width = placePageWidth;
+ self.titleLabel.width = maximumTitleWidth;
[self.titleLabel sizeToFit];
- self.titleLabel.width = self.bounds.size.width * 0.7f;
- self.typeLabel.minY = self.titleLabel.maxY + titleOffset;
- self.featureTable.minY = self.typeLabel.maxY + typeOffset;
- self.directionArrow.center = CGPointMake(self.directionArrow.center.x, self.titleLabel.center.y);
- self.distanceLabel.center = CGPointMake(self.distanceLabel.center.x, self.titleLabel.center.y);
+ self.typeLabel.width = maximumTitleWidth;
+ [self.typeLabel sizeToFit];
+ CGFloat const typeMinY = self.titleLabel.maxY + titleBottomOffset;
+
+ self.titleLabel.origin = CGPointMake(leftOffset, topOffset);
+ self.typeLabel.origin = CGPointMake(leftOffset, typeMinY);
+
+ [self layoutDistanceLabel];
+ if (type == MWMPlacePageEntityTypeEle || type == MWMPlacePageEntityTypeHotel)
+ [self layoutTypeDescription];
+
+ CGFloat const typeHeight = self.typeLabel.text.length > 0 ? self.typeLabel.height : self.typeDescriptionView.height;
+ self.featureTable.minY = typeMinY + typeHeight + typeBottomOffset;
+ self.separatorView.minY = self.featureTable.minY - 1;
+// self.directionArrow.center = CGPointMake(self.directionArrow.center.x, self.titleLabel.center.y);
+// self.distanceLabel.center = CGPointMake(self.distanceLabel.center.x, self.titleLabel.center.y);
+// self.directionButton.center = CGPointMake(self.directionArrow.center.x, self.directionArrow.center.y);
self.featureTable.height = self.featureTable.contentSize.height;
+ self.featureTable.contentOffset = CGPointZero;
+ self.height = typeBottomOffset + titleBottomOffset + typeHeight + self.titleLabel.height + self.typeLabel.height + self.featureTable.height;
+}
+
+- (void)layoutTypeDescription
+{
+ MWMPlacePageEntity const * entity = self.entity;
+ CGFloat const typeMinY = self.titleLabel.maxY + titleBottomOffset;
+ [self.typeDescriptionView removeFromSuperview];
+ self.typeDescriptionView = nil;
+ MWMPlacePageTypeDescription * typeDescription = [[MWMPlacePageTypeDescription alloc] initWithPlacePageEntity:entity];
+ self.typeDescriptionView = entity.type == MWMPlacePageEntityTypeHotel ? (UIView *)typeDescription.hotelDescription : (UIView *)typeDescription.eleDescription;
+ self.typeDescriptionView.autoresizingMask = UIViewAutoresizingNone;
+ BOOL const typeLabelIsNotEmpty = self.typeLabel.text.length > 0;
+ CGFloat const minX = typeLabelIsNotEmpty ? self.typeLabel.minX + self.typeLabel.width + 2 *titleBottomOffset : leftOffset;
+ CGFloat const minY = typeLabelIsNotEmpty ? self.typeLabel.center.y - self.typeDescriptionView.height / 2. - 1.: typeMinY;
+ [self addSubview:self.typeDescriptionView];
+ self.typeDescriptionView.origin = CGPointMake(minX, minY);
+}
+
+- (void)layoutDistanceLabel
+{
+ CGFloat const maximumTitleWidth = kPlacePageTitleKoefficient * placePageWidth;
+ CGFloat const distanceLabelWidthPositionLeft = placePageWidth - maximumTitleWidth - directionArrowSide - 2 * leftOffset - offsetFromDistanceToArrow - offsetFromTitleToDistance;
+ self.distanceLabel.width = distanceLabelWidthPositionLeft;
+ [self.distanceLabel sizeToFit];
+ CGFloat const titleCenterY = self.titleLabel.center.y;
+ CGFloat const directionArrowMinX = placePageWidth - leftOffset - directionArrowSide;
+ CGFloat const distanceLabelMinX = directionArrowMinX - self.distanceLabel.width - offsetFromDistanceToArrow;
+ CGFloat const distanceLabelMinY = titleCenterY - self.distanceLabel.height / 2.;
+ CGFloat const directionArrowMinY = titleCenterY - directionArrowSide / 2.;
+ self.distanceLabel.origin = CGPointMake(distanceLabelMinX, distanceLabelMinY);
+ self.directionArrow.center = CGPointMake(directionArrowMinX + directionArrowSide / 2., directionArrowMinY + directionArrowSide / 2.);
+ self.directionButton.origin = self.directionArrow.origin;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { }
- (void)addBookmark
{
+ [self.typeDescriptionView removeFromSuperview];
+ self.typeDescriptionView = nil;
+ self.typeLabel.text = self.entity.bookmarkCategory;
+ [self.typeLabel sizeToFit];
NSUInteger const count = [self.entity.metadata[@"keys"] count];
[self.entity.metadata[@"keys"] insertObject:@"Bookmark" atIndex:count];
- [self.featureTable beginUpdates];
- [self.featureTable insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:count inSection:0]] withRowAnimation:UITableViewRowAnimationAutomatic];
- [self.featureTable endUpdates];
- self.featureTable.height += kBookmarkCellHeight;
+ [self configure];
+}
+
+- (void)removeBookmark
+{
+ [self.entity.metadata[@"keys"] removeObject:@"Bookmark"];
+ [self configure];
+}
+
+- (void)reloadBookmarkCell
+{
+ NSUInteger const count = [self.entity.metadata[@"keys"] count];
+ NSIndexPath * index = [NSIndexPath indexPathForRow:count - 1 inSection:0];
+ [self.featureTable reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationAutomatic];
+}
+
+- (IBAction)directionButtonTap:(id)sender
+{
+ self.directionView = [MWMDirectionView directionViewForViewController:self.ownerPlacePage.manager.ownerViewController];
+ self.directionView.titleLabel.text = self.titleLabel.text;
+ self.directionView.typeLabel.text = self.typeLabel.text;
+ self.directionView.distanceLabel.text = self.distanceLabel.text;
+}
+
+- (MWMDirectionView *)directionView
+{
+ if (_directionView)
+ return _directionView;
+
+ UIView * window = [[[UIApplication sharedApplication] delegate] window];
+ __block MWMDirectionView * view = nil;
+
+ [window.subviews enumerateObjectsUsingBlock:^(id subview, NSUInteger idx, BOOL *stop)
+ {
+ if ([subview isKindOfClass:[MWMDirectionView class]])
+ {
+ view = subview;
+ *stop = YES;
+ }
+ }];
+
+ return view;
}
@end
@@ -84,15 +220,16 @@ static CGFloat const kBookmarkCellHeight = 204.;
if ([currentKey isEqualToString:@"Bookmark"])
return kBookmarkCellHeight;
-
- static CGFloat const kDefaultCellHeight = 44.;
- UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0., 0., self.bounds.size.width * .7f, 10)];
+ CGFloat const kDefaultCellHeight = 44.;
+ CGFloat const defaultWidth = tableView.width;
+ CGFloat const leftOffset = 40.;
+ CGFloat const rightOffset = 22.;
+ UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0., 0., defaultWidth - leftOffset - rightOffset, 10.)];
label.numberOfLines = 0;
label.text = self.entity.metadata[@"values"][indexPath.row];
[label sizeToFit];
- CGFloat const defaultCellOffset = 22.;
- CGFloat const height = MAX(label.height + defaultCellOffset, kDefaultCellHeight);
- return height;
+ CGFloat const defaultCellOffset = 26.;
+ return MAX(label.height + defaultCellOffset, kDefaultCellHeight);
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@@ -112,6 +249,7 @@ static CGFloat const kBookmarkCellHeight = 204.;
cell = [[MWMPlacePageBookmarkCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kPlacePageBookmarkCellIdentifier];
cell.ownerTableView = tableView;
+ cell.placePage = self.ownerPlacePage;
[cell configure];
return cell;
}
@@ -123,6 +261,7 @@ static CGFloat const kBookmarkCellHeight = 204.;
if (cell == nil)
cell = [[MWMPlacePageInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellIdentifier];
+ cell.currentEntity = self.entity;
[cell configureWithIconTitle:currentKey info:self.entity.metadata[@"values"][indexPath.row]];
return cell;
}
diff --git a/iphone/Maps/Classes/MWMBookmarkColorCell.h b/iphone/Maps/Classes/MWMBookmarkColorCell.h
new file mode 100644
index 0000000000..2e0b516b05
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkColorCell.h
@@ -0,0 +1,19 @@
+//
+// MWMBookmarkColorCell.h
+// Maps
+//
+// Created by v.mikhaylenko on 27.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MWMBookmarkColorCell : UITableViewCell
+
+@property (weak, nonatomic) IBOutlet UIButton * colorButton;
+@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
+@property (weak, nonatomic) IBOutlet UIImageView * approveImageView;
+
+- (void)configureWithColorString:(NSString *)colorString;
+
+@end
diff --git a/iphone/Maps/Classes/MWMBookmarkColorCell.mm b/iphone/Maps/Classes/MWMBookmarkColorCell.mm
new file mode 100644
index 0000000000..6c2db0edd7
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkColorCell.mm
@@ -0,0 +1,45 @@
+//
+// MWMBookmarkColorCell.m
+// Maps
+//
+// Created by v.mikhaylenko on 27.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMBookmarkColorCell.h"
+#import "UIKitCategories.h"
+
+extern NSArray * const kBookmarkColorsVariant;
+
+@interface MWMBookmarkColorCell ()
+
+@property (copy, nonatomic) NSString * currentImageName;
+
+@end
+
+@implementation MWMBookmarkColorCell
+
+- (void)configureWithColorString:(NSString *)colorString
+{
+ CGFloat const leftOffset = 60.;
+ CGFloat const rightOffset = 42.;
+ self.currentImageName = colorString;
+ self.titleLabel.text = L([colorString stringByReplacingOccurrencesOfString:@"placemark-" withString:@""]);
+ self.titleLabel.width = self.bounds.size.width - leftOffset - rightOffset;
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated
+{
+ [super setSelected:selected animated:animated];
+ NSMutableString * curentImageMutableString = self.currentImageName.mutableCopy;
+
+ if (selected)
+ [curentImageMutableString appendString:@"-on"];
+ else
+ [curentImageMutableString appendString:@"-off"];
+
+ [self.colorButton setImage:[UIImage imageNamed:curentImageMutableString] forState:UIControlStateNormal];
+ self.approveImageView.hidden = !selected;
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMBookmarkColorCell.xib b/iphone/Maps/Classes/MWMBookmarkColorCell.xib
new file mode 100644
index 0000000000..25e935444f
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkColorCell.xib
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMBookmarkColorViewController"/>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="MWMBookmarkColorCell" id="KGk-i7-Jjw" customClass="MWMBookmarkColorCell">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="3MP-b3-Pk5">
+ <rect key="frame" x="8" y="0.0" width="36" height="43"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
+ <state key="normal">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ </button>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Красный" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="15v-Tv-AWS">
+ <rect key="frame" x="60" y="11" width="216" height="21"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="16"/>
+ <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_approve" id="icw-Gw-rjx">
+ <rect key="frame" x="290" y="15" width="14" height="14"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
+ </imageView>
+ </subviews>
+ </tableViewCellContentView>
+ <inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
+ <connections>
+ <outlet property="approveImageView" destination="icw-Gw-rjx" id="hoe-O8-915"/>
+ <outlet property="colorButton" destination="3MP-b3-Pk5" id="HmX-KA-iq9"/>
+ <outlet property="titleLabel" destination="15v-Tv-AWS" id="ljy-gW-Wvc"/>
+ </connections>
+ <point key="canvasLocation" x="247" y="298"/>
+ </tableViewCell>
+ </objects>
+ <resources>
+ <image name="ic_approve" width="14" height="14"/>
+ </resources>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination" type="retina4"/>
+ </simulatedMetricsContainer>
+</document>
diff --git a/iphone/Maps/Classes/MWMBookmarkColorViewController.h b/iphone/Maps/Classes/MWMBookmarkColorViewController.h
new file mode 100644
index 0000000000..928b1cefff
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkColorViewController.h
@@ -0,0 +1,18 @@
+//
+// MWMBookmarkColorViewController.h
+// Maps
+//
+// Created by v.mikhaylenko on 27.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class MWMPlacePageViewManager;
+
+@interface MWMBookmarkColorViewController : UIViewController
+
+@property (weak, nonatomic) MWMPlacePageViewManager * placePageManager;
+@property (weak, nonatomic) UINavigationController * ownerNavigationController;
+
+@end
diff --git a/iphone/Maps/Classes/MWMBookmarkColorViewController.mm b/iphone/Maps/Classes/MWMBookmarkColorViewController.mm
new file mode 100644
index 0000000000..3f7c70d2ae
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkColorViewController.mm
@@ -0,0 +1,188 @@
+//
+// MWMBookmarkColorViewController.m
+// Maps
+//
+// Created by v.mikhaylenko on 27.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMBookmarkColorViewController.h"
+#import "UIKitCategories.h"
+#import "MWMBookmarkColorCell.h"
+#import "MWMPlacePageEntity.h"
+#import "MWMPlacePageViewManager.h"
+
+@interface MWMTableView : UITableView
+
+@end
+
+@implementation MWMTableView
+
+//- (void)setContentInset:(UIEdgeInsets)contentInset
+//{
+//// Workaround on apple "feature" with navigationController (see NavigationController.mm, line 22).
+// return;
+// [super setContentInset:UIEdgeInsetsZero];
+//}
+////
+//- (void)setContentOffset:(CGPoint)contentOffset
+//{
+//// Workaround on apple "feature" with navigationController (see NavigationController.mm, line 22).
+// [super setContentOffset:CGPointZero];
+//}
+////
+//- (void)setScrollEnabled:(BOOL)scrollEnabled
+//{
+// [super setScrollEnabled:YES];
+//}
+@end
+
+extern NSArray * const kBookmarkColorsVariant;
+
+static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
+
+@interface MWMBookmarkColorViewController ()
+
+@property (weak, nonatomic) IBOutlet UITableView * tableView;
+@property (nonatomic) CGFloat realPlacePageHeight;
+
+@end
+
+@interface MWMBookmarkColorViewController (TableView) <UITableViewDataSource, UITableViewDelegate>
+@end
+
+@implementation MWMBookmarkColorViewController
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ [self.ownerNavigationController setNavigationBarHidden:NO];
+ self.title = L(@"bookmark_color");
+ [self.tableView registerNib:[UINib nibWithNibName:kBookmarkColorCellIdentifier bundle:nil] forCellReuseIdentifier:kBookmarkColorCellIdentifier];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+ [self configureTableViewForOrientation:self.interfaceOrientation];
+ [self.tableView reloadData];
+
+ if (!self.ownerNavigationController)
+ return;
+
+ self.realPlacePageHeight = self.ownerNavigationController.view.height;
+ CGFloat const bottomOffset = 88.;
+ self.ownerNavigationController.view.height = self.tableView.height + bottomOffset;
+ UIImage * backImage = [UIImage imageNamed:@"NavigationBarBackButton"];
+ UIButton * backButton = [[UIButton alloc] initWithFrame:CGRectMake(0., 0., backImage.size.width, backImage.size.height)];
+ [backButton addTarget:self action:@selector(backTap:) forControlEvents:UIControlEventTouchUpInside];
+ [backButton setImage:backImage forState:UIControlStateNormal];
+ UIBarButtonItem * leftButton = [[UIBarButtonItem alloc] initWithCustomView:backButton];
+ [self.navigationItem setLeftBarButtonItem:leftButton];
+}
+
+- (void)viewDidAppear:(BOOL)animated
+{
+ [super viewDidAppear:animated];
+}
+
+- (void)backTap:(id)sender
+{
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (void)configureTableViewForOrientation:(UIInterfaceOrientation)orientation
+{
+ if (self.ownerNavigationController)
+ return;
+
+ CGFloat const defaultHeight = 352.;
+ CGSize size = self.navigationController.view.bounds.size;
+ CGFloat width, height;
+
+ switch (orientation)
+ {
+ case UIInterfaceOrientationUnknown:
+ break;
+
+ case UIInterfaceOrientationPortraitUpsideDown:
+ case UIInterfaceOrientationPortrait:
+ {
+ CGFloat const topOffset = 88.;
+ width = size.width < size.height ? size.width : size.height;
+ height = size.width > size.height ? size.width : size.height;
+ CGFloat const externalHeight = self.navigationController.navigationBar.height + [[UIApplication sharedApplication] statusBarFrame].size.height;
+ CGFloat const actualHeight = defaultHeight > (height - externalHeight) ? height : defaultHeight;
+ self.tableView.frame = CGRectMake(0., topOffset, width, actualHeight);
+// self.tableView.contentInset = UIEdgeInsetsZero;
+ break;
+ }
+
+ case UIInterfaceOrientationLandscapeLeft:
+ case UIInterfaceOrientationLandscapeRight:
+ {
+ CGFloat const navBarHeight = self.navigationController.navigationBar.height;
+ width = size.width > size.height ? size.width : size.height;
+ height = size.width < size.height ? size.width : size.height;
+ CGFloat const currentHeight = height - navBarHeight;
+ CGFloat const actualHeight = currentHeight > defaultHeight ? defaultHeight : currentHeight;
+ self.tableView.frame = CGRectMake(0., navBarHeight, width, actualHeight);
+// self.tableView.contentInset = UIEdgeInsetsZero;
+ break;
+ }
+ }
+}
+
+- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
+{
+ [self configureTableViewForOrientation:self.interfaceOrientation];
+}
+
+- (BOOL)shouldAutorotate
+{
+ return YES;
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [super viewWillDisappear:animated];
+ [self.placePageManager reloadBookmark];
+
+ if (!self.ownerNavigationController)
+ return;
+
+ self.ownerNavigationController.navigationBar.hidden = YES;
+ [self.ownerNavigationController setNavigationBarHidden:YES];
+ self.ownerNavigationController.view.height = self.realPlacePageHeight;
+}
+
+@end
+
+@implementation MWMBookmarkColorViewController (TableView)
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ MWMBookmarkColorCell * cell = (MWMBookmarkColorCell *)[tableView dequeueReusableCellWithIdentifier:kBookmarkColorCellIdentifier];
+ if (!cell)
+ cell = [[MWMBookmarkColorCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kBookmarkColorCellIdentifier];
+
+ NSString * const currentColor = kBookmarkColorsVariant[indexPath.row];
+ [cell configureWithColorString:kBookmarkColorsVariant[indexPath.row]];
+
+ if ([currentColor isEqualToString:self.placePageManager.entity.bookmarkColor] && !cell.selected)
+ [tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
+
+ return cell;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return kBookmarkColorsVariant.count;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ self.placePageManager.entity.bookmarkColor = kBookmarkColorsVariant[indexPath.row];
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMBookmarkColorViewController.xib b/iphone/Maps/Classes/MWMBookmarkColorViewController.xib
new file mode 100644
index 0000000000..f8645e39c6
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkColorViewController.xib
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMBookmarkColorViewController">
+ <connections>
+ <outlet property="tableView" destination="07I-Yr-hrI" id="cuQ-HB-occ"/>
+ <outlet property="view" destination="TjH-fk-Ez1" id="avG-d0-UHK"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="TjH-fk-Ez1">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" id="07I-Yr-hrI" customClass="MWMTableView">
+ <rect key="frame" x="0.0" y="22" width="320" height="352"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
+ <connections>
+ <outlet property="dataSource" destination="-1" id="sfi-es-NXL"/>
+ <outlet property="delegate" destination="-1" id="C78-4z-O7V"/>
+ </connections>
+ </tableView>
+ </subviews>
+ <color key="backgroundColor" red="0.96078431369999995" green="0.96078431369999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
+ <simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
+ <point key="canvasLocation" x="931" y="273"/>
+ </view>
+ </objects>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination" type="retina4"/>
+ </simulatedMetricsContainer>
+</document>
diff --git a/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.h b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.h
new file mode 100644
index 0000000000..4573b099ae
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.h
@@ -0,0 +1,19 @@
+//
+// MWMBookmarkDescriptionViewController.h
+// Maps
+//
+// Created by v.mikhaylenko on 03.06.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class MWMPlacePageViewManager;
+
+@interface MWMBookmarkDescriptionViewController : UIViewController
+
+- (instancetype)initWithPlacePageManager:(MWMPlacePageViewManager *)manager;
+
+@property (weak, nonatomic) UINavigationController * ownerNavigationController;
+
+@end
diff --git a/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm
new file mode 100644
index 0000000000..e61332069f
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.mm
@@ -0,0 +1,184 @@
+//
+// MWMBookmarkDescriptionViewController.m
+// Maps
+//
+// Created by v.mikhaylenko on 03.06.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMBookmarkDescriptionViewController.h"
+#import "MWMPlacePageViewManager.h"
+#import "MWMPlacePage.h"
+#import "MWMPlacePageEntity.h"
+#import "UIKitCategories.h"
+
+static NSString * const kBookmarkDescriptionViewControllerNibName = @"MWMBookmarkDescriptionViewController";
+
+typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
+{
+ BookmarkDescriptionStateEditText,
+ BookmarkDescriptionStateViewHTML,
+ BookmarkDescriptionStateEditHTML
+};
+
+@interface MWMBookmarkDescriptionViewController ()
+
+@property (weak, nonatomic) IBOutlet UITextView * textView;
+@property (weak, nonatomic) IBOutlet UIWebView * webView;
+
+@property (nonatomic) UIBarButtonItem * leftButton;
+@property (nonatomic) UIBarButtonItem * rightButton;
+
+@property (weak, nonatomic) MWMPlacePageViewManager * manager;
+@property (nonatomic) BookmarkDescriptionState state;
+@property (nonatomic) CGFloat realPlacePageHeight;
+
+@end
+
+@implementation MWMBookmarkDescriptionViewController
+
+
+- (instancetype)initWithPlacePageManager:(MWMPlacePageViewManager *)manager
+{
+ self = [super initWithNibName:kBookmarkDescriptionViewControllerNibName bundle:nil];
+ if (self)
+ self.manager = manager;
+
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ [self.ownerNavigationController setNavigationBarHidden:NO];
+ self.navigationItem.title = L(@"description");
+ MWMPlacePageEntity const * entity = self.manager.entity;
+
+ if (entity.isHTMLDescription)
+ self.state = BookmarkDescriptionStateViewHTML;
+ else
+ self.state = BookmarkDescriptionStateEditText;
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ if (!self.ownerNavigationController)
+ return;
+
+ self.realPlacePageHeight = self.ownerNavigationController.view.height;
+ CGFloat const bottomOffset = 88.;
+ self.ownerNavigationController.view.height = self.textView.height + bottomOffset;
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [super viewWillDisappear:animated];
+ if (!self.ownerNavigationController)
+ return;
+
+ self.ownerNavigationController.navigationBar.hidden = YES;
+ [self.ownerNavigationController setNavigationBarHidden:YES];
+ self.ownerNavigationController.view.height = self.realPlacePageHeight;
+}
+
+- (void)setState:(BookmarkDescriptionState)state
+{
+ MWMPlacePageEntity * entity = self.manager.entity;
+ NSString * description = entity.bookmarkDescription;
+ switch (state)
+ {
+ case BookmarkDescriptionStateEditText:
+ case BookmarkDescriptionStateEditHTML:
+
+ [self setupForEditingWithText:description];
+ [self configureNavigationBarForEditing];
+
+ break;
+
+ case BookmarkDescriptionStateViewHTML:
+
+ [self setupForViewWithText:description];
+ [self configureNavigationBarForView];
+ break;
+ }
+ _state = state;
+}
+
+- (void)setupForEditingWithText:(NSString *)text
+{
+ [UIView animateWithDuration:0.2f animations:^
+ {
+ self.webView.alpha = 0.;
+ self.textView.alpha = 1.;
+ }
+ completion:^(BOOL finished)
+ {
+ self.textView.text = text;
+ }];
+}
+
+- (void)setupForViewWithText:(NSString *)text
+{
+ [UIView animateWithDuration:0.2f animations:^
+ {
+ self.webView.alpha = 1.;
+ self.textView.alpha = 0.;
+ }
+ completion:^(BOOL finished)
+ {
+ [self.webView loadHTMLString:text baseURL:nil];
+ }];
+}
+
+- (void)configureNavigationBarForEditing
+{
+ self.leftButton = [[UIBarButtonItem alloc] initWithTitle:L(@"cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelTap:)];
+ self.rightButton = [[UIBarButtonItem alloc] initWithTitle:L(@"done") style:UIBarButtonItemStylePlain target:self action:@selector(doneTap:)];
+ [self setupButtons];
+}
+
+- (void)configureNavigationBarForView
+{
+ self.leftButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"NavigationBarBackButton"] style:UIBarButtonItemStylePlain target:self action:@selector(backTap:)];
+ self.rightButton = [[UIBarButtonItem alloc] initWithTitle:L(@"edit") style:UIBarButtonItemStylePlain target:self action:@selector(editTap:)];
+ [self setupButtons];
+}
+
+- (void)setupButtons
+{
+ [self.navigationItem setLeftBarButtonItem:self.leftButton];
+ [self.navigationItem setRightBarButtonItem:self.rightButton];
+}
+
+- (void)cancelTap:(id)sender
+{
+ if (self.manager.entity.isHTMLDescription)
+ self.state = BookmarkDescriptionStateViewHTML;
+ else
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (void)doneTap:(id)sender
+{
+ MWMPlacePageEntity * entity = self.manager.entity;
+ entity.bookmarkDescription = self.textView.text;
+ [entity synchronize];
+ [self.textView resignFirstResponder];
+
+ if (entity.isHTMLDescription)
+ self.state = BookmarkDescriptionStateViewHTML;
+ else
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (void)backTap:(id)sender
+{
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (void)editTap:(id)sender
+{
+ self.state = BookmarkDescriptionStateEditHTML;
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.xib b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.xib
new file mode 100644
index 0000000000..eb42f9f8a4
--- /dev/null
+++ b/iphone/Maps/Classes/MWMBookmarkDescriptionViewController.xib
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMBookmarkDescriptionViewController">
+ <connections>
+ <outlet property="textView" destination="24o-IB-Pbl" id="sUc-Ad-jBz"/>
+ <outlet property="view" destination="iN0-l3-epB" id="CMc-df-bqm"/>
+ <outlet property="webView" destination="lov-Ku-GJM" id="0tn-HE-9c5"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="iN0-l3-epB">
+ <rect key="frame" x="0.0" y="64" width="320" height="568"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textView clipsSubviews="YES" multipleTouchEnabled="YES" alpha="0.0" contentMode="scaleToFill" id="24o-IB-Pbl" customClass="MWMTextView">
+ <rect key="frame" x="10" y="5" width="300" height="494"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <inset key="contentInset" minX="0.0" minY="-6" maxX="0.0" maxY="0.0"/>
+ <color key="textColor" red="0.12941176470588237" green="0.12941176470588237" blue="0.12941176470588237" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
+ <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="localizedPlaceholder" value="description"/>
+ </userDefinedRuntimeAttributes>
+ </textView>
+ <webView alpha="0.0" contentMode="scaleToFill" id="lov-Ku-GJM">
+ <rect key="frame" x="10" y="69" width="300" height="494"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES"/>
+ </webView>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <nil key="simulatedTopBarMetrics"/>
+ <point key="canvasLocation" x="303" y="292"/>
+ </view>
+ </objects>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination" type="retina4"/>
+ </simulatedMetricsContainer>
+</document>
diff --git a/iphone/Maps/Classes/MWMDirectionView.h b/iphone/Maps/Classes/MWMDirectionView.h
new file mode 100644
index 0000000000..9bab8d0b55
--- /dev/null
+++ b/iphone/Maps/Classes/MWMDirectionView.h
@@ -0,0 +1,21 @@
+//
+// MWMDirectionView.h
+// Maps
+//
+// Created by v.mikhaylenko on 27.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MWMDirectionView : UIView
+
+@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
+@property (weak, nonatomic) IBOutlet UILabel * typeLabel;
+@property (weak, nonatomic) IBOutlet UILabel * distanceLabel;
+@property (weak, nonatomic) IBOutlet UIImageView * directionArrow;
+@property (weak, nonatomic) IBOutlet UIView * contentView;
+
++ (MWMDirectionView *)directionViewForViewController:(UIViewController *)viewController;
+
+@end
diff --git a/iphone/Maps/Classes/MWMDirectionView.mm b/iphone/Maps/Classes/MWMDirectionView.mm
new file mode 100644
index 0000000000..ebb3744e25
--- /dev/null
+++ b/iphone/Maps/Classes/MWMDirectionView.mm
@@ -0,0 +1,150 @@
+//
+// MWMDirectionView.m
+// Maps
+//
+// Created by v.mikhaylenko on 27.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMDirectionView.h"
+#import "UIKitCategories.h"
+#import "MapsAppDelegate.h"
+
+static NSString * const kDirectionViewNibName = @"MWMDirectionView";
+static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
+
+@interface MWMImageView : UIImageView
+
+@end
+
+@implementation MWMImageView
+
+- (void)setFrame:(CGRect)frame
+{
+ [super setFrame:frame];
+
+}
+
+@end
+
+@interface MWMDirectionView ()
+
+@property (weak, nonatomic) UIViewController * ownerController;
+@property (nonatomic) CGSize defaultSize;
+
+@end
+
+@implementation MWMDirectionView
+
++ (MWMDirectionView *)directionViewForViewController:(UIViewController *)viewController
+{
+ MWMDirectionView * view = [[[NSBundle mainBundle] loadNibNamed:kDirectionViewNibName owner:nil options:nil] firstObject];
+ view.ownerController = viewController;
+ view.directionArrow.size = CGSizeMake(kDirectionArrowSide, kDirectionArrowSide);
+ view.directionArrow.image = [UIImage imageNamed:IPAD ? @"direction_big" : @"direction_mini"];
+ [(MapsAppDelegate *)[UIApplication sharedApplication].delegate disableStandby];
+ [view configure];
+ return view;
+}
+
+- (void)configure
+{
+ NSString * const kFontName = @"HelveticaNeue";
+ UIFont * titleFont = IPAD ? [UIFont fontWithName:kFontName size:52.] : [UIFont fontWithName:kFontName size:32.];
+ UIFont * typeFont = IPAD ? [UIFont fontWithName:kFontName size:24.] : [UIFont fontWithName:kFontName size:16.];
+
+ self.titleLabel.font = titleFont;
+ self.distanceLabel.font = titleFont;
+ self.typeLabel.font = typeFont;
+
+ UIViewAutoresizing mask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
+ self.autoresizingMask = mask;
+ self.contentView.autoresizingMask = mask;
+ self.directionArrow.autoresizingMask = UIViewAutoresizingNone;
+ self.frame = self.ownerController.view.frame;
+ [[[[UIApplication sharedApplication] delegate] window] addSubview:self];
+}
+
+- (void)layoutSubviews
+{
+ CGSize const size = [[UIScreen mainScreen] bounds].size;
+ self.size = size;
+ CGFloat const minimumBorderOffset = 40.;
+
+ switch (self.ownerController.interfaceOrientation)
+ {
+ case UIInterfaceOrientationLandscapeLeft:
+ case UIInterfaceOrientationLandscapeRight:
+ {
+ CGFloat const defaultWidth = size.width - 3. * minimumBorderOffset - kDirectionArrowSide;
+ [self resizeLabelsWithWidth:defaultWidth];
+
+ CGFloat const titleOffset = 8.;
+ CGFloat const typeOffset = 24.;
+ CGFloat const contentViewHeight = size.height - 2. * minimumBorderOffset;
+ CGFloat const contentViewOffset = (size.width - self.titleLabel.width - minimumBorderOffset - self.directionArrow.width) / 2.;
+ CGFloat const contentViewWidth = self.titleLabel.width + minimumBorderOffset + self.directionArrow.width;
+ self.contentView.frame = CGRectMake(contentViewOffset, minimumBorderOffset, contentViewWidth, contentViewHeight);
+ self.directionArrow.center = CGPointMake(0., self.contentView.height / 2.);
+ CGFloat const directionArrowOffsetX = self.directionArrow.maxX + minimumBorderOffset;
+ CGFloat const actualLabelsBlockHeight = self.titleLabel.height + titleOffset + self.typeLabel.height + typeOffset + self.distanceLabel.height;
+ CGFloat const labelsBlockTopOffset = (contentViewHeight - actualLabelsBlockHeight) / 2.;
+ self.titleLabel.origin = CGPointMake(directionArrowOffsetX, labelsBlockTopOffset);
+ self.titleLabel.textAlignment = NSTextAlignmentLeft;
+ self.typeLabel.origin = CGPointMake(directionArrowOffsetX, self.titleLabel.maxY + titleOffset);
+ self.typeLabel.textAlignment = NSTextAlignmentLeft;
+ self.distanceLabel.origin = CGPointMake(directionArrowOffsetX, self.typeLabel.maxY + typeOffset);
+ self.distanceLabel.textAlignment = NSTextAlignmentLeft;
+ break;
+ }
+ case UIInterfaceOrientationPortrait:
+ case UIInterfaceOrientationPortraitUpsideDown:
+ {
+ CGFloat const defaultWidth = size.width - 2. * minimumBorderOffset;
+ [self resizeLabelsWithWidth:defaultWidth];
+
+ CGFloat const titleOffset = IPAD ? 12. : 8.;
+ CGFloat const arrowOffset = IPAD ? 80. : 40.;
+ CGFloat const contentViewActualHeight = self.titleLabel.height + titleOffset + self.typeLabel.height + 2. * arrowOffset + kDirectionArrowSide + self.distanceLabel.height;
+ CGFloat const contentViewSize = size.height > contentViewActualHeight ? contentViewActualHeight : size.height;
+ CGFloat const yOffset = (size.height - contentViewSize) / 2.;
+ self.contentView.frame = CGRectMake(minimumBorderOffset, yOffset, defaultWidth, contentViewSize);
+ CGFloat xOffset = self.contentView.width / 2.;
+ self.titleLabel.origin = CGPointMake(xOffset - self.titleLabel.width / 2., 0.);
+ self.titleLabel.textAlignment = NSTextAlignmentCenter;
+ self.typeLabel.origin = CGPointMake(xOffset - self.typeLabel.width / 2., self.titleLabel.maxY + titleOffset);
+ self.typeLabel.textAlignment = NSTextAlignmentCenter;
+ self.directionArrow.center = CGPointMake(xOffset, self.typeLabel.maxY + arrowOffset + kDirectionArrowSide / 2.);
+ self.distanceLabel.origin = CGPointMake(xOffset - self.distanceLabel.width / 2., self.directionArrow.maxY + arrowOffset);
+ self.distanceLabel.textAlignment = NSTextAlignmentCenter;
+
+ break;
+ }
+ case UIInterfaceOrientationUnknown:
+
+ break;
+ }
+}
+
+- (void)resizeLabelsWithWidth:(CGFloat)width
+{
+ self.titleLabel.width = width;
+ self.typeLabel.width = width;
+ self.distanceLabel.width = width;
+ [self.titleLabel sizeToFit];
+ [self.typeLabel sizeToFit];
+ [self.distanceLabel sizeToFit];
+}
+
+- (IBAction)tap:(UITapGestureRecognizer *)sender
+{
+ [self removeFromSuperview];
+}
+
+- (void)removeFromSuperview
+{
+ [(MapsAppDelegate *)[UIApplication sharedApplication].delegate enableStandby];
+ [super removeFromSuperview];
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMDirectionView.xib b/iphone/Maps/Classes/MWMDirectionView.xib
new file mode 100644
index 0000000000..b13826fb6a
--- /dev/null
+++ b/iphone/Maps/Classes/MWMDirectionView.xib
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="hge-yy-9dK" customClass="MWMDirectionView">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <view autoresizesSubviews="NO" contentMode="scaleToFill" id="pOG-zF-o2a">
+ <rect key="frame" x="40" y="120" width="240" height="328"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Аэропорт" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="6QE-ZP-1Wz">
+ <rect key="frame" x="0.0" y="0.0" width="240" height="35"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="32"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="метро" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="pJJ-Om-WmO">
+ <rect key="frame" x="0.0" y="41" width="240" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="16"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="400 М" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="izl-Ei-GSs">
+ <rect key="frame" x="50" y="297" width="140" height="31"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="32"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="GxV-GV-jxj" customClass="MWMImageView">
+ <rect key="frame" x="40" y="84" width="160" height="160"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ </imageView>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </subviews>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.90000000000000002" colorSpace="calibratedRGB"/>
+ <gestureRecognizers/>
+ <connections>
+ <outlet property="contentView" destination="pOG-zF-o2a" id="WLr-CK-VBZ"/>
+ <outlet property="directionArrow" destination="GxV-GV-jxj" id="aJc-nx-gQO"/>
+ <outlet property="distanceLabel" destination="izl-Ei-GSs" id="I3d-IM-XhG"/>
+ <outlet property="titleLabel" destination="6QE-ZP-1Wz" id="ywn-Qi-Mhf"/>
+ <outlet property="typeLabel" destination="pJJ-Om-WmO" id="9kH-tO-qTP"/>
+ <outletCollection property="gestureRecognizers" destination="lOu-cy-wFh" appends="YES" id="Caw-W1-B4s"/>
+ </connections>
+ <point key="canvasLocation" x="360" y="226"/>
+ </view>
+ <tapGestureRecognizer id="lOu-cy-wFh">
+ <connections>
+ <action selector="tap:" destination="hge-yy-9dK" id="sVQ-u6-g3l"/>
+ </connections>
+ </tapGestureRecognizer>
+ </objects>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination" type="retina4"/>
+ </simulatedMetricsContainer>
+</document>
diff --git a/iphone/Maps/Classes/MWMExtendedPlacePageView.h b/iphone/Maps/Classes/MWMExtendedPlacePageView.h
new file mode 100644
index 0000000000..c6dfd127ff
--- /dev/null
+++ b/iphone/Maps/Classes/MWMExtendedPlacePageView.h
@@ -0,0 +1,13 @@
+//
+// MWMExtendedPlacePageView.h
+// Maps
+//
+// Created by v.mikhaylenko on 22.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MWMExtendedPlacePageView : UIView
+
+@end
diff --git a/iphone/Maps/Classes/MWMExtendedPlacePageView.m b/iphone/Maps/Classes/MWMExtendedPlacePageView.m
new file mode 100644
index 0000000000..83201fdb22
--- /dev/null
+++ b/iphone/Maps/Classes/MWMExtendedPlacePageView.m
@@ -0,0 +1,22 @@
+//
+// MWMExtendedPlacePageView.m
+// Maps
+//
+// Created by v.mikhaylenko on 22.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMExtendedPlacePageView.h"
+
+@implementation MWMExtendedPlacePageView
+
+- (instancetype)initWithCoder:(NSCoder *)aDecoder
+{
+ self = [super initWithCoder:aDecoder];
+ if (self)
+ self.autoresizingMask = UIViewAutoresizingNone;
+
+ return self;
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMPlacePage.h b/iphone/Maps/Classes/MWMPlacePage.h
index f5dd3cfbe7..e71bc516b8 100644
--- a/iphone/Maps/Classes/MWMPlacePage.h
+++ b/iphone/Maps/Classes/MWMPlacePage.h
@@ -22,7 +22,24 @@
- (void)show;
- (void)dismiss;
- (void)configure;
+
+#pragma mark - Actions
- (void)addBookmark;
+- (void)removeBookmark;
+- (void)changeBookmarkColor;
+- (void)changeBookmarkCategory;
+- (void)changeBookmarkDescription;
+- (void)share;
+- (void)route;
+- (void)stopBuildingRoute;
+- (void)reloadBookmark;
+- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight;
+- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight;
+
+- (IBAction)didTap:(UITapGestureRecognizer *)sender;
+
+- (void)setArrowAngle:(CGFloat)angle;
+- (void)setDistance:(NSString *)distance;
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithManager: instead")));
diff --git a/iphone/Maps/Classes/MWMPlacePage.mm b/iphone/Maps/Classes/MWMPlacePage.mm
index b699cb4298..536669acbc 100644
--- a/iphone/Maps/Classes/MWMPlacePage.mm
+++ b/iphone/Maps/Classes/MWMPlacePage.mm
@@ -11,8 +11,16 @@
#import "MWMPlacePageEntity.h"
#import "MWMPlacePageViewManager.h"
#import "MWMPlacePageActionBar.h"
+#import "MWMDirectionView.h"
+#import "MWMBookmarkColorViewController.h"
+#import "SelectSetVC.h"
+#import "UIKitCategories.h"
+#import "MWMBookmarkDescriptionViewController.h"
+
+#import "../../3party/Alohalytics/src/alohalytics_objc.h"
static NSString * const kPlacePageNibIdentifier = @"PlacePageView";
+extern NSString * const kAlohalyticsTapEventKey;
@interface MWMPlacePage ()
@@ -29,14 +37,24 @@ static NSString * const kPlacePageNibIdentifier = @"PlacePageView";
{
[[NSBundle mainBundle] loadNibNamed:kPlacePageNibIdentifier owner:self options:nil];
self.manager = manager;
- [self configure];
}
return self;
}
- (void)configure
{
- [self.basePlacePageView configureWithEntity:self.manager.entity];
+ MWMPlacePageEntity * entity = self.manager.entity;
+ [self.basePlacePageView configureWithEntity:entity];
+
+ if (!self.actionBar)
+ self.actionBar = [MWMPlacePageActionBar actionBarForPlacePage:self];
+
+ MWMPlacePageEntityType type = entity.type;
+ BOOL const isBookmark = type == MWMPlacePageEntityTypeBookmark;
+ self.actionBar.bookmarkButton.selected = isBookmark;
+
+ BOOL const isMyPosition = type == MWMPlacePageEntityTypeMyPosition;
+ [self.actionBar configureForMyPosition:isMyPosition];
}
- (void)show
@@ -47,14 +65,98 @@ static NSString * const kPlacePageNibIdentifier = @"PlacePageView";
- (void)dismiss
{
[self.extendedPlacePageView removeFromSuperview];
+ [self.actionBar removeFromSuperview];
+ self.actionBar = nil;
}
+#pragma mark - Actions
+
- (void)addBookmark
{
- [self doesNotRecognizeSelector:_cmd];
+ [self.manager addBookmark];
+ [self.basePlacePageView addBookmark];
+}
+
+- (void)removeBookmark
+{
+ [self.manager removeBookmark];
+ [self.basePlacePageView removeBookmark];
+}
+
+- (void)share
+{
+ [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"ppShare"];
+ [self.manager share];
+}
+
+- (void)route
+{
+ [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"ppRoute"];
+ [self.manager buildRoute];
}
-- (IBAction)didTap:(UITapGestureRecognizer *)sender { }
+- (void)stopBuildingRoute
+{
+ self.actionBar.routeButton.hidden = NO;
+ [self.actionBar dismissActivityIndicatior];
+}
+
+- (void)setArrowAngle:(CGFloat)angle
+{
+ CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_2 - angle);
+
+ self.basePlacePageView.directionArrow.transform = CGAffineTransformIdentity;
+ self.basePlacePageView.directionArrow.transform = transform;
+
+ self.basePlacePageView.directionView.directionArrow.transform = CGAffineTransformIdentity;
+ self.basePlacePageView.directionView.directionArrow.transform = transform;
+}
+
+- (void)setDistance:(NSString *)distance
+{
+ NSString const * currentString = self.basePlacePageView.distanceLabel.text;
+ if ([currentString isEqualToString:distance])
+ return;
+
+ self.basePlacePageView.distanceLabel.text = distance;
+ self.basePlacePageView.directionView.distanceLabel.text = distance;
+ [self.basePlacePageView layoutDistanceLabel];
+}
+
+- (void)changeBookmarkCategory
+{
+ MWMPlacePageViewManager * manager = self.manager;
+ SelectSetVC * vc = [[SelectSetVC alloc] initWithPlacePageManager:manager];
+ [manager.ownerViewController.navigationController pushViewController:vc animated:YES];
+}
+
+- (void)changeBookmarkColor
+{
+ MWMBookmarkColorViewController * controller = [[MWMBookmarkColorViewController alloc] initWithNibName:[MWMBookmarkColorViewController className] bundle:nil];
+ controller.placePageManager = self.manager;
+ [self.manager.ownerViewController.navigationController pushViewController:controller animated:YES];
+}
+
+- (void)changeBookmarkDescription
+{
+ MWMBookmarkDescriptionViewController * viewController = [[MWMBookmarkDescriptionViewController alloc] initWithPlacePageManager:self.manager];
+ [self.manager.ownerViewController.navigationController pushViewController:viewController animated:YES];
+}
+
+- (void)reloadBookmark
+{
+ [self.basePlacePageView reloadBookmarkCell];
+}
+
+- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight { }
+
+- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight { }
+
+- (IBAction)didTap:(UITapGestureRecognizer *)sender
+{
+ if ([sender.view isKindOfClass:[UIControl class]])
+ [(UIControl *)sender.view sendActionsForControlEvents:UIControlEventTouchUpInside];
+}
- (IBAction)didPan:(UIPanGestureRecognizer *)sender { }
diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.h b/iphone/Maps/Classes/MWMPlacePageActionBar.h
index c5b1c08770..9dbe8cf4ad 100644
--- a/iphone/Maps/Classes/MWMPlacePageActionBar.h
+++ b/iphone/Maps/Classes/MWMPlacePageActionBar.h
@@ -12,7 +12,12 @@
@interface MWMPlacePageActionBar : UIView
+@property (weak, nonatomic, readonly) IBOutlet UIButton * bookmarkButton;
+@property (weak, nonatomic, readonly) IBOutlet UIButton * routeButton;
+
+ (MWMPlacePageActionBar *)actionBarForPlacePage:(MWMPlacePage *)placePage;
+- (void)configureForMyPosition:(BOOL)isMyPosition;
+- (void)dismissActivityIndicatior;
- (instancetype)init __attribute__((unavailable("init is unavailable, call actionBarForPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("initWithCoder: is unavailable, call actionBarForPlacePage: instead")));
diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.mm b/iphone/Maps/Classes/MWMPlacePageActionBar.mm
index bb393f80ea..d480637975 100644
--- a/iphone/Maps/Classes/MWMPlacePageActionBar.mm
+++ b/iphone/Maps/Classes/MWMPlacePageActionBar.mm
@@ -8,15 +8,30 @@
#import "MWMPlacePageActionBar.h"
#import "MWMPlacePage.h"
-#import "UIKitCategories.h"
#import "MWMBasePlacePageView.h"
+#import "MWMPlacePageViewManager.h"
+#import "MWMPlacePageEntity.h"
+#import "UIKitCategories.h"
+
+#include "Framework.h"
+
+#import "../../3party/Alohalytics/src/alohalytics_objc.h"
+extern NSString * const kAlohalyticsTapEventKey;
static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
@interface MWMPlacePageActionBar ()
@property (weak, nonatomic) MWMPlacePage * placePage;
+@property (weak, nonatomic, readwrite) IBOutlet UIButton * routeButton;
+@property (weak, nonatomic, readwrite) IBOutlet UIButton * bookmarkButton;
+@property (weak, nonatomic) IBOutlet UIButton * shareButton;
+@property (weak, nonatomic) IBOutlet UILabel * routeLabel;
+@property (weak, nonatomic) IBOutlet UILabel * bookmarkLabel;
+@property (weak, nonatomic) IBOutlet UILabel * shareLabel;
+@property (nonatomic) UIActivityIndicatorView * indicatior;
+
@end
@implementation MWMPlacePageActionBar
@@ -25,14 +40,90 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
{
MWMPlacePageActionBar * bar = [[[NSBundle mainBundle] loadNibNamed:kPlacePageActionBarNibName owner:self options:nil] firstObject];
bar.placePage = placePage;
- bar.width = placePage.extendedPlacePageView.width;
+ BOOL const isMyPosition = placePage.manager.entity.type == MWMPlacePageEntityTypeMyPosition;
+ bar.routeButton.hidden = isMyPosition;
bar.autoresizingMask = UIViewAutoresizingNone;
return bar;
}
-- (IBAction)bookmarkTap:(id)sender
+- (IBAction)bookmarkTap:(UIButton *)sender
+{
+ sender.selected = !sender.selected;
+ NSMutableString *eventName = @"ppBookmarkButtonTap".mutableCopy;
+ if (sender.selected)
+ {
+ [self.placePage addBookmark];
+ [eventName appendString:@"Add"];
+ }
+ else
+ {
+ [self.placePage removeBookmark];
+ [eventName appendString:@"Delete"];
+ }
+ [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:eventName];
+}
+
+- (void)configureForMyPosition:(BOOL)isMyPosition
+{
+ self.routeLabel.hidden = isMyPosition;
+ self.routeButton.hidden = isMyPosition;
+ [self layoutSubviews];
+}
+
+- (void)layoutSubviews
+{
+ BOOL isMyPosition = self.placePage.manager.entity.type == MWMPlacePageEntityTypeMyPosition;
+
+ if (GetFramework().IsRouteBuilding())
+ [self startActivityIndicator];
+
+ CGPoint const center = self.center;
+ CGFloat const leftOffset = 18.;
+
+ if (isMyPosition)
+ {
+ CGSize const size = [[UIScreen mainScreen] bounds].size;
+ CGFloat const maximumWidth = 360.;
+ CGFloat const screenWidth = size.width > size.height ? (size.height > maximumWidth ? maximumWidth : size.height) : size.width;
+
+ self.bookmarkButton.center = CGPointMake(3. * screenWidth / 4., self.bookmarkButton.center.y);
+ self.shareButton.center = CGPointMake(screenWidth / 4., self.bookmarkButton.center.y);
+ }
+ else
+ {
+ self.bookmarkButton.center = CGPointMake(center.x, self.bookmarkButton.center.y);
+ self.shareButton.center = CGPointMake(leftOffset + self.shareButton.width / 2., self.shareButton.center.y);
+ }
+
+ self.shareLabel.center = CGPointMake(self.shareButton.center.x, self.shareLabel.center.y);
+ self.bookmarkLabel.center = CGPointMake(self.bookmarkButton.center.x, self.bookmarkLabel.center.y);
+}
+
+- (IBAction)shareTap:(id)sender
+{
+ [self.placePage share];
+}
+
+- (IBAction)routeTap:(id)sender
+{
+ [self.placePage route];
+ [self startActivityIndicator];
+}
+
+- (void)startActivityIndicator
+{
+ [self.indicatior removeFromSuperview];
+ self.indicatior = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
+ self.indicatior.center = self.routeButton.center;
+ self.routeButton.hidden = YES;
+ [self.indicatior startAnimating];
+ [self addSubview:self.indicatior];
+}
+
+- (void)dismissActivityIndicatior
{
- [self.placePage addBookmark];
+ [self.indicatior removeFromSuperview];
+ self.indicatior = nil;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { }
diff --git a/iphone/Maps/Classes/MWMPlacePageBookmarkCell.h b/iphone/Maps/Classes/MWMPlacePageBookmarkCell.h
index e5483b777d..78350fc53e 100644
--- a/iphone/Maps/Classes/MWMPlacePageBookmarkCell.h
+++ b/iphone/Maps/Classes/MWMPlacePageBookmarkCell.h
@@ -8,15 +8,16 @@
#import <UIKit/UIKit.h>
+@class MWMPlacePageEntity, MWMPlacePage, MWMTextView;
+
@interface MWMPlacePageBookmarkCell : UITableViewCell
-@property (weak, nonatomic, readonly) IBOutlet UITextView * title;
+@property (weak, nonatomic, readonly) IBOutlet UITextField * title;
@property (weak, nonatomic, readonly) IBOutlet UIButton * categoryButton;
@property (weak, nonatomic, readonly) IBOutlet UIButton * markButton;
-@property (weak, nonatomic, readonly) IBOutlet UITextView * descriptionTextView;
-
+@property (weak, nonatomic, readonly) IBOutlet UILabel * descriptionLabel;
@property (weak, nonatomic) UITableView * ownerTableView;
-@property (nonatomic) CGFloat actualHeight;
+@property (weak, nonatomic) MWMPlacePage * placePage;
- (void)configure;
diff --git a/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm b/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm
index 329ef5b76a..064fb53832 100644
--- a/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm
+++ b/iphone/Maps/Classes/MWMPlacePageBookmarkCell.mm
@@ -7,70 +7,87 @@
//
#import "MWMPlacePageBookmarkCell.h"
+#import "MWMPlacePageEntity.h"
#import "UIKitCategories.h"
+#import "MWMPlacePage.h"
+#import "MWMPlacePageViewManager.h"
+#import "MWMBasePlacePageView.h"
+#import "MWMTextView.h"
-@interface MWMPlacePageBookmarkCell () <UITextViewDelegate>
+extern NSString * const kBookmarkCellWebViewDidFinishLoadContetnNotification = @"WebViewDidFifishLoadContent";
-@property (weak, nonatomic, readwrite) IBOutlet UITextView * title;
+@interface MWMPlacePageBookmarkCell () <UITextFieldDelegate, UIWebViewDelegate>
+
+@property (weak, nonatomic, readwrite) IBOutlet UITextField * title;
@property (weak, nonatomic, readwrite) IBOutlet UIButton * categoryButton;
@property (weak, nonatomic, readwrite) IBOutlet UIButton * markButton;
-@property (weak, nonatomic, readwrite) IBOutlet UITextView * descriptionTextView;
+@property (weak, nonatomic, readwrite) IBOutlet UILabel * descriptionLabel;
@property (weak, nonatomic) IBOutlet UIView * firstSeparatorView;
@property (weak, nonatomic) IBOutlet UIView * secondSeparatorView;
-@property (nonatomic) UITextView * activeTextView;
-
@end
@implementation MWMPlacePageBookmarkCell
- (void)configure
{
+ MWMPlacePageEntity const * entity = self.placePage.manager.entity;
+ self.title.text = entity.bookmarkTitle;
+ [self.categoryButton setTitle:[NSString stringWithFormat:@"%@ >", entity.bookmarkCategory] forState:UIControlStateNormal];
+ [self.markButton setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@-on", entity.bookmarkColor]] forState:UIControlStateNormal];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(keyboardWasShown:)
- name:UIKeyboardDidShowNotification object:nil];
+ selector:@selector(keyboardWillShown:)
+ name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
}
-- (void)keyboardWasShown:(NSNotification *)aNotification
+- (void)keyboardWillShown:(NSNotification *)aNotification
{
+
NSDictionary const * info = [aNotification userInfo];
CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
-
- UIEdgeInsets const contentInsets = UIEdgeInsetsMake(0., 0., kbSize.height, 0.);
- self.ownerTableView.contentInset = contentInsets;
- self.ownerTableView.scrollIndicatorInsets = contentInsets;
-
- CGRect aRect = self.ownerTableView.superview.frame;
- aRect.size.height -= kbSize.height;
- if (!CGRectContainsPoint(aRect, self.activeTextView.frame.origin))
- [self.ownerTableView scrollRectToVisible:self.activeTextView.frame animated:YES];
+ [self.placePage willStartEditingBookmarkTitle:kbSize.height];
+
+// UIEdgeInsets const contentInsets = UIEdgeInsetsMake(0., 0., kbSize.height, 0.);
+// self.ownerTableView.contentInset = contentInsets;
+// self.ownerTableView.scrollIndicatorInsets = contentInsets;
+//
+// CGRect aRect = self.ownerTableView.superview.frame;
+// aRect.size.height -= kbSize.height;
+// if (!CGRectContainsPoint(aRect, self.title.frame.origin))
+// [self.ownerTableView scrollRectToVisible:aRect animated:YES];
}
- (void)keyboardWillBeHidden:(NSNotification *)aNotification
{
- UIEdgeInsets const contentInsets = UIEdgeInsetsZero;
- self.ownerTableView.contentInset = contentInsets;
- self.ownerTableView.scrollIndicatorInsets = contentInsets;
+ NSDictionary const * info = [aNotification userInfo];
+ CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
+ [self.placePage willFinishEditingBookmarkTitle:kbSize.height];
+// UIEdgeInsets const contentInsets = UIEdgeInsetsZero;
+// self.ownerTableView.contentInset = contentInsets;
+// self.ownerTableView.scrollIndicatorInsets = contentInsets;
}
-- (void)textViewDidBeginEditing:(UITextView *)textView
+- (void)textFieldDidEndEditing:(UITextField *)textField
{
- self.activeTextView = textView;
+ MWMPlacePageEntity * entity = self.placePage.manager.entity;
+ entity.bookmarkTitle = textField.text;
+ [entity synchronize];
}
-- (void)textViewDidEndEditing:(UITextView *)textView
+- (BOOL)textFieldShouldClear:(UITextField *)textField
{
- self.activeTextView = nil;
+ return YES;
}
-- (void)textViewDidChange:(UITextView *)textView
+- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
- [textView scrollRangeToVisible:[textView selectedRange]];
+ [textField resignFirstResponder];
+ return YES;
}
- (void)dealloc
@@ -78,4 +95,19 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
+- (IBAction)colorPickerButtonTap:(id)sender
+{
+ [self.placePage changeBookmarkColor];
+}
+
+- (IBAction)categoryButtonTap:(id)sender
+{
+ [self.placePage changeBookmarkCategory];
+}
+
+- (IBAction)editTap:(id)sender
+{
+ [self.placePage changeBookmarkDescription];
+}
+
@end
diff --git a/iphone/Maps/Classes/MWMPlacePageDescriptionView.xib b/iphone/Maps/Classes/MWMPlacePageDescriptionView.xib
new file mode 100644
index 0000000000..049c708ba2
--- /dev/null
+++ b/iphone/Maps/Classes/MWMPlacePageDescriptionView.xib
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMPlacePageTypeDescription">
+ <connections>
+ <outlet property="eleDescription" destination="vX3-r7-Aki" id="LUf-oh-3eN"/>
+ <outlet property="hotelDescription" destination="iN0-l3-epB" id="9BG-77-HF6"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MWMPlacePageHotelDescription">
+ <rect key="frame" x="0.0" y="0.0" width="86" height="13"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hotel_star_off" id="Bel-8r-iqM">
+ <rect key="frame" x="0.0" y="0.0" width="14" height="13"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hotel_star_off" id="dHV-87-NX9">
+ <rect key="frame" x="18" y="0.0" width="14" height="13"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hotel_star_off" id="vUJ-r8-CBo">
+ <rect key="frame" x="36" y="0.0" width="14" height="13"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hotel_star_off" id="Njn-mB-sxS">
+ <rect key="frame" x="54" y="0.0" width="14" height="13"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hotel_star_off" id="x6v-bI-Mnv">
+ <rect key="frame" x="72" y="0.0" width="14" height="13"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <nil key="simulatedStatusBarMetrics"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ <point key="canvasLocation" x="247" y="33.5"/>
+ </view>
+ <view contentMode="scaleToFill" id="vX3-r7-Aki" customClass="MWMPlacePageELEDescription">
+ <rect key="frame" x="0.0" y="0.0" width="81" height="16"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="5125 м" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="XDk-Zw-AaI">
+ <rect key="frame" x="25" y="2" width="58" height="16"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
+ <color key="textColor" red="0.60784313725490191" green="0.60784313725490191" blue="0.60784313725490191" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_hight_mountain" id="7GG-hb-FBC">
+ <rect key="frame" x="0.0" y="5" width="21" height="10"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <nil key="simulatedStatusBarMetrics"/>
+ <nil key="simulatedTopBarMetrics"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ <connections>
+ <outlet property="heightLabel" destination="XDk-Zw-AaI" id="lN9-Y9-VK8"/>
+ </connections>
+ <point key="canvasLocation" x="247.5" y="105"/>
+ </view>
+ </objects>
+ <resources>
+ <image name="hotel_star_off" width="14" height="13"/>
+ <image name="ic_hight_mountain" width="21" height="10"/>
+ </resources>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination" type="retina4"/>
+ </simulatedMetricsContainer>
+</document>
diff --git a/iphone/Maps/Classes/MWMPlacePageEntity.h b/iphone/Maps/Classes/MWMPlacePageEntity.h
index d7482c2c3c..3b76ac2a0a 100644
--- a/iphone/Maps/Classes/MWMPlacePageEntity.h
+++ b/iphone/Maps/Classes/MWMPlacePageEntity.h
@@ -8,15 +8,42 @@
#import <Foundation/Foundation.h>
+#import "Framework.h"
+
#include "map/user_mark.hpp"
+typedef NS_ENUM (NSUInteger, MWMPlacePageEntityType)
+{
+ MWMPlacePageEntityTypeRegular,
+ MWMPlacePageEntityTypeBookmark,
+ MWMPlacePageEntityTypeEle,
+ MWMPlacePageEntityTypeHotel,
+ MWMPlacePageEntityTypeMyPosition
+};
+
+@class MWMPlacePageViewManager;
+
@interface MWMPlacePageEntity : NSObject
@property (copy, nonatomic) NSString * title;
@property (copy, nonatomic) NSString * category;
-@property (copy, nonatomic) NSString * distance;
@property (copy, nonatomic) NSDictionary * metadata;
+@property (copy, nonatomic) NSString * bookmarkTitle;
+@property (copy, nonatomic) NSString * bookmarkCategory;
+@property (copy, nonatomic) NSString * bookmarkDescription;
+@property (nonatomic, readonly) BOOL isHTMLDescription;
+@property (copy, nonatomic) NSString * bookmarkColor;
+
+@property (nonatomic) MWMPlacePageEntityType type;
+
+@property (nonatomic) int typeDescriptionValue;
+
+@property (nonatomic) BookmarkAndCategory bac;
+@property (nonatomic) m2::PointD point;
+@property (weak, nonatomic) MWMPlacePageViewManager * manager;
+
- (instancetype)initWithUserMark:(UserMark const *)mark;
+- (void)synchronize;
@end
diff --git a/iphone/Maps/Classes/MWMPlacePageEntity.mm b/iphone/Maps/Classes/MWMPlacePageEntity.mm
index 7eb785dc6f..bcf1454780 100644
--- a/iphone/Maps/Classes/MWMPlacePageEntity.mm
+++ b/iphone/Maps/Classes/MWMPlacePageEntity.mm
@@ -8,11 +8,17 @@
#import "MWMPlacePageEntity.h"
#import "UIKitCategories.h"
-
-#import "Framework.h"
+#import "MWMPlacePageViewManager.h"
+#import "MapViewController.h"
+#import "UIKitCategories.h"
+#include "../../../platform/measurement_utils.hpp"
static NSArray * const kTypesArray = @[@"Coisine", @"OpenHours", @"PhoneNumber", @"FaxNumber", @"Stars", @"Operator", @"URL", @"Website", @"Internet", @"ELE", @"TurnLanes", @"TurnLanesForward", @"TurnLanesBackward", @"Email", @"Coordinate"];
+extern NSArray * const kBookmarkColorsVariant = @[@"placemark-red", @"placemark-yellow", @"placemark-blue", @"placemark-green", @"placemark-purple", @"placemark-orange", @"placemark-brown", @"placemark-pink"];
+
+extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
+
@implementation MWMPlacePageEntity
- (instancetype)initWithUserMark:(UserMark const *)mark
@@ -27,6 +33,9 @@ static NSArray * const kTypesArray = @[@"Coisine", @"OpenHours", @"PhoneNumber",
- (void)configureWithUserMark:(UserMark const *)mark
{
UserMark::Type type = mark->GetMarkType();
+ double x, y;
+ mark->GetLatLon(x, y);
+ self.point = m2::PointD(x, y);
switch (type)
{
case UserMark::Type::API:
@@ -41,13 +50,7 @@ static NSArray * const kTypesArray = @[@"Coisine", @"OpenHours", @"PhoneNumber",
[self configureForSearch:searchMark];
break;
}
-
- case UserMark::Type::BOOKMARK:
-
- break;
-
case UserMark::Type::DEBUG_MARK:
-
break;
case UserMark::Type::MY_POSITION:
@@ -64,24 +67,81 @@ static NSArray * const kTypesArray = @[@"Coisine", @"OpenHours", @"PhoneNumber",
break;
}
+ case UserMark::Type::BOOKMARK:
+ [self configureForBookmark:mark];
+ break;
+
}
- GetFramework().ActivateUserMark(mark);
+ GetFramework().ActivateUserMark(mark);
+}
+
+- (void)configureForBookmark:(UserMark const *)bookmark
+{
+ Framework & f = GetFramework();
+ self.bac = f.FindBookmark(bookmark);
+ self.type = MWMPlacePageEntityTypeBookmark;
+ BookmarkCategory * category = f.GetBmCategory(self.bac.first);
+ BookmarkData data = static_cast<Bookmark const *>(bookmark)->GetData();
+ m2::PointD const & point = bookmark->GetOrg();
+ feature::FeatureMetadata metadata;
+ search::AddressInfo info;
+ f.FindClosestPOIMetadata(point, metadata);
+ f.GetAddressInfoForGlobalPoint(point, info);
+
+ self.bookmarkTitle = [NSString stringWithUTF8String:data.GetName().c_str()];
+ self.bookmarkCategory = [NSString stringWithUTF8String:category->GetName().c_str()];
+ string const description = data.GetDescription();
+ self.bookmarkDescription = [NSString stringWithUTF8String:description.c_str()];
+ _isHTMLDescription = strings::IsHTML(description);
+ self.bookmarkColor = [NSString stringWithUTF8String:data.GetType().c_str()];
+
+ [self configureEntityWithMetadata:metadata addressInfo:info];
+ NSUInteger const count = [self.metadata[@"keys"] count];
+ [self.metadata[@"keys"] insertObject:@"Bookmark" atIndex:count];
}
- (void)configureForSearch:(SearchMarkPoint const *)searchMark
{
- search::AddressInfo const & info = searchMark->GetInfo();
- self.title = [NSString stringWithUTF8String:info.m_name.c_str()];
+ m2::PointD const & point = searchMark->GetOrg();
+ Framework & f = GetFramework();
+ feature::FeatureMetadata metadata;
+ search::AddressInfo info;
+ f.FindClosestPOIMetadata(point, metadata);
+ f.GetAddressInfoForGlobalPoint(point, info);
+ [self configureEntityWithMetadata:metadata addressInfo:info];
}
- (void)configureForPOI:(PoiMarkPoint const *)poiMark
{
search::AddressInfo const & addressInfo = poiMark->GetInfo();
- self.title = [NSString stringWithUTF8String:addressInfo.GetPinName().c_str()];
- self.category = [NSString stringWithUTF8String:addressInfo.GetPinType().c_str()];
-
- m2::PointD const & point = poiMark->GetOrg();
feature::FeatureMetadata const & metadata = poiMark->GetMetadata();
+ [self configureEntityWithMetadata:metadata addressInfo:addressInfo];
+}
+
+- (void)configureForMyPosition:(MyPositionMarkPoint const *)myPositionMark
+{
+ self.title = L(@"my_position");
+ self.type = MWMPlacePageEntityTypeMyPosition;
+ NSMutableArray * keys = [NSMutableArray array];
+ NSMutableArray * values = [NSMutableArray array];
+ [keys addObject:kTypesArray.lastObject];
+ BOOL const isLatLonAsDMS = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsLatLonAsDMSKey];
+ NSString * latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String: MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()]: [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
+ [values addObject:latLonStr];
+
+ self.metadata = @{@"keys" : keys, @"values" : values};
+}
+
+- (void)configureForApi:(ApiMarkPoint const *)apiMark
+{
+
+}
+
+- (void)configureEntityWithMetadata:(feature::FeatureMetadata const &)metadata addressInfo:(search::AddressInfo const &)info
+{
+ self.title = [NSString stringWithUTF8String:info.GetPinName().c_str()];
+ self.category = [NSString stringWithUTF8String:info.GetPinType().c_str()];
+
vector<feature::FeatureMetadata::EMetadataType> presentTypes = metadata.GetPresentTypes();
NSMutableArray * keys = [NSMutableArray array];
@@ -89,16 +149,40 @@ static NSArray * const kTypesArray = @[@"Coisine", @"OpenHours", @"PhoneNumber",
for (auto const & type : presentTypes)
{
+ if (type == feature::FeatureMetadata::EMetadataType::FMD_POSTCODE)
+ continue;
+
if (type == feature::FeatureMetadata::EMetadataType::FMD_OPERATOR)
+ {
+ NSString * bank = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
+ self.category = [NSString stringWithFormat:@"%@, %@", self.category, bank];
continue;
+ }
if (type == feature::FeatureMetadata::EMetadataType::FMD_CUISINE)
{
- self.category = [NSString stringWithFormat:@"%@, %@", self.category, L([NSString stringWithUTF8String:metadata.Get(type).c_str()])];
+ NSString * cuisine = [NSString stringWithFormat:@"cuisine_%@", [NSString stringWithUTF8String:metadata.Get(type).c_str()]];
+ self.category = [NSString stringWithFormat:@"%@, %@", self.category, L(cuisine)];
+ continue;
+ }
+
+ if (type == feature::FeatureMetadata::EMetadataType::FMD_ELE)
+ {
+ self.typeDescriptionValue = atoi(metadata.Get(type).c_str());
+ if (self.type != MWMPlacePageEntityTypeBookmark)
+ self.type = MWMPlacePageEntityTypeEle;
continue;
}
- NSString *value;
+ if (type == feature::FeatureMetadata::EMetadataType::FMD_STARS)
+ {
+ self.typeDescriptionValue = atoi(metadata.Get(type).c_str());
+ if (self.type != MWMPlacePageEntityTypeBookmark)
+ self.type = MWMPlacePageEntityTypeHotel;
+ continue;
+ }
+
+ NSString * value;
if (type == feature::FeatureMetadata::EMetadataType::FMD_OPEN_HOURS)
value = [[NSString stringWithUTF8String:metadata.Get(type).c_str()] stringByReplacingOccurrencesOfString:@"; " withString:@";\n"];
@@ -111,24 +195,90 @@ static NSArray * const kTypesArray = @[@"Coisine", @"OpenHours", @"PhoneNumber",
}
[keys addObject:kTypesArray.lastObject];
- [values addObject:[NSString stringWithFormat:@"%.6f, %.6f", point.y, point.x]];
+ BOOL const isLatLonAsDMS = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsLatLonAsDMSKey];
+ NSString * latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()] : [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
+ latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()] : [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
+ [values addObject:latLonStr];
self.metadata = @{@"keys" : keys, @"values" : values};
}
-- (void)configureForMyPosition:(MyPositionMarkPoint const *)myPositionMark
+- (NSString *)stringFromMetadataType:(feature::FeatureMetadata::EMetadataType)type
{
+ return kTypesArray[type - 1];
+}
+#pragma mark - Bookmark editing
+
+- (NSString *)bookmarkCategory
+{
+ if (_bookmarkCategory == nil)
+ {
+ Framework & f = GetFramework();
+ BookmarkCategory * category = f.GetBmCategory(f.LastEditedBMCategory());
+ return [NSString stringWithUTF8String:category->GetName().c_str()];
+ }
+ return _bookmarkCategory;
}
-- (void)configureForApi:(ApiMarkPoint const *)apiMark
+- (NSString *)bookmarkDescription
{
+ if (_bookmarkDescription == nil)
+ return @"";
+ return _bookmarkDescription;
}
-- (NSString *)stringFromMetadataType:(feature::FeatureMetadata::EMetadataType)type
+- (NSString *)bookmarkColor
{
- return kTypesArray[type - 1];
+ if (_bookmarkColor == nil)
+ {
+ Framework & f = GetFramework();
+ string type = f.LastEditedBMType();
+ return [NSString stringWithUTF8String:type.c_str()];
+ }
+ return _bookmarkColor;
+}
+
+- (NSString *)bookmarkTitle
+{
+ if (_bookmarkTitle == nil)
+ return self.title;
+ return _bookmarkTitle;
+}
+
+- (void)synchronize
+{
+ Framework & f = GetFramework();
+ BookmarkCategory * category = f.GetBmCategory(self.bac.first);
+ Bookmark * bookmark = category->GetBookmark(self.bac.second);
+
+ if (!bookmark)
+ return;
+
+
+ if (self.bookmarkColor)
+ bookmark->SetType(self.bookmarkColor.UTF8String);
+
+ if (self.bookmarkDescription)
+ {
+ string const description (self.bookmarkDescription.UTF8String);
+ _isHTMLDescription = strings::IsHTML(description);
+ bookmark->SetDescription(self.bookmarkDescription.UTF8String);
+ }
+
+ if (self.bookmarkTitle)
+ bookmark->SetName(self.bookmarkTitle.UTF8String);
+
+ category->SaveToKMLFile();
+}
+
+- (MWMPlacePageEntityType)type
+{
+ if (!_type)
+ return MWMPlacePageEntityTypeRegular;
+
+ return _type;
}
@end
diff --git a/iphone/Maps/Classes/MWMPlacePageInfoCell.h b/iphone/Maps/Classes/MWMPlacePageInfoCell.h
index 85ead3c28e..fcc62d3c17 100644
--- a/iphone/Maps/Classes/MWMPlacePageInfoCell.h
+++ b/iphone/Maps/Classes/MWMPlacePageInfoCell.h
@@ -8,11 +8,14 @@
#import <UIKit/UIKit.h>
+@class MWMPlacePageEntity;
+
@interface MWMPlacePageInfoCell : UITableViewCell
- (void)configureWithIconTitle:(NSString *)title info:(NSString *)info;
@property (weak, nonatomic, readonly) IBOutlet UIImageView * icon;
@property (weak, nonatomic, readonly) IBOutlet id textContainer;
+@property (nonatomic) MWMPlacePageEntity * currentEntity;
@end
diff --git a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm
index 886ddf3f74..aaa5177457 100644
--- a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm
+++ b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm
@@ -8,31 +8,72 @@
#import "MWMPlacePageInfoCell.h"
#import "UIKitCategories.h"
+#import "MWMPlacePageEntity.h"
+
+#include "../../../platform/settings.hpp"
+#include "../../../platform/measurement_utils.hpp"
+
+extern NSString * const kUserDefaultsLatLonAsDMSKey;
@interface MWMPlacePageInfoCell () <UITextViewDelegate>
@property (weak, nonatomic, readwrite) IBOutlet UIImageView * icon;
@property (weak, nonatomic, readwrite) IBOutlet id textContainer;
+@property (weak, nonatomic) IBOutlet UIButton * upperButton;
+@property (copy, nonatomic) NSString * type;
+
@end
@implementation MWMPlacePageInfoCell
- (void)configureWithIconTitle:(NSString *)title info:(NSString *)info
{
+ self.type = title;
[self.imageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"ic_%@", title]]];
- [self.textContainer setText:info];
-#warning TODO(Vlad): change 0.7f to computational constant.
- [(UIView *)self.textContainer setWidth:self.bounds.size.width * .7f];
+ if ([self.textContainer isKindOfClass:[UITextView class]])
+ [self.textContainer setAttributedText:[[NSAttributedString alloc] initWithString:info attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:16.]}]];
+ else
+ [self.textContainer setText:info];
- if ([self.textContainer respondsToSelector:@selector(sizeToFit)])
- [self.textContainer sizeToFit];
+ UILongPressGestureRecognizer * longTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
+ longTap.minimumPressDuration = 0.3f;
+ [self.upperButton addGestureRecognizer:longTap];
}
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
{
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:textView.text]];
return YES;
}
+
+- (IBAction)cellTap:(id)sender
+{
+ if ([self.type isEqualToString:@"Coordinate"])
+ {
+ NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
+ BOOL const isLatLonAsDMA = [defaults boolForKey:kUserDefaultsLatLonAsDMSKey];
+ m2::PointD const point = self.currentEntity.point;
+
+ isLatLonAsDMA ? [self.textContainer setText:[NSString stringWithUTF8String:MeasurementUtils::FormatLatLon(point.x, point.y).c_str()]] : [self.textContainer setText:[NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(point.x, point.y, 2).c_str()]];
+
+ [defaults setBool:!isLatLonAsDMA forKey:kUserDefaultsLatLonAsDMSKey];
+ [defaults synchronize];
+ }
+}
+
+- (void)longTap:(UILongPressGestureRecognizer *)sender
+{
+ UIMenuController * menuController = [UIMenuController sharedMenuController];
+ if (menuController.isMenuVisible)
+ return;
+
+ CGPoint tapPoint = [sender locationInView:sender.view.superview];
+ UIView * targetView = [self.textContainer isKindOfClass:[UITextView class]] ? sender.view : self.textContainer;
+ [menuController setTargetRect:CGRectMake(tapPoint.x, targetView.minY, 0., 0.) inView:sender.view.superview];
+ [menuController setMenuVisible:YES animated:YES];
+ [targetView becomeFirstResponder];
+ [menuController update];
+}
+
@end
diff --git a/iphone/Maps/Classes/MWMPlacePageNavigationBar.h b/iphone/Maps/Classes/MWMPlacePageNavigationBar.h
index e4d38b5d94..13124aac40 100644
--- a/iphone/Maps/Classes/MWMPlacePageNavigationBar.h
+++ b/iphone/Maps/Classes/MWMPlacePageNavigationBar.h
@@ -12,9 +12,9 @@
@interface MWMPlacePageNavigationBar : UIView
-@property (weak, nonatomic, readonly) IBOutlet UILabel * titleLabel;
-
-+ (instancetype)navigationBarWithPlacePage:(MWMiPhonePortraitPlacePage *)placePage;
++ (void)dismissNavigationBar;
++ (void)showNavigationBarForPlacePage:(MWMiPhonePortraitPlacePage *)placePage;
++ (void)remove;
- (instancetype)init __attribute__((unavailable("init is unavailable, call navigationBarWithPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("initWithCoder: is unavailable, call navigationBarWithPlacePage: instead")));
diff --git a/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm b/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm
index 9af3752956..7690a5e050 100644
--- a/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm
+++ b/iphone/Maps/Classes/MWMPlacePageNavigationBar.mm
@@ -11,40 +11,116 @@
#import "MWMPlacePageViewManager.h"
#import "MWMBasePlacePageView.h"
#import "UIKitCategories.h"
+#import "MWMPlacePageEntity.h"
+#import <objc/runtime.h>
static NSString * const kPlacePageNavigationBarNibName = @"PlacePageNavigationBar";
+static int kNavigationBarKey;
+
+static CGFloat const kHeight = 64.;
+
+static CGPoint const openCenter(CGFloat xPosition)
+{
+ return CGPointMake(xPosition, kHeight / 2.);
+}
+
+static CGPoint const dismissCenter(CGFloat xPosition)
+{
+ return CGPointMake(xPosition, - kHeight / 2.);
+}
@interface MWMPlacePageNavigationBar ()
-@property (weak, nonatomic, readwrite) IBOutlet UILabel * titleLabel;
+@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
@property (weak, nonatomic) MWMiPhonePortraitPlacePage * placePage;
@end
@implementation MWMPlacePageNavigationBar
++ (void)remove
+{
+ UIScreen * screen = [UIScreen mainScreen];
+ MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, &kNavigationBarKey);
+ if (!navBar)
+ return;
+
+ [navBar removeFromSuperview];
+ objc_setAssociatedObject(screen, &kNavigationBarKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
++ (void)showNavigationBarForPlacePage:(MWMiPhonePortraitPlacePage *)placePage
+{
+ UIView const * superview = placePage.manager.ownerViewController.view;
+
+ UIScreen * screen = [UIScreen mainScreen];
+ MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, &kNavigationBarKey);
+ if (!navBar)
+ {
+ navBar = [self navigationBarWithPlacePage:placePage];
+ objc_setAssociatedObject(screen, &kNavigationBarKey, navBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ [superview addSubview:navBar];
+ }
+
+ navBar.placePage = placePage;
+ MWMPlacePageEntity * entity = placePage.manager.entity;
+ navBar.titleLabel.text = entity.type == MWMPlacePageEntityTypeBookmark ? entity.bookmarkTitle : entity.title;
+ [navBar show];
+}
+
++ (void)dismissNavigationBar
+{
+ UIScreen * screen = [UIScreen mainScreen];
+ MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, &kNavigationBarKey);
+
+ if (!navBar)
+ return;
+
+ [navBar dismiss];
+}
+
+- (void)dismiss
+{
+ [UIView animateWithDuration:.3f animations:^
+ {
+ self.center = dismissCenter(self.center.x);
+ }];
+}
+
+- (void)show
+{
+ [UIView animateWithDuration:.3f animations:^
+ {
+ self.center = openCenter(self.center.x);
+ }];
+}
+
+ (instancetype)navigationBarWithPlacePage:(MWMiPhonePortraitPlacePage *)placePage
{
MWMPlacePageNavigationBar * navBar = [[[NSBundle mainBundle] loadNibNamed:kPlacePageNavigationBarNibName owner:nil options:nil] firstObject];
navBar.placePage = placePage;
- navBar.width = placePage.extendedPlacePageView.bounds.size.width;
- navBar.titleLabel.text = placePage.basePlacePageView.titleLabel.text;
- navBar.center = CGPointMake(placePage.extendedPlacePageView.superview.origin.x + navBar.width / 2., placePage.extendedPlacePageView.superview.origin.y - navBar.height / 2.);
- [placePage.extendedPlacePageView.superview addSubview:navBar];
+ navBar.autoresizingMask = UIViewAutoresizingNone;
+ UIView const * superview = placePage.manager.ownerViewController.view;
+ navBar.center = dismissCenter(superview.center.x);
+ CGSize const size = [[UIScreen mainScreen] bounds].size;
+ BOOL const isLandscape = size.width > size.height;
+ CGFloat const width = isLandscape ? size.height : size.width;
+ navBar.width = width;
return navBar;
}
- (IBAction)backTap:(id)sender
{
+ [self dismiss];
[self.placePage.manager dismissPlacePage];
- [UIView animateWithDuration:.25f animations:^
- {
- self.transform = CGAffineTransformMakeTranslation(0., - self.height);
- }
- completion:^(BOOL finished)
- {
- [self removeFromSuperview];
- }];
}
+- (void)layoutSubviews
+{
+ if (self)
+ self.origin = CGPointMake(0., 0.);
+}
+
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { }
+
@end
diff --git a/iphone/Maps/Classes/MWMPlacePageTypeDescription.h b/iphone/Maps/Classes/MWMPlacePageTypeDescription.h
new file mode 100644
index 0000000000..a76276f59b
--- /dev/null
+++ b/iphone/Maps/Classes/MWMPlacePageTypeDescription.h
@@ -0,0 +1,21 @@
+//
+// MWMPlacePageTypeDescription.h
+// Maps
+//
+// Created by v.mikhaylenko on 07.06.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "MWMPlacePageEntity.h"
+
+@class MWMPlacePageELEDescription, MWMPlacePageHotelDescription;
+
+@interface MWMPlacePageTypeDescription : NSObject
+
+@property (strong, nonatomic) IBOutlet MWMPlacePageELEDescription * eleDescription;
+@property (strong, nonatomic) IBOutlet MWMPlacePageHotelDescription * hotelDescription;
+
+- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity const *)entity;
+
+@end
diff --git a/iphone/Maps/Classes/MWMPlacePageTypeDescription.mm b/iphone/Maps/Classes/MWMPlacePageTypeDescription.mm
new file mode 100644
index 0000000000..3b90ca648e
--- /dev/null
+++ b/iphone/Maps/Classes/MWMPlacePageTypeDescription.mm
@@ -0,0 +1,61 @@
+//
+// MWMPlacePageTypeDescription.m
+// Maps
+//
+// Created by v.mikhaylenko on 07.06.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMPlacePageTypeDescription.h"
+#import "UIKitCategories.h"
+
+@interface MWMPlacePageELEDescription : UIView
+
+@property (weak, nonatomic) IBOutlet UILabel * heightLabel;
+
+@end
+
+@interface MWMPlacePageHotelDescription : UIView
+
+- (void)configureWithStarsCount:(NSUInteger)count;
+
+@end
+
+static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescriptionView";
+
+@implementation MWMPlacePageTypeDescription
+
+- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity const *)entity
+{
+ self = [super init];
+ if (self)
+ {
+ [[NSBundle mainBundle] loadNibNamed:kPlacePageDescriptionViewNibName owner:self options:nil];
+ if (entity.type == MWMPlacePageEntityTypeEle)
+ self.eleDescription.heightLabel.text = [NSString stringWithFormat:@"%@", @(entity.typeDescriptionValue)];
+ else
+ [self.hotelDescription configureWithStarsCount:entity.typeDescriptionValue];
+ }
+ return self;
+}
+
+@end
+
+@implementation MWMPlacePageELEDescription
+
+@end
+
+@implementation MWMPlacePageHotelDescription
+
+- (void)configureWithStarsCount:(NSUInteger)count
+{
+ [self.subviews enumerateObjectsUsingBlock:^(UIImageView * star, NSUInteger idx, BOOL *stop)
+ {
+ if (idx < count)
+ star.image = [UIImage imageNamed:@"hotel_star_on"];
+ else
+ star.image = [UIImage imageNamed:@"hotel_star_off"];
+ }];
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.h b/iphone/Maps/Classes/MWMPlacePageViewManager.h
index 9dfd7ff45d..cd88b741f8 100644
--- a/iphone/Maps/Classes/MWMPlacePageViewManager.h
+++ b/iphone/Maps/Classes/MWMPlacePageViewManager.h
@@ -14,13 +14,19 @@
@interface MWMPlacePageViewManager : NSObject
-@property (weak, nonatomic, readonly) UIViewController *ownerViewController;
-@property (nonatomic, readonly) MWMPlacePageEntity *entity;
+@property (weak, nonatomic, readonly) UIViewController * ownerViewController;
+@property (nonatomic, readonly) MWMPlacePageEntity * entity;
- (instancetype)initWithViewController:(UIViewController *)viewController;
-- (void)showPlacePageWithUserMark:(std::unique_ptr<UserMarkCopy>)userMark;
+- (void)showPlacePageWithUserMark:(unique_ptr<UserMarkCopy>)userMark;
- (void)dismissPlacePage;
+- (void)buildRoute;
+- (void)stopBuildingRoute;
+- (void)share;
+- (void)addBookmark;
+- (void)removeBookmark;
- (void)layoutPlacePageToOrientation:(UIInterfaceOrientation)orientation;
+- (void)reloadBookmark;
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithViewController: instead")));
diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm
index c8de776bd0..0b9b254b7e 100644
--- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm
+++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm
@@ -15,6 +15,10 @@
#import "MWMiPhonePortraitPlacePage.h"
#import "MWMiPadPlacePage.h"
#import "MWMPlacePageActionBar.h"
+#import "MapsAppDelegate.h"
+#import "LocationManager.h"
+#import "ShareActionSheet.h"
+#import "Common.h"
#include "Framework.h"
@@ -24,12 +28,16 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
MWMPlacePageManagerStateOpen
};
-@interface MWMPlacePageViewManager ()
+@interface MWMPlacePageViewManager () <LocationObserver>
+{
+ shared_ptr<UserMark const *> m_userMark;
+}
@property (weak, nonatomic) UIViewController *ownerViewController;
@property (nonatomic, readwrite) MWMPlacePageEntity *entity;
@property (nonatomic) MWMPlacePage *placePage;
@property (nonatomic) MWMPlacePageManagerState state;
+@property (nonatomic) ShareActionSheet * actionSheet;
@end
@@ -43,7 +51,6 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
self.ownerViewController = viewController;
self.state = MWMPlacePageManagerStateClosed;
}
-
return self;
}
@@ -51,13 +58,17 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
{
self.state = MWMPlacePageManagerStateClosed;
[self.placePage dismiss];
- self.placePage = nil;
+ GetFramework().GetBalloonManager().RemovePin();
+ self.entity = nil;
}
-- (void)showPlacePageWithUserMark:(std::unique_ptr<UserMarkCopy>)userMark
+- (void)showPlacePageWithUserMark:(unique_ptr<UserMarkCopy>)userMark
{
- UserMark const * mark = userMark->GetUserMark();
- self.entity = [[MWMPlacePageEntity alloc] initWithUserMark:mark];
+ if (userMark != nullptr)
+ m_userMark = make_shared<UserMark const *>(userMark->GetUserMark());
+
+ [[MapsAppDelegate theApp].m_locationManager start:self];
+ self.entity = [[MWMPlacePageEntity alloc] initWithUserMark:*m_userMark];
self.state = MWMPlacePageManagerStateOpen;
if (IPAD)
@@ -68,12 +79,19 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
- (void)layoutPlacePageToOrientation:(UIInterfaceOrientation)orientation
{
- [self.placePage.extendedPlacePageView removeFromSuperview];
- [self.placePage.actionBar removeFromSuperview];
+ if (IPAD)
+ return;
+
+ [self.placePage dismiss];
[self presentPlacePageForiPhoneWithOrientation:orientation];
}
-- (void)presentPlacePageForiPad { }
+- (void)presentPlacePageForiPad {
+ [self.placePage dismiss];
+ self.placePage = [[MWMiPadPlacePage alloc] initWithManager:self];
+ [self.placePage configure];
+ [self.placePage show];
+}
- (void)presentPlacePageForiPhoneWithOrientation:(UIInterfaceOrientation)orientation
{
@@ -85,11 +103,10 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
- if ([self.placePage isKindOfClass:[MWMiPhoneLandscapePlacePage class]])
- [self.placePage configure];
- else
+ if (![self.placePage isKindOfClass:[MWMiPhoneLandscapePlacePage class]])
self.placePage = [[MWMiPhoneLandscapePlacePage alloc] initWithManager:self];
+ [self.placePage configure];
[self.placePage show];
break;
@@ -97,11 +114,10 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
case UIInterfaceOrientationPortrait:
case UIInterfaceOrientationPortraitUpsideDown:
- if ([self.placePage isKindOfClass:[MWMiPhonePortraitPlacePage class]])
- [self.placePage configure];
- else
+ if (![self.placePage isKindOfClass:[MWMiPhonePortraitPlacePage class]])
self.placePage = [[MWMiPhonePortraitPlacePage alloc] initWithManager:self];
+ [self.placePage configure];
[self.placePage show];
break;
@@ -110,7 +126,116 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
break;
}
+}
+
+- (void)buildRoute
+{
+ GetFramework().BuildRoute((*m_userMark)->GetOrg());
+}
+
+- (void)stopBuildingRoute
+{
+ [self.placePage stopBuildingRoute];
+}
+
+- (void)share
+{
+ MWMPlacePageEntity * entity = self.entity;
+ ShareInfo * info = [[ShareInfo alloc] initWithText:entity.title gX:entity.point.x gY:entity.point.y myPosition:NO];
+
+ self.actionSheet = [[ShareActionSheet alloc] initWithInfo:info viewController:self.ownerViewController];
+ [self.actionSheet showFromRect:CGRectNull];
+}
+
+- (void)addBookmark
+{
+ Framework & f = GetFramework();
+ BookmarkData data = BookmarkData(self.entity.title.UTF8String, f.LastEditedBMType());
+ size_t const categoryIndex = f.LastEditedBMCategory();
+ size_t const bookmarkIndex = f.GetBookmarkManager().AddBookmark(categoryIndex, (*m_userMark)->GetOrg(), data);
+ self.entity.bac = make_pair(categoryIndex, bookmarkIndex);
+ self.entity.type = MWMPlacePageEntityTypeBookmark;
+ BookmarkCategory const * category = f.GetBmCategory(categoryIndex);
+ m_userMark = make_shared<UserMark const *>(category->GetBookmark(bookmarkIndex));
+ f.ActivateUserMark(*m_userMark);
+ f.Invalidate();
+}
+
+- (void)removeBookmark
+{
+ Framework & f = GetFramework();
+ UserMark const * mark = *m_userMark;
+ BookmarkAndCategory bookmarkAndCategory = f.FindBookmark(mark);
+ self.entity.type = MWMPlacePageEntityTypeRegular;
+ BookmarkCategory * category = f.GetBmCategory(bookmarkAndCategory.first);
+ PoiMarkPoint const * m = f.GetAddressMark(mark->GetOrg());
+ m_userMark = make_shared<UserMark const *>(m);
+ f.ActivateUserMark(*m_userMark);
+ if (category)
+ {
+ category->DeleteBookmark(bookmarkAndCategory.second);
+ category->SaveToKMLFile();
+ }
+ f.Invalidate();
+}
+- (void)reloadBookmark
+{
+ [self.entity synchronize];
+ [self.placePage reloadBookmark];
+}
+
+- (void)startMonitoringLocation:(NSNotification *)notification
+{
+ [[MapsAppDelegate theApp].m_locationManager start:self];
+}
+
+- (void)onLocationError:(location::TLocationError)errorCode
+{
+ NSLog(@"Location error %i in %@", errorCode, [[self class] className]);
+}
+
+- (void)onLocationUpdate:(location::GpsInfo const &)info
+{
+ if (m_userMark == nullptr)
+ return;
+
+ [self.placePage setDistance:self.distance];
+}
+- (NSString *)distance
+{
+ CLLocation const * location = [MapsAppDelegate theApp].m_locationManager.lastLocation;
+
+ if (!location)
+ return @"";
+
+ double const userLatitude = location.coordinate.latitude;
+ double const userLongitude = location.coordinate.longitude;
+ double azimut = -1;
+ double north = -1;
+
+ [[MapsAppDelegate theApp].m_locationManager getNorthRad:north];
+
+ string distance;
+ GetFramework().GetDistanceAndAzimut((*m_userMark)->GetOrg(), userLatitude, userLongitude, north, distance, azimut);
+ return [NSString stringWithUTF8String:distance.c_str()];
+}
+
+- (void)onCompassUpdate:(location::CompassInfo const &)info
+{
+ if (m_userMark == nullptr)
+ return;
+
+ double lat, lon;
+
+ if ([[MapsAppDelegate theApp].m_locationManager getLat:lat Lon:lon])
+ [self.placePage setArrowAngle:ang::AngleTo(MercatorBounds::FromLatLon(lat, lon), (*m_userMark)->GetOrg()) + info.m_bearing];
+
+}
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
diff --git a/iphone/Maps/Classes/MWMSpringAnimation.mm b/iphone/Maps/Classes/MWMSpringAnimation.mm
index 62270a9848..eeddc4fe61 100644
--- a/iphone/Maps/Classes/MWMSpringAnimation.mm
+++ b/iphone/Maps/Classes/MWMSpringAnimation.mm
@@ -59,7 +59,6 @@ static inline CGFloat CGPointLength(CGPoint point)
{
static CGFloat const frictionConstant = 25.;
static CGFloat const springConstant = 300.;
- CGFloat const time = (CGFloat) dt;
// friction force = velocity * friction constant
CGPoint const frictionForce = CGPointMultiply(self.velocity, frictionConstant);
@@ -68,9 +67,9 @@ static inline CGFloat CGPointLength(CGPoint point)
// force = spring force - friction force
CGPoint const force = CGPointSubtract(springForce, frictionForce);
// velocity = current velocity + force * time / mass
- self.velocity = CGPointAdd(self.velocity, CGPointMultiply(force, time));
+ self.velocity = CGPointAdd(self.velocity, CGPointMultiply(force, dt));
// position = current position + velocity * time
- self.view.center = CGPointAdd(self.view.center, CGPointMultiply(self.velocity, time));
+ self.view.center = CGPointAdd(self.view.center, CGPointMultiply(self.velocity, dt));
CGFloat const speed = CGPointLength(self.velocity);
CGFloat const distanceToGoal = CGPointLength(CGPointSubtract(self.targetPoint, self.view.center));
diff --git a/iphone/Maps/Classes/MWMTextView.h b/iphone/Maps/Classes/MWMTextView.h
new file mode 100644
index 0000000000..a7c0ed027a
--- /dev/null
+++ b/iphone/Maps/Classes/MWMTextView.h
@@ -0,0 +1,15 @@
+//
+// MWMTextView.h
+// Maps
+//
+// Created by v.mikhaylenko on 24.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MWMTextView : UITextView
+
+@property (copy, nonatomic) NSString * placeholder;
+
+@end
diff --git a/iphone/Maps/Classes/MWMTextView.mm b/iphone/Maps/Classes/MWMTextView.mm
new file mode 100644
index 0000000000..06e3bdc159
--- /dev/null
+++ b/iphone/Maps/Classes/MWMTextView.mm
@@ -0,0 +1,139 @@
+//
+// MWMTextView.m
+// Maps
+//
+// Created by v.mikhaylenko on 24.05.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMTextView.h"
+#import "Common.h"
+
+static CGFloat const kDefaultTextLeftInset = 5.;
+
+@interface MWMTextView ()
+
+@property (nonatomic) UILabel *placeholderView;
+
+@end
+
+@implementation MWMTextView
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+ self = [super initWithCoder:coder];
+ if (self)
+ [self preparePlaceholder];
+
+ return self;
+}
+
+- (instancetype)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer
+{
+ self = [super initWithFrame:frame textContainer:textContainer];
+ if (self)
+ [self preparePlaceholder];
+
+ return self;
+}
+
+- (void)preparePlaceholder
+{
+ NSAssert(!self.placeholderView, @"placeholder has been prepared already: %@", self.placeholderView);
+
+ self.placeholderView = [[UILabel alloc] initWithFrame:self.bounds];
+ self.placeholderView.opaque = NO;
+ self.placeholderView.backgroundColor = [UIColor clearColor];
+ self.placeholderView.textColor = [UIColor lightGrayColor];
+ self.placeholderView.textAlignment = self.textAlignment;
+ self.placeholderView.userInteractionEnabled = NO;
+ self.placeholderView.font = self.font;
+ self.placeholderView.isAccessibilityElement = NO;
+
+ if (!isIOSVersionLessThan(7))
+ [self setTextContainerInset:UIEdgeInsetsZero];
+
+ [self updatePlaceholderVisibility];
+
+ NSNotificationCenter * defaultCenter = [NSNotificationCenter defaultCenter];
+ [defaultCenter addObserver:self selector:@selector(textDidChange:)
+ name:UITextViewTextDidChangeNotification object:self];
+ self.clipsToBounds = YES;
+}
+
+#pragma mark - Setters
+
+- (void)setPlaceholder:(NSString *)placeholder
+{
+ _placeholder = placeholder.copy;
+ self.placeholderView.text = placeholder;
+ [self resizePlaceholderFrame];
+}
+
+- (void)setFont:(UIFont *)font
+{
+ [super setFont:font];
+ self.placeholderView.font = font;
+}
+
+- (void)setAttributedText:(NSAttributedString *)attributedText
+{
+ [super setAttributedText:attributedText];
+ [self updatePlaceholderVisibility];
+}
+
+- (void)setText:(NSString *)text
+{
+ [super setText:text];
+ [self updatePlaceholderVisibility];
+}
+
+- (void)setTextAlignment:(NSTextAlignment)textAlignment
+{
+ [super setTextAlignment:textAlignment];
+ self.placeholderView.textAlignment = textAlignment;
+}
+
+- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset
+{
+ textContainerInset.left -= kDefaultTextLeftInset;
+ [super setTextContainerInset:textContainerInset];
+ [self updatePlaceholderInset:textContainerInset];
+}
+
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+ [self resizePlaceholderFrame];
+}
+
+- (void)resizePlaceholderFrame
+{
+ self.placeholderView.numberOfLines = 0;
+ [self.placeholderView sizeToFit];
+}
+
+- (void)textDidChange:(NSNotification *)aNotification
+{
+ [self updatePlaceholderVisibility];
+}
+
+- (void)updatePlaceholderInset:(UIEdgeInsets)inset
+{
+ self.placeholderView.frame = CGRectMake(inset.left + kDefaultTextLeftInset, inset.top, self.bounds.size.width - inset.right, self.bounds.size.height - inset.bottom);
+ [self resizePlaceholderFrame];
+}
+
+- (void)updatePlaceholderVisibility
+{
+ if (self.text.length == 0) {
+ [self addSubview:self.placeholderView];
+ [self sendSubviewToBack:self.placeholderView];
+ }
+ else
+ {
+ [self.placeholderView removeFromSuperview];
+ }
+}
+
+@end
diff --git a/iphone/Maps/Classes/MWMiPadPlacePage.mm b/iphone/Maps/Classes/MWMiPadPlacePage.mm
index c304dc4d32..55d61cdcc9 100644
--- a/iphone/Maps/Classes/MWMiPadPlacePage.mm
+++ b/iphone/Maps/Classes/MWMiPadPlacePage.mm
@@ -7,7 +7,148 @@
//
#import "MWMiPadPlacePage.h"
+#import "MWMPlacePageViewManager.h"
+#import "MWMPlacePageActionBar.h"
+#import "UIKitCategories.h"
+#import "MWMBasePlacePageView.h"
+#import "MWMBookmarkColorViewController.h"
+#import "SelectSetVC.h"
+#import "UIViewController+Navigation.h"
+#import "MWMBookmarkDescriptionViewController.h"
+
+@interface MWMNavigationController : UINavigationController
+
+@end
+
+@implementation MWMNavigationController
+
+- (instancetype)initWithRootViewController:(UIViewController *)rootViewController
+{
+ self = [super initWithRootViewController:rootViewController];
+ if (self)
+ {
+ [self setNavigationBarHidden:YES];
+ self.view.autoresizingMask = UIViewAutoresizingNone;
+ }
+ return self;
+}
+
+- (void)backTap:(id)sender
+{
+ [self popViewControllerAnimated:YES];
+}
+
+@end
+
+@interface MWMPlacePageViewController : UIViewController
+
+@end
+
+@implementation MWMPlacePageViewController
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+ [self.navigationController setNavigationBarHidden:YES];
+ self.view.autoresizingMask = UIViewAutoresizingNone;
+}
+
+@end
+
+extern CGFloat kBookmarkCellHeight;
+
+@interface MWMiPadPlacePage ()
+
+@property (strong, nonatomic) MWMNavigationController * navigationController;
+@property (strong, nonatomic) MWMPlacePageViewController * viewController;
+
+@end
@implementation MWMiPadPlacePage
+- (void)configure
+{
+ [super configure];
+ UIView const * view = self.manager.ownerViewController.view;
+
+ self.viewController = [[MWMPlacePageViewController alloc] init];
+ [self.navigationController.view removeFromSuperview];
+ [self.navigationController removeFromParentViewController];
+ self.navigationController = [[MWMNavigationController alloc] initWithRootViewController:self.viewController];
+
+
+ CGFloat const topOffset = 36.;
+ CGFloat const leftOffset = 12.;
+ CGFloat const defaultWidth = 360.;
+
+ CGFloat const kActionBarHeight = 58.;
+
+ CGFloat const defaultHeight = self.basePlacePageView.height + self.anchorImageView.height + kActionBarHeight;
+ [self.manager.ownerViewController addChildViewController:self.navigationController];
+
+ self.navigationController.view.frame = CGRectMake(leftOffset, topOffset, defaultWidth, defaultHeight);
+ self.viewController.view.frame = CGRectMake(leftOffset, topOffset, defaultWidth, defaultHeight);
+
+ self.extendedPlacePageView.frame = CGRectMake(0., 0., defaultWidth, defaultHeight - 1);
+ self.anchorImageView.image = nil;
+ self.anchorImageView.backgroundColor = [UIColor whiteColor];
+
+ self.actionBar.width = defaultWidth;
+ self.actionBar.origin = CGPointMake(0., defaultHeight - kActionBarHeight - 1);
+ [self.viewController.view addSubview:self.extendedPlacePageView];
+ [self.viewController.view addSubview:self.actionBar];
+ [view addSubview:self.navigationController.view];
+}
+
+- (void)show { }
+
+- (void)dismiss
+{
+ [self.navigationController.view removeFromSuperview];
+ [self.navigationController removeFromParentViewController];
+ [super dismiss];
+}
+
+- (void)addBookmark
+{
+ [super addBookmark];
+ self.navigationController.view.height += kBookmarkCellHeight;
+ self.viewController.view.height += kBookmarkCellHeight;
+ self.extendedPlacePageView.height += kBookmarkCellHeight;
+ self.actionBar.minY += kBookmarkCellHeight;
+}
+
+- (void)removeBookmark
+{
+ [super removeBookmark];
+ self.navigationController.view.height += kBookmarkCellHeight;
+ self.viewController.view.height -= kBookmarkCellHeight;
+ self.extendedPlacePageView.height -= kBookmarkCellHeight;
+ self.actionBar.minY -= kBookmarkCellHeight;
+}
+
+- (void)changeBookmarkColor
+{
+ MWMBookmarkColorViewController * controller = [[MWMBookmarkColorViewController alloc] initWithNibName:[MWMBookmarkColorViewController className] bundle:nil];
+ controller.ownerNavigationController = self.navigationController;
+ controller.placePageManager = self.manager;
+ controller.view.frame = self.viewController.view.frame;
+ [self.viewController.navigationController pushViewController:controller animated:YES];
+}
+
+- (void)changeBookmarkCategory
+{
+ SelectSetVC * controller = [[SelectSetVC alloc] initWithPlacePageManager:self.manager];
+ controller.ownerNavigationController = self.navigationController;
+ controller.view.frame = self.viewController.view.frame;
+ [self.viewController.navigationController pushViewController:controller animated:YES];
+}
+
+- (void)changeBookmarkDescription
+{
+ MWMBookmarkDescriptionViewController * controller = [[MWMBookmarkDescriptionViewController alloc] initWithPlacePageManager:self.manager];
+ controller.ownerNavigationController = self.navigationController;
+ [self.viewController.navigationController pushViewController:controller animated:YES];
+}
+
@end
diff --git a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm
index d22af78890..09353ab000 100644
--- a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm
+++ b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm
@@ -17,6 +17,7 @@
#include "Framework.h"
static CGFloat const kMaximumPlacePageWidth = 360.;
+extern CGFloat const kBookmarkCellHeight;
typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
{
@@ -36,42 +37,37 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
- (void)configure
{
[super configure];
- UIView const * view = self.manager.ownerViewController.view;
- if ([view.subviews containsObject:self.extendedPlacePageView] && self.state != MWMiPhoneLandscapePlacePageStateClosed)
- return;
CGSize const size = UIScreen.mainScreen.bounds.size;
CGFloat const height = size.width > size.height ? size.height : size.width;
CGFloat const offset = height > kMaximumPlacePageWidth ? kMaximumPlacePageWidth : height;
- self.extendedPlacePageView.frame = CGRectMake(-offset, 0, offset, height);
+ UIView const * view = self.manager.ownerViewController.view;
+ if ([view.subviews containsObject:self.extendedPlacePageView] && self.state != MWMiPhoneLandscapePlacePageStateClosed)
+ return;
+
+ self.extendedPlacePageView.frame = CGRectMake(0., 0, offset, height);
+
+ self.anchorImageView.backgroundColor = [UIColor whiteColor];
self.anchorImageView.image = nil;
- self.anchorImageView.backgroundColor = self.basePlacePageView.backgroundColor;
- self.actionBar = [MWMPlacePageActionBar actionBarForPlacePage:self];
-
-#warning TODO (Vlad): Change 35. to computational constant.
- self.basePlacePageView.featureTable.contentInset = UIEdgeInsetsMake(0., 0., self.actionBar.height + 35., 0.);
-
+ CGFloat const headerViewHeight = self.basePlacePageView.height - self.basePlacePageView.featureTable.height;
+ CGFloat const tableContentHeight = self.basePlacePageView.featureTable.contentSize.height;
+ self.basePlacePageView.featureTable.contentInset = UIEdgeInsetsMake(0., 0., self.actionBar.height+ (tableContentHeight - height - headerViewHeight + self.anchorImageView.height), 0.);
[view addSubview:self.extendedPlacePageView];
+ self.actionBar.width = offset;
self.actionBar.center = CGPointMake(self.actionBar.width / 2., height - self.actionBar.height / 2.);
[self.extendedPlacePageView addSubview:self.actionBar];
}
- (void)show
{
- if (self.state != MWMiPhoneLandscapePlacePageStateOpen)
- self.state = MWMiPhoneLandscapePlacePageStateOpen;
-}
-
-- (void)dismiss
-{
- self.state = MWMiPhoneLandscapePlacePageStateClosed;
- [super dismiss];
+ self.state = MWMiPhoneLandscapePlacePageStateOpen;
}
- (void)addBookmark
{
- [self.basePlacePageView addBookmark];
+ [super addBookmark];
+
}
- (void)setState:(MWMiPhoneLandscapePlacePageState)state
@@ -113,7 +109,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
if (sender.state == UIGestureRecognizerStateEnded)
{
CGPoint velocity = [sender velocityInView:self.extendedPlacePageView.superview];
- velocity.y = 20;
+ velocity.y = 20.;
self.state = velocity.x < 0. ? MWMiPhoneLandscapePlacePageStateClosed : MWMiPhoneLandscapePlacePageStateOpen;
[self startAnimatingPlacePage:self initialVelocity:velocity];
if (self.state == MWMiPhoneLandscapePlacePageStateClosed)
@@ -125,4 +121,28 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
}
}
+- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight
+{
+ CGFloat const statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
+ MWMBasePlacePageView const * basePlacePageView = self.basePlacePageView;
+ UITableView const * tableView = basePlacePageView.featureTable;
+ CGFloat const baseViewHeight = basePlacePageView.height;
+ CGFloat const tableHeight = tableView.contentSize.height;
+ CGFloat const headerViewHeight = baseViewHeight - tableHeight;
+ CGFloat const titleOriginY = tableHeight - kBookmarkCellHeight - tableView.contentOffset.y;
+
+ [UIView animateWithDuration:0.3f animations:^
+ {
+ self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., statusBarHeight - headerViewHeight - titleOriginY);
+ }];
+}
+
+- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight
+{
+ [UIView animateWithDuration:0.3f animations:^
+ {
+ self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., 0.);
+ }];
+}
+
@end
diff --git a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm
index a1efdf3d28..f472e633dd 100644
--- a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm
+++ b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm
@@ -14,6 +14,9 @@
#import "MWMPlacePageViewManager.h"
#import "MWMBasePlacePageView.h"
#import "MWMPlacePage+Animation.h"
+#import "MWMPlacePageEntity.h"
+#import "MWMMapViewControlsManager.h"
+#import "MapViewController.h"
#include "Framework.h"
@@ -28,7 +31,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
@property (nonatomic) MWMiPhonePortraitPlacePageState state;
@property (nonatomic) CGPoint targetPoint;
-@property (nonatomic) MWMPlacePageNavigationBar *navigationBar;
+@property (nonatomic) CGFloat keyboardHeight;
@end
@@ -39,21 +42,18 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
[super configure];
UIView const * view = self.manager.ownerViewController.view;
if ([view.subviews containsObject:self.extendedPlacePageView])
- {
- self.state = MWMiPhonePortraitPlacePageStatePreview;
return;
- }
CGSize const size = UIScreen.mainScreen.bounds.size;
CGFloat const width = size.width > size.height ? size.height : size.width;
CGFloat const height = size.width > size.height ? size.width : size.height;
- self.extendedPlacePageView.frame = CGRectMake(0., height, width, height);
+ self.extendedPlacePageView.frame = CGRectMake(0., height, width, 2 * height);
[view addSubview:self.extendedPlacePageView];
- self.actionBar = [MWMPlacePageActionBar actionBarForPlacePage:self];
+ self.actionBar.width = width;
self.actionBar.center = CGPointMake(width / 2., height + self.actionBar.height / 2.);
[view addSubview:self.actionBar];
- self.state = MWMiPhonePortraitPlacePageStatePreview;
- [UIView animateWithDuration:0.25f delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^
+
+ [UIView animateWithDuration:0.3f delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^
{
self.actionBar.center = CGPointMake(width / 2., height - self.actionBar.height / 2.);
}
@@ -67,79 +67,75 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
- (void)dismiss
{
- UIView const * view = self.manager.ownerViewController.view;
- self.state = MWMiPhonePortraitPlacePageStateClosed;
- [UIView animateWithDuration:.25f delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^
- {
- self.actionBar.center = CGPointMake(view.midX, view.maxY + self.actionBar.height / 2.);
- }
- completion:^(BOOL finished)
- {
- [self.actionBar removeFromSuperview];
- self.actionBar = nil;
- [self.navigationBar removeFromSuperview];
- self.navigationBar = nil;
- [super dismiss];
- }];
+ self.state = MWMiPhonePortraitPlacePageStateClosed;
+ [MWMPlacePageNavigationBar remove];
+ self.keyboardHeight = 0.;
+ [super dismiss];
}
- (void)addBookmark
{
- [self.basePlacePageView addBookmark];
+ [super addBookmark];
self.state = MWMiPhonePortraitPlacePageStateOpen;
}
+- (void)removeBookmark
+{
+ [super removeBookmark];
+ self.keyboardHeight = 0.;
+ self.state = MWMiPhonePortraitPlacePageStatePreview;
+}
+
- (void)setState:(MWMiPhonePortraitPlacePageState)state
{
CGSize const size = UIScreen.mainScreen.bounds.size;
- CGFloat const width = size.width > size.height ? size.height : size.width;
- CGFloat const height = size.width > size.height ? size.width : size.height;
+ BOOL const isLandscape = size.width > size.height;
+ CGFloat const width = isLandscape ? size.height : size.width;
+ CGFloat const height = isLandscape ? size.width : size.height;
+ static CGFloat const kPlacePageBottomOffset = 30.;
switch (state)
{
case MWMiPhonePortraitPlacePageStateClosed:
- GetFramework().GetBalloonManager().RemovePin();
+// GetFramework().GetBalloonManager().RemovePin();
self.targetPoint = CGPointMake(self.extendedPlacePageView.width / 2., self.extendedPlacePageView.height * 2.);
break;
case MWMiPhonePortraitPlacePageStatePreview:
{
- static CGFloat const kPreviewPlacePageOffset = 30.;
-
- CGFloat const h = height / 2. - (self.basePlacePageView.titleLabel.height + kPreviewPlacePageOffset + self.basePlacePageView.typeLabel.height + self.actionBar.height);
+ CGFloat const typeHeight = self.basePlacePageView.typeLabel.text.length > 0 ? self.basePlacePageView.typeLabel.height : self.basePlacePageView.typeDescriptionView.height;
+ CGFloat const h = height - (self.basePlacePageView.titleLabel.height + kPlacePageBottomOffset + typeHeight + self.actionBar.height + 1);
self.targetPoint = CGPointMake(width / 2., height + h);
- if (self.navigationBar)
- {
- [UIView animateWithDuration:.25f delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^
- {
- self.navigationBar.transform = CGAffineTransformMakeTranslation(0., - self.navigationBar.height);
- }
- completion:^(BOOL finished)
- {
- [self.navigationBar removeFromSuperview];
- }];
- }
+
+ [MWMPlacePageNavigationBar dismissNavigationBar];
break;
}
case MWMiPhonePortraitPlacePageStateOpen:
{
- static CGFloat const kOpenPlacePageOffset = 27.;
- CGFloat const h = height / 2. - (self.basePlacePageView.titleLabel.height + kOpenPlacePageOffset + self.basePlacePageView.typeLabel.height + self.basePlacePageView.featureTable.height + self.actionBar.height);
+ CGFloat const typeHeight = self.basePlacePageView.typeLabel.text.length > 0 ? self.basePlacePageView.typeLabel.height : self.basePlacePageView.typeDescriptionView.height;
+ CGFloat const h = height - (self.basePlacePageView.titleLabel.height + kPlacePageBottomOffset + typeHeight + [(UITableView *)self.basePlacePageView.featureTable height] + self.actionBar.height + 1 + self.keyboardHeight);
self.targetPoint = CGPointMake(width / 2., height + h);
- if (self.targetPoint.y <= height / 2.)
- {
- self.navigationBar = [MWMPlacePageNavigationBar navigationBarWithPlacePage:self];
- [UIView animateWithDuration:0.25f delay:0. options:UIViewAnimationOptionCurveEaseOut animations:^
- {
- self.navigationBar.transform = CGAffineTransformMakeTranslation(0., self.navigationBar.height);
- }
- completion:nil];
- }
+
+ if (self.targetPoint.y <= height)
+ [MWMPlacePageNavigationBar showNavigationBarForPlacePage:self];
+ else
+ [MWMPlacePageNavigationBar dismissNavigationBar];
+
break;
}
}
_state = state;
[self startAnimatingPlacePage:self initialVelocity:self.springAnimation.velocity];
+
+ NSString * anchorImageName;
+ NSNumber const * widthNumber = @((NSUInteger)width);
+ if (_state == MWMiPhonePortraitPlacePageStateOpen)
+ anchorImageName = [@"bg_placepage_tablet_open_" stringByAppendingString:widthNumber.stringValue];
+ else
+ anchorImageName = [@"bg_placepage_tablet_normal_" stringByAppendingString:widthNumber.stringValue];
+
+ self.anchorImageView.image = [UIImage imageNamed:anchorImageName];
+
}
#pragma mark - Actions
@@ -148,6 +144,15 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
{
CGPoint const point = [sender translationInView:self.extendedPlacePageView.superview];
self.extendedPlacePageView.center = CGPointMake(self.extendedPlacePageView.center.x, self.extendedPlacePageView.center.y + point.y);
+ CGSize const size = UIScreen.mainScreen.bounds.size;
+ BOOL const isLandscape = size.width > size.height;
+ CGFloat const height = isLandscape ? size.width : size.height;
+
+ if (self.extendedPlacePageView.center.y <= height)
+ [MWMPlacePageNavigationBar showNavigationBarForPlacePage:self];
+ else
+ [MWMPlacePageNavigationBar dismissNavigationBar];
+
[sender setTranslation:CGPointZero inView:self.extendedPlacePageView.superview];
if (sender.state == UIGestureRecognizerStateEnded)
{
@@ -169,21 +174,36 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
- (IBAction)didTap:(UITapGestureRecognizer *)sender
{
+ [super didTap:sender];
switch (self.state)
{
- case MWMiPhonePortraitPlacePageStateClosed:
- self.state = MWMiPhonePortraitPlacePageStatePreview;
- break;
+ case MWMiPhonePortraitPlacePageStateClosed:
+ self.state = MWMiPhonePortraitPlacePageStatePreview;
+ break;
- case MWMiPhonePortraitPlacePageStatePreview:
- self.state = MWMiPhonePortraitPlacePageStateOpen;
- break;
+ case MWMiPhonePortraitPlacePageStatePreview:
+ self.state = MWMiPhonePortraitPlacePageStateOpen;
+ break;
- case MWMiPhonePortraitPlacePageStateOpen:
- self.state = MWMiPhonePortraitPlacePageStatePreview;
- break;
+ case MWMiPhonePortraitPlacePageStateOpen:
+ self.state = MWMiPhonePortraitPlacePageStatePreview;
+ break;
}
[self startAnimatingPlacePage:self initialVelocity:self.springAnimation.velocity];
}
+- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight
+{
+ self.keyboardHeight = keyboardHeight;
+ self.state = MWMiPhonePortraitPlacePageStateOpen;
+}
+
+- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight
+{
+ self.keyboardHeight = 0.;
+ //Just setup current state.
+ MWMiPhonePortraitPlacePageState currentState = self.state;
+ self.state = currentState;
+}
+
@end
diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm
index 3dd748941f..a495092b75 100644
--- a/iphone/Maps/Classes/MapViewController.mm
+++ b/iphone/Maps/Classes/MapViewController.mm
@@ -1,8 +1,5 @@
#import "AppInfo.h"
-#import "BookmarkDescriptionVC.h"
-#import "BookmarkNameVC.h"
#import "Common.h"
-#import "ContainerView.h"
#import "EAGLView.h"
#import "MapsAppDelegate.h"
#import "MapViewController.h"
@@ -11,7 +8,6 @@
#import "Reachability.h"
#import "RouteState.h"
#import "RouteView.h"
-#import "SelectSetVC.h"
#import "ShareActionSheet.h"
#import "UIKitCategories.h"
#import "UIViewController+Navigation.h"
@@ -84,11 +80,10 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
@end
-@interface MapViewController () <PlacePageViewDelegate, SelectSetVCDelegate, BookmarkDescriptionVCDelegate, BookmarkNameVCDelegate, RouteViewDelegate, SearchViewDelegate>
+@interface MapViewController () <RouteViewDelegate, SearchViewDelegate>
@property (nonatomic) UIView * routeViewWrapper;
@property (nonatomic) RouteView * routeView;
-@property (nonatomic) ContainerView * containerView;
@property (nonatomic) UIImageView * apiBar;
@property (nonatomic) UILabel * apiTitleLabel;
@property (nonatomic, readwrite) MWMMapViewControlsManager * controlsManager;
@@ -235,18 +230,12 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
{
self.disableStandbyOnLocationStateMode = NO;
[[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];
break;
}
case location::State::PendingPosition:
self.disableStandbyOnLocationStateMode = NO;
[[MapsAppDelegate theApp].m_locationManager start:self];
- [[NSNotificationCenter defaultCenter] postNotificationName:LOCATION_MANAGER_STARTED_NOTIFICATION object:nil];
+ self.placePageManager = [[MWMPlacePageViewManager alloc] initWithViewController:self];
break;
case location::State::NotFollow:
self.disableStandbyOnLocationStateMode = NO;
@@ -270,9 +259,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
- (void)dismissPlacePage
{
- GetFramework().GetBalloonManager().RemovePin();
[self.placePageManager dismissPlacePage];
- self.placePageManager = nil;
}
- (void)onUserMarkClicked:(unique_ptr<UserMarkCopy>)mark
@@ -369,7 +356,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
- // [NSValue valueWithCGPoint:[theTouch locationInView:self.view]]
// To cancel single tap timer
UITouch * theTouch = (UITouch *)[touches anyObject];
if (theTouch.tapCount > 1)
@@ -578,16 +564,10 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
- (void)viewDidLoad
{
[super viewDidLoad];
-
self.view.clipsToBounds = YES;
-
[self.view addSubview:self.routeViewWrapper];
-
self.controlsManager = [[MWMMapViewControlsManager alloc] initWithParentController:self];
-
[self.view addSubview:self.searchView];
-
- [self.view addSubview:self.containerView];
}
- (void)viewDidAppear:(BOOL)animated
@@ -619,8 +599,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
UIStatusBarStyle style = UIStatusBarStyleDefault;
if (self.searchView.state != SearchViewStateHidden || self.controlsManager.menuState == MWMSideMenuStateActive)
style = UIStatusBarStyleLightContent;
- if (self.containerView.placePage.state != PlacePageStateHidden)
- style = UIStatusBarStyleDefault;
return style;
}
}
@@ -729,15 +707,13 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
f.SetRouteBuildingListener([self, &f](routing::IRouter::ResultCode code, vector<storage::TIndex> const & absentCountries)
{
- [self.containerView.placePage showBuildingRoutingActivity:NO];
-
+ [self.placePageManager stopBuildingRoute];
switch (code)
{
case routing::IRouter::ResultCode::NoError:
{
f.GetBalloonManager().RemovePin();
f.GetBalloonManager().Dismiss();
- [self.containerView.placePage setState:PlacePageStateHidden animated:YES withCallback:YES];
[self.searchView setState:SearchViewStateHidden animated:YES withCallback:YES];
[self performAfterDelay:0.3 block:^
{
@@ -784,13 +760,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
#pragma mark - ShowDialog callback
-- (void)showDialogWithMessageID:(string const &)message
-{
- [[[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String:message.c_str()] message:nil delegate:self cancelButtonTitle:L(@"ok") otherButtonTitles:nil] show];
-}
-
-- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)type countries:(vector<storage::TIndex> const&)countries
-{
+- (void)presentDownloaderAlert:(routing::IRouter::ResultCode)type countries:(vector<storage::TIndex> const&)countries {
if (countries.size())
{
MWMAlertViewController *alert = [[MWMAlertViewController alloc] initWithViewController:self];
@@ -843,17 +813,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
return _searchView;
}
-- (ContainerView *)containerView
-{
- if (!_containerView)
- {
- _containerView = [[ContainerView alloc] initWithFrame:self.view.bounds];
- _containerView.placePage.delegate = self;
- [_containerView.placePage addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
- }
- return _containerView;
-}
-
- (UIImageView *)apiBar
{
if (!_apiBar)
@@ -922,13 +881,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
#pragma mark - Routing
-- (void)tryToBuildRoute
-{
- [self.routeView updateWithInfo:nil];
- [self.containerView.placePage showBuildingRoutingActivity:YES];
- GetFramework().BuildRoute([self.containerView.placePage pinPoint]);
-}
-
- (void)dismissRouting
{
GetFramework().CloseRouting();
@@ -966,80 +918,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
self.controlsManager.hidden = (state == SearchViewStateFullscreen);
}
-#pragma mark - PlacePageViewDelegate
-
-- (void)placePageViewDidStartRouting:(PlacePageView *)placePage
-{
- [self tryToBuildRoute];
-}
-
-- (void)placePageView:(PlacePageView *)placePage willShareText:(NSString *)text point:(m2::PointD)point
-{
- ShareInfo * info = [[ShareInfo alloc] initWithText:text gX:point.x gY:point.y myPosition:NO];
- self.shareActionSheet = [[ShareActionSheet alloc] initWithInfo:info viewController:self];
- [self.shareActionSheet showFromRect:CGRectMake(placePage.midX, placePage.maxY, 0, 0)];
-}
-
-- (void)placePageView:(PlacePageView *)placePage willEditProperty:(NSString *)propertyName inBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
-{
- if ([propertyName isEqualToString:@"Set"])
- {
- SelectSetVC * vc = [[SelectSetVC alloc] initWithBookmarkAndCategory:bookmarkAndCategory];
- vc.delegate = self;
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if ([propertyName isEqualToString:@"Description"])
- {
- BookmarkDescriptionVC * vc = [self.mainStoryboard instantiateViewControllerWithIdentifier:[BookmarkDescriptionVC className]];
- vc.delegate = self;
- vc.bookmarkAndCategory = bookmarkAndCategory;
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if ([propertyName isEqualToString:@"Name"])
- {
- BookmarkNameVC * vc = [self.mainStoryboard instantiateViewControllerWithIdentifier:[BookmarkNameVC className]];
- vc.delegate = self;
- vc.temporaryName = placePage.temporaryTitle;
- vc.bookmarkAndCategory = bookmarkAndCategory;
- [self.navigationController pushViewController:vc animated:YES];
- }
-}
-
-- (void)selectSetVC:(SelectSetVC *)vc didUpdateBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
-{
- [self updatePlacePageWithBookmarkAndCategory:bookmarkAndCategory];
-}
-
-- (void)bookmarkDescriptionVC:(BookmarkDescriptionVC *)vc didUpdateBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
-{
- [self updatePlacePageWithBookmarkAndCategory:bookmarkAndCategory];
-}
-
-- (void)bookmarkNameVC:(BookmarkNameVC *)vc didUpdateBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
-{
- [self updatePlacePageWithBookmarkAndCategory:bookmarkAndCategory];
-}
-
-- (void)updatePlacePageWithBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
-{
- BookmarkCategory const * category = GetFramework().GetBookmarkManager().GetBmCategory(bookmarkAndCategory.first);
- Bookmark const * bookmark = category->GetBookmark(bookmarkAndCategory.second);
-
- [self.containerView.placePage showUserMark:bookmark->Copy()];
- [self.containerView.placePage setState:self.containerView.placePage.state animated:YES withCallback:NO];
-}
-
-- (void)placePageView:(PlacePageView *)placePage willShareApiPoint:(ApiMarkPoint const *)point
-{
- NSString * urlString = [NSString stringWithUTF8String:GetFramework().GenerateApiBackUrl(*point).c_str()];
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
-}
-
-- (void)placePageViewWillEnterState:(PlacePageState)state
-{
- [self.controlsManager moveButton:MWMMapViewControlsButtonZoom toDefaultPosition:(state == PlacePageStateHidden)];
-}
-
#pragma mark - UIKitViews delegates
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
@@ -1059,85 +937,13 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
- if (object == self.containerView.placePage && [keyPath isEqualToString:@"state"])
+ if (object == self.searchView && [keyPath isEqualToString:@"state"])
{
- [self updateStatusBarStyle];
- switch (self.containerView.placePage.state)
- {
- case PlacePageStateHidden:
- {
- if (self.searchView.state == SearchViewStateAlpha)
- [self.searchView setState:SearchViewStateResults animated:YES withCallback:NO];
-
- GetFramework().GetBalloonManager().RemovePin();
-
- [UIView animateWithDuration:0.3 animations:^
- {
- if (GetFramework().IsRoutingActive())
- {
- if (self.searchView.state == SearchViewStateResults)
- {
- [self observeValueForKeyPath:@"state" ofObject:self.searchView change:nil context:nil];
- }
- else
- {
- self.routeView.alpha = 1;
- self.routeView.minY = 0;
- }
- }
- }];
- break;
- }
- case PlacePageStatePreview:
- {
- if (self.searchView.state == SearchViewStateResults)
- [self.searchView setState:SearchViewStateAlpha animated:YES withCallback:NO];
-
- if ([change[@"old"] integerValue] == PlacePageStatePreview || [change[@"old"] integerValue] == PlacePageStateHidden)
- {
- m2::PointD const pinPoint = [self.containerView.placePage pinPoint];
- CGPoint viewPinPoint = [(EAGLView *)self.view globalPoint2ViewPoint:CGPointMake(pinPoint.x, pinPoint.y)];
-
- if (CGRectContainsPoint(self.view.bounds, viewPinPoint))
- {
- CGFloat const minOffset = 40.0;
- CGFloat const bottomOffset = 44.0;
- viewPinPoint.x = MIN(self.view.width - minOffset, viewPinPoint.x);
- viewPinPoint.x = MAX(minOffset, viewPinPoint.x);
- viewPinPoint.y = MIN(self.view.height - minOffset - bottomOffset, viewPinPoint.y);
- viewPinPoint.y = MAX(minOffset + self.containerView.placePage.maxY, viewPinPoint.y);
-
- CGPoint const center = [(EAGLView *)self.view viewPoint2GlobalPoint:viewPinPoint];
- m2::PointD const offset = [self.containerView.placePage pinPoint] - m2::PointD(center.x, center.y);
- Framework & framework = GetFramework();
- framework.SetViewportCenterAnimated(framework.GetViewportCenter() + offset);
- }
- }
- [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^
- {
- if (GetFramework().IsRoutingActive())
- self.routeView.alpha = 1;
- }
- completion:nil];
- break;
- }
- case PlacePageStateOpened:
- {
- [UIView animateWithDuration:0.3 animations:^
- {
- self.routeView.alpha = 0;
- }];
- break;
- }
- }
- }
- else if (object == self.searchView && [keyPath isEqualToString:@"state"])
- {
- [self updateStatusBarStyle];
+ if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
+ [self setNeedsStatusBarAppearanceUpdate];
if (self.searchView.state == SearchViewStateFullscreen)
{
GetFramework().ActivateUserMark(NULL);
- [self.containerView.placePage setState:PlacePageStateHidden animated:YES withCallback:NO];
}
else if (self.searchView.state == SearchViewStateResults)
{
@@ -1169,13 +975,11 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
[UIView animateWithDuration:(animated ? 0.3 : 0) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^
{
self.apiBar.minY = 0;
- self.containerView.frame = CGRectMake(0, self.apiBar.maxY, self.view.width, self.view.height - self.apiBar.maxY);
self.routeViewWrapper.minY = self.apiBar.maxY;
}
completion:nil];
[self.view insertSubview:self.searchView aboveSubview:self.apiBar];
- self.containerView.placePage.statusBarIncluded = NO;
self.apiTitleLabel.text = [NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()];
}
@@ -1184,20 +988,15 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
[UIView animateWithDuration:(animated ? 0.3 : 0) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^
{
self.apiBar.maxY = 0;
- self.containerView.frame = self.view.bounds;
self.routeViewWrapper.minY = self.apiBar.maxY;
}
completion:^(BOOL finished)
{
[self.apiBar removeFromSuperview];
}];
-
- [self.view insertSubview:self.searchView belowSubview:self.containerView];
- self.containerView.placePage.statusBarIncluded = YES;
}
[self dismissPopover];
- [self.containerView.placePage setState:self.containerView.placePage.state animated:YES withCallback:YES];
[self.searchView setState:SearchViewStateHidden animated:YES withCallback:YES];
_apiMode = apiMode;
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm
index 3898e68bc2..5f3fe09966 100644
--- a/iphone/Maps/Classes/MapsAppDelegate.mm
+++ b/iphone/Maps/Classes/MapsAppDelegate.mm
@@ -358,16 +358,21 @@ void InitLocalizedStrings()
NSMutableDictionary * attributes = [[NSMutableDictionary alloc] init];
attributes[UITextAttributeTextColor] = [UIColor whiteColor];
attributes[UITextAttributeTextShadowColor] = [UIColor clearColor];
- [[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTintColor:[UIColor colorWithColorCode:@"15c584"]];
+// 1F9952
if (!isIOSVersionLessThan(7))
{
+ [[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];
-
- [[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setBackgroundImage:[UIImage imageNamed:@"NavigationBarBackground7"] forBarMetrics:UIBarMetricsDefault];
+ [[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setBarTintColor:[UIColor colorWithColorCode:@"1F9952"]];
attributes[UITextAttributeFont] = [UIFont fontWithName:@"HelveticaNeue" size:17.5];
}
+ else
+ {
+ [[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTintColor:[UIColor colorWithColorCode:@"15c584"]];
+ [[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setBackgroundImage:[UIImage imageNamed:@"NavigationBarBackground7"] forBarMetrics:UIBarMetricsCompactPrompt];
+ }
if ([UINavigationBar instancesRespondToSelector:@selector(setShadowImage:)])
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setShadowImage:[[UIImage alloc] init]];
diff --git a/iphone/Maps/Classes/PlacePageActionBar.xib b/iphone/Maps/Classes/PlacePageActionBar.xib
index 4cda9827c5..830afcbbb6 100644
--- a/iphone/Maps/Classes/PlacePageActionBar.xib
+++ b/iphone/Maps/Classes/PlacePageActionBar.xib
@@ -9,34 +9,30 @@
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MWMPlacePageActionBar">
<rect key="frame" x="0.0" y="0.0" width="320" height="58"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Jtm-w6-q1e">
- <rect key="frame" x="47" y="12" width="24" height="23"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <rect key="frame" x="18" y="0.0" width="83" height="46"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
<state key="normal" image="ic_share">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
+ <connections>
+ <action selector="shareTap:" destination="iN0-l3-epB" eventType="touchUpInside" id="MEA-aQ-UTU"/>
+ </connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="66j-hn-azO">
- <rect key="frame" x="148" y="12" width="24" height="23"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <rect key="frame" x="118" y="0.0" width="83" height="46"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES"/>
<state key="normal" title="" image="ic_bookmark_off"/>
<state key="selected" image="ic_bookmark_on"/>
<connections>
<action selector="bookmarkTap:" destination="iN0-l3-epB" eventType="touchUpInside" id="9DU-IP-Xms"/>
</connections>
</button>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6cp-1o-ehc">
- <rect key="frame" x="250" y="12" width="24" height="23"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- <state key="normal" image="ic_route">
- <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
- </state>
- </button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Share" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4Hy-ie-rSK">
<rect key="frame" x="22" y="38" width="75" height="13"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.094117647058823528" green="0.61960784313725492" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@@ -45,18 +41,18 @@
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bookmark" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="niS-Il-TNU">
- <rect key="frame" x="123" y="37" width="75" height="13"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <rect key="frame" x="122" y="37" width="75" height="13"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.094117647060000004" green="0.61960784310000006" blue="0.30588235289999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="bookmark"/>
+ <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="dropped_pin"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Route" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="OOE-NW-gUw">
<rect key="frame" x="225" y="37" width="75" height="13"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.094117647060000004" green="0.61960784310000006" blue="0.30588235289999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@@ -69,9 +65,27 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
</view>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6cp-1o-ehc">
+ <rect key="frame" x="221" y="0.0" width="83" height="46"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
+ <state key="normal" image="ic_route">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="routeTap:" destination="iN0-l3-epB" eventType="touchUpInside" id="MNc-Va-OZm"/>
+ </connections>
+ </button>
</subviews>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ <connections>
+ <outlet property="bookmarkButton" destination="66j-hn-azO" id="uBJ-zf-YgW"/>
+ <outlet property="bookmarkLabel" destination="niS-Il-TNU" id="q0I-39-OWe"/>
+ <outlet property="routeButton" destination="6cp-1o-ehc" id="qSO-u1-8px"/>
+ <outlet property="routeLabel" destination="OOE-NW-gUw" id="hLC-Td-pdV"/>
+ <outlet property="shareButton" destination="Jtm-w6-q1e" id="Bu8-eV-KhG"/>
+ <outlet property="shareLabel" destination="4Hy-ie-rSK" id="b5p-nj-j5J"/>
+ </connections>
<point key="canvasLocation" x="335" y="266"/>
</view>
</objects>
diff --git a/iphone/Maps/Classes/PlacePageBookmarkCell.xib b/iphone/Maps/Classes/PlacePageBookmarkCell.xib
index e7d1812ca5..d23703022b 100644
--- a/iphone/Maps/Classes/PlacePageBookmarkCell.xib
+++ b/iphone/Maps/Classes/PlacePageBookmarkCell.xib
@@ -7,88 +7,108 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="PlacePageBookmarkCell" rowHeight="204" id="riP-j7-sc5" customClass="MWMPlacePageBookmarkCell">
- <rect key="frame" x="0.0" y="0.0" width="320" height="204"/>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="PlacePageBookmarkCell" rowHeight="123" id="riP-j7-sc5" customClass="MWMPlacePageBookmarkCell">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="135"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="riP-j7-sc5" id="tHy-p3-ggw">
- <rect key="frame" x="0.0" y="0.0" width="320" height="203"/>
+ <rect key="frame" x="0.0" y="0.0" width="320" height="134"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <view contentMode="scaleToFill" id="Ke2-cO-m9r">
- <rect key="frame" x="0.0" y="0.0" width="320" height="1"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="calibratedRGB"/>
+ <view hidden="YES" contentMode="scaleToFill" id="Ke2-cO-m9r">
+ <rect key="frame" x="0.0" y="0.0" width="40" height="1"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" id="X0g-D4-i58">
<rect key="frame" x="40" y="81" width="280" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" id="jSl-xq-N7n">
<rect key="frame" x="40" y="44" width="220" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
</view>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_bookmark" id="Sgy-EK-ZNd">
- <rect key="frame" x="16" y="14" width="16" height="16"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- </imageView>
- <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" text="Lorem ipsum dolor sit er elit l\" id="3gL-gW-aeo">
- <rect key="frame" x="40" y="1" width="220" height="43"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
- <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
- <textInputTraits key="textInputTraits" autocapitalizationType="sentences" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
- <connections>
- <outlet property="delegate" destination="riP-j7-sc5" id="rlP-W1-zvM"/>
- </connections>
- </textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="IZm-JR-i7Q">
<rect key="frame" x="44" y="45" width="220" height="36"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="14"/>
+ <inset key="contentEdgeInsets" minX="-3" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="My marks &gt;">
<color key="titleColor" red="0.094117647060000004" green="0.61960784310000006" blue="0.30588235289999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
+ <connections>
+ <action selector="categoryButtonTap:" destination="riP-j7-sc5" eventType="touchUpInside" id="x6i-Vq-hMR"/>
+ </connections>
</button>
- <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="spq-S9-utn">
- <rect key="frame" x="40" y="82" width="272" height="102"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
- <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
- <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
- <textInputTraits key="textInputTraits" autocapitalizationType="sentences" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="rer-vk-fBj">
+ <rect key="frame" x="40" y="82" width="280" height="32"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
+ <inset key="contentEdgeInsets" minX="0.0" minY="0.0" maxX="9" maxY="0.0"/>
+ <state key="normal" title="&gt;">
+ <color key="titleColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
<connections>
- <outlet property="delegate" destination="riP-j7-sc5" id="WTA-HN-wKo"/>
+ <action selector="editTap:" destination="riP-j7-sc5" eventType="touchUpInside" id="IPm-fW-P5Z"/>
</connections>
- </textView>
+ </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="07N-gj-Msx">
- <rect key="frame" x="276" y="16" width="28" height="28"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
- <state key="normal" image="color_picker_red_on">
+ <rect key="frame" x="278" y="14" width="28" height="28"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
+ <connections>
+ <action selector="colorPickerButtonTap:" destination="riP-j7-sc5" eventType="touchUpInside" id="02I-jl-a67"/>
+ </connections>
</button>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dpw-Z7-JkD">
+ <rect key="frame" x="40" y="82" width="248" height="32"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
+ <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="description"/>
+ </userDefinedRuntimeAttributes>
+ </label>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_bookmark" id="Sgy-EK-ZNd">
+ <rect key="frame" x="16" y="15" width="16" height="16"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES"/>
+ </imageView>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" clearButtonMode="whileEditing" id="iH4-qA-j8k">
+ <rect key="frame" x="42" y="0.0" width="228" height="44"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+ <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
+ <textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="done"/>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="localizedPlaceholder" value="name"/>
+ </userDefinedRuntimeAttributes>
+ <connections>
+ <outlet property="delegate" destination="riP-j7-sc5" id="V5L-on-8bx"/>
+ </connections>
+ </textField>
</subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<connections>
<outlet property="categoryButton" destination="IZm-JR-i7Q" id="D5e-XT-WOB"/>
- <outlet property="descriptionTextView" destination="spq-S9-utn" id="C3A-u7-L8M"/>
+ <outlet property="descriptionLabel" destination="dpw-Z7-JkD" id="UFN-79-sDe"/>
<outlet property="firstSeparatorView" destination="jSl-xq-N7n" id="MLa-z2-PIS"/>
<outlet property="markButton" destination="07N-gj-Msx" id="fQD-22-0C8"/>
<outlet property="secondSeparatorView" destination="X0g-D4-i58" id="kN1-EX-J9i"/>
- <outlet property="title" destination="3gL-gW-aeo" id="ux0-Ld-aSx"/>
+ <outlet property="title" destination="iH4-qA-j8k" id="A6E-Ob-jsN"/>
</connections>
- <point key="canvasLocation" x="191" y="339"/>
+ <point key="canvasLocation" x="191" y="304.5"/>
</tableViewCell>
</objects>
<resources>
- <image name="color_picker_red_on" width="28" height="28"/>
<image name="ic_bookmark" width="16" height="16"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
diff --git a/iphone/Maps/Classes/PlacePageInfoCell.mm b/iphone/Maps/Classes/PlacePageInfoCell.mm
index 05364dae04..191f832aaf 100644
--- a/iphone/Maps/Classes/PlacePageInfoCell.mm
+++ b/iphone/Maps/Classes/PlacePageInfoCell.mm
@@ -49,6 +49,7 @@
- (NSString *)distance
{
+#warning тут про локацию
CLLocation * location = [MapsAppDelegate theApp].m_locationManager.lastLocation;
if (location)
{
diff --git a/iphone/Maps/Classes/PlacePageInfoCell.xib b/iphone/Maps/Classes/PlacePageInfoCell.xib
index dd194ab704..dc6c9abd3f 100644
--- a/iphone/Maps/Classes/PlacePageInfoCell.xib
+++ b/iphone/Maps/Classes/PlacePageInfoCell.xib
@@ -16,24 +16,40 @@
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="xwC-DR-6Il">
<rect key="frame" x="16" y="14" width="16" height="16"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES"/>
</imageView>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="viE-zJ-wsl">
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="viE-zJ-wsl" customClass="CopyLabel">
<rect key="frame" x="44" y="14" width="256" height="18"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <gestureRecognizers/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
+ <view contentMode="scaleToFill" id="CNm-TR-GPW">
+ <rect key="frame" x="40" y="43" width="280" height="1"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
+ </view>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="vu9-VL-9jn">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <state key="normal">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="cellTap:" destination="VAd-kw-ZEC" eventType="touchUpInside" id="ztB-CS-FOm"/>
+ </connections>
+ </button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
- <inset key="separatorInset" minX="40" minY="0.0" maxX="0.0" maxY="0.0"/>
<connections>
<outlet property="icon" destination="xwC-DR-6Il" id="vcm-nJ-D7N"/>
<outlet property="textContainer" destination="viE-zJ-wsl" id="0bz-b0-s3h"/>
+ <outlet property="upperButton" destination="vu9-VL-9jn" id="mrL-f3-DXh"/>
</connections>
<point key="canvasLocation" x="120" y="300"/>
</tableViewCell>
diff --git a/iphone/Maps/Classes/PlacePageLinkCell.xib b/iphone/Maps/Classes/PlacePageLinkCell.xib
index 8c83ffb0c4..eae94364b6 100644
--- a/iphone/Maps/Classes/PlacePageLinkCell.xib
+++ b/iphone/Maps/Classes/PlacePageLinkCell.xib
@@ -16,12 +16,13 @@
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="DT5-2i-vCG">
<rect key="frame" x="16" y="14" width="16" height="16"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
</imageView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" id="T5l-Sb-Hfo">
- <rect key="frame" x="40" y="3" width="256" height="35"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <rect key="frame" x="40" y="4" width="256" height="35"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <inset key="contentInset" minX="0.0" minY="2" maxX="0.0" maxY="0.0"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -30,6 +31,11 @@
<outlet property="delegate" destination="DKh-ne-anv" id="KQo-Mn-gqx"/>
</connections>
</textView>
+ <view contentMode="scaleToFill" id="ZSw-Rd-B64">
+ <rect key="frame" x="40" y="43" width="280" height="1"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
+ </view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tableViewCellContentView>
diff --git a/iphone/Maps/Classes/PlacePageNavigationBar.xib b/iphone/Maps/Classes/PlacePageNavigationBar.xib
index 1c97ee09b5..1817ae2a94 100644
--- a/iphone/Maps/Classes/PlacePageNavigationBar.xib
+++ b/iphone/Maps/Classes/PlacePageNavigationBar.xib
@@ -9,7 +9,7 @@
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MWMPlacePageNavigationBar">
<rect key="frame" x="0.0" y="0.0" width="320" height="64"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="WrL-L0-rh7">
<rect key="frame" x="0.0" y="20" width="44" height="44"/>
diff --git a/iphone/Maps/Classes/PlacePageView.mm b/iphone/Maps/Classes/PlacePageView.mm
index 1b68cf1700..cd9ff9532f 100644
--- a/iphone/Maps/Classes/PlacePageView.mm
+++ b/iphone/Maps/Classes/PlacePageView.mm
@@ -415,13 +415,13 @@ typedef NS_ENUM(NSUInteger, CellRow)
- (void)setState:(PlacePageState)state animated:(BOOL)animated withCallback:(BOOL)withCallback
{
- if (withCallback)
- [self willChangeValueForKey:@"state"];
-
- [self applyState:state animated:animated];
-
- if (withCallback)
- [self didChangeValueForKey:@"state"];
+// if (withCallback)
+// [self willChangeValueForKey:@"state"];
+//
+// [self applyState:state animated:animated];
+//
+// if (withCallback)
+// [self didChangeValueForKey:@"state"];
}
- (void)applyState:(PlacePageState)state animated:(BOOL)animated
@@ -722,7 +722,6 @@ typedef NS_ENUM(NSUInteger, CellRow)
UserMark const * mark = [self userMark];
BookmarkData newData = static_cast<Bookmark const *>(mark)->GetData();
newData.SetType([[ColorPickerView colorName:colorIndex] UTF8String]);
-
BookmarkAndCategory bookmarkAndCategory = framework.FindBookmark(mark);
framework.ReplaceBookmark(bookmarkAndCategory.first, bookmarkAndCategory.second, newData);
framework.ActivateUserMark(mark);
diff --git a/iphone/Maps/Classes/PlacePageView.xib b/iphone/Maps/Classes/PlacePageView.xib
index 6494e53d63..29982c450e 100644
--- a/iphone/Maps/Classes/PlacePageView.xib
+++ b/iphone/Maps/Classes/PlacePageView.xib
@@ -13,15 +13,21 @@
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
- <view contentMode="scaleToFill" id="KWK-Ky-ZkL">
+ <view clipsSubviews="YES" contentMode="scaleToFill" id="KWK-Ky-ZkL" customClass="MWMExtendedPlacePageView">
<rect key="frame" x="0.0" y="0.0" width="320" height="498"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_placepage_tablet_normal" id="a4c-bA-qa5">
<rect key="frame" x="0.0" y="0.0" width="320" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</imageView>
- <view contentMode="scaleToFill" id="8RI-YR-2UD" customClass="MWMBasePlacePageView">
+ <view contentMode="scaleToFill" id="1m8-Jf-cgf">
+ <rect key="frame" x="0.0" y="22" width="320" height="477"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </view>
+ <view autoresizesSubviews="NO" contentMode="scaleToFill" id="8RI-YR-2UD" customClass="MWMBasePlacePageView">
<rect key="frame" x="0.0" y="22" width="320" height="468"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@@ -39,22 +45,11 @@
<color key="textColor" red="0.60784313729999995" green="0.60784313729999995" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_direction" id="w6w-zO-6d8">
- <rect key="frame" x="272" y="0.0" width="32" height="32"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- </imageView>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="500 mi" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="kGT-CI-UsC">
- <rect key="frame" x="207" y="5" width="57" height="21"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- <fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
- <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
- <nil key="highlightedColor"/>
- </label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" allowsSelection="NO" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="hZM-Gs-BbS">
<rect key="frame" x="0.0" y="60" width="320" height="408"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
- <color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="custom" customColorSpace="sRGB"/>
+ <color key="separatorColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="layer.borderUIColor">
@@ -62,12 +57,41 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</tableView>
+ <view contentMode="scaleToFill" id="Spo-tb-t0A">
+ <rect key="frame" x="0.0" y="52" width="320" height="1"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
+ </view>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="500 mi" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="kGT-CI-UsC">
+ <rect key="frame" x="214" y="7" width="57" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>
+ <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView autoresizesSubviews="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_direction" id="ExH-ug-j1j">
+ <rect key="frame" x="279" y="5" width="25" height="25"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ </imageView>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="X4O-iK-cA2">
+ <rect key="frame" x="260" y="0.0" width="60" height="43"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <state key="normal">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="directionButtonTap:" destination="8RI-YR-2UD" eventType="touchUpInside" id="cAw-3M-BpH"/>
+ </connections>
+ </button>
</subviews>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.94999999999999996" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<connections>
- <outlet property="directionArrow" destination="w6w-zO-6d8" id="1xb-GP-etA"/>
+ <outlet property="directionArrow" destination="ExH-ug-j1j" id="3iY-1E-PNI"/>
+ <outlet property="directionButton" destination="X4O-iK-cA2" id="JA4-dy-K6g"/>
<outlet property="distanceLabel" destination="kGT-CI-UsC" id="xLt-R1-jy2"/>
<outlet property="featureTable" destination="hZM-Gs-BbS" id="iBU-Iq-8go"/>
+ <outlet property="ownerPlacePage" destination="-1" id="ptD-bf-NPp"/>
+ <outlet property="separatorView" destination="Spo-tb-t0A" id="y6P-TK-Wws"/>
<outlet property="titleLabel" destination="T1Y-Oq-6fg" id="ifK-nU-q7x"/>
<outlet property="typeLabel" destination="TNu-JO-vJi" id="mWV-cH-KMk"/>
</connections>
diff --git a/iphone/Maps/Classes/SmallCompassView.mm b/iphone/Maps/Classes/SmallCompassView.mm
index a8d3295d6f..59d8edaa15 100644
--- a/iphone/Maps/Classes/SmallCompassView.mm
+++ b/iphone/Maps/Classes/SmallCompassView.mm
@@ -24,6 +24,7 @@
- (void)setAngle:(CGFloat)angle
{
+#warning тут про стрелку
self.arrow.transform = CGAffineTransformIdentity;
self.arrow.transform = CGAffineTransformMakeRotation(M_PI_2 - angle);
_angle = angle;
diff --git a/iphone/Maps/Classes/UIViewController+Navigation.mm b/iphone/Maps/Classes/UIViewController+Navigation.mm
index c5a4a17c69..974548cd34 100644
--- a/iphone/Maps/Classes/UIViewController+Navigation.mm
+++ b/iphone/Maps/Classes/UIViewController+Navigation.mm
@@ -6,14 +6,15 @@
- (void)showBackButton
{
- UIButton * backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 56, 44)];
- [backButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
- [backButton setImage:[UIImage imageNamed:@"NavigationBarBackButton"] forState:UIControlStateNormal];
-
- UIBarButtonItem * space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
- space.width = isIOSVersionLessThan(7) ? -8 : -16;
- UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:backButton];
- self.navigationItem.leftBarButtonItems = @[space, item];
+// UIButton * backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 56, 44)];
+// [backButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
+// [backButton setImage:[UIImage imageNamed:@"NavigationBarBackButton"] forState:UIControlStateNormal];
+//
+// UIBarButtonItem * space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
+// space.width = SYSTEM_VERSION_IS_LESS_THAN(@"7") ? -8 : -16;
+ UIBarButtonItem * leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"NavigationBarBackButton"] style:UIBarButtonItemStylePlain target:self action:@selector(backButtonPressed:)];
+// UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:backButton];
+ self.navigationItem.leftBarButtonItem = leftItem;
}
- (void)backButtonPressed:(id)sender