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

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

Issue 2814793003: Adds accessoryType property to CollectionViewItem (Closed)
Patch Set: Created 3 years, 8 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_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_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.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;
18 @synthesize text = _text; 17 @synthesize text = _text;
19 @synthesize detailText = _detailText; 18 @synthesize detailText = _detailText;
20 @synthesize textFont = _textFont; 19 @synthesize textFont = _textFont;
21 @synthesize textColor = _textColor; 20 @synthesize textColor = _textColor;
22 @synthesize numberOfTextLines = _numberOfTextLines; 21 @synthesize numberOfTextLines = _numberOfTextLines;
23 @synthesize detailTextFont = _detailTextFont; 22 @synthesize detailTextFont = _detailTextFont;
24 @synthesize detailTextColor = _detailTextColor; 23 @synthesize detailTextColor = _detailTextColor;
25 @synthesize numberOfDetailTextLines = _numberOfDetailTextLines; 24 @synthesize numberOfDetailTextLines = _numberOfDetailTextLines;
26 25
27 - (instancetype)initWithType:(NSInteger)type { 26 - (instancetype)initWithType:(NSInteger)type {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
65 64
66 #pragma mark CollectionViewItem 65 #pragma mark CollectionViewItem
67 66
68 - (void)configureCell:(CollectionViewTextCell*)cell { 67 - (void)configureCell:(CollectionViewTextCell*)cell {
69 [super configureCell:cell]; 68 [super configureCell:cell];
70 cell.accessoryType = self.accessoryType;
71 cell.textLabel.text = self.text; 69 cell.textLabel.text = self.text;
72 cell.detailTextLabel.text = self.detailText; 70 cell.detailTextLabel.text = self.detailText;
73 cell.isAccessibilityElement = YES; 71 cell.isAccessibilityElement = YES;
74 if (self.detailText.length == 0) { 72 if (self.detailText.length == 0) {
75 cell.accessibilityLabel = self.text; 73 cell.accessibilityLabel = self.text;
76 } else { 74 } else {
77 cell.accessibilityLabel = 75 cell.accessibilityLabel =
78 [NSString stringWithFormat:@"%@, %@", self.text, self.detailText]; 76 [NSString stringWithFormat:@"%@, %@", self.text, self.detailText];
79 } 77 }
80 78
81 // Styling. 79 // Styling.
82 cell.textLabel.font = self.textFont; 80 cell.textLabel.font = self.textFont;
83 cell.textLabel.textColor = self.textColor; 81 cell.textLabel.textColor = self.textColor;
84 cell.textLabel.numberOfLines = self.numberOfTextLines; 82 cell.textLabel.numberOfLines = self.numberOfTextLines;
85 cell.detailTextLabel.font = self.detailTextFont; 83 cell.detailTextLabel.font = self.detailTextFont;
86 cell.detailTextLabel.textColor = self.detailTextColor; 84 cell.detailTextLabel.textColor = self.detailTextColor;
87 cell.detailTextLabel.numberOfLines = self.numberOfDetailTextLines; 85 cell.detailTextLabel.numberOfLines = self.numberOfDetailTextLines;
88 } 86 }
89 87
90 @end 88 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698