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

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

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h "
6
7 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
8 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h"
9
10 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support."
12 #endif
13
14 @implementation CollectionViewTextItem
15
16 @synthesize accessoryType = _accessoryType;
17 @synthesize text = _text;
18 @synthesize detailText = _detailText;
19 @synthesize image = _image;
20
21 - (instancetype)initWithType:(NSInteger)type {
22 self = [super initWithType:type];
23 if (self) {
24 self.cellClass = [MDCCollectionViewTextCell class];
25 }
26 return self;
27 }
28
29 #pragma mark CollectionViewItem
30
31 - (void)configureCell:(MDCCollectionViewTextCell*)cell {
32 [super configureCell:cell];
33 cell.accessoryType = self.accessoryType;
34 cell.textLabel.text = self.text;
35 cell.detailTextLabel.text = self.detailText;
36 cell.imageView.image = self.image;
37 cell.isAccessibilityElement = YES;
38 if (self.detailText.length == 0) {
39 cell.accessibilityLabel = self.text;
40 } else {
41 cell.accessibilityLabel =
42 [NSString stringWithFormat:@"%@, %@", self.text, self.detailText];
43 }
44
45 // Styling.
46 cell.textLabel.font =
47 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14];
48 cell.textLabel.textColor = [[MDCPalette greyPalette] tint900];
49
50 cell.detailTextLabel.font =
51 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14];
52 cell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
53 }
54
55 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698