| 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/autofill_data_item.h" | 5 #import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h" |
| 6 | 6 |
| 7 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 7 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 8 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 8 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." | 11 #error "This file requires ARC support." |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 // Padding used on the leading and trailing edges of the cell. | 15 // Padding used on the leading and trailing edges of the cell. |
| 16 const CGFloat kHorizontalPadding = 16; | 16 const CGFloat kHorizontalPadding = 16; |
| 17 // Padding used on the top and bottom edges of the cell. | 17 // Padding used on the top and bottom edges of the cell. |
| 18 const CGFloat kVerticalPadding = 16; | 18 const CGFloat kVerticalPadding = 16; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 _leadingDetailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; | 78 _leadingDetailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; |
| 79 [contentView addSubview:_leadingDetailTextLabel]; | 79 [contentView addSubview:_leadingDetailTextLabel]; |
| 80 | 80 |
| 81 _trailingDetailTextLabel = [[UILabel alloc] init]; | 81 _trailingDetailTextLabel = [[UILabel alloc] init]; |
| 82 _trailingDetailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; | 82 _trailingDetailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; |
| 83 [contentView addSubview:_trailingDetailTextLabel]; | 83 [contentView addSubview:_trailingDetailTextLabel]; |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Sets default font and text colors for labels. | 86 // Sets default font and text colors for labels. |
| 87 - (void)setDefaultViewStyling { | 87 - (void)setDefaultViewStyling { |
| 88 _textLabel.font = [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | 88 _textLabel.font = [MDCTypography body2Font]; |
| 89 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; | 89 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
| 90 _textLabel.numberOfLines = 0; | 90 _textLabel.numberOfLines = 0; |
| 91 _textLabel.lineBreakMode = NSLineBreakByWordWrapping; | 91 _textLabel.lineBreakMode = NSLineBreakByWordWrapping; |
| 92 | 92 |
| 93 _leadingDetailTextLabel.font = | 93 _leadingDetailTextLabel.font = [MDCTypography body1Font]; |
| 94 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14]; | |
| 95 _leadingDetailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; | 94 _leadingDetailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; |
| 96 _leadingDetailTextLabel.numberOfLines = 0; | 95 _leadingDetailTextLabel.numberOfLines = 0; |
| 97 _leadingDetailTextLabel.lineBreakMode = NSLineBreakByWordWrapping; | 96 _leadingDetailTextLabel.lineBreakMode = NSLineBreakByWordWrapping; |
| 98 | 97 |
| 99 _trailingDetailTextLabel.font = | 98 _trailingDetailTextLabel.font = [MDCTypography captionFont]; |
| 100 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12]; | |
| 101 _trailingDetailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; | 99 _trailingDetailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; |
| 102 } | 100 } |
| 103 | 101 |
| 104 // Sets constraints on subviews. | 102 // Sets constraints on subviews. |
| 105 - (void)setViewConstraints { | 103 - (void)setViewConstraints { |
| 106 UIView* contentView = self.contentView; | 104 UIView* contentView = self.contentView; |
| 107 | 105 |
| 108 // Set up the width constraint for the text label. It is activated here | 106 // Set up the width constraint for the text label. It is activated here |
| 109 // and updated in layoutSubviews. | 107 // and updated in layoutSubviews. |
| 110 _textLabelWidthConstraint = | 108 _textLabelWidthConstraint = |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (self.trailingDetailTextLabel.text) { | 171 if (self.trailingDetailTextLabel.text) { |
| 174 return [NSString stringWithFormat:@"%@, %@, %@", self.textLabel.text, | 172 return [NSString stringWithFormat:@"%@, %@, %@", self.textLabel.text, |
| 175 self.leadingDetailTextLabel.text, | 173 self.leadingDetailTextLabel.text, |
| 176 self.trailingDetailTextLabel.text]; | 174 self.trailingDetailTextLabel.text]; |
| 177 } | 175 } |
| 178 return [NSString stringWithFormat:@"%@, %@", self.textLabel.text, | 176 return [NSString stringWithFormat:@"%@, %@", self.textLabel.text, |
| 179 self.leadingDetailTextLabel.text]; | 177 self.leadingDetailTextLabel.text]; |
| 180 } | 178 } |
| 181 | 179 |
| 182 @end | 180 @end |
| OLD | NEW |