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

Side by Side Diff: ios/chrome/browser/ui/collection_view/cells/collection_view_switch_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/collection_view/cells/collection_view_switch_item .h" 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h"
6 6
7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
8 #include "ios/chrome/grit/ios_strings.h" 8 #include "ios/chrome/grit/ios_strings.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_mac.h" 11 #include "ui/base/l10n/l10n_util_mac.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 self.isAccessibilityElement = YES; 64 self.isAccessibilityElement = YES;
65 65
66 _textLabel = [[UILabel alloc] init]; 66 _textLabel = [[UILabel alloc] init];
67 _textLabel.translatesAutoresizingMaskIntoConstraints = NO; 67 _textLabel.translatesAutoresizingMaskIntoConstraints = NO;
68 [self.contentView addSubview:_textLabel]; 68 [self.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 _switchView = [[UISwitch alloc] initWithFrame:CGRectZero]; 74 _switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
76 _switchView.translatesAutoresizingMaskIntoConstraints = NO; 75 _switchView.translatesAutoresizingMaskIntoConstraints = NO;
77 _switchView.onTintColor = [[MDCPalette cr_bluePalette] tint500]; 76 _switchView.onTintColor = [[MDCPalette cr_bluePalette] tint500];
78 _switchView.accessibilityHint = l10n_util::GetNSString( 77 _switchView.accessibilityHint = l10n_util::GetNSString(
79 IDS_IOS_TOGGLE_SETTING_SWITCH_ACCESSIBILITY_HINT); 78 IDS_IOS_TOGGLE_SETTING_SWITCH_ACCESSIBILITY_HINT);
80 [self.contentView addSubview:_switchView]; 79 [self.contentView addSubview:_switchView];
81 80
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 153
155 - (NSString*)accessibilityValue { 154 - (NSString*)accessibilityValue {
156 if (_switchView.on) { 155 if (_switchView.on) {
157 return l10n_util::GetNSString(IDS_IOS_SETTING_ON); 156 return l10n_util::GetNSString(IDS_IOS_SETTING_ON);
158 } else { 157 } else {
159 return l10n_util::GetNSString(IDS_IOS_SETTING_OFF); 158 return l10n_util::GetNSString(IDS_IOS_SETTING_OFF);
160 } 159 }
161 } 160 }
162 161
163 @end 162 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698