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

Unified Diff: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.mm

Issue 2775593002: Add a message to empty ContentSuggestions sections (Closed)
Patch Set: Change tests Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.mm
new file mode 100644
index 0000000000000000000000000000000000000000..5cdf8c22c56cfbbf565f0eaa774b9e813856c77d
--- /dev/null
+++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.mm
@@ -0,0 +1,50 @@
+// Copyright 2017 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/content_suggestions/cells/content_suggestions_text_item.h"
+
+#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h"
+#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
+#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@implementation ContentSuggestionsTextItem
+
+@synthesize text = _text;
+@synthesize detailText = _detailText;
+@synthesize suggestionIdentifier = _suggestionIdentifier;
+
+- (instancetype)initWithType:(NSInteger)type {
+ self = [super initWithType:type];
+ if (self) {
+ self.cellClass = [CollectionViewTextCell class];
+ }
+ return self;
+}
+
+- (void)configureCell:(CollectionViewTextCell*)cell {
+ [super configureCell:cell];
+
+ cell.textLabel.text = self.text;
+ cell.textLabel.textColor = [[MDCPalette greyPalette] tint900];
+ cell.textLabel.font = [MDCTypography body2Font];
+ cell.textLabel.numberOfLines = 0;
+ cell.detailTextLabel.text = self.detailText;
+ cell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
+ cell.detailTextLabel.font = [MDCTypography body1Font];
+ cell.detailTextLabel.numberOfLines = 0;
+
+ cell.isAccessibilityElement = YES;
+ if (self.detailText.length == 0) {
+ cell.accessibilityLabel = self.text;
+ } else {
+ cell.accessibilityLabel =
+ [NSString stringWithFormat:@"%@, %@", self.text, self.detailText];
+ }
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698