| 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/password_details_item.h" | 5 #import "ios/chrome/browser/ui/settings/cells/password_details_item.h" |
| 6 | 6 |
| 7 #import <CoreGraphics/CoreGraphics.h> | 7 #import <CoreGraphics/CoreGraphics.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "ios/chrome/grit/ios_strings.h" | 10 #include "ios/chrome/grit/ios_strings.h" |
| 11 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 11 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 12 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 13 #include "ui/base/l10n/l10n_util_mac.h" | 13 #include "ui/base/l10n/l10n_util_mac.h" |
| 14 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) | 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." | 16 #error "This file requires ARC support." |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 // Padding used on the leading and trailing edges of the cell. | 20 // Padding used on the leading and trailing edges of the cell. |
| 21 const CGFloat kHorizontalPadding = 16; | 21 const CGFloat kHorizontalPadding = 16; |
| 22 | 22 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 - (instancetype)initWithFrame:(CGRect)frame { | 61 - (instancetype)initWithFrame:(CGRect)frame { |
| 62 self = [super initWithFrame:frame]; | 62 self = [super initWithFrame:frame]; |
| 63 if (self) { | 63 if (self) { |
| 64 UIView* contentView = self.contentView; | 64 UIView* contentView = self.contentView; |
| 65 | 65 |
| 66 _textLabel = [[UILabel alloc] init]; | 66 _textLabel = [[UILabel alloc] init]; |
| 67 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; | 67 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; |
| 68 [contentView addSubview:_textLabel]; | 68 [contentView addSubview:_textLabel]; |
| 69 | 69 |
| 70 _textLabel.font = | 70 _textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14]; |
| 71 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
| 72 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; | 71 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
| 73 _textLabel.numberOfLines = 0; | 72 _textLabel.numberOfLines = 0; |
| 74 | 73 |
| 75 // Set up the constraints. | 74 // Set up the constraints. |
| 76 [NSLayoutConstraint activateConstraints:@[ | 75 [NSLayoutConstraint activateConstraints:@[ |
| 77 [_textLabel.leadingAnchor | 76 [_textLabel.leadingAnchor |
| 78 constraintEqualToAnchor:contentView.leadingAnchor | 77 constraintEqualToAnchor:contentView.leadingAnchor |
| 79 constant:kHorizontalPadding], | 78 constant:kHorizontalPadding], |
| 80 [_textLabel.trailingAnchor | 79 [_textLabel.trailingAnchor |
| 81 constraintEqualToAnchor:contentView.trailingAnchor | 80 constraintEqualToAnchor:contentView.trailingAnchor |
| (...skipping 22 matching lines...) Expand all Loading... |
| 104 // changes, for instance on screen rotation. | 103 // changes, for instance on screen rotation. |
| 105 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); | 104 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); |
| 106 self.textLabel.preferredMaxLayoutWidth = parentWidth - 2 * kHorizontalPadding; | 105 self.textLabel.preferredMaxLayoutWidth = parentWidth - 2 * kHorizontalPadding; |
| 107 | 106 |
| 108 // Re-layout with the new preferred width to allow the label to adjust its | 107 // Re-layout with the new preferred width to allow the label to adjust its |
| 109 // height. | 108 // height. |
| 110 [super layoutSubviews]; | 109 [super layoutSubviews]; |
| 111 } | 110 } |
| 112 | 111 |
| 113 @end | 112 @end |
| OLD | NEW |