| 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_text_item.h
" | 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h
" | 7 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h
" |
| 8 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 8 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 9 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) | 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." | 12 #error "This file requires ARC support." |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 @implementation CollectionViewTextItem | 15 @implementation CollectionViewTextItem |
| 16 | 16 |
| 17 @synthesize accessoryType = _accessoryType; | 17 @synthesize accessoryType = _accessoryType; |
| 18 @synthesize text = _text; | 18 @synthesize text = _text; |
| 19 @synthesize detailText = _detailText; | 19 @synthesize detailText = _detailText; |
| 20 @synthesize textFont = _textFont; | 20 @synthesize textFont = _textFont; |
| 21 @synthesize textColor = _textColor; | 21 @synthesize textColor = _textColor; |
| 22 @synthesize numberOfTextLines = _numberOfTextLines; | 22 @synthesize numberOfTextLines = _numberOfTextLines; |
| 23 @synthesize detailTextFont = _detailTextFont; | 23 @synthesize detailTextFont = _detailTextFont; |
| 24 @synthesize detailTextColor = _detailTextColor; | 24 @synthesize detailTextColor = _detailTextColor; |
| 25 @synthesize numberOfDetailTextLines = _numberOfDetailTextLines; | 25 @synthesize numberOfDetailTextLines = _numberOfDetailTextLines; |
| 26 | 26 |
| 27 - (instancetype)initWithType:(NSInteger)type { | 27 - (instancetype)initWithType:(NSInteger)type { |
| 28 self = [super initWithType:type]; | 28 self = [super initWithType:type]; |
| 29 if (self) { | 29 if (self) { |
| 30 self.cellClass = [CollectionViewTextCell class]; | 30 self.cellClass = [CollectionViewTextCell class]; |
| 31 _numberOfTextLines = 1; | 31 _numberOfTextLines = 1; |
| 32 _numberOfDetailTextLines = 1; | 32 _numberOfDetailTextLines = 1; |
| 33 } | 33 } |
| 34 return self; | 34 return self; |
| 35 } | 35 } |
| 36 | 36 |
| 37 - (UIFont*)textFont { | 37 - (UIFont*)textFont { |
| 38 if (!_textFont) { | 38 if (!_textFont) { |
| 39 _textFont = [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | 39 _textFont = [MDCTypography body2Font]; |
| 40 } | 40 } |
| 41 return _textFont; | 41 return _textFont; |
| 42 } | 42 } |
| 43 | 43 |
| 44 - (UIColor*)textColor { | 44 - (UIColor*)textColor { |
| 45 if (!_textColor) { | 45 if (!_textColor) { |
| 46 _textColor = [[MDCPalette greyPalette] tint900]; | 46 _textColor = [[MDCPalette greyPalette] tint900]; |
| 47 } | 47 } |
| 48 return _textColor; | 48 return _textColor; |
| 49 } | 49 } |
| 50 | 50 |
| 51 - (UIFont*)detailTextFont { | 51 - (UIFont*)detailTextFont { |
| 52 if (!_detailTextFont) { | 52 if (!_detailTextFont) { |
| 53 _detailTextFont = | 53 _detailTextFont = [MDCTypography body1Font]; |
| 54 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14]; | |
| 55 } | 54 } |
| 56 return _detailTextFont; | 55 return _detailTextFont; |
| 57 } | 56 } |
| 58 | 57 |
| 59 - (UIColor*)detailTextColor { | 58 - (UIColor*)detailTextColor { |
| 60 if (!_detailTextColor) { | 59 if (!_detailTextColor) { |
| 61 _detailTextColor = [[MDCPalette greyPalette] tint500]; | 60 _detailTextColor = [[MDCPalette greyPalette] tint500]; |
| 62 } | 61 } |
| 63 return _detailTextColor; | 62 return _detailTextColor; |
| 64 } | 63 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 85 // Styling. | 84 // Styling. |
| 86 cell.textLabel.font = self.textFont; | 85 cell.textLabel.font = self.textFont; |
| 87 cell.textLabel.textColor = self.textColor; | 86 cell.textLabel.textColor = self.textColor; |
| 88 cell.textLabel.numberOfLines = self.numberOfTextLines; | 87 cell.textLabel.numberOfLines = self.numberOfTextLines; |
| 89 cell.detailTextLabel.font = self.detailTextFont; | 88 cell.detailTextLabel.font = self.detailTextFont; |
| 90 cell.detailTextLabel.textColor = self.detailTextColor; | 89 cell.detailTextLabel.textColor = self.detailTextColor; |
| 91 cell.detailTextLabel.numberOfLines = self.numberOfDetailTextLines; | 90 cell.detailTextLabel.numberOfLines = self.numberOfDetailTextLines; |
| 92 } | 91 } |
| 93 | 92 |
| 94 @end | 93 @end |
| OLD | NEW |