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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.mm
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.mm
new file mode 100644
index 0000000000000000000000000000000000000000..3a92984c5b9c3d7b5745b8d8644caeca35972f66
--- /dev/null
+++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.mm
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
+
+#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
+#import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoFontLoader.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@implementation CollectionViewTextItem
+
+@synthesize accessoryType = _accessoryType;
+@synthesize text = _text;
+@synthesize detailText = _detailText;
+@synthesize image = _image;
+
+- (instancetype)initWithType:(NSInteger)type {
+ self = [super initWithType:type];
+ if (self) {
+ self.cellClass = [MDCCollectionViewTextCell class];
+ }
+ return self;
+}
+
+#pragma mark CollectionViewItem
+
+- (void)configureCell:(MDCCollectionViewTextCell*)cell {
+ [super configureCell:cell];
+ cell.accessoryType = self.accessoryType;
+ cell.textLabel.text = self.text;
+ cell.detailTextLabel.text = self.detailText;
+ cell.imageView.image = self.image;
+ cell.isAccessibilityElement = YES;
+ if (self.detailText.length == 0) {
+ cell.accessibilityLabel = self.text;
+ } else {
+ cell.accessibilityLabel =
+ [NSString stringWithFormat:@"%@, %@", self.text, self.detailText];
+ }
+
+ // Styling.
+ cell.textLabel.font =
+ [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14];
+ cell.textLabel.textColor = [[MDCPalette greyPalette] tint900];
+
+ cell.detailTextLabel.font =
+ [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14];
+ cell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698