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/collection_view/cells/collection_view_account_ite
m.h" | 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_account_ite
m.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 8 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.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.h" | 11 #include "ui/base/l10n/l10n_util.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 _detailTextLabel = [[UILabel alloc] init]; | 133 _detailTextLabel = [[UILabel alloc] init]; |
134 _detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; | 134 _detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; |
135 [contentView addSubview:_detailTextLabel]; | 135 [contentView addSubview:_detailTextLabel]; |
136 } | 136 } |
137 | 137 |
138 // Set default imageView styling and default font and text colors for labels. | 138 // Set default imageView styling and default font and text colors for labels. |
139 - (void)setDefaultViewStyling { | 139 - (void)setDefaultViewStyling { |
140 _imageView.contentMode = UIViewContentModeCenter; | 140 _imageView.contentMode = UIViewContentModeCenter; |
141 _imageView.layer.masksToBounds = YES; | 141 _imageView.layer.masksToBounds = YES; |
142 | 142 |
143 _textLabel.font = [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | 143 _textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14]; |
144 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; | 144 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
145 _detailTextLabel.font = | 145 _detailTextLabel.font = [[MDCTypography fontLoader] regularFontOfSize:14]; |
146 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14]; | |
147 _detailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; | 146 _detailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; |
148 _imageView.contentMode = UIViewContentModeScaleAspectFit; | 147 _imageView.contentMode = UIViewContentModeScaleAspectFit; |
149 } | 148 } |
150 | 149 |
151 // Set constraints on subviews. | 150 // Set constraints on subviews. |
152 - (void)setViewConstraints { | 151 - (void)setViewConstraints { |
153 UIView* contentView = self.contentView; | 152 UIView* contentView = self.contentView; |
154 | 153 |
155 // This view is used to center the two leading textLabels. | 154 // This view is used to center the two leading textLabels. |
156 UIView* verticalCenteringView = [[UIView alloc] init]; | 155 UIView* verticalCenteringView = [[UIView alloc] init]; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 257 |
259 - (NSString*)accessibilityLabel { | 258 - (NSString*)accessibilityLabel { |
260 return self.textLabel.text; | 259 return self.textLabel.text; |
261 } | 260 } |
262 | 261 |
263 - (NSString*)accessibilityValue { | 262 - (NSString*)accessibilityValue { |
264 return self.detailTextLabel.text; | 263 return self.detailTextLabel.text; |
265 } | 264 } |
266 | 265 |
267 @end | 266 @end |
OLD | NEW |