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

Side by Side Diff: ios/chrome/browser/ui/autofill/cells/cvc_item.mm

Issue 2912863005: Use MDCTypography instead of MDFRobotoFontLoader directly. (Closed)
Patch Set: Tentative fix for ManualTextFramerTest 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/autofill/cells/cvc_item.h" 5 #import "ios/chrome/browser/ui/autofill/cells/cvc_item.h"
6 6
7 #include "components/strings/grit/components_strings.h" 7 #include "components/strings/grit/components_strings.h"
8 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 8 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
9 #import "ios/chrome/browser/ui/uikit_ui_util.h" 9 #import "ios/chrome/browser/ui/uikit_ui_util.h"
10 #include "ios/chrome/grit/ios_strings.h" 10 #include "ios/chrome/grit/ios_strings.h"
11 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" 11 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
12 #import "ios/public/provider/chrome/browser/ui/text_field_styling.h" 12 #import "ios/public/provider/chrome/browser/ui/text_field_styling.h"
13 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 13 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
14 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" 14 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 #if !defined(__has_feature) || !__has_feature(objc_arc) 17 #if !defined(__has_feature) || !__has_feature(objc_arc)
18 #error "This file requires ARC support." 18 #error "This file requires ARC support."
19 #endif 19 #endif
20 20
21 namespace { 21 namespace {
22 // Padding used on the leading and trailing edges of the cell. 22 // Padding used on the leading and trailing edges of the cell.
23 const CGFloat kHorizontalPadding = 16; 23 const CGFloat kHorizontalPadding = 16;
24 // Padding used on the top and bottom edges of the cell. 24 // Padding used on the top and bottom edges of the cell.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 @synthesize CVCContainerLeadingConstraintWithoutDate = 110 @synthesize CVCContainerLeadingConstraintWithoutDate =
111 _CVCContainerLeadingConstraintWithoutDate; 111 _CVCContainerLeadingConstraintWithoutDate;
112 112
113 - (instancetype)initWithFrame:(CGRect)frame { 113 - (instancetype)initWithFrame:(CGRect)frame {
114 self = [super initWithFrame:frame]; 114 self = [super initWithFrame:frame];
115 if (self) { 115 if (self) {
116 UIView* contentView = self.contentView; 116 UIView* contentView = self.contentView;
117 117
118 _instructionsTextLabel = [[UILabel alloc] init]; 118 _instructionsTextLabel = [[UILabel alloc] init];
119 _instructionsTextLabel.font = 119 _instructionsTextLabel.font =
120 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; 120 [[MDCTypography fontLoader] mediumFontOfSize:14];
121 _instructionsTextLabel.textColor = [[MDCPalette greyPalette] tint500]; 121 _instructionsTextLabel.textColor = [[MDCPalette greyPalette] tint500];
122 _instructionsTextLabel.numberOfLines = 0; 122 _instructionsTextLabel.numberOfLines = 0;
123 _instructionsTextLabel.lineBreakMode = NSLineBreakByWordWrapping; 123 _instructionsTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
124 _instructionsTextLabel.translatesAutoresizingMaskIntoConstraints = NO; 124 _instructionsTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
125 [contentView addSubview:_instructionsTextLabel]; 125 [contentView addSubview:_instructionsTextLabel];
126 126
127 _errorLabel = [[UILabel alloc] init]; 127 _errorLabel = [[UILabel alloc] init];
128 _errorLabel.font = 128 _errorLabel.font = [[MDCTypography fontLoader] regularFontOfSize:12];
129 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12];
130 _errorLabel.textColor = [[MDCPalette cr_redPalette] tint500]; 129 _errorLabel.textColor = [[MDCPalette cr_redPalette] tint500];
131 _errorLabel.numberOfLines = 0; 130 _errorLabel.numberOfLines = 0;
132 _errorLabel.lineBreakMode = NSLineBreakByWordWrapping; 131 _errorLabel.lineBreakMode = NSLineBreakByWordWrapping;
133 _errorLabel.translatesAutoresizingMaskIntoConstraints = NO; 132 _errorLabel.translatesAutoresizingMaskIntoConstraints = NO;
134 [contentView addSubview:_errorLabel]; 133 [contentView addSubview:_errorLabel];
135 134
136 _dateContainerView = [[UIView alloc] init]; 135 _dateContainerView = [[UIView alloc] init];
137 _dateContainerView.translatesAutoresizingMaskIntoConstraints = NO; 136 _dateContainerView.translatesAutoresizingMaskIntoConstraints = NO;
138 [contentView addSubview:_dateContainerView]; 137 [contentView addSubview:_dateContainerView];
139 138
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 _CVCInput.delegate = self; 172 _CVCInput.delegate = self;
174 _CVCInput.translatesAutoresizingMaskIntoConstraints = NO; 173 _CVCInput.translatesAutoresizingMaskIntoConstraints = NO;
175 [_CVCContainerView addSubview:_CVCInput]; 174 [_CVCContainerView addSubview:_CVCInput];
176 175
177 _CVCImageView = [[UIImageView alloc] init]; 176 _CVCImageView = [[UIImageView alloc] init];
178 _CVCImageView.translatesAutoresizingMaskIntoConstraints = NO; 177 _CVCImageView.translatesAutoresizingMaskIntoConstraints = NO;
179 [_CVCContainerView addSubview:_CVCImageView]; 178 [_CVCContainerView addSubview:_CVCImageView];
180 179
181 _buttonForNewCard = [UIButton buttonWithType:UIButtonTypeCustom]; 180 _buttonForNewCard = [UIButton buttonWithType:UIButtonTypeCustom];
182 _buttonForNewCard.titleLabel.font = 181 _buttonForNewCard.titleLabel.font =
183 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12]; 182 [[MDCTypography fontLoader] regularFontOfSize:12];
184 [_buttonForNewCard 183 [_buttonForNewCard
185 setTitle:l10n_util::GetNSString(IDS_AUTOFILL_CARD_UNMASK_NEW_CARD_LINK) 184 setTitle:l10n_util::GetNSString(IDS_AUTOFILL_CARD_UNMASK_NEW_CARD_LINK)
186 forState:UIControlStateNormal]; 185 forState:UIControlStateNormal];
187 [_buttonForNewCard setTitleColor:[[MDCPalette cr_bluePalette] tint500] 186 [_buttonForNewCard setTitleColor:[[MDCPalette cr_bluePalette] tint500]
188 forState:UIControlStateNormal]; 187 forState:UIControlStateNormal];
189 _buttonForNewCard.translatesAutoresizingMaskIntoConstraints = NO; 188 _buttonForNewCard.translatesAutoresizingMaskIntoConstraints = NO;
190 [contentView addSubview:_buttonForNewCard]; 189 [contentView addSubview:_buttonForNewCard];
191 190
192 [NSLayoutConstraint activateConstraints:@[ 191 [NSLayoutConstraint activateConstraints:@[
193 // Text label 192 // Text label
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 replacementString:(NSString*)string { 351 replacementString:(NSString*)string {
353 if (textField == self.CVCInput || textField == self.yearInput) { 352 if (textField == self.CVCInput || textField == self.yearInput) {
354 return ([textField.text length] + [string length] - range.length) <= 4; 353 return ([textField.text length] + [string length] - range.length) <= 4;
355 } else if (textField == self.monthInput) { 354 } else if (textField == self.monthInput) {
356 return ([textField.text length] + [string length] - range.length) <= 2; 355 return ([textField.text length] + [string length] - range.length) <= 2;
357 } 356 }
358 return YES; 357 return YES;
359 } 358 }
360 359
361 @end 360 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/autofill/cells/autofill_edit_item.mm ('k') | ios/chrome/browser/ui/autofill/cells/status_item.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698