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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladiMihaylenko <vxmihaylenko@gmail.com>2016-03-18 13:06:38 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:56:55 +0300
commit2e50b59bc31b52e64e2de8fad3ff2343960e34e9 (patch)
tree2772967825133ec934d74e43f9ceecad63f67c8d
parent834d876a9c2b104c25bdf1e47d2578bebd228224 (diff)
[ios] Fixed bug with adding place while we are in routing.
-rw-r--r--iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.h4
-rw-r--r--iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm20
-rw-r--r--iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewPortraitCell.xib4
-rw-r--r--iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm15
4 files changed, 27 insertions, 16 deletions
diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.h b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.h
index 9b0b4ba0a7..e6b57920c7 100644
--- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.h
+++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.h
@@ -1,9 +1,11 @@
@interface MWMBottomMenuCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView * icon;
+@property (nonatomic, readonly) BOOL isEnabled;
- (void)configureWithImageName:(NSString *)imageName
label:(NSString *)label
- badgeCount:(NSUInteger)badgeCount;
+ badgeCount:(NSUInteger)badgeCount
+ isEnabled:(BOOL)isEnabled;
@end
diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm
index d1163fcd09..a6ec5a7ebd 100644
--- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm
+++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewCell.mm
@@ -1,6 +1,7 @@
#import "MWMBottomMenuCollectionViewCell.h"
#import "UIFont+MapsMeFonts.h"
#import "UIColor+MapsMeColor.h"
+#import "UIImageView+Coloring.h"
@interface MWMBottomMenuCollectionViewCell ()
@@ -9,17 +10,19 @@
@property (weak, nonatomic) IBOutlet UILabel * badgeCount;
@property (weak, nonatomic) IBOutlet UIView * separator;
+@property (nonatomic, readwrite) BOOL isEnabled;
@property (nonatomic) BOOL isWideMenu;
@end
@implementation MWMBottomMenuCollectionViewCell
-- (void)configureWithImage:(UIImage *)image
+- (void)configureWithImageName:(NSString *)imageName
label:(NSString *)label
badgeCount:(NSUInteger)badgeCount
+ isEnabled:(BOOL)isEnabled
{
- self.icon.image = image;
+ self.icon.image = [UIImage imageNamed:imageName];
[self.icon makeImageAlwaysTemplate];
self.label.text = label;
if (badgeCount > 0)
@@ -33,17 +36,18 @@
self.badgeBackground.hidden = YES;
self.badgeCount.hidden = YES;
}
-}
-
-- (void)configureWithImageName:(NSString *)imageName label:(NSString *)label badgeCount:(NSUInteger)badgeCount
-{
- [self configureWithImage:[UIImage imageNamed:imageName] label:label badgeCount:badgeCount];
+ self.isEnabled = isEnabled;
+ self.icon.mwm_coloring = isEnabled ? MWMImageColoringBlack : MWMImageColoringGray;
+ self.label.textColor = isEnabled ? [UIColor blackPrimaryText] : [UIColor blackHintText];
}
- (void)setHighlighted:(BOOL)highlighted
{
+ if (!self.isEnabled)
+ return;
+
[super setHighlighted:highlighted];
- self.icon.tintColor = self.label.textColor = highlighted ? [UIColor blackHintText] : [UIColor blackSecondaryText];
+ self.icon.tintColor = self.label.textColor = highlighted ? [UIColor blackHintText] : [UIColor blackPrimaryText];
}
- (void)setSelected:(BOOL)selected
diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewPortraitCell.xib b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewPortraitCell.xib
index 612960eea5..08fe588261 100644
--- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewPortraitCell.xib
+++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuCollectionViewPortraitCell.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
</dependencies>
<customFonts key="customFonts">
<mutableArray key="HelveticaNeue.ttc">
diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm
index 9ee11f5f03..c8c5f7f643 100644
--- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm
+++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm
@@ -279,7 +279,8 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
case MWMBottomMenuViewCellAddPlace:
[cell configureWithImageName:@"ic_add_place"
label:L(@"placepage_add_place_button")
- badgeCount:0];
+ badgeCount:0
+ isEnabled:self.controller.controlsManager.navigationState == MWMNavigationDashboardStateHidden];
break;
case MWMBottomMenuViewCellDownload:
{
@@ -288,20 +289,21 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
s.GetUpdateInfo(s.GetRootId(), updateInfo);
[cell configureWithImageName:@"ic_menu_download"
label:L(@"download_maps")
- badgeCount:updateInfo.m_numberOfMwmFilesToUpdate];
+ badgeCount:updateInfo.m_numberOfMwmFilesToUpdate
+ isEnabled:YES];
}
break;
case MWMBottomMenuViewCellSettings:
- [cell configureWithImageName:@"ic_menu_settings" label:L(@"settings") badgeCount:0];
+ [cell configureWithImageName:@"ic_menu_settings" label:L(@"settings") badgeCount:0 isEnabled:YES];
break;
case MWMBottomMenuViewCellShare:
- [cell configureWithImageName:@"ic_menu_share" label:L(@"share_my_location") badgeCount:0];
+ [cell configureWithImageName:@"ic_menu_share" label:L(@"share_my_location") badgeCount:0 isEnabled:YES];
break;
case MWMBottomMenuViewCellAd:
{
MTRGNativeAppwallBanner * banner = [self.controller.appWallAd.banners firstObject];
[self.controller.appWallAd handleShow:banner];
- [cell configureWithImageName:@"ic_menu_showcase" label:L(@"showcase_more_apps") badgeCount:0];
+ [cell configureWithImageName:@"ic_menu_showcase" label:L(@"showcase_more_apps") badgeCount:0 isEnabled:YES];
}
break;
case MWMBottomMenuViewCellCount:
@@ -315,6 +317,9 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell)
- (void)collectionView:(nonnull UICollectionView *)collectionView
didSelectItemAtIndexPath:(nonnull NSIndexPath *)indexPath
{
+ MWMBottomMenuCollectionViewCell * cell = static_cast<MWMBottomMenuCollectionViewCell *>([collectionView cellForItemAtIndexPath:indexPath]);
+ if (!cell.isEnabled)
+ return;
switch (indexPath.item)
{
case MWMBottomMenuViewCellAddPlace: