OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tex
t_item.h" |
| 6 |
| 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" |
| 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 15 @implementation ContentSuggestionsTextItem |
| 16 |
| 17 @synthesize text = _text; |
| 18 @synthesize detailText = _detailText; |
| 19 @synthesize suggestionIdentifier = _suggestionIdentifier; |
| 20 |
| 21 - (instancetype)initWithType:(NSInteger)type { |
| 22 self = [super initWithType:type]; |
| 23 if (self) { |
| 24 self.cellClass = [CollectionViewTextCell class]; |
| 25 } |
| 26 return self; |
| 27 } |
| 28 |
| 29 - (void)configureCell:(CollectionViewTextCell*)cell { |
| 30 [super configureCell:cell]; |
| 31 |
| 32 cell.textLabel.text = self.text; |
| 33 cell.textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
| 34 cell.textLabel.font = [MDCTypography body2Font]; |
| 35 cell.textLabel.numberOfLines = 0; |
| 36 cell.detailTextLabel.text = self.detailText; |
| 37 cell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500]; |
| 38 cell.detailTextLabel.font = [MDCTypography body1Font]; |
| 39 cell.detailTextLabel.numberOfLines = 0; |
| 40 |
| 41 cell.isAccessibilityElement = YES; |
| 42 if (self.detailText.length == 0) { |
| 43 cell.accessibilityLabel = self.text; |
| 44 } else { |
| 45 cell.accessibilityLabel = |
| 46 [NSString stringWithFormat:@"%@, %@", self.text, self.detailText]; |
| 47 } |
| 48 } |
| 49 |
| 50 @end |
OLD | NEW |