From 04424d1c8d27f9ae6920027fd17e5f3775d6b7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=20=D0=93=D1=80=D0=B5=D1=87=D1=83?= =?UTF-8?q?=D1=85=D0=B8=D0=BD?= Date: Mon, 4 Jan 2016 10:50:15 +0300 Subject: [PATCH] [ios] Updated showcase. --- .../BottomMenu/MWMBottomMenuLayout.mm | 15 ++++++------ .../BottomMenu/MWMBottomMenuViewController.mm | 10 +++----- .../ic_menu_showcase.imageset/Contents.json | 23 ++++++++++++++++++ .../ic_menu_showcase.png | Bin 0 -> 111 bytes .../ic_menu_showcase@2x.png | Bin 0 -> 167 bytes .../ic_menu_showcase@3x.png | Bin 0 -> 219 bytes .../Contents.json | 23 ++++++++++++++++++ .../ic_menu_showcase_press.png | Bin 0 -> 111 bytes .../ic_menu_showcase_press@2x.png | Bin 0 -> 168 bytes .../ic_menu_showcase_press@3x.png | Bin 0 -> 221 bytes 10 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/Contents.json create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase.png create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase@2x.png create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase@3x.png create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/Contents.json create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press.png create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press@2x.png create mode 100644 iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press@3x.png diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm index e8e643da41..df63b54111 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm @@ -11,21 +11,22 @@ { UICollectionViewLayoutAttributes * attr = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; - CGSize const size = self.collectionView.frame.size; + CGPoint origin = {}; + CGSize size = self.collectionView.frame.size; CGFloat const position = (CGFloat)indexPath.item / self.buttonsCount; attr.hidden = (size.width == 0.0 || size.height == 0.0); if (size.width > self.layoutThreshold) { - CGFloat const xPos = nearbyint(position * size.width); - CGFloat const width = nearbyint(size.width / self.buttonsCount); - attr.frame = {{xPos, 0.0}, {width, size.height}}; + origin = {nearbyint(position * size.width), 0.0}; + size.width = nearbyint(size.width / self.buttonsCount); } else { - CGFloat const yPos = nearbyint(position * size.height); - CGFloat const height = nearbyint(size.height / self.buttonsCount); - attr.frame = {{0.0, yPos}, {size.width, height}}; + origin = {0.0, nearbyint(position * size.height)}; + size.height = nearbyint(size.height / self.buttonsCount); } + NSAssert(!CGSizeEqualToSize(size, CGSizeZero), @"Invalid cell size"); + attr.frame = {origin, size}; return attr; } diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index f7a8e75208..0076c09f62 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -286,10 +286,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { MTRGNativeAppwallBanner * banner = [self.controller.appWallAd.banners firstObject]; [self.controller.appWallAd handleShow:banner]; - UIImage * image = banner.icon.image; - UIImage * highlightedImage = banner.itemHighlightIcon.image; - NSString * title = banner.title; - [cell configureWithImage:image highlightedImage:highlightedImage label:title badgeCount:0]; + [cell configureWithImageName:@"ic_menu_showcase" label:L(@"showcase_more_apps") badgeCount:0]; } break; case MWMBottomMenuViewCellCount: @@ -381,10 +378,11 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) - (void)menuActionOpenAd { - NSAssert(self.controller.appWallAd.banners.count != 0, @"Banners collection can not be empty!"); + NSArray * banners = self.controller.appWallAd.banners; + NSAssert(banners.count != 0, @"Banners collection can not be empty!"); [[Statistics instance] logEvent:kStatMenu withParameters:@{kStatButton : kStatMoreApps}]; self.state = self.restoreState; - [self.controller.appWallAd handleClick:[self.controller.appWallAd.banners firstObject] + [self.controller.appWallAd handleClick:[banners firstObject] withController:self.controller]; } diff --git a/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/Contents.json b/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/Contents.json new file mode 100644 index 0000000000..536501036c --- /dev/null +++ b/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_menu_showcase.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_menu_showcase@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_menu_showcase@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase.png b/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase.png new file mode 100644 index 0000000000000000000000000000000000000000..e9d1787c57203e79a56aed2eadd3d3b4b523625f GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^G9b*s0wiy+h|2>hGfx-CkP60Ri9m#F zu);O&LBY%nZ!pi)MMBl6x}|XfuPS LtDnm{r-UW|v133t literal 0 HcmV?d00001 diff --git a/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase@3x.png b/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase.imageset/ic_menu_showcase@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..1f8e51c14c972ab34245a53dadb436b8d0db70fe GIT binary patch literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^At21b0wlL3-S7fZi#%N%Ln;{G-dHJl#DIr2(R4!9 zoxlmZ4T`UJJAMB=(fWUfJ@1q_28IUz$x7~>zskLyc>Gr1viXSA*2-%U-+VKc*Ph&# z@xO&F=*l}!Yju-}?AM;m6`rNRoPFvXr|*@CHw_muE^_G4IV%IhABM!qcaJn44i5mj Omci52&t;ucLK6Uu6hGfx-CkP60Ri9m;rgIxzX*&1^c zWfr|)SjMoBqg{ioz^VO)t9z5%Cg-VtDwY^a_!cep%wu6>xc1P$(|Y^Q^FR|AJYD@< J);T3K0RW^kAQu1t literal 0 HcmV?d00001 diff --git a/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press@2x.png b/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a766a4ee0609da1304f4f190e0e7c9c5d3b5891e GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^79h;Q0wkIGKTicx`JOJ0Ar*{or)?K)a1c3s=dND4 z^n}F!3ndy7il*H8WgBYG!64@u5V9^$W#^(pZR;*heU%oZwdPgSB&*3gR%M^OI`hfu zUDM8`JBuqiwQ%T1&(xLR?@^^(T*y+FtdlKFY-$1R2gX4`2gc0J-dl2-$* OX7F_Nb6Mw<&;$TIeL+|N literal 0 HcmV?d00001 diff --git a/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press@3x.png b/iphone/Maps/Images.xcassets/Bottom Menu/ic_menu_showcase_press.imageset/ic_menu_showcase_press@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..c0fbbacef71afd1879f85108d26916f65f3748b4 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^At21b0wlL3-S7fZOFUg1Ln;{G-q^$^D?8i9*kI)zldO#a)>`gzFz zv+>fOPQrh_a?TQB2za7ZB)YRJ#$FhzX37es@QJHWgaXAG84j$fVYqSn?E771zZU_W O!QkoY=d#Wzp$PzH`dA_W literal 0 HcmV?d00001