[ios] Added safety interface for work with metadata dictionary.
|
@ -8,6 +8,6 @@
|
|||
|
||||
- (instancetype)initWithPlacePageManager:(MWMPlacePageViewManager *)manager;
|
||||
|
||||
@property (weak, nonatomic) UINavigationController * ownerNavigationController;
|
||||
@property (weak, nonatomic) UINavigationController * iPadOwnerNavigationController;
|
||||
|
||||
@end
|
||||
|
|
|
@ -29,28 +29,28 @@
|
|||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self.ownerNavigationController setNavigationBarHidden:NO];
|
||||
[self.iPadOwnerNavigationController setNavigationBarHidden:NO];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
if (!self.ownerNavigationController)
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
return;
|
||||
self.realPlacePageHeight = self.ownerNavigationController.view.height;
|
||||
self.realPlacePageHeight = self.iPadOwnerNavigationController.view.height;
|
||||
CGFloat const bottomOffset = 88.;
|
||||
self.ownerNavigationController.view.height = self.tableView.height + bottomOffset;
|
||||
self.iPadOwnerNavigationController.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 addTarget:self action:@selector(backTap) forControlEvents:UIControlEventTouchUpInside];
|
||||
[backButton setImage:backImage forState:UIControlStateNormal];
|
||||
UIBarButtonItem * leftButton = [[UIBarButtonItem alloc] initWithCustomView:backButton];
|
||||
[self.navigationItem setLeftBarButtonItem:leftButton];
|
||||
}
|
||||
|
||||
- (void)backTap:(id)sender
|
||||
- (void)backTap
|
||||
{
|
||||
[self.ownerNavigationController popViewControllerAnimated:YES];
|
||||
[self.iPadOwnerNavigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
|
@ -90,7 +90,7 @@
|
|||
if (cat)
|
||||
cell.textLabel.text = [NSString stringWithUTF8String:cat->GetName().c_str()];
|
||||
|
||||
BookmarkAndCategory bac = self.manager.entity.bac;
|
||||
BookmarkAndCategory const bac = self.manager.entity.bac;
|
||||
|
||||
if (bac.first == indexPath.row)
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
|
@ -111,12 +111,12 @@
|
|||
- (void)moveBookmarkToSetWithIndex:(int)setIndex
|
||||
{
|
||||
MWMPlacePageEntity * entity = self.manager.entity;
|
||||
BookmarkAndCategory bac = entity.bac;
|
||||
BookmarkAndCategory bac;
|
||||
bac.second = static_cast<int>(GetFramework().MoveBookmark(entity.bac.second, entity.bac.first, setIndex));
|
||||
bac.first = setIndex;
|
||||
entity.bac = bac;
|
||||
|
||||
BookmarkCategory * category = GetFramework().GetBookmarkManager().GetBmCategory(bac.first);
|
||||
BookmarkCategory const * category = GetFramework().GetBookmarkManager().GetBmCategory(bac.first);
|
||||
entity.bookmarkCategory = [NSString stringWithUTF8String:category->GetName().c_str()];
|
||||
}
|
||||
|
||||
|
@ -142,14 +142,11 @@
|
|||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
[self.manager reloadBookmark];
|
||||
|
||||
if (!self.ownerNavigationController)
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
self.ownerNavigationController.navigationBar.hidden = YES;
|
||||
[self.ownerNavigationController setNavigationBarHidden:YES];
|
||||
self.ownerNavigationController.view.height = self.realPlacePageHeight;
|
||||
[self.iPadOwnerNavigationController setNavigationBarHidden:YES];
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -2,6 +2,26 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "Macros.h"
|
||||
|
||||
static inline CGPoint CGPointSubtract(CGPoint p1, CGPoint p2)
|
||||
{
|
||||
return CGPointMake(p1.x - p2.x, p1.y - p2.y);
|
||||
}
|
||||
|
||||
static inline CGPoint CGPointAdd(CGPoint p1, CGPoint p2)
|
||||
{
|
||||
return CGPointMake(p1.x + p2.x, p1.y + p2.y);
|
||||
}
|
||||
|
||||
static inline CGPoint CGPointMultiply(CGPoint point, CGFloat multiplier)
|
||||
{
|
||||
return CGPointMake(point.x * multiplier, point.y * multiplier);
|
||||
}
|
||||
|
||||
static inline CGFloat CGPointLength(CGPoint point)
|
||||
{
|
||||
return (CGFloat)sqrt(point.x * point.x + point.y * point.y);
|
||||
}
|
||||
|
||||
@interface NSObject (Optimized)
|
||||
|
||||
+ (NSString *)className;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
+ (UIColor *)navigationBarColor
|
||||
{
|
||||
return [UIColor colorWithColorCode:@"15c783"];
|
||||
return [UIColor colorWithColorCode:@"1F9952"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
6
iphone/Maps/Classes/ContextViews.h
Executable file
|
@ -0,0 +1,6 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface CopyLabel : UILabel
|
||||
|
||||
@end
|
30
iphone/Maps/Classes/ContextViews.mm
Executable file
|
@ -0,0 +1,30 @@
|
|||
|
||||
#import "ContextViews.h"
|
||||
|
||||
@implementation CopyLabel
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
self.userInteractionEnabled = YES;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
|
||||
{
|
||||
return action == @selector(copy:);
|
||||
}
|
||||
|
||||
- (void)copy:(id)sender
|
||||
{
|
||||
[UIPasteboard generalPasteboard].string = self.text;
|
||||
}
|
||||
|
||||
@end
|
|
@ -24,7 +24,6 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
|
|||
self = [super initWithNibName:kAlertControllerNibIdentifier bundle:nil];
|
||||
if (self)
|
||||
self.ownerViewController = viewController;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#import "MWMAnimator.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
static int kScreenAnimationKey;
|
||||
|
||||
@interface MWMAnimator ()
|
||||
|
||||
@property (nonatomic) CADisplayLink * displayLink;
|
||||
|
@ -25,13 +23,12 @@ static int kScreenAnimationKey;
|
|||
if (!screen)
|
||||
screen = [UIScreen mainScreen];
|
||||
|
||||
MWMAnimator * animator = objc_getAssociatedObject(screen, &kScreenAnimationKey);
|
||||
MWMAnimator * animator = objc_getAssociatedObject(screen, _cmd);
|
||||
if (!animator)
|
||||
{
|
||||
animator = [[self alloc] initWithScreen:screen];
|
||||
objc_setAssociatedObject(screen, &kScreenAnimationKey, animator, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(screen, _cmd, animator, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
return animator;
|
||||
}
|
||||
|
||||
|
@ -50,7 +47,7 @@ static int kScreenAnimationKey;
|
|||
|
||||
- (void)animationTick:(CADisplayLink *)displayLink
|
||||
{
|
||||
CFTimeInterval dt = displayLink.duration;
|
||||
CFTimeInterval const dt = displayLink.duration;
|
||||
for (id<Animation> a in self.animations.copy)
|
||||
{
|
||||
BOOL finished = NO;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
@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;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#import "MWMPlacePage.h"
|
||||
#import "MWMPlacePageActionBar.h"
|
||||
#import "MWMPlacePageViewManager.h"
|
||||
#import "MWMDirectionView.h"
|
||||
#import "MWMPlacePageTypeDescription.h"
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
|
@ -51,8 +50,8 @@ extern CGFloat const kBookmarkCellHeight = 135.;
|
|||
|
||||
- (void)configure
|
||||
{
|
||||
MWMPlacePageEntity const * entity = self.entity;
|
||||
MWMPlacePageEntityType type = entity.type;
|
||||
MWMPlacePageEntity * entity = self.entity;
|
||||
MWMPlacePageEntityType const type = entity.type;
|
||||
self.directionArrow.autoresizingMask = UIViewAutoresizingNone;
|
||||
|
||||
if (type == MWMPlacePageEntityTypeBookmark)
|
||||
|
@ -80,80 +79,83 @@ extern CGFloat const kBookmarkCellHeight = 135.;
|
|||
[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.;
|
||||
static CGFloat const kLeftOffset = 16.;
|
||||
static CGFloat const kDirectionArrowSide = 32.;
|
||||
static CGFloat const kOffsetFromTitleToDistance = 12.;
|
||||
static CGFloat const kOffsetFromDistanceToArrow = 8.;
|
||||
static CGFloat const kTitleBottomOffset = 2.;
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
MWMPlacePageEntity const * entity = self.entity;
|
||||
MWMPlacePageEntity * 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 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.;
|
||||
BOOL const isExtendedType = type == MWMPlacePageEntityTypeEle || type == MWMPlacePageEntityTypeHotel;
|
||||
CGFloat const topOffset = (self.typeLabel.text.length > 0 || isExtendedType) ? 0 : 4.;
|
||||
CGFloat const typeBottomOffset = 10.;
|
||||
self.width = placePageWidth;
|
||||
self.titleLabel.width = maximumTitleWidth;
|
||||
[self.titleLabel sizeToFit];
|
||||
self.typeLabel.width = maximumTitleWidth;
|
||||
[self.typeLabel sizeToFit];
|
||||
CGFloat const typeMinY = self.titleLabel.maxY + titleBottomOffset;
|
||||
CGFloat const typeMinY = self.titleLabel.maxY + kTitleBottomOffset;
|
||||
|
||||
self.titleLabel.origin = CGPointMake(leftOffset, topOffset);
|
||||
self.typeLabel.origin = CGPointMake(leftOffset, typeMinY);
|
||||
self.titleLabel.origin = CGPointMake(kLeftOffset, topOffset);
|
||||
self.typeLabel.origin = CGPointMake(kLeftOffset, typeMinY);
|
||||
|
||||
[self layoutDistanceLabel];
|
||||
if (type == MWMPlacePageEntityTypeEle || type == MWMPlacePageEntityTypeHotel)
|
||||
[self layoutDistanceLabelWithPlacePageWidth:placePageWidth];
|
||||
if (isExtendedType)
|
||||
[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.featureTable.height = self.featureTable.contentSize.height;
|
||||
self.featureTable.contentOffset = CGPointZero;
|
||||
self.height = typeBottomOffset + titleBottomOffset + typeHeight + self.titleLabel.height + self.typeLabel.height + self.featureTable.height;
|
||||
self.height = typeBottomOffset + kTitleBottomOffset + typeHeight + self.titleLabel.height + self.typeLabel.height + self.featureTable.height;
|
||||
}
|
||||
|
||||
- (void)layoutTypeDescription
|
||||
{
|
||||
MWMPlacePageEntity const * entity = self.entity;
|
||||
CGFloat const typeMinY = self.titleLabel.maxY + titleBottomOffset;
|
||||
MWMPlacePageEntity * entity = self.entity;
|
||||
CGFloat const typeMinY = self.titleLabel.maxY + kTitleBottomOffset;
|
||||
[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 minX = typeLabelIsNotEmpty ? self.typeLabel.minX + self.typeLabel.width + 2 * kTitleBottomOffset : kLeftOffset;
|
||||
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
|
||||
- (void)layoutDistanceLabelWithPlacePageWidth:(CGFloat)placePageWidth
|
||||
{
|
||||
CGFloat const maximumTitleWidth = kPlacePageTitleKoefficient * placePageWidth;
|
||||
CGFloat const distanceLabelWidthPositionLeft = placePageWidth - maximumTitleWidth - directionArrowSide - 2 * leftOffset - offsetFromDistanceToArrow - offsetFromTitleToDistance;
|
||||
CGFloat const distanceLabelWidthPositionLeft = placePageWidth - maximumTitleWidth - kDirectionArrowSide - 2 * kLeftOffset - kOffsetFromDistanceToArrow - kOffsetFromTitleToDistance;
|
||||
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 directionArrowMinX = placePageWidth - kLeftOffset - kDirectionArrowSide;
|
||||
CGFloat const distanceLabelMinX = directionArrowMinX - self.distanceLabel.width - kOffsetFromDistanceToArrow;
|
||||
CGFloat const distanceLabelMinY = titleCenterY - self.distanceLabel.height / 2.;
|
||||
CGFloat const directionArrowMinY = titleCenterY - directionArrowSide / 2.;
|
||||
CGFloat const directionArrowMinY = titleCenterY - kDirectionArrowSide / 2.;
|
||||
self.distanceLabel.origin = CGPointMake(distanceLabelMinX, distanceLabelMinY);
|
||||
self.directionArrow.center = CGPointMake(directionArrowMinX + directionArrowSide / 2., directionArrowMinY + directionArrowSide / 2.);
|
||||
self.directionArrow.center = CGPointMake(directionArrowMinX + kDirectionArrowSide / 2., directionArrowMinY + kDirectionArrowSide / 2.);
|
||||
self.directionButton.origin = self.directionArrow.origin;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { }
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
// Prevent super call to stop event propagation
|
||||
// [super touchesBegan:touches withEvent:event];
|
||||
}
|
||||
|
||||
- (void)addBookmark
|
||||
{
|
||||
|
@ -161,50 +163,26 @@ static CGFloat const titleBottomOffset = 2.;
|
|||
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.entity insertBookmarkInTypes];
|
||||
[self configure];
|
||||
}
|
||||
|
||||
- (void)removeBookmark
|
||||
{
|
||||
[self.entity.metadata[@"keys"] removeObject:@"Bookmark"];
|
||||
[self.entity removeBookmarkFromTypes];
|
||||
[self configure];
|
||||
}
|
||||
|
||||
- (void)reloadBookmarkCell
|
||||
{
|
||||
NSUInteger const count = [self.entity.metadata[@"keys"] count];
|
||||
NSUInteger const count = self.entity.metadataTypes.count;
|
||||
NSIndexPath * index = [NSIndexPath indexPathForRow:count - 1 inSection:0];
|
||||
[self.featureTable reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
}
|
||||
|
||||
- (IBAction)directionButtonTap:(id)sender
|
||||
- (IBAction)directionButtonTap
|
||||
{
|
||||
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;
|
||||
[self.ownerPlacePage.manager showDirectionViewWithTitle:self.titleLabel.text type:self.typeLabel.text];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -213,36 +191,36 @@ static CGFloat const titleBottomOffset = 2.;
|
|||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
NSString * const currentKey = self.entity.metadata[@"keys"][indexPath.row];
|
||||
|
||||
if ([currentKey isEqualToString:@"Bookmark"])
|
||||
NSNumber * const currentType = self.entity.metadataTypes[indexPath.row];
|
||||
if (currentType.integerValue == MWMPlacePageMetadataTypeBookmark)
|
||||
return kBookmarkCellHeight;
|
||||
CGFloat const kDefaultCellHeight = 44.;
|
||||
|
||||
CGFloat const defaultCellHeight = 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.text = self.entity.metadataValues[indexPath.row];
|
||||
[label sizeToFit];
|
||||
CGFloat const defaultCellOffset = 26.;
|
||||
return MAX(label.height + defaultCellOffset, kDefaultCellHeight);
|
||||
return MAX(label.height + defaultCellOffset, defaultCellHeight);
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return [self.entity.metadata[@"keys"] count];
|
||||
return self.entity.metadataTypes.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
NSString * const currentKey = self.entity.metadata[@"keys"][indexPath.row];
|
||||
|
||||
if ([currentKey isEqualToString:@"Bookmark"])
|
||||
MWMPlacePageMetadataType currentType = (MWMPlacePageMetadataType)[self.entity.metadataTypes[indexPath.row] integerValue];
|
||||
|
||||
if (currentType == MWMPlacePageMetadataTypeBookmark)
|
||||
{
|
||||
MWMPlacePageBookmarkCell * cell = (MWMPlacePageBookmarkCell *)[tableView dequeueReusableCellWithIdentifier:kPlacePageBookmarkCellIdentifier];
|
||||
|
||||
if (cell == nil)
|
||||
if (!cell)
|
||||
cell = [[MWMPlacePageBookmarkCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kPlacePageBookmarkCellIdentifier];
|
||||
|
||||
cell.ownerTableView = tableView;
|
||||
|
@ -251,15 +229,16 @@ static CGFloat const titleBottomOffset = 2.;
|
|||
return cell;
|
||||
}
|
||||
|
||||
NSString * const kCellIdentifier = ([currentKey isEqualToString:@"PhoneNumber"] ||[currentKey isEqualToString:@"Email"] || [currentKey isEqualToString:@"Website"]) ? kPlacePageLinkCellIdentifier : kPlacePageInfoCellIdentifier;
|
||||
BOOL const isLinkTypeCell = (currentType == MWMPlacePageMetadataTypePhoneNumber || currentType == MWMPlacePageMetadataTypeEmail || currentType == MWMPlacePageMetadataTypeWebsite || currentType == MWMPlacePageMetadataTypeURL);
|
||||
NSString * const cellIdentifier = isLinkTypeCell ? kPlacePageLinkCellIdentifier : kPlacePageInfoCellIdentifier;
|
||||
|
||||
MWMPlacePageInfoCell * cell = (MWMPlacePageInfoCell *)[tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
|
||||
MWMPlacePageInfoCell * cell = (MWMPlacePageInfoCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
||||
|
||||
if (cell == nil)
|
||||
cell = [[MWMPlacePageInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellIdentifier];
|
||||
if (!cell)
|
||||
cell = [[MWMPlacePageInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
|
||||
|
||||
cell.currentEntity = self.entity;
|
||||
[cell configureWithIconTitle:currentKey info:self.entity.metadata[@"values"][indexPath.row]];
|
||||
[cell configureWithType:currentType info:self.entity.metadataValues[indexPath.row]];
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
@interface MWMBookmarkColorCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton * colorButton;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView * approveImageView;
|
||||
|
||||
- (void)configureWithColorString:(NSString *)colorString;
|
||||
|
|
|
@ -31,14 +31,7 @@ extern NSArray * const kBookmarkColorsVariant;
|
|||
- (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.colorButton setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@%@", self.currentImageName, selected ? @"-on" : @"-off"]] forState:UIControlStateNormal];
|
||||
self.approveImageView.hidden = !selected;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ViewController.h"
|
||||
|
||||
@class MWMPlacePageViewManager;
|
||||
|
||||
@interface MWMBookmarkColorViewController : UIViewController
|
||||
@interface MWMBookmarkColorViewController : ViewController
|
||||
|
||||
@property (weak, nonatomic) MWMPlacePageViewManager * placePageManager;
|
||||
@property (weak, nonatomic) UINavigationController * ownerNavigationController;
|
||||
@property (weak, nonatomic) UINavigationController * iPadOwnerNavigationController;
|
||||
|
||||
@end
|
||||
|
|
|
@ -31,7 +31,7 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self.ownerNavigationController setNavigationBarHidden:NO];
|
||||
[self.iPadOwnerNavigationController setNavigationBarHidden:NO];
|
||||
self.title = L(@"bookmark_color");
|
||||
[self.tableView registerNib:[UINib nibWithNibName:kBookmarkColorCellIdentifier bundle:nil] forCellReuseIdentifier:kBookmarkColorCellIdentifier];
|
||||
}
|
||||
|
@ -42,38 +42,32 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
[self configureTableViewForOrientation:self.interfaceOrientation];
|
||||
[self.tableView reloadData];
|
||||
|
||||
if (!self.ownerNavigationController)
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
self.realPlacePageHeight = self.ownerNavigationController.view.height;
|
||||
self.realPlacePageHeight = self.iPadOwnerNavigationController.view.height;
|
||||
CGFloat const bottomOffset = 88.;
|
||||
self.ownerNavigationController.view.height = self.tableView.height + bottomOffset;
|
||||
self.iPadOwnerNavigationController.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 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
|
||||
- (void)backTap
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)configureTableViewForOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
if (self.ownerNavigationController)
|
||||
if (self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
CGFloat const defaultHeight = 352.;
|
||||
CGSize size = self.navigationController.view.bounds.size;
|
||||
CGFloat width, height;
|
||||
CGSize const size = self.navigationController.view.bounds.size;
|
||||
|
||||
switch (orientation)
|
||||
{
|
||||
|
@ -84,8 +78,8 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
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 width = size.width < size.height ? size.width : size.height;
|
||||
CGFloat const 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);
|
||||
|
@ -96,8 +90,8 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
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 width = size.width > size.height ? size.width : size.height;
|
||||
CGFloat const 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);
|
||||
|
@ -121,12 +115,11 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
[super viewWillDisappear:animated];
|
||||
[self.placePageManager reloadBookmark];
|
||||
|
||||
if (!self.ownerNavigationController)
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
self.ownerNavigationController.navigationBar.hidden = YES;
|
||||
[self.ownerNavigationController setNavigationBarHidden:YES];
|
||||
self.ownerNavigationController.view.height = self.realPlacePageHeight;
|
||||
[self.iPadOwnerNavigationController setNavigationBarHidden:YES];
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ViewController.h"
|
||||
|
||||
@class MWMPlacePageViewManager;
|
||||
|
||||
@interface MWMBookmarkDescriptionViewController : UIViewController
|
||||
@interface MWMBookmarkDescriptionViewController : ViewController
|
||||
|
||||
- (instancetype)initWithPlacePageManager:(MWMPlacePageViewManager *)manager;
|
||||
|
||||
@property (weak, nonatomic) UINavigationController * ownerNavigationController;
|
||||
@property (weak, nonatomic) UINavigationController * iPadOwnerNavigationController;
|
||||
|
||||
@end
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
BookmarkDescriptionStateEditHTML
|
||||
};
|
||||
|
||||
@interface MWMBookmarkDescriptionViewController ()
|
||||
@interface MWMBookmarkDescriptionViewController () <UIWebViewDelegate>
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UITextView * textView;
|
||||
@property (weak, nonatomic) IBOutlet UIWebView * webView;
|
||||
|
@ -50,7 +50,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self.ownerNavigationController setNavigationBarHidden:NO];
|
||||
[self.iPadOwnerNavigationController setNavigationBarHidden:NO];
|
||||
self.navigationItem.title = L(@"description");
|
||||
MWMPlacePageEntity const * entity = self.manager.entity;
|
||||
|
||||
|
@ -62,23 +62,22 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
if (!self.ownerNavigationController)
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
self.realPlacePageHeight = self.ownerNavigationController.view.height;
|
||||
self.realPlacePageHeight = self.iPadOwnerNavigationController.view.height;
|
||||
CGFloat const bottomOffset = 88.;
|
||||
self.ownerNavigationController.view.height = self.textView.height + bottomOffset;
|
||||
self.iPadOwnerNavigationController.view.height = self.textView.height + bottomOffset;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
if (!self.ownerNavigationController)
|
||||
return;
|
||||
if (!self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
self.ownerNavigationController.navigationBar.hidden = YES;
|
||||
[self.ownerNavigationController setNavigationBarHidden:YES];
|
||||
self.ownerNavigationController.view.height = self.realPlacePageHeight;
|
||||
[self.iPadOwnerNavigationController setNavigationBarHidden:YES];
|
||||
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
|
||||
}
|
||||
|
||||
- (void)setState:(BookmarkDescriptionState)state
|
||||
|
@ -89,16 +88,11 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
{
|
||||
case BookmarkDescriptionStateEditText:
|
||||
case BookmarkDescriptionStateEditHTML:
|
||||
|
||||
[self setupForEditingWithText:description];
|
||||
[self configureNavigationBarForEditing];
|
||||
|
||||
break;
|
||||
|
||||
case BookmarkDescriptionStateViewHTML:
|
||||
|
||||
[self setupForViewWithText:description];
|
||||
[self configureNavigationBarForView];
|
||||
break;
|
||||
}
|
||||
_state = state;
|
||||
|
@ -115,6 +109,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
{
|
||||
self.textView.text = text;
|
||||
}];
|
||||
[self configureNavigationBarForEditing];
|
||||
}
|
||||
|
||||
- (void)setupForViewWithText:(NSString *)text
|
||||
|
@ -128,19 +123,20 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
{
|
||||
[self.webView loadHTMLString:text baseURL:nil];
|
||||
}];
|
||||
[self configureNavigationBarForView];
|
||||
}
|
||||
|
||||
- (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.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.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];
|
||||
}
|
||||
|
||||
|
@ -150,7 +146,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
[self.navigationItem setRightBarButtonItem:self.rightButton];
|
||||
}
|
||||
|
||||
- (void)cancelTap:(id)sender
|
||||
- (void)cancelTap
|
||||
{
|
||||
if (self.manager.entity.isHTMLDescription)
|
||||
self.state = BookmarkDescriptionStateViewHTML;
|
||||
|
@ -158,7 +154,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)doneTap:(id)sender
|
||||
- (void)doneTap
|
||||
{
|
||||
MWMPlacePageEntity * entity = self.manager.entity;
|
||||
entity.bookmarkDescription = self.textView.text;
|
||||
|
@ -171,14 +167,24 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)backTap:(id)sender
|
||||
- (void)backTap
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)editTap:(id)sender
|
||||
- (void)editTap
|
||||
{
|
||||
self.state = BookmarkDescriptionStateEditHTML;
|
||||
}
|
||||
|
||||
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType
|
||||
{
|
||||
if (inType == UIWebViewNavigationTypeLinkClicked)
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:[inRequest URL]];
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-1" id="kcw-1c-sOr"/>
|
||||
</connections>
|
||||
</webView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
|
|
|
@ -17,5 +17,6 @@
|
|||
@property (weak, nonatomic) IBOutlet UIView * contentView;
|
||||
|
||||
+ (MWMDirectionView *)directionViewForViewController:(UIViewController *)viewController;
|
||||
- (void)setDirectionArrowTransform:(CGAffineTransform)transform;
|
||||
|
||||
@end
|
||||
|
|
|
@ -28,7 +28,6 @@ static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
|
|||
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;
|
||||
}
|
||||
|
@ -36,19 +35,23 @@ static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
|
|||
- (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 = self.distanceLabel.font = IPAD ? [UIFont fontWithName:kFontName size:52.] : [UIFont fontWithName:kFontName size:32.];
|
||||
self.typeLabel.font = 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.autoresizingMask = self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
||||
self.directionArrow.autoresizingMask = UIViewAutoresizingNone;
|
||||
self.frame = self.ownerController.view.frame;
|
||||
[[[[UIApplication sharedApplication] delegate] window] addSubview:self];
|
||||
UIView * window = [UIApplication sharedApplication].delegate.window;
|
||||
[self addToView:window];
|
||||
}
|
||||
|
||||
- (void)addToView:(UIView *)view
|
||||
{
|
||||
if ([view.subviews containsObject:self])
|
||||
return;
|
||||
|
||||
[view addSubview:self];
|
||||
[(MapsAppDelegate *)[UIApplication sharedApplication].delegate disableStandby];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
|
@ -64,14 +67,13 @@ static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
|
|||
{
|
||||
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.);
|
||||
self.directionArrow.center = CGPointMake(kDirectionArrowSide / 2., 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.;
|
||||
|
@ -88,7 +90,6 @@ static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
|
|||
{
|
||||
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;
|
||||
|
@ -112,15 +113,18 @@ static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
|
|||
|
||||
- (void)resizeLabelsWithWidth:(CGFloat)width
|
||||
{
|
||||
self.titleLabel.width = width;
|
||||
self.typeLabel.width = width;
|
||||
self.distanceLabel.width = width;
|
||||
self.titleLabel.width = self.typeLabel.width = self.distanceLabel.width = width;
|
||||
[self.titleLabel sizeToFit];
|
||||
[self.typeLabel sizeToFit];
|
||||
[self.distanceLabel sizeToFit];
|
||||
}
|
||||
|
||||
- (IBAction)tap:(UITapGestureRecognizer *)sender
|
||||
- (void)setDirectionArrowTransform:(CGAffineTransform)transform
|
||||
{
|
||||
self.directionArrow.transform = transform;
|
||||
}
|
||||
|
||||
- (IBAction)tap
|
||||
{
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<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">
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" 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"/>
|
||||
|
@ -58,7 +58,7 @@
|
|||
</view>
|
||||
<tapGestureRecognizer id="lOu-cy-wFh">
|
||||
<connections>
|
||||
<action selector="tap:" destination="hge-yy-9dK" id="sVQ-u6-g3l"/>
|
||||
<action selector="tap" destination="hge-yy-9dK" id="uEi-g2-I4S"/>
|
||||
</connections>
|
||||
</tapGestureRecognizer>
|
||||
</objects>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
self = [super initWithCoder:aDecoder];
|
||||
if (self)
|
||||
self.autoresizingMask = UIViewAutoresizingNone;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
@property (weak, nonatomic) IBOutlet MWMBasePlacePageView * basePlacePageView;
|
||||
@property (weak, nonatomic) IBOutlet UIView * extendedPlacePageView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *anchorImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView * anchorImageView;
|
||||
@property (weak, nonatomic, readonly) MWMPlacePageViewManager * manager;
|
||||
@property (nonatomic) MWMPlacePageActionBar * actionBar;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
- (IBAction)didTap:(UITapGestureRecognizer *)sender;
|
||||
|
||||
- (void)setArrowAngle:(CGFloat)angle;
|
||||
- (void)setDirectionArrowTransform:(CGAffineTransform)transform;
|
||||
- (void)setDistance:(NSString *)distance;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithManager: instead")));
|
||||
|
|
|
@ -59,7 +59,7 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
|
||||
- (void)show
|
||||
{
|
||||
[self doesNotRecognizeSelector:_cmd];
|
||||
// Should override this method if you want to show place page with custom animation.
|
||||
}
|
||||
|
||||
- (void)dismiss
|
||||
|
@ -101,21 +101,14 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
[self.actionBar dismissActivityIndicatior];
|
||||
}
|
||||
|
||||
- (void)setArrowAngle:(CGFloat)angle
|
||||
- (void)setDirectionArrowTransform:(CGAffineTransform)transform
|
||||
{
|
||||
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
|
||||
{
|
||||
self.basePlacePageView.distanceLabel.text = distance;
|
||||
self.basePlacePageView.directionView.distanceLabel.text = distance;
|
||||
}
|
||||
|
||||
- (void)changeBookmarkCategory
|
||||
|
@ -143,16 +136,24 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
[self.basePlacePageView reloadBookmarkCell];
|
||||
}
|
||||
|
||||
- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight { }
|
||||
- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight
|
||||
{
|
||||
// This method should be empty if your target is iPad.
|
||||
}
|
||||
|
||||
- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight { }
|
||||
- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight
|
||||
{
|
||||
// This method should be empty if your target is iPad.
|
||||
}
|
||||
|
||||
- (IBAction)didTap:(UITapGestureRecognizer *)sender
|
||||
{
|
||||
if ([sender.view isKindOfClass:[UIControl class]])
|
||||
[(UIControl *)sender.view sendActionsForControlEvents:UIControlEventTouchUpInside];
|
||||
// This method should be ovverriden if you want to process custom tap.
|
||||
}
|
||||
|
||||
- (IBAction)didPan:(UIPanGestureRecognizer *)sender { }
|
||||
- (IBAction)didPan:(UIPanGestureRecognizer *)sender
|
||||
{
|
||||
// This method should be ovverriden if you want to process custom pan.
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
@interface MWMPlacePageActionBar : UIView
|
||||
|
||||
@property (weak, nonatomic, readonly) IBOutlet UIButton * bookmarkButton;
|
||||
@property (weak, nonatomic, readonly) IBOutlet UIButton * routeButton;
|
||||
@property (weak, nonatomic) IBOutlet UIButton * bookmarkButton;
|
||||
@property (weak, nonatomic) IBOutlet UIButton * routeButton;
|
||||
|
||||
+ (MWMPlacePageActionBar *)actionBarForPlacePage:(MWMPlacePage *)placePage;
|
||||
- (void)configureForMyPosition:(BOOL)isMyPosition;
|
||||
|
|
|
@ -24,8 +24,6 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
|
|||
|
||||
@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;
|
||||
|
@ -99,12 +97,12 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
|
|||
self.bookmarkLabel.center = CGPointMake(self.bookmarkButton.center.x, self.bookmarkLabel.center.y);
|
||||
}
|
||||
|
||||
- (IBAction)shareTap:(id)sender
|
||||
- (IBAction)shareTap
|
||||
{
|
||||
[self.placePage share];
|
||||
}
|
||||
|
||||
- (IBAction)routeTap:(id)sender
|
||||
- (IBAction)routeTap
|
||||
{
|
||||
[self.placePage route];
|
||||
[self startActivityIndicator];
|
||||
|
@ -126,6 +124,10 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
|
|||
self.indicatior = nil;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { }
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
// Prevent super call to stop event propagation
|
||||
// [super touchesBegan:touches withEvent:event];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -49,21 +49,24 @@ extern NSString * const kBookmarkCellWebViewDidFinishLoadContetnNotification = @
|
|||
{
|
||||
NSDictionary const * info = [aNotification userInfo];
|
||||
CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
|
||||
[self.placePage willStartEditingBookmarkTitle:kbSize.height];
|
||||
if ([self.title isEditing])
|
||||
[self.placePage willStartEditingBookmarkTitle:kbSize.height];
|
||||
}
|
||||
|
||||
- (void)keyboardWillBeHidden:(NSNotification *)aNotification
|
||||
{
|
||||
NSDictionary const * info = [aNotification userInfo];
|
||||
CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
|
||||
[self.placePage willFinishEditingBookmarkTitle:kbSize.height];
|
||||
if ([self.title isEditing])
|
||||
[self.placePage willFinishEditingBookmarkTitle:kbSize.height];
|
||||
}
|
||||
|
||||
- (void)textFieldDidEndEditing:(UITextField *)textField
|
||||
{
|
||||
MWMPlacePageEntity * entity = self.placePage.manager.entity;
|
||||
entity.bookmarkTitle = textField.text;
|
||||
entity.bookmarkTitle = textField.text.length > 0 ? textField.text : self.placePage.manager.entity.title;
|
||||
[entity synchronize];
|
||||
[textField resignFirstResponder];
|
||||
}
|
||||
|
||||
- (BOOL)textFieldShouldClear:(UITextField *)textField
|
||||
|
@ -82,17 +85,17 @@ extern NSString * const kBookmarkCellWebViewDidFinishLoadContetnNotification = @
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (IBAction)colorPickerButtonTap:(id)sender
|
||||
- (IBAction)colorPickerButtonTap
|
||||
{
|
||||
[self.placePage changeBookmarkColor];
|
||||
}
|
||||
|
||||
- (IBAction)categoryButtonTap:(id)sender
|
||||
- (IBAction)categoryButtonTap
|
||||
{
|
||||
[self.placePage changeBookmarkCategory];
|
||||
}
|
||||
|
||||
- (IBAction)editTap:(id)sender
|
||||
- (IBAction)editTap
|
||||
{
|
||||
[self.placePage changeBookmarkDescription];
|
||||
}
|
||||
|
|
|
@ -12,6 +12,18 @@
|
|||
|
||||
#include "map/user_mark.hpp"
|
||||
|
||||
typedef NS_ENUM (NSUInteger, MWMPlacePageMetadataType)
|
||||
{
|
||||
MWMPlacePageMetadataTypePostcode,
|
||||
MWMPlacePageMetadataTypePhoneNumber,
|
||||
MWMPlacePageMetadataTypeWebsite,
|
||||
MWMPlacePageMetadataTypeURL,
|
||||
MWMPlacePageMetadataTypeEmail,
|
||||
MWMPlacePageMetadataTypeOpenHours,
|
||||
MWMPlacePageMetadataTypeCoordinate,
|
||||
MWMPlacePageMetadataTypeBookmark
|
||||
};
|
||||
|
||||
typedef NS_ENUM (NSUInteger, MWMPlacePageEntityType)
|
||||
{
|
||||
MWMPlacePageEntityTypeRegular,
|
||||
|
@ -27,8 +39,6 @@ typedef NS_ENUM (NSUInteger, MWMPlacePageEntityType)
|
|||
|
||||
@property (copy, nonatomic) NSString * title;
|
||||
@property (copy, nonatomic) NSString * category;
|
||||
@property (copy, nonatomic) NSDictionary * metadata;
|
||||
|
||||
@property (copy, nonatomic) NSString * bookmarkTitle;
|
||||
@property (copy, nonatomic) NSString * bookmarkCategory;
|
||||
@property (copy, nonatomic) NSString * bookmarkDescription;
|
||||
|
@ -43,6 +53,11 @@ typedef NS_ENUM (NSUInteger, MWMPlacePageEntityType)
|
|||
@property (nonatomic) m2::PointD point;
|
||||
@property (weak, nonatomic) MWMPlacePageViewManager * manager;
|
||||
|
||||
- (NSArray *)metadataTypes;
|
||||
- (NSArray *)metadataValues;
|
||||
- (void)insertBookmarkInTypes;
|
||||
- (void)removeBookmarkFromTypes;
|
||||
|
||||
- (instancetype)initWithUserMark:(UserMark const *)mark;
|
||||
- (void)synchronize;
|
||||
|
||||
|
|
|
@ -13,11 +13,20 @@
|
|||
#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";
|
||||
static NSArray * const kPatternTypesArray = @[@(MWMPlacePageMetadataTypePostcode), @(MWMPlacePageMetadataTypePhoneNumber), @(MWMPlacePageMetadataTypeWebsite), @(MWMPlacePageMetadataTypeURL), @(MWMPlacePageMetadataTypeEmail), @(MWMPlacePageMetadataTypeOpenHours), @(MWMPlacePageMetadataTypeCoordinate)];
|
||||
|
||||
static NSString * const kTypesKey = @"types";
|
||||
static NSString * const kValuesKey = @"values";
|
||||
|
||||
typedef feature::FeatureMetadata::EMetadataType TMetadataType;
|
||||
|
||||
@interface MWMPlacePageEntity ()
|
||||
|
||||
@property (nonatomic) NSDictionary * metadata;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageEntity
|
||||
|
||||
|
@ -32,45 +41,43 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
|
||||
- (void)configureWithUserMark:(UserMark const *)mark
|
||||
{
|
||||
UserMark::Type type = mark->GetMarkType();
|
||||
UserMark::Type const type = mark->GetMarkType();
|
||||
double x, y;
|
||||
mark->GetLatLon(x, y);
|
||||
self.point = m2::PointD(x, y);
|
||||
|
||||
typedef UserMark::Type t;
|
||||
switch (type)
|
||||
{
|
||||
case UserMark::Type::API:
|
||||
case t::API:
|
||||
{
|
||||
ApiMarkPoint const * apiMark = static_cast<ApiMarkPoint const *>(mark);
|
||||
[self configureForApi:apiMark];
|
||||
break;
|
||||
}
|
||||
case UserMark::Type::SEARCH:
|
||||
case t::SEARCH:
|
||||
{
|
||||
SearchMarkPoint const * searchMark = static_cast<SearchMarkPoint const *>(mark);
|
||||
[self configureForSearch:searchMark];
|
||||
[self configureForPOI:searchMark];
|
||||
break;
|
||||
}
|
||||
case UserMark::Type::DEBUG_MARK:
|
||||
case t::DEBUG_MARK:
|
||||
break;
|
||||
|
||||
case UserMark::Type::MY_POSITION:
|
||||
case t::MY_POSITION:
|
||||
{
|
||||
MyPositionMarkPoint const * myPositionMark = static_cast<MyPositionMarkPoint const *>(mark);
|
||||
[self configureForMyPosition:myPositionMark];
|
||||
break;
|
||||
}
|
||||
|
||||
case UserMark::Type::POI:
|
||||
case t::POI:
|
||||
{
|
||||
PoiMarkPoint const * poiMark = static_cast<PoiMarkPoint const *>(mark);
|
||||
[self configureForPOI:poiMark];
|
||||
break;
|
||||
}
|
||||
|
||||
case UserMark::Type::BOOKMARK:
|
||||
case t::BOOKMARK:
|
||||
[self configureForBookmark:mark];
|
||||
break;
|
||||
|
||||
}
|
||||
GetFramework().ActivateUserMark(mark);
|
||||
}
|
||||
|
@ -96,22 +103,10 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
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];
|
||||
[self insertBookmarkInTypes];
|
||||
}
|
||||
|
||||
- (void)configureForSearch:(SearchMarkPoint const *)searchMark
|
||||
{
|
||||
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
|
||||
- (void)configureForPOI:(SearchMarkPoint const *)poiMark
|
||||
{
|
||||
search::AddressInfo const & addressInfo = poiMark->GetInfo();
|
||||
feature::FeatureMetadata const & metadata = poiMark->GetMetadata();
|
||||
|
@ -122,19 +117,19 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
{
|
||||
self.title = L(@"my_position");
|
||||
self.type = MWMPlacePageEntityTypeMyPosition;
|
||||
NSMutableArray * keys = [NSMutableArray array];
|
||||
NSMutableArray * types = [NSMutableArray array];
|
||||
NSMutableArray * values = [NSMutableArray array];
|
||||
[keys addObject:kTypesArray.lastObject];
|
||||
[types addObject:kPatternTypesArray.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};
|
||||
self.metadata = @{kTypesKey : types, kValuesKey : values};
|
||||
}
|
||||
|
||||
- (void)configureForApi:(ApiMarkPoint const *)apiMark
|
||||
{
|
||||
|
||||
// TODO(Vlad): Should implement this method.
|
||||
}
|
||||
|
||||
- (void)configureEntityWithMetadata:(feature::FeatureMetadata const &)metadata addressInfo:(search::AddressInfo const &)info
|
||||
|
@ -142,70 +137,142 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
self.title = [NSString stringWithUTF8String:info.GetPinName().c_str()];
|
||||
self.category = [NSString stringWithUTF8String:info.GetPinType().c_str()];
|
||||
|
||||
vector<feature::FeatureMetadata::EMetadataType> presentTypes = metadata.GetPresentTypes();
|
||||
vector<TMetadataType> const presentTypes = metadata.GetPresentTypes();
|
||||
|
||||
NSMutableArray * keys = [NSMutableArray array];
|
||||
NSMutableArray * values = [NSMutableArray array];
|
||||
NSMutableArray const * types = [NSMutableArray array];
|
||||
NSMutableArray const * values = [NSMutableArray array];
|
||||
|
||||
for (auto const & type : presentTypes)
|
||||
{
|
||||
if (type == feature::FeatureMetadata::EMetadataType::FMD_POSTCODE)
|
||||
continue;
|
||||
|
||||
if (type == feature::FeatureMetadata::EMetadataType::FMD_OPERATOR)
|
||||
switch (type)
|
||||
{
|
||||
NSString * bank = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
self.category = [NSString stringWithFormat:@"%@, %@", self.category, bank];
|
||||
continue;
|
||||
case TMetadataType::FMD_CUISINE:
|
||||
{
|
||||
NSString * cuisine = [NSString stringWithFormat:@"cuisine_%@", [NSString stringWithUTF8String:metadata.Get(type).c_str()]];
|
||||
self.category = [NSString stringWithFormat:@"%@, %@", self.category, L(cuisine)];
|
||||
break;
|
||||
}
|
||||
case TMetadataType::FMD_ELE:
|
||||
{
|
||||
self.typeDescriptionValue = atoi(metadata.Get(type).c_str());
|
||||
if (self.type != MWMPlacePageEntityTypeBookmark)
|
||||
self.type = MWMPlacePageEntityTypeEle;
|
||||
break;
|
||||
}
|
||||
case TMetadataType::FMD_OPERATOR:
|
||||
{
|
||||
NSString const * bank = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
if (self.category.length)
|
||||
self.category = [NSString stringWithFormat:@"%@, %@", self.category, bank];
|
||||
else
|
||||
self.category = [NSString stringWithFormat:@"%@", bank];
|
||||
break;
|
||||
}
|
||||
case TMetadataType::FMD_STARS:
|
||||
{
|
||||
self.typeDescriptionValue = atoi(metadata.Get(type).c_str());
|
||||
if (self.type != MWMPlacePageEntityTypeBookmark)
|
||||
self.type = MWMPlacePageEntityTypeHotel;
|
||||
break;
|
||||
}
|
||||
case TMetadataType::FMD_URL:
|
||||
case TMetadataType::FMD_WEBSITE:
|
||||
case TMetadataType::FMD_PHONE_NUMBER:
|
||||
case TMetadataType::FMD_OPEN_HOURS:
|
||||
case TMetadataType::FMD_EMAIL:
|
||||
case TMetadataType::FMD_POSTCODE:
|
||||
{
|
||||
NSString * v;
|
||||
if (type == feature::FeatureMetadata::EMetadataType::FMD_OPEN_HOURS)
|
||||
v = [[NSString stringWithUTF8String:metadata.Get(type).c_str()] stringByReplacingOccurrencesOfString:@"; " withString:@";\n"];
|
||||
else
|
||||
v = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
|
||||
NSNumber const * t = [self typeFromMetadata:type];
|
||||
[types addObject:t];
|
||||
[values addObject:v];
|
||||
break;
|
||||
}
|
||||
case TMetadataType::FMD_TURN_LANES:
|
||||
case TMetadataType::FMD_TURN_LANES_BACKWARD:
|
||||
case TMetadataType::FMD_TURN_LANES_FORWARD:
|
||||
case TMetadataType::FMD_FAX_NUMBER:
|
||||
case TMetadataType::FMD_INTERNET:
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == feature::FeatureMetadata::EMetadataType::FMD_CUISINE)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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"];
|
||||
else
|
||||
value = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
|
||||
NSString *key = [self stringFromMetadataType:type];
|
||||
[keys addObject:key];
|
||||
[values addObject:value];
|
||||
}
|
||||
|
||||
[keys addObject:kTypesArray.lastObject];
|
||||
NSUInteger swappedIndex = 0;
|
||||
for (NSNumber * pattern in kPatternTypesArray)
|
||||
{
|
||||
NSUInteger const index = [types indexOfObject:pattern];
|
||||
if (index == NSNotFound)
|
||||
continue;
|
||||
[types exchangeObjectAtIndex:index withObjectAtIndex:swappedIndex];
|
||||
[values exchangeObjectAtIndex:index withObjectAtIndex:swappedIndex];
|
||||
swappedIndex++;
|
||||
}
|
||||
|
||||
[types addObject:kPatternTypesArray.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()];
|
||||
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};
|
||||
|
||||
self.metadata = @{kTypesKey : types, kValuesKey : values};
|
||||
}
|
||||
|
||||
- (NSString *)stringFromMetadataType:(feature::FeatureMetadata::EMetadataType)type
|
||||
- (NSArray *)metadataTypes
|
||||
{
|
||||
return kTypesArray[type - 1];
|
||||
return (NSArray *)self.metadata[kTypesKey];
|
||||
}
|
||||
|
||||
- (NSArray *)metadataValues
|
||||
{
|
||||
return (NSArray *)self.metadata[kValuesKey];
|
||||
}
|
||||
|
||||
- (void)insertBookmarkInTypes
|
||||
{
|
||||
if ([self.metadataTypes containsObject:@(MWMPlacePageMetadataTypeBookmark)])
|
||||
return;
|
||||
[self.metadata[kTypesKey] insertObject:@(MWMPlacePageMetadataTypeBookmark) atIndex:self.metadataTypes.count];
|
||||
}
|
||||
|
||||
- (void)removeBookmarkFromTypes
|
||||
{
|
||||
[self.metadata[kTypesKey] removeObject:@(MWMPlacePageMetadataTypeBookmark)];
|
||||
}
|
||||
|
||||
- (NSNumber *)typeFromMetadata:(TMetadataType)type
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case TMetadataType::FMD_URL:
|
||||
return @(MWMPlacePageMetadataTypeURL);
|
||||
case TMetadataType::FMD_WEBSITE:
|
||||
return @(MWMPlacePageMetadataTypeWebsite);
|
||||
case TMetadataType::FMD_PHONE_NUMBER:
|
||||
return @(MWMPlacePageMetadataTypePhoneNumber);
|
||||
case TMetadataType::FMD_OPEN_HOURS:
|
||||
return @(MWMPlacePageMetadataTypeOpenHours);
|
||||
case TMetadataType::FMD_EMAIL:
|
||||
return @(MWMPlacePageMetadataTypeEmail);
|
||||
case TMetadataType::FMD_POSTCODE:
|
||||
return @(MWMPlacePageMetadataTypePostcode);
|
||||
|
||||
case TMetadataType::FMD_TURN_LANES:
|
||||
case TMetadataType::FMD_TURN_LANES_BACKWARD:
|
||||
case TMetadataType::FMD_TURN_LANES_FORWARD:
|
||||
case TMetadataType::FMD_FAX_NUMBER:
|
||||
case TMetadataType::FMD_INTERNET:
|
||||
case TMetadataType::FMD_STARS:
|
||||
case TMetadataType::FMD_OPERATOR:
|
||||
case TMetadataType::FMD_ELE:
|
||||
case TMetadataType::FMD_CUISINE:
|
||||
break;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Bookmark editing
|
||||
|
@ -224,8 +291,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
- (NSString *)bookmarkDescription
|
||||
{
|
||||
if (_bookmarkDescription == nil)
|
||||
return @"";
|
||||
|
||||
_bookmarkDescription = @"";
|
||||
return _bookmarkDescription;
|
||||
}
|
||||
|
||||
|
@ -235,7 +301,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
{
|
||||
Framework & f = GetFramework();
|
||||
string type = f.LastEditedBMType();
|
||||
return [NSString stringWithUTF8String:type.c_str()];
|
||||
_bookmarkColor = [NSString stringWithUTF8String:type.c_str()];
|
||||
}
|
||||
return _bookmarkColor;
|
||||
}
|
||||
|
@ -243,7 +309,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
- (NSString *)bookmarkTitle
|
||||
{
|
||||
if (_bookmarkTitle == nil)
|
||||
return self.title;
|
||||
_bookmarkTitle = self.title;
|
||||
return _bookmarkTitle;
|
||||
}
|
||||
|
||||
|
@ -251,20 +317,21 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
{
|
||||
Framework & f = GetFramework();
|
||||
BookmarkCategory * category = f.GetBmCategory(self.bac.first);
|
||||
Bookmark * bookmark = category->GetBookmark(self.bac.second);
|
||||
if (!category)
|
||||
return;
|
||||
|
||||
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);
|
||||
string const description(self.bookmarkDescription.UTF8String);
|
||||
_isHTMLDescription = strings::IsHTML(description);
|
||||
bookmark->SetDescription(self.bookmarkDescription.UTF8String);
|
||||
bookmark->SetDescription(description);
|
||||
}
|
||||
|
||||
if (self.bookmarkTitle)
|
||||
|
@ -273,12 +340,4 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"
|
|||
category->SaveToKMLFile();
|
||||
}
|
||||
|
||||
- (MWMPlacePageEntityType)type
|
||||
{
|
||||
if (!_type)
|
||||
return MWMPlacePageEntityTypeRegular;
|
||||
|
||||
return _type;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,12 +7,11 @@
|
|||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class MWMPlacePageEntity;
|
||||
#import "MWMPlacePageEntity.h"
|
||||
|
||||
@interface MWMPlacePageInfoCell : UITableViewCell
|
||||
|
||||
- (void)configureWithIconTitle:(NSString *)title info:(NSString *)info;
|
||||
- (void)configureWithType:(MWMPlacePageMetadataType)type info:(NSString *)info;
|
||||
|
||||
@property (weak, nonatomic, readonly) IBOutlet UIImageView * icon;
|
||||
@property (weak, nonatomic, readonly) IBOutlet id textContainer;
|
||||
|
|
|
@ -21,16 +21,44 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey;
|
|||
@property (weak, nonatomic, readwrite) IBOutlet id textContainer;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton * upperButton;
|
||||
@property (copy, nonatomic) NSString * type;
|
||||
@property (nonatomic) MWMPlacePageMetadataType type;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageInfoCell
|
||||
|
||||
- (void)configureWithIconTitle:(NSString *)title info:(NSString *)info
|
||||
- (void)configureWithType:(MWMPlacePageMetadataType)type info:(NSString *)info;
|
||||
{
|
||||
self.type = title;
|
||||
[self.imageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"ic_%@", title]]];
|
||||
NSMutableString * imageName = [@"ic_" mutableCopy];
|
||||
switch (type)
|
||||
{
|
||||
case MWMPlacePageMetadataTypeURL:
|
||||
case MWMPlacePageMetadataTypeWebsite:
|
||||
[imageName appendString:@"Website"];
|
||||
break;
|
||||
case MWMPlacePageMetadataTypeEmail:
|
||||
[imageName appendString:@"Email"];
|
||||
break;
|
||||
case MWMPlacePageMetadataTypePhoneNumber:
|
||||
[imageName appendString:@"PhoneNumber"];
|
||||
break;
|
||||
case MWMPlacePageMetadataTypeCoordinate:
|
||||
[imageName appendString:@"Coordinate"];
|
||||
break;
|
||||
case MWMPlacePageMetadataTypePostcode:
|
||||
[imageName appendString:@"Postcode"];
|
||||
break;
|
||||
case MWMPlacePageMetadataTypeOpenHours:
|
||||
[imageName appendString:@"OpenHours"];
|
||||
break;
|
||||
case MWMPlacePageMetadataTypeBookmark:
|
||||
NSAssert(false, @"Incorrect type!");
|
||||
break;
|
||||
}
|
||||
|
||||
UIImage * image = [UIImage imageNamed:imageName];
|
||||
self.type = type;
|
||||
[self.imageView setImage:image];
|
||||
|
||||
if ([self.textContainer isKindOfClass:[UITextView class]])
|
||||
[self.textContainer setAttributedText:[[NSAttributedString alloc] initWithString:info attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:16.]}]];
|
||||
|
@ -38,7 +66,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey;
|
|||
[self.textContainer setText:info];
|
||||
|
||||
UILongPressGestureRecognizer * longTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
|
||||
longTap.minimumPressDuration = 0.3f;
|
||||
longTap.minimumPressDuration = 0.3;
|
||||
[self.upperButton addGestureRecognizer:longTap];
|
||||
}
|
||||
|
||||
|
@ -47,19 +75,17 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (IBAction)cellTap:(id)sender
|
||||
- (IBAction)cellTap
|
||||
{
|
||||
if ([self.type isEqualToString:@"Coordinate"])
|
||||
{
|
||||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||
BOOL const isLatLonAsDMA = [defaults boolForKey:kUserDefaultsLatLonAsDMSKey];
|
||||
m2::PointD const point = self.currentEntity.point;
|
||||
if (self.type != MWMPlacePageMetadataTypeCoordinate)
|
||||
return;
|
||||
|
||||
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];
|
||||
}
|
||||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||
BOOL const showLatLonAsDMS = [defaults boolForKey:kUserDefaultsLatLonAsDMSKey];
|
||||
m2::PointD const point = self.currentEntity.point;
|
||||
[self.textContainer setText:[NSString stringWithUTF8String:(showLatLonAsDMS ? MeasurementUtils::FormatLatLon(point.x, point.y).c_str() : MeasurementUtils::FormatLatLonAsDMS(point.x, point.y, 2).c_str())]];
|
||||
[defaults setBool:!showLatLonAsDMS forKey:kUserDefaultsLatLonAsDMSKey];
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
- (void)longTap:(UILongPressGestureRecognizer *)sender
|
||||
|
@ -67,8 +93,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey;
|
|||
UIMenuController * menuController = [UIMenuController sharedMenuController];
|
||||
if (menuController.isMenuVisible)
|
||||
return;
|
||||
|
||||
CGPoint tapPoint = [sender locationInView:sender.view.superview];
|
||||
CGPoint const 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];
|
||||
|
|
|
@ -15,18 +15,16 @@
|
|||
#import <objc/runtime.h>
|
||||
|
||||
static NSString * const kPlacePageNavigationBarNibName = @"PlacePageNavigationBar";
|
||||
static int kNavigationBarKey;
|
||||
static CGFloat const kNavigationBarHeight = 64.;
|
||||
|
||||
static CGFloat const kHeight = 64.;
|
||||
|
||||
static CGPoint const openCenter(CGFloat xPosition)
|
||||
static inline CGPoint const openCenter(CGFloat xPosition)
|
||||
{
|
||||
return CGPointMake(xPosition, kHeight / 2.);
|
||||
return CGPointMake(xPosition, kNavigationBarHeight / 2.);
|
||||
}
|
||||
|
||||
static CGPoint const dismissCenter(CGFloat xPosition)
|
||||
static inline CGPoint const dismissCenter(CGFloat xPosition)
|
||||
{
|
||||
return CGPointMake(xPosition, - kHeight / 2.);
|
||||
return CGPointMake(xPosition, - kNavigationBarHeight / 2.);
|
||||
}
|
||||
|
||||
@interface MWMPlacePageNavigationBar ()
|
||||
|
@ -41,24 +39,23 @@ static CGPoint const dismissCenter(CGFloat xPosition)
|
|||
+ (void)remove
|
||||
{
|
||||
UIScreen * screen = [UIScreen mainScreen];
|
||||
MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, &kNavigationBarKey);
|
||||
MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, @selector(navigationBarWithPlacePage:));
|
||||
if (!navBar)
|
||||
return;
|
||||
|
||||
[navBar removeFromSuperview];
|
||||
objc_setAssociatedObject(screen, &kNavigationBarKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(screen, @selector(navigationBarWithPlacePage:), 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);
|
||||
MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, @selector(navigationBarWithPlacePage:));
|
||||
if (!navBar)
|
||||
{
|
||||
navBar = [self navigationBarWithPlacePage:placePage];
|
||||
objc_setAssociatedObject(screen, &kNavigationBarKey, navBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(screen, @selector(navigationBarWithPlacePage:), navBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
[superview addSubview:navBar];
|
||||
}
|
||||
|
||||
|
@ -71,8 +68,7 @@ static CGPoint const dismissCenter(CGFloat xPosition)
|
|||
+ (void)dismissNavigationBar
|
||||
{
|
||||
UIScreen * screen = [UIScreen mainScreen];
|
||||
MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, &kNavigationBarKey);
|
||||
|
||||
MWMPlacePageNavigationBar * navBar = objc_getAssociatedObject(screen, @selector(navigationBarWithPlacePage:));
|
||||
if (!navBar)
|
||||
return;
|
||||
|
||||
|
@ -118,9 +114,13 @@ static CGPoint const dismissCenter(CGFloat xPosition)
|
|||
- (void)layoutSubviews
|
||||
{
|
||||
if (self)
|
||||
self.origin = CGPointMake(0., 0.);
|
||||
self.origin = CGPointZero;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { }
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
// Prevent super call to stop event propagation
|
||||
// [super touchesBegan:touches withEvent:event];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
@property (strong, nonatomic) IBOutlet MWMPlacePageELEDescription * eleDescription;
|
||||
@property (strong, nonatomic) IBOutlet MWMPlacePageHotelDescription * hotelDescription;
|
||||
|
||||
- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity const *)entity;
|
||||
- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity *)entity;
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,10 +9,14 @@
|
|||
#import "MWMPlacePageTypeDescription.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescriptionView";
|
||||
|
||||
@interface MWMPlacePageELEDescription : UIView
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * heightLabel;
|
||||
|
||||
- (void)configureWithHeight:(NSUInteger)height;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMPlacePageHotelDescription : UIView
|
||||
|
@ -21,18 +25,16 @@
|
|||
|
||||
@end
|
||||
|
||||
static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescriptionView";
|
||||
|
||||
@implementation MWMPlacePageTypeDescription
|
||||
|
||||
- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity const *)entity
|
||||
- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity *)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)];
|
||||
[self.eleDescription configureWithHeight:entity.typeDescriptionValue];
|
||||
else
|
||||
[self.hotelDescription configureWithStarsCount:entity.typeDescriptionValue];
|
||||
}
|
||||
|
@ -41,10 +43,6 @@ static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescrip
|
|||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageELEDescription
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageHotelDescription
|
||||
|
||||
- (void)configureWithStarsCount:(NSUInteger)count
|
||||
|
@ -59,3 +57,13 @@ static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescrip
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageELEDescription
|
||||
|
||||
- (void)configureWithHeight:(NSUInteger)height
|
||||
{
|
||||
self.heightLabel.text = [NSString stringWithFormat:@"%@", @(height)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
|
||||
#include "map/user_mark.hpp"
|
||||
|
||||
@class MWMPlacePageEntity;
|
||||
@class MWMPlacePageEntity, MWMPlacePageNavigationBar;
|
||||
@protocol MWMPlacePageViewDragDelegate;
|
||||
|
||||
@interface MWMPlacePageViewManager : NSObject
|
||||
|
||||
@property (weak, nonatomic, readonly) UIViewController<MWMPlacePageViewDragDelegate> * ownerViewController;
|
||||
@property (nonatomic, readonly) MWMPlacePageEntity * entity;
|
||||
@property (nonatomic) MWMPlacePageNavigationBar * iPhoneNavigationBar;
|
||||
|
||||
- (instancetype)initWithViewController:(UIViewController<MWMPlacePageViewDragDelegate> *)viewController;
|
||||
- (void)showPlacePageWithUserMark:(unique_ptr<UserMarkCopy>)userMark;
|
||||
|
@ -29,6 +30,7 @@
|
|||
- (void)layoutPlacePageToOrientation:(UIInterfaceOrientation)orientation;
|
||||
- (void)reloadBookmark;
|
||||
- (void)dragPlacePage:(CGPoint)point;
|
||||
- (void)showDirectionViewWithTitle:(NSString *)title type:(NSString *)type;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithViewController: instead")));
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#import "MWMPlacePageViewManager.h"
|
||||
#import "ShareActionSheet.h"
|
||||
#import "UIKitCategories.h"
|
||||
#import "MWMDirectionView.h"
|
||||
#import "MWMPlacePageNavigationBar.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
|
@ -31,7 +33,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
|
||||
@interface MWMPlacePageViewManager () <LocationObserver>
|
||||
{
|
||||
shared_ptr<UserMark const *> m_userMark;
|
||||
unique_ptr<UserMarkCopy> m_userMark;
|
||||
}
|
||||
|
||||
@property (weak, nonatomic) UIViewController<MWMPlacePageViewDragDelegate> * ownerViewController;
|
||||
|
@ -39,6 +41,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
@property (nonatomic) MWMPlacePage * placePage;
|
||||
@property (nonatomic) MWMPlacePageManagerState state;
|
||||
@property (nonatomic) ShareActionSheet * actionSheet;
|
||||
@property (nonatomic) MWMDirectionView * directionView;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -60,18 +63,17 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
self.state = MWMPlacePageManagerStateClosed;
|
||||
[self.placePage dismiss];
|
||||
GetFramework().GetBalloonManager().RemovePin();
|
||||
m_userMark = nullptr;
|
||||
self.entity = nil;
|
||||
}
|
||||
|
||||
- (void)showPlacePageWithUserMark:(unique_ptr<UserMarkCopy>)userMark
|
||||
{
|
||||
if (userMark != nullptr)
|
||||
m_userMark = make_shared<UserMark const *>(userMark->GetUserMark());
|
||||
|
||||
NSAssert(userMark, @"userMark cannot be nil");
|
||||
m_userMark = std::move(userMark);
|
||||
[[MapsAppDelegate theApp].m_locationManager start:self];
|
||||
self.entity = [[MWMPlacePageEntity alloc] initWithUserMark:*m_userMark];
|
||||
self.entity = [[MWMPlacePageEntity alloc] initWithUserMark:m_userMark->GetUserMark()];
|
||||
self.state = MWMPlacePageManagerStateOpen;
|
||||
|
||||
if (IPAD)
|
||||
[self presentPlacePageForiPad];
|
||||
else
|
||||
|
@ -87,7 +89,8 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
[self presentPlacePageForiPhoneWithOrientation:orientation];
|
||||
}
|
||||
|
||||
- (void)presentPlacePageForiPad {
|
||||
- (void)presentPlacePageForiPad
|
||||
{
|
||||
[self.placePage dismiss];
|
||||
self.placePage = [[MWMiPadPlacePage alloc] initWithManager:self];
|
||||
[self.placePage configure];
|
||||
|
@ -103,35 +106,30 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
{
|
||||
case UIInterfaceOrientationLandscapeLeft:
|
||||
case UIInterfaceOrientationLandscapeRight:
|
||||
|
||||
if (![self.placePage isKindOfClass:[MWMiPhoneLandscapePlacePage class]])
|
||||
self.placePage = [[MWMiPhoneLandscapePlacePage alloc] initWithManager:self];
|
||||
|
||||
[self.placePage configure];
|
||||
[self.placePage show];
|
||||
|
||||
break;
|
||||
|
||||
case UIInterfaceOrientationPortrait:
|
||||
case UIInterfaceOrientationPortraitUpsideDown:
|
||||
|
||||
if (![self.placePage isKindOfClass:[MWMiPhonePortraitPlacePage class]])
|
||||
self.placePage = [[MWMiPhonePortraitPlacePage alloc] initWithManager:self];
|
||||
|
||||
[self.placePage configure];
|
||||
[self.placePage show];
|
||||
|
||||
break;
|
||||
|
||||
case UIInterfaceOrientationUnknown:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)buildRoute
|
||||
{
|
||||
GetFramework().BuildRoute((*m_userMark)->GetOrg());
|
||||
GetFramework().BuildRoute(m_userMark->GetUserMark()->GetOrg());
|
||||
}
|
||||
|
||||
- (void)stopBuildingRoute
|
||||
|
@ -153,25 +151,28 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
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);
|
||||
size_t const bookmarkIndex = f.GetBookmarkManager().AddBookmark(categoryIndex, m_userMark->GetUserMark()->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);
|
||||
Bookmark const * bookmark = category->GetBookmark(bookmarkIndex);
|
||||
unique_ptr<UserMarkCopy> userMarkCopy(new UserMarkCopy(bookmark, false));
|
||||
m_userMark = std::move(userMarkCopy);
|
||||
f.ActivateUserMark(bookmark);
|
||||
f.Invalidate();
|
||||
}
|
||||
|
||||
- (void)removeBookmark
|
||||
{
|
||||
Framework & f = GetFramework();
|
||||
UserMark const * mark = *m_userMark;
|
||||
UserMark const * mark = m_userMark->GetUserMark();
|
||||
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);
|
||||
PoiMarkPoint const * poi = f.GetAddressMark(mark->GetOrg());
|
||||
unique_ptr<UserMarkCopy> userMarkCopy(new UserMarkCopy(poi, false));
|
||||
m_userMark = std::move(userMarkCopy);
|
||||
f.ActivateUserMark(poi);
|
||||
if (category)
|
||||
{
|
||||
category->DeleteBookmark(bookmarkAndCategory.second);
|
||||
|
@ -203,45 +204,47 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
|
||||
- (void)onLocationUpdate:(location::GpsInfo const &)info
|
||||
{
|
||||
if (m_userMark == nullptr)
|
||||
if (!m_userMark)
|
||||
return;
|
||||
|
||||
[self.placePage setDistance:self.distance];
|
||||
NSString * distance = [self distance];
|
||||
self.directionView.distanceLabel.text = distance;
|
||||
[self.placePage setDistance: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);
|
||||
GetFramework().GetDistanceAndAzimut(m_userMark->GetUserMark()->GetOrg(), location.coordinate.latitude, location.coordinate.longitude, north, distance, azimut);
|
||||
return [NSString stringWithUTF8String:distance.c_str()];
|
||||
}
|
||||
|
||||
- (void)onCompassUpdate:(location::CompassInfo const &)info
|
||||
{
|
||||
if (m_userMark == nullptr)
|
||||
if (!m_userMark)
|
||||
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];
|
||||
|
||||
if (![[MapsAppDelegate theApp].m_locationManager getLat:lat Lon:lon])
|
||||
return;
|
||||
|
||||
CGFloat angle = ang::AngleTo(MercatorBounds::FromLatLon(lat, lon), m_userMark->GetUserMark()->GetOrg()) + info.m_bearing;
|
||||
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_2 - angle);
|
||||
[self.placePage setDirectionArrowTransform:transform];
|
||||
[self.directionView setDirectionArrowTransform:transform];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
- (void)showDirectionViewWithTitle:(NSString *)title type:(NSString *)type
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
self.directionView = [MWMDirectionView directionViewForViewController:self.ownerViewController];
|
||||
self.directionView.titleLabel.text = title;
|
||||
self.directionView.typeLabel.text = type;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,32 +7,13 @@
|
|||
//
|
||||
|
||||
#import "MWMSpringAnimation.h"
|
||||
|
||||
static inline CGPoint CGPointSubtract(CGPoint p1, CGPoint p2)
|
||||
{
|
||||
return CGPointMake(p1.x - p2.x, p1.y - p2.y);
|
||||
}
|
||||
|
||||
static inline CGPoint CGPointAdd(CGPoint p1, CGPoint p2)
|
||||
{
|
||||
return CGPointMake(p1.x + p2.x, p1.y + p2.y);
|
||||
}
|
||||
|
||||
static inline CGPoint CGPointMultiply(CGPoint point, CGFloat multiplier)
|
||||
{
|
||||
return CGPointMake(point.x * multiplier, point.y * multiplier);
|
||||
}
|
||||
|
||||
static inline CGFloat CGPointLength(CGPoint point)
|
||||
{
|
||||
return (CGFloat)sqrt(point.x * point.x + point.y * point.y);
|
||||
}
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
@interface MWMSpringAnimation ()
|
||||
|
||||
@property (nonatomic) CGPoint velocity;
|
||||
@property (nonatomic) CGPoint targetPoint;
|
||||
@property (nonatomic) UIView *view;
|
||||
@property (nonatomic) UIView * view;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -57,8 +38,8 @@ static inline CGFloat CGPointLength(CGPoint point)
|
|||
|
||||
- (void)animationTick:(CFTimeInterval)dt finished:(BOOL *)finished
|
||||
{
|
||||
static CGFloat const frictionConstant = 25.;
|
||||
static CGFloat const springConstant = 300.;
|
||||
CGFloat const frictionConstant = 25.;
|
||||
CGFloat const springConstant = 300.;
|
||||
|
||||
// friction force = velocity * friction constant
|
||||
CGPoint const frictionForce = CGPointMultiply(self.velocity, frictionConstant);
|
||||
|
|
|
@ -13,7 +13,7 @@ static CGFloat const kDefaultTextLeftInset = 5.;
|
|||
|
||||
@interface MWMTextView ()
|
||||
|
||||
@property (nonatomic) UILabel *placeholderView;
|
||||
@property (nonatomic) UILabel * placeholderView;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -126,7 +126,8 @@ static CGFloat const kDefaultTextLeftInset = 5.;
|
|||
|
||||
- (void)updatePlaceholderVisibility
|
||||
{
|
||||
if (self.text.length == 0) {
|
||||
if (!self.text.length)
|
||||
{
|
||||
[self addSubview:self.placeholderView];
|
||||
[self sendSubviewToBack:self.placeholderView];
|
||||
}
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
#import "UIViewController+Navigation.h"
|
||||
#import "MWMBookmarkDescriptionViewController.h"
|
||||
|
||||
@interface MWMNavigationController : UINavigationController
|
||||
extern CGFloat kBookmarkCellHeight;
|
||||
|
||||
@interface MWMiPadNavigationController : UINavigationController
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMNavigationController
|
||||
@implementation MWMiPadNavigationController
|
||||
|
||||
- (instancetype)initWithRootViewController:(UIViewController *)rootViewController
|
||||
{
|
||||
|
@ -40,11 +42,11 @@
|
|||
|
||||
@end
|
||||
|
||||
@interface MWMPlacePageViewController : UIViewController
|
||||
@interface MWMiPadPlacePageViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageViewController
|
||||
@implementation MWMiPadPlacePageViewController
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
|
@ -55,12 +57,10 @@
|
|||
|
||||
@end
|
||||
|
||||
extern CGFloat kBookmarkCellHeight;
|
||||
|
||||
@interface MWMiPadPlacePage ()
|
||||
|
||||
@property (strong, nonatomic) MWMNavigationController * navigationController;
|
||||
@property (strong, nonatomic) MWMPlacePageViewController * viewController;
|
||||
@property (strong, nonatomic) MWMiPadNavigationController * navigationController;
|
||||
@property (strong, nonatomic) MWMiPadPlacePageViewController * viewController;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -69,39 +69,34 @@ extern CGFloat kBookmarkCellHeight;
|
|||
- (void)configure
|
||||
{
|
||||
[super configure];
|
||||
UIView const * view = self.manager.ownerViewController.view;
|
||||
|
||||
self.viewController = [[MWMPlacePageViewController alloc] init];
|
||||
self.viewController = [[MWMiPadPlacePageViewController alloc] init];
|
||||
[self.navigationController.view removeFromSuperview];
|
||||
[self.navigationController removeFromParentViewController];
|
||||
self.navigationController = [[MWMNavigationController alloc] initWithRootViewController:self.viewController];
|
||||
|
||||
self.navigationController = [[MWMiPadNavigationController alloc] initWithRootViewController:self.viewController];
|
||||
|
||||
UIView const * view = self.manager.ownerViewController.view;
|
||||
CGFloat const topOffset = 36.;
|
||||
CGFloat const leftOffset = 12.;
|
||||
CGFloat const defaultWidth = 360.;
|
||||
CGFloat const actionBarHeight = 58.;
|
||||
CGFloat const defaultHeight = self.basePlacePageView.height + self.anchorImageView.height + actionBarHeight;
|
||||
|
||||
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.actionBar.origin = CGPointMake(0., defaultHeight - actionBarHeight - 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];
|
||||
|
@ -130,7 +125,7 @@ extern CGFloat kBookmarkCellHeight;
|
|||
- (void)changeBookmarkColor
|
||||
{
|
||||
MWMBookmarkColorViewController * controller = [[MWMBookmarkColorViewController alloc] initWithNibName:[MWMBookmarkColorViewController className] bundle:nil];
|
||||
controller.ownerNavigationController = self.navigationController;
|
||||
controller.iPadOwnerNavigationController = self.navigationController;
|
||||
controller.placePageManager = self.manager;
|
||||
controller.view.frame = self.viewController.view.frame;
|
||||
[self.viewController.navigationController pushViewController:controller animated:YES];
|
||||
|
@ -139,7 +134,7 @@ extern CGFloat kBookmarkCellHeight;
|
|||
- (void)changeBookmarkCategory
|
||||
{
|
||||
SelectSetVC * controller = [[SelectSetVC alloc] initWithPlacePageManager:self.manager];
|
||||
controller.ownerNavigationController = self.navigationController;
|
||||
controller.iPadOwnerNavigationController = self.navigationController;
|
||||
controller.view.frame = self.viewController.view.frame;
|
||||
[self.viewController.navigationController pushViewController:controller animated:YES];
|
||||
}
|
||||
|
@ -147,7 +142,7 @@ extern CGFloat kBookmarkCellHeight;
|
|||
- (void)changeBookmarkDescription
|
||||
{
|
||||
MWMBookmarkDescriptionViewController * controller = [[MWMBookmarkDescriptionViewController alloc] initWithPlacePageManager:self.manager];
|
||||
controller.ownerNavigationController = self.navigationController;
|
||||
controller.iPadOwnerNavigationController = self.navigationController;
|
||||
[self.viewController.navigationController pushViewController:controller animated:YES];
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
|
|||
if ([view.subviews containsObject:self.extendedPlacePageView] && self.state != MWMiPhoneLandscapePlacePageStateClosed)
|
||||
return;
|
||||
|
||||
self.extendedPlacePageView.frame = CGRectMake(0., 0, offset, height);
|
||||
self.extendedPlacePageView.frame = CGRectMake(0., 0., offset, height);
|
||||
|
||||
self.anchorImageView.backgroundColor = [UIColor whiteColor];
|
||||
self.anchorImageView.image = nil;
|
||||
|
@ -64,12 +64,6 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
|
|||
self.state = MWMiPhoneLandscapePlacePageStateOpen;
|
||||
}
|
||||
|
||||
- (void)addBookmark
|
||||
{
|
||||
[super addBookmark];
|
||||
|
||||
}
|
||||
|
||||
- (void)setState:(MWMiPhoneLandscapePlacePageState)state
|
||||
{
|
||||
CGSize const size = UIScreen.mainScreen.bounds.size;
|
||||
|
@ -109,7 +103,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
|
|||
if (sender.state == UIGestureRecognizerStateEnded)
|
||||
{
|
||||
CGPoint velocity = [sender velocityInView:self.extendedPlacePageView.superview];
|
||||
velocity.y = 20.;
|
||||
velocity.y = 5.;
|
||||
self.state = velocity.x < 0. ? MWMiPhoneLandscapePlacePageStateClosed : MWMiPhoneLandscapePlacePageStateOpen;
|
||||
[self startAnimatingPlacePage:self initialVelocity:velocity];
|
||||
if (self.state == MWMiPhoneLandscapePlacePageStateClosed)
|
||||
|
|
|
@ -157,7 +157,6 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
|
|||
anchorImageName = [@"bg_placepage_tablet_normal_" stringByAppendingString:widthNumber.stringValue];
|
||||
|
||||
self.anchorImageView.image = [UIImage imageNamed:anchorImageName];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
@ -209,6 +208,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
|
|||
|
||||
case MWMiPhonePortraitPlacePageStateOpen:
|
||||
self.state = MWMiPhonePortraitPlacePageStatePreview;
|
||||
[self.manager.ownerViewController.view endEditing:YES];
|
||||
break;
|
||||
}
|
||||
[self startAnimatingPlacePage:self initialVelocity:self.springAnimation.velocity];
|
||||
|
|
|
@ -563,6 +563,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
|
|||
[super viewDidLoad];
|
||||
self.view.clipsToBounds = YES;
|
||||
[self.view addSubview:self.routeViewWrapper];
|
||||
self.placePageManager = [[MWMPlacePageViewManager alloc] initWithViewController:self];
|
||||
self.controlsManager = [[MWMMapViewControlsManager alloc] initWithParentController:self];
|
||||
[self.view addSubview:self.searchView];
|
||||
}
|
||||
|
@ -608,11 +609,6 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
|
|||
[UIApplication sharedApplication].statusBarStyle = [self preferredStatusBarStyle];
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
NSLog(@"MapViewController initWithCoder Started");
|
||||
|
@ -943,8 +939,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction)
|
|||
{
|
||||
if (object == self.searchView && [keyPath isEqualToString:@"state"])
|
||||
{
|
||||
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
|
||||
[self setNeedsStatusBarAppearanceUpdate];
|
||||
[self updateStatusBarStyle];
|
||||
if (self.searchView.state == SearchViewStateFullscreen)
|
||||
{
|
||||
GetFramework().ActivateUserMark(NULL);
|
||||
|
@ -1114,11 +1109,4 @@ NSInteger compareAddress(id l, id r, void * context)
|
|||
_userTouchesAction = userTouchesAction;
|
||||
}
|
||||
|
||||
- (MWMPlacePageViewManager *)placePageManager
|
||||
{
|
||||
if (!_placePageManager)
|
||||
_placePageManager = [[MWMPlacePageViewManager alloc] initWithViewController:self];
|
||||
return _placePageManager;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -358,26 +358,25 @@ void InitLocalizedStrings()
|
|||
NSMutableDictionary * attributes = [[NSMutableDictionary alloc] init];
|
||||
attributes[UITextAttributeTextColor] = [UIColor whiteColor];
|
||||
attributes[UITextAttributeTextShadowColor] = [UIColor clearColor];
|
||||
// 1F9952
|
||||
|
||||
Class const navigationControllerClass = [NavigationController class];
|
||||
if (!isIOSVersionLessThan(7))
|
||||
{
|
||||
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTintColor:[UIColor whiteColor]];
|
||||
[[UINavigationBar appearanceWhenContainedIn:navigationControllerClass, nil] setTintColor:[UIColor whiteColor]];
|
||||
[[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];
|
||||
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setBarTintColor:[UIColor colorWithColorCode:@"1F9952"]];
|
||||
|
||||
[[UINavigationBar appearanceWhenContainedIn:navigationControllerClass, nil] setBarTintColor:[UIColor colorWithColorCode:@"0e8639"]];
|
||||
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];
|
||||
[[UINavigationBar appearanceWhenContainedIn:navigationControllerClass, nil] setTintColor:[UIColor colorWithColorCode:@"15c584"]];
|
||||
[[UINavigationBar appearanceWhenContainedIn:navigationControllerClass, nil] setBackgroundImage:[UIImage imageNamed:@"NavigationBarBackground7"] forBarMetrics:UIBarMetricsCompactPrompt];
|
||||
}
|
||||
|
||||
if ([UINavigationBar instancesRespondToSelector:@selector(setShadowImage:)])
|
||||
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setShadowImage:[[UIImage alloc] init]];
|
||||
[[UINavigationBar appearanceWhenContainedIn:navigationControllerClass, nil] setShadowImage:[[UIImage alloc] init]];
|
||||
|
||||
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTitleTextAttributes:attributes];
|
||||
[[UINavigationBar appearanceWhenContainedIn:navigationControllerClass, nil] setTitleTextAttributes:attributes];
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<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"/>
|
||||
<action selector="shareTap" destination="iN0-l3-epB" eventType="touchUpInside" id="PGT-Ie-Gmr"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="66j-hn-azO">
|
||||
|
@ -27,7 +27,7 @@
|
|||
<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"/>
|
||||
<action selector="bookmarkTap:" destination="iN0-l3-epB" eventType="touchUpInside" id="sTn-J9-JAv"/>
|
||||
</connections>
|
||||
</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">
|
||||
|
@ -72,7 +72,7 @@
|
|||
<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"/>
|
||||
<action selector="routeTap" destination="iN0-l3-epB" eventType="touchUpInside" id="mAp-BH-2qW"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<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"/>
|
||||
<action selector="categoryButtonTap" destination="riP-j7-sc5" eventType="touchUpInside" id="MSi-Yf-pko"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="rer-vk-fBj">
|
||||
|
@ -53,7 +53,7 @@
|
|||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="editTap:" destination="riP-j7-sc5" eventType="touchUpInside" id="IPm-fW-P5Z"/>
|
||||
<action selector="editTap" destination="riP-j7-sc5" eventType="touchUpInside" id="anV-lp-0Gq"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="07N-gj-Msx">
|
||||
|
@ -63,7 +63,7 @@
|
|||
<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"/>
|
||||
<action selector="colorPickerButtonTap" destination="riP-j7-sc5" eventType="touchUpInside" id="DlV-JE-4MA"/>
|
||||
</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">
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<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"/>
|
||||
<action selector="cellTap" destination="VAd-kw-ZEC" eventType="touchUpInside" id="eLw-l7-FXA"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
<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"/>
|
||||
<action selector="directionButtonTap" destination="8RI-YR-2UD" eventType="touchUpInside" id="dw3-kq-Pxp"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
|
|
|
@ -116,7 +116,7 @@ typedef NS_ENUM(NSUInteger, CellType)
|
|||
@interface SearchView () <UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource, SearchBarDelegate, LocationObserver>
|
||||
|
||||
@property (nonatomic) UITableView * tableView;
|
||||
@property (nonatomic) SolidTouchImageView * topBackgroundView;
|
||||
@property (nonatomic) SolidTouchView * topBackgroundView;
|
||||
@property (nonatomic) UILabel * emptyResultLabel;
|
||||
|
||||
@property (nonatomic) SearchResultsWrapper * wrapper;
|
||||
|
@ -752,15 +752,12 @@ static BOOL keyboardLoaded = NO;
|
|||
return _tableView;
|
||||
}
|
||||
|
||||
- (SolidTouchImageView *)topBackgroundView
|
||||
- (SolidTouchView *)topBackgroundView
|
||||
{
|
||||
if (!_topBackgroundView)
|
||||
{
|
||||
_topBackgroundView = [[SolidTouchImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, 0)];
|
||||
if ([UIImage instancesRespondToSelector:@selector(resizableImageWithCapInsets:resizingMode:)]) // iOS 6 and higher
|
||||
_topBackgroundView.image = [[UIImage imageNamed:@"SearchViewTopBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0) resizingMode:UIImageResizingModeStretch];
|
||||
else // iOS 5
|
||||
_topBackgroundView.image = [[UIImage imageNamed:@"SearchViewTopBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0)];
|
||||
_topBackgroundView = [[SolidTouchView alloc] initWithFrame:CGRectMake(0, 0, self.width, 0)];
|
||||
_topBackgroundView.backgroundColor = [UIColor colorWithColorCode:@"1F9952"];
|
||||
_topBackgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
_topBackgroundView.userInteractionEnabled = YES;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,18 @@
|
|||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
"scale" : "1x",
|
||||
"filename" : "nav_bar_color-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "NavigationBarBackground7@2x.png"
|
||||
"filename" : "nav_bar_color@2x-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "NavigationBarBackground7@3x.png"
|
||||
"filename" : "nav_bar_color@3x-1.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
|
Before Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 1 KiB |
BIN
iphone/Maps/Images.xcassets/Navigation Bar/NavigationBarBackground7.imageset/nav_bar_color-1.png
vendored
Normal file
After Width: | Height: | Size: 97 B |
BIN
iphone/Maps/Images.xcassets/Navigation Bar/NavigationBarBackground7.imageset/nav_bar_color@2x-1.png
vendored
Normal file
After Width: | Height: | Size: 104 B |
BIN
iphone/Maps/Images.xcassets/Navigation Bar/NavigationBarBackground7.imageset/nav_bar_color@3x-1.png
vendored
Normal file
After Width: | Height: | Size: 117 B |
23
iphone/Maps/Images.xcassets/New Place Page/ic_Postcode.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "ic_Postcode.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "ic_Postcode@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "ic_Postcode@3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_Postcode.imageset/ic_Postcode.png
vendored
Normal file
After Width: | Height: | Size: 180 B |
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_Postcode.imageset/ic_Postcode@2x.png
vendored
Normal file
After Width: | Height: | Size: 286 B |
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_Postcode.imageset/ic_Postcode@3x.png
vendored
Normal file
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 447 B |
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 639 B |
|
@ -225,6 +225,7 @@
|
|||
F6CB21681AEFC6AA00FB8963 /* MWMPlacePageActionBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6CB21671AEFC6AA00FB8963 /* MWMPlacePageActionBar.mm */; };
|
||||
F6CB216A1AF1303900FB8963 /* PlacePageBookmarkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6CB21691AF1303900FB8963 /* PlacePageBookmarkCell.xib */; };
|
||||
F6CB216D1AF13EBD00FB8963 /* MWMPlacePageBookmarkCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6CB216C1AF13EBD00FB8963 /* MWMPlacePageBookmarkCell.mm */; };
|
||||
F6D409FA1B319BD70041730F /* ContextViews.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6D409F91B319BD70041730F /* ContextViews.mm */; };
|
||||
F6D4344E1AD2AB96007C7728 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F6D4344D1AD2AB96007C7728 /* Images.xcassets */; };
|
||||
F6D434521AD2AB96007C7728 /* maps.me WatchKit App.app in Resources */ = {isa = PBXBuildFile; fileRef = 348E57D71B0F49EE000FA02A /* maps.me WatchKit App.app */; };
|
||||
F6D4345A1AD2AB96007C7728 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F6D434581AD2AB96007C7728 /* Interface.storyboard */; };
|
||||
|
@ -634,6 +635,8 @@
|
|||
F6CB21691AF1303900FB8963 /* PlacePageBookmarkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlacePageBookmarkCell.xib; sourceTree = "<group>"; };
|
||||
F6CB216B1AF13EBD00FB8963 /* MWMPlacePageBookmarkCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageBookmarkCell.h; sourceTree = "<group>"; };
|
||||
F6CB216C1AF13EBD00FB8963 /* MWMPlacePageBookmarkCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageBookmarkCell.mm; sourceTree = "<group>"; };
|
||||
F6D409F81B319BD70041730F /* ContextViews.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextViews.h; sourceTree = "<group>"; };
|
||||
F6D409F91B319BD70041730F /* ContextViews.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextViews.mm; sourceTree = "<group>"; };
|
||||
F6D434491AD2AB96007C7728 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F6D4344D1AD2AB96007C7728 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
F6D434571AD2AB96007C7728 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
|
@ -1567,6 +1570,8 @@
|
|||
F6F722F51AE156A000DA3DA1 /* PlacePage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F6D409F81B319BD70041730F /* ContextViews.h */,
|
||||
F6D409F91B319BD70041730F /* ContextViews.mm */,
|
||||
F6CB215A1AED126900FB8963 /* PlacePageManager */,
|
||||
F6C9343D1AE6473F00DDC624 /* Animation */,
|
||||
F652432F1B0B517600BFA9D4 /* BaseView */,
|
||||
|
@ -2137,6 +2142,7 @@
|
|||
976D86F519CB21BD00C920EF /* RouteView.mm in Sources */,
|
||||
FA29FDAA141E77F8004ADF66 /* Preferences.mm in Sources */,
|
||||
F6588E371B15D87A00EE1E58 /* MWMBookmarkColorCell.mm in Sources */,
|
||||
F6D409FA1B319BD70041730F /* ContextViews.mm in Sources */,
|
||||
97A8000C18B21363000C07A2 /* SearchView.mm in Sources */,
|
||||
FAA5C2A2144F135F005337F6 /* LocationManager.mm in Sources */,
|
||||
F66A8FAC1B09F137001B9C97 /* MWMiPadPlacePage.mm in Sources */,
|
||||
|
|