Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.mm

Issue 2912863005: Use MDCTypography instead of MDFRobotoFontLoader directly. (Closed)
Patch Set: Update target value in unit test Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_detail_item .h" 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item .h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
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 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 13 #error "This file requires ARC support."
14 #endif 14 #endif
15 15
16 namespace { 16 namespace {
17 17
18 // Padding used on the leading and trailing edges of the cell and between the 18 // Padding used on the leading and trailing edges of the cell and between the
19 // two labels. 19 // two labels.
20 const CGFloat kHorizontalPadding = 16; 20 const CGFloat kHorizontalPadding = 16;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 self = [super initWithFrame:frame]; 62 self = [super initWithFrame:frame];
63 if (self) { 63 if (self) {
64 self.isAccessibilityElement = YES; 64 self.isAccessibilityElement = YES;
65 UIView* contentView = self.contentView; 65 UIView* contentView = self.contentView;
66 66
67 _textLabel = [[UILabel alloc] init]; 67 _textLabel = [[UILabel alloc] init];
68 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; 68 _textLabel.translatesAutoresizingMaskIntoConstraints = NO;
69 _textLabel.backgroundColor = [UIColor clearColor]; 69 _textLabel.backgroundColor = [UIColor clearColor];
70 [contentView addSubview:_textLabel]; 70 [contentView addSubview:_textLabel];
71 71
72 _textLabel.font = 72 _textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14];
73 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14];
74 _textLabel.textColor = [[MDCPalette greyPalette] tint900]; 73 _textLabel.textColor = [[MDCPalette greyPalette] tint900];
75 74
76 _detailTextLabel = [[UILabel alloc] init]; 75 _detailTextLabel = [[UILabel alloc] init];
77 _detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO; 76 _detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
78 _detailTextLabel.backgroundColor = [UIColor clearColor]; 77 _detailTextLabel.backgroundColor = [UIColor clearColor];
79 [contentView addSubview:_detailTextLabel]; 78 [contentView addSubview:_detailTextLabel];
80 79
81 _detailTextLabel.font = 80 _detailTextLabel.font = [[MDCTypography fontLoader] regularFontOfSize:14];
82 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14];
83 _detailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; 81 _detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
84 82
85 // Set up the width constraints. They are activated here and updated in 83 // Set up the width constraints. They are activated here and updated in
86 // layoutSubviews. 84 // layoutSubviews.
87 _textLabelWidthConstraint = 85 _textLabelWidthConstraint =
88 [_textLabel.widthAnchor constraintEqualToConstant:0]; 86 [_textLabel.widthAnchor constraintEqualToConstant:0];
89 _detailTextLabelWidthConstraint = 87 _detailTextLabelWidthConstraint =
90 [_detailTextLabel.widthAnchor constraintEqualToConstant:0]; 88 [_detailTextLabel.widthAnchor constraintEqualToConstant:0];
91 89
92 [NSLayoutConstraint activateConstraints:@[ 90 [NSLayoutConstraint activateConstraints:@[
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 158
161 - (NSString*)accessibilityLabel { 159 - (NSString*)accessibilityLabel {
162 return self.textLabel.text; 160 return self.textLabel.text;
163 } 161 }
164 162
165 - (NSString*)accessibilityValue { 163 - (NSString*)accessibilityValue {
166 return self.detailTextLabel.text; 164 return self.detailTextLabel.text;
167 } 165 }
168 166
169 @end 167 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698