From 0fb029ad724dd16948b3008c95843b27c451e57f Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 13 Feb 2020 17:53:48 +0300 Subject: [PATCH] [iOS] Fixed styles in place page after rebase from release-96 --- iphone/Maps/Core/Theme/GlobalStyleSheet.swift | 5 + iphone/Maps/Core/Theme/MapStyleSheet.swift | 12 +- .../Renderers/StarRatingViewRenderer.swift | 23 + iphone/Maps/Maps.xcodeproj/project.pbxproj | 4 + .../HotelFacilitiesViewController.swift | 3 +- .../HotelReviewsViewController.swift | 3 +- iphone/Maps/UI/PlacePage/PlacePage.storyboard | 454 ++++++------------ .../PlacePageBookmarkViewController.swift | 5 + .../PlacePageInfoViewController.swift | 15 +- .../PlacePagePreviewViewController.swift | 6 +- .../PlacePageReviewsViewController.swift | 3 +- .../PlacePage/PlacePageViewController.swift | 2 +- .../RatingSummaryViewController.swift | 9 +- .../UI/PlacePage/Views/MyReviewView.swift | 5 +- .../WikiDescriptionViewController.swift | 5 + 15 files changed, 214 insertions(+), 340 deletions(-) create mode 100644 iphone/Maps/Core/Theme/Renderers/StarRatingViewRenderer.swift diff --git a/iphone/Maps/Core/Theme/GlobalStyleSheet.swift b/iphone/Maps/Core/Theme/GlobalStyleSheet.swift index 946ca334f6..8c83f29778 100644 --- a/iphone/Maps/Core/Theme/GlobalStyleSheet.swift +++ b/iphone/Maps/Core/Theme/GlobalStyleSheet.swift @@ -66,6 +66,11 @@ class GlobalStyleSheet: IStyleSheet { s.backgroundColor = colors.white } + theme.add(styleName: "StarRatingView") { (s) -> (Void) in + s.onTintColor = colors.ratingYellow + s.offTintColor = colors.blackDividers + } + //MARK: Global styles theme.add(styleName: "Divider") { (s) -> (Void) in s.backgroundColor = colors.blackDividers diff --git a/iphone/Maps/Core/Theme/MapStyleSheet.swift b/iphone/Maps/Core/Theme/MapStyleSheet.swift index bdb4a7d375..a8072631e3 100644 --- a/iphone/Maps/Core/Theme/MapStyleSheet.swift +++ b/iphone/Maps/Core/Theme/MapStyleSheet.swift @@ -38,6 +38,11 @@ class MapStyleSheet: IStyleSheet { s.shadowOffset = CGSize(width: 0, height: 1) } + theme.add(styleName: "PPRatingView") { (s) -> (Void) in + s.backgroundColor = colors.blackOpaque + s.round = true + } + theme.add(styleName: "PPRatingHorrible") { (s) -> (Void) in s.image = "ic_24px_rating_horrible" s.tintColor = colors.ratingRed @@ -63,6 +68,11 @@ class MapStyleSheet: IStyleSheet { s.tintColor = colors.ratingGreen } + theme.add(styleName: "PPButton", from: "FlatNormalTransButtonBig") { (s) -> (Void) in + s.borderColor = colors.linkBlue + s.borderWidth = 1 + } + theme.add(styleName: "ButtonZoomIn") { (s) -> (Void) in s.mwmImage = "btn_zoom_in" } @@ -123,7 +133,7 @@ class MapStyleSheet: IStyleSheet { theme.add(styleName: "PPTitlePopularView") { (s) -> (Void) in s.backgroundColor = colors.linkBlueHighlighted - s.round = true + s.cornerRadius = 10 } theme.add(styleName: "RouteBasePreview") { (s) -> (Void) in diff --git a/iphone/Maps/Core/Theme/Renderers/StarRatingViewRenderer.swift b/iphone/Maps/Core/Theme/Renderers/StarRatingViewRenderer.swift new file mode 100644 index 0000000000..d0ddd7f551 --- /dev/null +++ b/iphone/Maps/Core/Theme/Renderers/StarRatingViewRenderer.swift @@ -0,0 +1,23 @@ +extension StarRatingView { + @objc override func applyTheme() { + if styleName.isEmpty { + styleName = "StarRatingView" + } + for style in StyleManager.shared.getStyle(styleName) + where !style.isEmpty && !style.hasExclusion(view: self) { + StarRatingViewViewRenderer.render(self, style: style) + } + } +} + +class StarRatingViewViewRenderer { + class func render(_ control: StarRatingView, style: Style) { + if let onTintColor = style.onTintColor { + control.activeColor = onTintColor + } + if let offTintColor = style.offTintColor { + control.inactiveColor = offTintColor + } + } +} + diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 582603c309..2654c06956 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 116616F223F597AF003CB923 /* StarRatingViewRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116616F123F597AF003CB923 /* StarRatingViewRenderer.swift */; }; 1185C52C23BB53A7004BF349 /* UIViewControllerRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1185C52B23BB53A7004BF349 /* UIViewControllerRenderer.swift */; }; 1DA7908820762CEB008BDD6B /* libopen_location_code.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DA7908920762CEB008BDD6B /* libopen_location_code.a */; }; 1DFA2F6A20D3B57400FB2C66 /* UIColor+PartnerColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFA2F6920D3B57400FB2C66 /* UIColor+PartnerColor.m */; }; @@ -869,6 +870,7 @@ /* Begin PBXFileReference section */ 0B07BBB5C2EFC6F60EF51BC8 /* Pods-MAPS.ME.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MAPS.ME.debug.xcconfig"; path = "Target Support Files/Pods-MAPS.ME/Pods-MAPS.ME.debug.xcconfig"; sourceTree = ""; }; + 116616F123F597AF003CB923 /* StarRatingViewRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarRatingViewRenderer.swift; sourceTree = ""; }; 1185C52B23BB53A7004BF349 /* UIViewControllerRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerRenderer.swift; sourceTree = ""; }; 166595280BE641CF8ADE2209 /* Pods-MAPS.ME.production full.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MAPS.ME.production full.xcconfig"; path = "Target Support Files/Pods-MAPS.ME/Pods-MAPS.ME.production full.xcconfig"; sourceTree = ""; }; 1D3623240D0F684500981E51 /* MapsAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapsAppDelegate.h; sourceTree = ""; }; @@ -3677,6 +3679,7 @@ 99169D7223D06B390006A9CA /* RatingSummaryViewRenderer.swift */, 9974CA3923E05B9C003FE824 /* RatingViewRenderer.swift */, 999FC12E23ABD53300B0E6F9 /* TabViewRenderer.swift */, + 116616F123F597AF003CB923 /* StarRatingViewRenderer.swift */, 994AEBEB23AB763C0079B81F /* UIActivityIndicatorRenderer.swift */, 994AEBEA23AB763C0079B81F /* UIButtonRenderer.swift */, 994AEBF723AB763C0079B81F /* UIBarButtonItemRenderer.swift */, @@ -5473,6 +5476,7 @@ 348A8DF81F66775A00D83026 /* RatingViewDelegate.swift in Sources */, 4716EABA21A325310029B886 /* IPaidRouteStatistics.swift in Sources */, 3490D2E11CE9DD2500D0B838 /* MWMSideButtonsView.mm in Sources */, + 116616F223F597AF003CB923 /* StarRatingViewRenderer.swift in Sources */, 47F4F21523A6F06F0022FD56 /* AvailableMapsDataSource.swift in Sources */, 995739062355CAC40019AEE7 /* ImageViewCrossDisolve.swift in Sources */, 994AEC1F23AB763C0079B81F /* UITextFieldRenderer.swift in Sources */, diff --git a/iphone/Maps/UI/PlacePage/HotelFacilitiesViewController.swift b/iphone/Maps/UI/PlacePage/HotelFacilitiesViewController.swift index b4b91bdf5a..6f76c92451 100644 --- a/iphone/Maps/UI/PlacePage/HotelFacilitiesViewController.swift +++ b/iphone/Maps/UI/PlacePage/HotelFacilitiesViewController.swift @@ -55,8 +55,7 @@ class HotelFacilitiesViewController: UIViewController { private func addMoreButton() { let button = UIButton() button.setTitle(L("booking_show_more"), for: .normal) - button.titleLabel?.font = UIFont.regular16() - button.setTitleColor(UIColor.linkBlue(), for: .normal) + button.styleName = "MoreButton" button.heightAnchor.constraint(equalToConstant: 44).isActive = true stackView.addArrangedSubview(button) button.addTarget(self, action: #selector(onMoreButton(_:)), for: .touchUpInside) diff --git a/iphone/Maps/UI/PlacePage/HotelReviewsViewController.swift b/iphone/Maps/UI/PlacePage/HotelReviewsViewController.swift index 97db372a1a..d68b3bba55 100644 --- a/iphone/Maps/UI/PlacePage/HotelReviewsViewController.swift +++ b/iphone/Maps/UI/PlacePage/HotelReviewsViewController.swift @@ -92,8 +92,7 @@ class HotelReviewsViewController: UIViewController { private func addMoreButton() { let button = UIButton() button.setTitle(L("reviews_on_bookingcom"), for: .normal) - button.titleLabel?.font = UIFont.regular16() - button.setTitleColor(UIColor.linkBlue(), for: .normal) + button.styleName = "MoreButton" button.heightAnchor.constraint(equalToConstant: 44).isActive = true stackView.addArrangedSubview(button) button.addTarget(self, action: #selector(onMoreButton(_:)), for: .touchUpInside) diff --git a/iphone/Maps/UI/PlacePage/PlacePage.storyboard b/iphone/Maps/UI/PlacePage/PlacePage.storyboard index 97498518e1..5ff9c9dd4c 100644 --- a/iphone/Maps/UI/PlacePage/PlacePage.storyboard +++ b/iphone/Maps/UI/PlacePage/PlacePage.storyboard @@ -1,9 +1,9 @@ - + - + @@ -38,7 +38,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -77,14 +77,14 @@ - + - + @@ -134,8 +134,7 @@ - - + @@ -150,8 +149,7 @@ - - + @@ -166,10 +164,7 @@ - - - - + @@ -181,7 +176,7 @@ - +