From d0d84a5dd55e13f4859b619de4b7c6ab7c927a97 Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Fri, 14 Mar 2025 19:08:45 +0400 Subject: [PATCH] [ios] add CornerRadius enum for easily setting up the property 1. new typed corner radius 2. updated styles where the corner radius is used Signed-off-by: Kiryl Kaveryn --- .../Maps/Categories/CALayer+SetCorner.swift | 16 ++-- iphone/Maps/Categories/UIView+Snapshot.swift | 2 +- .../Modal/AlertPresentationController.swift | 2 +- .../IPadModalPresentationController.swift | 2 +- .../PromoBookingPresentationController.swift | 2 +- .../Classes/CustomAlert/Toast/Toast.swift | 2 +- .../TransportRuler.swift | 3 +- .../TransportTransitPedestrian.swift | 5 +- .../TransportTransitTrain.swift | 3 +- iphone/Maps/Core/Theme/Core/Style.swift | 4 +- iphone/Maps/Core/Theme/CornerRadius.swift | 21 +++++ iphone/Maps/Core/Theme/GlobalStyleSheet.swift | 27 ++++--- iphone/Maps/Core/Theme/MapStyleSheet.swift | 8 +- .../Maps/Core/Theme/PlacePageStyleSheet.swift | 16 ++-- .../Theme/Renderers/UISearchBarRenderer.swift | 2 +- .../Theme/Renderers/UITextFieldRenderer.swift | 2 +- .../Core/Theme/Renderers/UIViewRenderer.swift | 2 +- iphone/Maps/Core/Theme/SearchStyleSheet.swift | 78 +------------------ iphone/Maps/Maps.xcodeproj/project.pbxproj | 4 + .../Menu/BottomMenuViewController.swift | 2 +- .../Components/Products/ProductButton.swift | 2 +- .../UI/PlacePage/Views/DifficultyView.swift | 2 +- .../SearchOnMap/SearchOnMapHeaderView.swift | 3 +- 23 files changed, 81 insertions(+), 129 deletions(-) create mode 100644 iphone/Maps/Core/Theme/CornerRadius.swift diff --git a/iphone/Maps/Categories/CALayer+SetCorner.swift b/iphone/Maps/Categories/CALayer+SetCorner.swift index da94169854..7b49343a81 100644 --- a/iphone/Maps/Categories/CALayer+SetCorner.swift +++ b/iphone/Maps/Categories/CALayer+SetCorner.swift @@ -1,12 +1,18 @@ extension CALayer { - func setCorner(radius: CGFloat, - corners: CACornerMask? = nil) { - cornerRadius = radius - if let corners { - maskedCorners = corners + func setCornerRadius(_ cornerRadius: CornerRadius, + maskedCorners: CACornerMask? = nil) { + self.cornerRadius = cornerRadius.value + if let maskedCorners { + self.maskedCorners = maskedCorners } if #available(iOS 13.0, *) { cornerCurve = .continuous } } } + +extension CACornerMask { + static var all: CACornerMask { + return [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner] + } +} diff --git a/iphone/Maps/Categories/UIView+Snapshot.swift b/iphone/Maps/Categories/UIView+Snapshot.swift index f983e08e65..b06ae54f68 100644 --- a/iphone/Maps/Categories/UIView+Snapshot.swift +++ b/iphone/Maps/Categories/UIView+Snapshot.swift @@ -13,7 +13,7 @@ extension UIView { snapshot.layer.contents = contents snapshot.layer.bounds = layer.bounds } - snapshot.layer.setCorner(radius: layer.cornerRadius) + snapshot.layer.setCornerRadius(.custom(layer.cornerRadius)) snapshot.layer.masksToBounds = layer.masksToBounds snapshot.contentMode = contentMode snapshot.transform = transform diff --git a/iphone/Maps/Classes/Components/Modal/AlertPresentationController.swift b/iphone/Maps/Classes/Components/Modal/AlertPresentationController.swift index f870fac3fb..c8f8353f1e 100644 --- a/iphone/Maps/Classes/Components/Modal/AlertPresentationController.swift +++ b/iphone/Maps/Classes/Components/Modal/AlertPresentationController.swift @@ -8,7 +8,7 @@ final class AlertPresentationController: DimmedModalPresentationController { override func presentationTransitionWillBegin() { super.presentationTransitionWillBegin() - presentedViewController.view.layer.setCorner(radius: 12) + presentedViewController.view.layer.setCornerRadius(.modalSheet) presentedViewController.view.clipsToBounds = true guard let containerView = containerView, let presentedView = presentedView else { return } containerView.addSubview(presentedView) diff --git a/iphone/Maps/Classes/Components/Modal/IPadModalPresentationController.swift b/iphone/Maps/Classes/Components/Modal/IPadModalPresentationController.swift index 2aec213d36..810f1c1b21 100644 --- a/iphone/Maps/Classes/Components/Modal/IPadModalPresentationController.swift +++ b/iphone/Maps/Classes/Components/Modal/IPadModalPresentationController.swift @@ -17,7 +17,7 @@ override var frameOfPresentedViewInContainerView: CGRect { override func presentationTransitionWillBegin() { super.presentationTransitionWillBegin() - presentedViewController.view.layer.setCorner(radius: 8) + presentedViewController.view.layer.setCornerRadius(.buttonDefault) presentedViewController.view.clipsToBounds = true guard let containerView = containerView, let presentedView = presentedView else { return } containerView.addSubview(presentedView) diff --git a/iphone/Maps/Classes/Components/Modal/PromoBookingPresentationController.swift b/iphone/Maps/Classes/Components/Modal/PromoBookingPresentationController.swift index 11c004fa58..ed2e5a3aa0 100644 --- a/iphone/Maps/Classes/Components/Modal/PromoBookingPresentationController.swift +++ b/iphone/Maps/Classes/Components/Modal/PromoBookingPresentationController.swift @@ -16,7 +16,7 @@ final class PromoBookingPresentationController: DimmedModalPresentationControlle override func presentationTransitionWillBegin() { super.presentationTransitionWillBegin() - presentedViewController.view.layer.setCorner(radius: 8) + presentedViewController.view.layer.setCornerRadius(.buttonDefault) presentedViewController.view.clipsToBounds = true guard let containerView = containerView, let presentedView = presentedView else { return } containerView.addSubview(presentedView) diff --git a/iphone/Maps/Classes/CustomAlert/Toast/Toast.swift b/iphone/Maps/Classes/CustomAlert/Toast/Toast.swift index 44ebd057eb..275339ec0b 100644 --- a/iphone/Maps/Classes/CustomAlert/Toast/Toast.swift +++ b/iphone/Maps/Classes/CustomAlert/Toast/Toast.swift @@ -22,7 +22,7 @@ final class Toast: NSObject { } private init(_ text: String) { - blurView.layer.setCorner(radius: 8) + blurView.layer.setCornerRadius(.buttonDefault) blurView.clipsToBounds = true blurView.alpha = 0 diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportRuler.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportRuler.swift index 782aa4aa72..00a0f2c8f6 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportRuler.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportRuler.swift @@ -1,6 +1,5 @@ final class TransportRuler: TransportTransitCell { enum Config { - static let backgroundCornerRadius: CGFloat = 4 static var backgroundColor: UIColor { return UIColor.blackOpaque() } static var imageColor: UIColor { return UIColor.blackSecondaryText() } static var labelTextColor: UIColor { return .black } @@ -10,7 +9,7 @@ final class TransportRuler: TransportTransitCell { @IBOutlet private weak var background: UIView! { didSet { - background.layer.setCorner(radius: Config.backgroundCornerRadius) + background.layer.setCornerRadius(.buttonSmall) background.backgroundColor = Config.backgroundColor } } diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift index 8def0c0d9c..20d06be438 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift @@ -1,20 +1,19 @@ final class TransportTransitPedestrian: TransportTransitCell { enum Config { - static let backgroundCornerRadius: CGFloat = 4 static var backgroundColor: UIColor { return UIColor.blackOpaque() } static var imageColor: UIColor { return UIColor.blackSecondaryText() } } @IBOutlet private weak var background: UIView! { didSet { - background.layer.setCorner(radius: Config.backgroundCornerRadius) + background.layer.setCornerRadius(.buttonSmall) background.backgroundColor = Config.backgroundColor } } @IBOutlet private weak var image: UIImageView! { didSet { - image.image = #imageLiteral(resourceName: "ic_walk") + image.image = UIImage(resource: .icWalk) image.tintColor = Config.imageColor image.contentMode = .scaleAspectFit } diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift index c04e96a710..a08e2077f7 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift @@ -1,6 +1,5 @@ final class TransportTransitTrain: TransportTransitCell { enum Config { - static let backgroundCornerRadius: CGFloat = 4 static var labelTextColor: UIColor { return .white } static let labelTextFont = UIFont.bold12() static let labelTrailing: CGFloat = 4 @@ -8,7 +7,7 @@ final class TransportTransitTrain: TransportTransitCell { @IBOutlet private weak var background: UIView! { didSet { - background.layer.setCorner(radius: Config.backgroundCornerRadius) + background.layer.setCornerRadius(.buttonSmall) } } diff --git a/iphone/Maps/Core/Theme/Core/Style.swift b/iphone/Maps/Core/Theme/Core/Style.swift index cef982070e..575b527694 100644 --- a/iphone/Maps/Core/Theme/Core/Style.swift +++ b/iphone/Maps/Core/Theme/Core/Style.swift @@ -116,8 +116,8 @@ extension Style { set { params[.borderWidth] = newValue } } - var cornerRadius: CGFloat? { - get { return self[.cornerRadius] as? CGFloat } + var cornerRadius: CornerRadius? { + get { return self[.cornerRadius] as? CornerRadius } set { params[.cornerRadius] = newValue } } diff --git a/iphone/Maps/Core/Theme/CornerRadius.swift b/iphone/Maps/Core/Theme/CornerRadius.swift new file mode 100644 index 0000000000..b6fe9c3af8 --- /dev/null +++ b/iphone/Maps/Core/Theme/CornerRadius.swift @@ -0,0 +1,21 @@ +enum CornerRadius { + case modalSheet + case buttonDefault + case buttonDefaultSmall + case buttonSmall + case grabber + case custom(CGFloat) +} + +extension CornerRadius { + var value: CGFloat { + switch self { + case .modalSheet: return 12 + case .buttonDefault: return 8 + case .buttonDefaultSmall: return 6 + case .buttonSmall: return 4 + case .grabber: return 2.5 + case .custom(let value): return value + } + } +} diff --git a/iphone/Maps/Core/Theme/GlobalStyleSheet.swift b/iphone/Maps/Core/Theme/GlobalStyleSheet.swift index 8de1a5fdcf..0b6ab0297e 100644 --- a/iphone/Maps/Core/Theme/GlobalStyleSheet.swift +++ b/iphone/Maps/Core/Theme/GlobalStyleSheet.swift @@ -59,6 +59,7 @@ enum GlobalStyleSheet: String, CaseIterable { case white = "MWMWhite" case datePickerView = "DatePickerView" case valueStepperView = "ValueStepperView" + case grabber case modalSheetBackground case modalSheetContent } @@ -178,7 +179,7 @@ extension GlobalStyleSheet: IStyleSheet { s.backgroundColor = colors.tabBarButtonBackground s.tintColor = colors.blackSecondaryText s.coloring = MWMButtonColoring.black - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.shadowColor = UIColor(0,0,0,alpha20) s.shadowOpacity = 1 s.shadowOffset = CGSize(width: 0, height: 1) @@ -186,7 +187,7 @@ extension GlobalStyleSheet: IStyleSheet { } case .trackRecordingWidgetButton: return .addFrom(Self.bottomTabBarButton) { s in - s.cornerRadius = 23 + s.cornerRadius = .custom(23) } case .blackOpaqueBackground: return .add { s in @@ -234,7 +235,7 @@ extension GlobalStyleSheet: IStyleSheet { } case .dialogView: return .add { s in - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.shadowRadius = 2 s.shadowColor = UIColor(0,0,0,alpha26) s.shadowOpacity = 1 @@ -244,7 +245,7 @@ extension GlobalStyleSheet: IStyleSheet { } case .alertView: return .add { s in - s.cornerRadius = 12 + s.cornerRadius = .modalSheet s.shadowRadius = 6 s.shadowColor = UIColor(0,0,0,alpha20) s.shadowOpacity = 1 @@ -275,7 +276,7 @@ extension GlobalStyleSheet: IStyleSheet { case .flatNormalButton: return .add { s in s.font = fonts.medium14 - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.clip = true s.fontColor = colors.whitePrimaryText s.backgroundColor = colors.linkBlue @@ -290,7 +291,7 @@ extension GlobalStyleSheet: IStyleSheet { case .flatNormalTransButton: return .add { s in s.font = fonts.medium14 - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.clip = true s.fontColor = colors.linkBlue s.backgroundColor = colors.clear @@ -332,7 +333,7 @@ extension GlobalStyleSheet: IStyleSheet { case .flatRedButton: return .add { s in s.font = fonts.medium14 - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.fontColor = colors.whitePrimaryText s.backgroundColor = colors.buttonRed s.fontColorHighlighted = colors.buttonRedHighlighted @@ -348,7 +349,7 @@ extension GlobalStyleSheet: IStyleSheet { return .add { s in s.font = fonts.regular14 s.fontColor = colors.linkBlue - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.borderColor = colors.linkBlue s.borderWidth = 1 s.fontColorHighlighted = colors.linkBlueHighlighted @@ -360,7 +361,7 @@ extension GlobalStyleSheet: IStyleSheet { s.fontColor = colors.linkBlue s.fontColorHighlighted = colors.white s.borderColor = colors.linkBlue - s.cornerRadius = 8 + s.cornerRadius = .buttonDefault s.borderWidth = 1 s.backgroundColor = colors.clear s.backgroundColorHighlighted = colors.linkBlue @@ -431,14 +432,18 @@ extension GlobalStyleSheet: IStyleSheet { s.fontColor = colors.blackPrimaryText s.coloring = MWMButtonColoring.blue } + case .grabber: + return .addFrom(Self.pressBackground) { s in + s.cornerRadius = .grabber + } case .modalSheetBackground: return .add { s in s.backgroundColor = colors.white s.shadowColor = UIColor.black s.shadowOffset = CGSize(width: 0, height: 1) - s.shadowOpacity = 0.4 + s.shadowOpacity = 0.3 s.shadowRadius = 6 - s.cornerRadius = 12 + s.cornerRadius = .modalSheet s.clip = false s.maskedCorners = isIPad ? [] : [.layerMinXMinYCorner, .layerMaxXMinYCorner] } diff --git a/iphone/Maps/Core/Theme/MapStyleSheet.swift b/iphone/Maps/Core/Theme/MapStyleSheet.swift index 7733e9b7d6..57ff96ee52 100644 --- a/iphone/Maps/Core/Theme/MapStyleSheet.swift +++ b/iphone/Maps/Core/Theme/MapStyleSheet.swift @@ -28,7 +28,7 @@ extension MapStyleSheet: IStyleSheet { s.backgroundColor = colors.clear s.borderColor = colors.clear s.borderWidth = 0 - s.cornerRadius = 6 + s.cornerRadius = .buttonDefaultSmall } case .mapMenuButtonEnabled: return .add { s in @@ -37,7 +37,7 @@ extension MapStyleSheet: IStyleSheet { s.backgroundColor = colors.linkBlue s.borderColor = colors.linkBlue s.borderWidth = 2 - s.cornerRadius = 6 + s.cornerRadius = .buttonDefaultSmall } case .mapStreetNameBackgroundView: return .add { s in @@ -90,7 +90,7 @@ extension MapStyleSheet: IStyleSheet { case .mapFirstTurnView: return .add { s in s.backgroundColor = colors.linkBlue - s.cornerRadius = 4 + s.cornerRadius = .buttonSmall s.shadowRadius = 2 s.shadowColor = colors.blackHintText s.shadowOpacity = 1 @@ -104,7 +104,7 @@ extension MapStyleSheet: IStyleSheet { return .add { s in s.shadowOffset = CGSize(width: 0, height: 3) s.shadowRadius = 6 - s.cornerRadius = 4 + s.cornerRadius = .buttonSmall s.shadowOpacity = 1 s.backgroundColor = colors.white } diff --git a/iphone/Maps/Core/Theme/PlacePageStyleSheet.swift b/iphone/Maps/Core/Theme/PlacePageStyleSheet.swift index 4aea353e94..dbece4923e 100644 --- a/iphone/Maps/Core/Theme/PlacePageStyleSheet.swift +++ b/iphone/Maps/Core/Theme/PlacePageStyleSheet.swift @@ -30,7 +30,7 @@ extension PlacePageStyleSheet: IStyleSheet { case .ppTitlePopularView: return .add { s in s.backgroundColor = colors.linkBlueHighlighted - s.cornerRadius = 10 + s.cornerRadius = .custom(10) } case .ppActionBarTitle: return .add { s in @@ -45,7 +45,7 @@ extension PlacePageStyleSheet: IStyleSheet { case .ppElevationProfileDescriptionCell: return .add { s in s.backgroundColor = colors.blackOpaque - s.cornerRadius = 6 + s.cornerRadius = .buttonDefault } case .ppElevationProfileExtendedDifficulty: return .add { s in @@ -110,7 +110,7 @@ extension PlacePageStyleSheet: IStyleSheet { case .ppHeaderView: return .add { s in s.backgroundColor = colors.white - s.cornerRadius = 10 + s.cornerRadius = .modalSheet s.clip = true } case .ppNavigationShadowView: @@ -123,19 +123,15 @@ extension PlacePageStyleSheet: IStyleSheet { s.clip = false } case .ppBackgroundView: - return .add { s in + return .addFrom(GlobalStyleSheet.modalSheetBackground) { s in s.backgroundColor = colors.pressBackground - s.cornerRadius = 10 - s.shadowColor = UIColor.black - s.shadowOffset = CGSize(width: 0, height: 1) - s.shadowOpacity = 0.6 - s.shadowRadius = 2 + s.maskedCorners = isIPad ? CACornerMask.all : [.layerMinXMinYCorner, .layerMaxXMinYCorner] s.clip = false } case .ppView: return .add { s in s.backgroundColor = colors.clear - s.cornerRadius = 10 + s.cornerRadius = .modalSheet s.clip = true } case .ppHeaderCircleIcon: diff --git a/iphone/Maps/Core/Theme/Renderers/UISearchBarRenderer.swift b/iphone/Maps/Core/Theme/Renderers/UISearchBarRenderer.swift index a113d2569a..25394df329 100644 --- a/iphone/Maps/Core/Theme/Renderers/UISearchBarRenderer.swift +++ b/iphone/Maps/Core/Theme/Renderers/UISearchBarRenderer.swift @@ -31,7 +31,7 @@ class UISearchBarRenderer: UIViewRenderer { } else { control.setSearchFieldBackgroundImage(UIImage(), for: .normal) } - searchTextField.layer.setCorner(radius: 8) + searchTextField.layer.setCornerRadius(.buttonDefault) searchTextField.layer.masksToBounds = true // Placeholder color if let placeholder = searchTextField.placeholder { diff --git a/iphone/Maps/Core/Theme/Renderers/UITextFieldRenderer.swift b/iphone/Maps/Core/Theme/Renderers/UITextFieldRenderer.swift index de3c850b37..5223f8e5f6 100644 --- a/iphone/Maps/Core/Theme/Renderers/UITextFieldRenderer.swift +++ b/iphone/Maps/Core/Theme/Renderers/UITextFieldRenderer.swift @@ -20,7 +20,7 @@ extension UITextField { class UITextFieldRenderer { class func render(_ control: UITextField, style: Style) { if let cornerRadius = style.cornerRadius { - control.layer.setCorner(radius: cornerRadius) + control.layer.setCornerRadius(cornerRadius) control.clipsToBounds = true } control.borderStyle = .none diff --git a/iphone/Maps/Core/Theme/Renderers/UIViewRenderer.swift b/iphone/Maps/Core/Theme/Renderers/UIViewRenderer.swift index 648c46f047..a9de58e081 100644 --- a/iphone/Maps/Core/Theme/Renderers/UIViewRenderer.swift +++ b/iphone/Maps/Core/Theme/Renderers/UIViewRenderer.swift @@ -46,7 +46,7 @@ class UIViewRenderer { control.layer.borderWidth = borderWidth } if let cornerRadius = style.cornerRadius { - control.layer.cornerRadius = cornerRadius + control.layer.cornerRadius = cornerRadius.value } if let maskedCorners = style.maskedCorners { control.layer.maskedCorners = maskedCorners diff --git a/iphone/Maps/Core/Theme/SearchStyleSheet.swift b/iphone/Maps/Core/Theme/SearchStyleSheet.swift index d9a9fbb40b..2d448e3072 100644 --- a/iphone/Maps/Core/Theme/SearchStyleSheet.swift +++ b/iphone/Maps/Core/Theme/SearchStyleSheet.swift @@ -1,97 +1,21 @@ enum SearchStyleSheet: String, CaseIterable { case searchCancelButton - case searchInstallButton = "SearchInstallButton" - case searchBanner = "SearchBanner" - case searchClosedBackground = "SearchClosedBackground" case searchPopularView = "SearchPopularView" case searchSideAvailableMarker = "SearchSideAvaliableMarker" - case searchBarView = "SearchBarView" - case searchActionBarView = "SearchActionBarView" - case searchActionBarButton = "SearchActionBarButton" - case searchSearchTextField = "SearchSearchTextField" - case searchSearchTextFieldIcon = "SearchSearchTextFieldIcon" - case searchDatePickerField = "SearchDatePickerField" - case searchCellAvailable = "SearchCellAvaliable" } extension SearchStyleSheet: IStyleSheet { func styleResolverFor(colors: IColors, fonts: IFonts) -> Theme.StyleResolver { switch self { - case .searchInstallButton: - return .add { s in - s.cornerRadius = 10 - s.clip = true - s.font = fonts.medium12 - s.fontColor = colors.blackSecondaryText - s.backgroundColor = colors.searchPromoBackground - } - case .searchBanner: - return .add { s in - s.backgroundColor = colors.searchPromoBackground - } - case .searchClosedBackground: - return .add { s in - s.cornerRadius = 4 - s.backgroundColor = colors.blackHintText - } case .searchPopularView: return .add { s in - s.cornerRadius = 10 + s.cornerRadius = .custom(10) s.backgroundColor = colors.linkBlueHighlighted } case .searchSideAvailableMarker: return .add { s in s.backgroundColor = colors.ratingGreen } - case .searchBarView: - return .add { s in - s.backgroundColor = colors.primary - s.shadowRadius = 2 - s.shadowColor = UIColor(0, 0, 0, alpha26) - s.shadowOpacity = 1 - s.shadowOffset = CGSize.zero - } - case .searchActionBarView: - return .add { s in - s.backgroundColor = colors.linkBlue - s.cornerRadius = 20 - s.shadowRadius = 1 - s.shadowColor = UIColor(0, 0, 0, 0.24) - s.shadowOffset = CGSize(width: 0, height: 2) - s.shadowOpacity = 1 - } - case .searchActionBarButton: - return .add { s in - s.backgroundColor = colors.clear - s.fontColor = colors.whitePrimaryText - s.font = fonts.semibold14 - s.coloring = .whiteText - } - case .searchSearchTextField: - return .add { s in - s.fontColor = colors.blackPrimaryText - s.backgroundColor = colors.white - s.tintColor = colors.blackSecondaryText - s.cornerRadius = 8.0 - s.barTintColor = colors.primary - } - case .searchSearchTextFieldIcon: - return .add { s in - s.tintColor = colors.blackSecondaryText - s.coloring = MWMButtonColoring.black - s.color = colors.blackSecondaryText - } - case .searchDatePickerField: - return .add { s in - s.backgroundColor = colors.white - s.cornerRadius = 4 - s.borderColor = colors.solidDividers - s.borderWidth = 1 - } - case .searchCellAvailable: - return .addFrom(GlobalStyleSheet.tableCell) { s in - s.backgroundColor = colors.transparentGreen - } case .searchCancelButton: return .add { s in s.fontColor = colors.whitePrimaryText diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index c6631e553e..0167018217 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -522,6 +522,7 @@ ED9966802B94FBC20083CE55 /* ColorPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED99667D2B94FBC20083CE55 /* ColorPicker.swift */; }; EDA1EAA42CC7ECAD00DBDCAA /* ElevationProfileFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDA1EAA32CC7ECAD00DBDCAA /* ElevationProfileFormatter.swift */; }; EDB71D5C2D82B4F8004A6A7F /* SearchOnMapPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDB71D5B2D82B4F8004A6A7F /* SearchOnMapPresentationController.swift */; }; + EDB71D8C2D8474A0004A6A7F /* CornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDB71D8B2D8474A0004A6A7F /* CornerRadius.swift */; }; EDBD68072B625724005DD151 /* LocationServicesDisabledAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = EDBD68062B625724005DD151 /* LocationServicesDisabledAlert.xib */; }; EDBD680B2B62572E005DD151 /* LocationServicesDisabledAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDBD680A2B62572E005DD151 /* LocationServicesDisabledAlert.swift */; }; EDC3573B2B7B5029001AE9CA /* CALayer+SetCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC3573A2B7B5029001AE9CA /* CALayer+SetCorner.swift */; }; @@ -1540,6 +1541,7 @@ ED99667D2B94FBC20083CE55 /* ColorPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorPicker.swift; sourceTree = ""; }; EDA1EAA32CC7ECAD00DBDCAA /* ElevationProfileFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElevationProfileFormatter.swift; sourceTree = ""; }; EDB71D5B2D82B4F8004A6A7F /* SearchOnMapPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchOnMapPresentationController.swift; sourceTree = ""; }; + EDB71D8B2D8474A0004A6A7F /* CornerRadius.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerRadius.swift; sourceTree = ""; }; EDBD68062B625724005DD151 /* LocationServicesDisabledAlert.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LocationServicesDisabledAlert.xib; sourceTree = ""; }; EDBD680A2B62572E005DD151 /* LocationServicesDisabledAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationServicesDisabledAlert.swift; sourceTree = ""; }; EDC3573A2B7B5029001AE9CA /* CALayer+SetCorner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CALayer+SetCorner.swift"; sourceTree = ""; }; @@ -3000,6 +3002,7 @@ 993DF0CE23F6BDB000AC231A /* MainTheme.swift */, ED914AB72D351DF000973C45 /* StyleApplicable.swift */, EDCA7CDE2D317DF9003366CE /* StyleSheet.swift */, + EDB71D8B2D8474A0004A6A7F /* CornerRadius.swift */, 993DF10123F6BDB100AC231A /* GlobalStyleSheet.swift */, 99A906F223FA95AB0005872B /* PlacePageStyleSheet.swift */, 99F8B4C523B644A6009FF0B4 /* MapStyleSheet.swift */, @@ -4718,6 +4721,7 @@ 34D3AFEA1E378AF1004100F9 /* UINib+Init.swift in Sources */, 34AB663E1FC5AA330078E451 /* RouteManagerTransitioning.swift in Sources */, 993DF0CB23F6BD0600AC231A /* ElevationDetailsRouter.swift in Sources */, + EDB71D8C2D8474A0004A6A7F /* CornerRadius.swift in Sources */, 47CA68FC250F99E500671019 /* BookmarksListCellStrategy.swift in Sources */, 34AB662F1FC5AA330078E451 /* RouteManagerPresentationController.swift in Sources */, 993F5508237C622700545511 /* DeepLinkRouteStrategyAdapter.mm in Sources */, diff --git a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuViewController.swift b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuViewController.swift index d4a2d2b187..cb388e4d32 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuViewController.swift +++ b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuViewController.swift @@ -25,7 +25,7 @@ class BottomMenuViewController: MWMViewController { override func viewDidLoad() { super.viewDidLoad() - tableView.layer.setCorner(radius: 8, corners: [.layerMinXMinYCorner, .layerMaxXMinYCorner]) + tableView.layer.setCornerRadius(.buttonDefault, maskedCorners: [.layerMinXMinYCorner, .layerMaxXMinYCorner]) tableView.sectionFooterHeight = 0 tableView.dataSource = presenter diff --git a/iphone/Maps/UI/PlacePage/Components/Products/ProductButton.swift b/iphone/Maps/UI/PlacePage/Components/Products/ProductButton.swift index 5cca486be1..8103344a14 100644 --- a/iphone/Maps/UI/PlacePage/Components/Products/ProductButton.swift +++ b/iphone/Maps/UI/PlacePage/Components/Products/ProductButton.swift @@ -22,7 +22,7 @@ final class ProductButton: UIButton { titleLabel?.allowsDefaultTighteningForTruncation = true titleLabel?.adjustsFontSizeToFitWidth = true titleLabel?.minimumScaleFactor = 0.5 - layer.setCorner(radius: 5.0) + layer.setCornerRadius(.buttonDefaultSmall) layer.masksToBounds = true addTarget(self, action: #selector(buttonDidTap), for: .touchUpInside) } diff --git a/iphone/Maps/UI/PlacePage/Views/DifficultyView.swift b/iphone/Maps/UI/PlacePage/Views/DifficultyView.swift index 493b1fce25..0e1992d7c0 100644 --- a/iphone/Maps/UI/PlacePage/Views/DifficultyView.swift +++ b/iphone/Maps/UI/PlacePage/Views/DifficultyView.swift @@ -43,7 +43,7 @@ class DifficultyView: UIView { for _ in 0..