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/text_and_error_item.h" | 5 #import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 8 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
9 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
10 | 10 |
11 #if !defined(__has_feature) || !__has_feature(objc_arc) | 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
12 #error "This file requires ARC support." | 12 #error "This file requires ARC support." |
13 #endif | 13 #endif |
14 | 14 |
15 namespace { | 15 namespace { |
16 // Padding used on the leading and trailing edges of the cell. | 16 // Padding used on the leading and trailing edges of the cell. |
17 const CGFloat kHorizontalPadding = 16; | 17 const CGFloat kHorizontalPadding = 16; |
18 | 18 |
19 // Padding used on the top and bottom edges of the cell. | 19 // Padding used on the top and bottom edges of the cell. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 @synthesize textLabel = _textLabel; | 83 @synthesize textLabel = _textLabel; |
84 @synthesize errorIcon = _errorIcon; | 84 @synthesize errorIcon = _errorIcon; |
85 | 85 |
86 - (instancetype)initWithFrame:(CGRect)frame { | 86 - (instancetype)initWithFrame:(CGRect)frame { |
87 self = [super initWithFrame:frame]; | 87 self = [super initWithFrame:frame]; |
88 if (self) { | 88 if (self) { |
89 self.contentView.clipsToBounds = YES; | 89 self.contentView.clipsToBounds = YES; |
90 _textLabel = [[UILabel alloc] init]; | 90 _textLabel = [[UILabel alloc] init]; |
91 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; | 91 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; |
92 _textLabel.font = | 92 _textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14]; |
93 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
94 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; | 93 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
95 _textLabel.numberOfLines = 0; | 94 _textLabel.numberOfLines = 0; |
96 [self.contentView addSubview:_textLabel]; | 95 [self.contentView addSubview:_textLabel]; |
97 _errorIcon = [[UIImageView alloc] init]; | 96 _errorIcon = [[UIImageView alloc] init]; |
98 _errorIcon.translatesAutoresizingMaskIntoConstraints = NO; | 97 _errorIcon.translatesAutoresizingMaskIntoConstraints = NO; |
99 [self.contentView addSubview:_errorIcon]; | 98 [self.contentView addSubview:_errorIcon]; |
100 [self setConstraints]; | 99 [self setConstraints]; |
101 } | 100 } |
102 return self; | 101 return self; |
103 } | 102 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 self.textLabel.textColor = [[MDCPalette greyPalette] tint900]; | 156 self.textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
158 [self setUserInteractionEnabled:YES]; | 157 [self setUserInteractionEnabled:YES]; |
159 UIImageView* accessoryImage = | 158 UIImageView* accessoryImage = |
160 base::mac::ObjCCastStrict<UIImageView>(self.accessoryView); | 159 base::mac::ObjCCastStrict<UIImageView>(self.accessoryView); |
161 accessoryImage.image = [accessoryImage.image | 160 accessoryImage.image = [accessoryImage.image |
162 imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; | 161 imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; |
163 [accessoryImage setTintColor:[[MDCPalette greyPalette] tint900]]; | 162 [accessoryImage setTintColor:[[MDCPalette greyPalette] tint900]]; |
164 } | 163 } |
165 | 164 |
166 @end | 165 @end |
OLD | NEW |