OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" | 5 #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
8 #include "ios/chrome/grit/ios_strings.h" | 8 #include "ios/chrome/grit/ios_strings.h" |
9 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 9 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
10 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 10 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
11 #include "ui/base/l10n/l10n_util_mac.h" | 11 #include "ui/base/l10n/l10n_util_mac.h" |
12 | 12 |
13 #if !defined(__has_feature) || !__has_feature(objc_arc) | 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
14 #error "This file requires ARC support." | 14 #error "This file requires ARC support." |
15 #endif | 15 #endif |
16 | 16 |
17 namespace { | 17 namespace { |
18 // Padding used on the leading and trailing edges of the cell. | 18 // Padding used on the leading and trailing edges of the cell. |
19 const CGFloat kHorizontalPadding = 16; | 19 const CGFloat kHorizontalPadding = 16; |
20 | 20 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 - (instancetype)initWithFrame:(CGRect)frame { | 74 - (instancetype)initWithFrame:(CGRect)frame { |
75 self = [super initWithFrame:frame]; | 75 self = [super initWithFrame:frame]; |
76 if (self) { | 76 if (self) { |
77 self.isAccessibilityElement = YES; | 77 self.isAccessibilityElement = YES; |
78 | 78 |
79 _textLabel = [[UILabel alloc] init]; | 79 _textLabel = [[UILabel alloc] init]; |
80 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; | 80 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; |
81 [self.contentView addSubview:_textLabel]; | 81 [self.contentView addSubview:_textLabel]; |
82 | 82 |
83 _textLabel.font = | 83 _textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14]; |
84 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
85 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; | 84 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
86 _textLabel.numberOfLines = 0; | 85 _textLabel.numberOfLines = 0; |
87 | 86 |
88 _detailTextLabel = [[UILabel alloc] init]; | 87 _detailTextLabel = [[UILabel alloc] init]; |
89 _detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; | 88 _detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; |
90 [self.contentView addSubview:_detailTextLabel]; | 89 [self.contentView addSubview:_detailTextLabel]; |
91 | 90 |
92 _detailTextLabel.font = | 91 _detailTextLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14]; |
93 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
94 _detailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; | 92 _detailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; |
95 _detailTextLabel.numberOfLines = 0; | 93 _detailTextLabel.numberOfLines = 0; |
96 | 94 |
97 _switchView = [[UISwitch alloc] initWithFrame:CGRectZero]; | 95 _switchView = [[UISwitch alloc] initWithFrame:CGRectZero]; |
98 _switchView.translatesAutoresizingMaskIntoConstraints = NO; | 96 _switchView.translatesAutoresizingMaskIntoConstraints = NO; |
99 _switchView.onTintColor = [[MDCPalette cr_bluePalette] tint500]; | 97 _switchView.onTintColor = [[MDCPalette cr_bluePalette] tint500]; |
100 _switchView.accessibilityHint = l10n_util::GetNSString( | 98 _switchView.accessibilityHint = l10n_util::GetNSString( |
101 IDS_IOS_TOGGLE_SETTING_SWITCH_ACCESSIBILITY_HINT); | 99 IDS_IOS_TOGGLE_SETTING_SWITCH_ACCESSIBILITY_HINT); |
102 [self.contentView addSubview:_switchView]; | 100 [self.contentView addSubview:_switchView]; |
103 | 101 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 197 |
200 - (NSString*)accessibilityValue { | 198 - (NSString*)accessibilityValue { |
201 if (_switchView.on) { | 199 if (_switchView.on) { |
202 return l10n_util::GetNSString(IDS_IOS_SETTING_ON); | 200 return l10n_util::GetNSString(IDS_IOS_SETTING_ON); |
203 } else { | 201 } else { |
204 return l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 202 return l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
205 } | 203 } |
206 } | 204 } |
207 | 205 |
208 @end | 206 @end |
OLD | NEW |