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

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

Issue 2627323003: Expose font and color of the main and secondary texts in CollectionViewTextItem (Closed)
Patch Set: Created 3 years, 11 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/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
index 3a92984c5b9c3d7b5745b8d8644caeca35972f66..b0da0cf8633918d72ec0489ad687c82830b9f2b7 100644
--- 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
@@ -17,15 +17,48 @@
@synthesize text = _text;
@synthesize detailText = _detailText;
@synthesize image = _image;
+@synthesize textFont = _textFont;
+@synthesize textColor = _textColor;
+@synthesize detailTextFont = _detailTextFont;
+@synthesize detailTextColor = _detailTextColor;
- (instancetype)initWithType:(NSInteger)type {
self = [super initWithType:type];
if (self) {
self.cellClass = [MDCCollectionViewTextCell class];
+ _textFont = [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14];
+ _textColor = [[MDCPalette greyPalette] tint900];
+ _detailTextFont =
+ [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14];
+ _detailTextColor = [[MDCPalette greyPalette] tint500];
}
return self;
}
+- (void)setTextFont:(UIFont*)textFont {
lpromero 2017/01/13 10:13:26 Could you do something like this: - (UIFont*)text
Moe 2017/01/13 15:28:19 Done.
+ if (textFont) {
+ _textFont = textFont;
+ }
+}
+
+- (void)setTextColor:(UIColor*)textColor {
+ if (textColor) {
+ _textColor = textColor;
+ }
+}
+
+- (void)setDetailTextFont:(UIFont*)detailTextFont {
+ if (detailTextFont) {
+ _detailTextFont = detailTextFont;
+ }
+}
+
+- (void)setDetailTextColor:(UIColor*)detailTextColor {
+ if (detailTextColor) {
+ _detailTextColor = detailTextColor;
+ }
+}
+
#pragma mark CollectionViewItem
- (void)configureCell:(MDCCollectionViewTextCell*)cell {
@@ -43,13 +76,10 @@
}
// 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];
+ cell.textLabel.font = self.textFont;
+ cell.textLabel.textColor = self.textColor;
+ cell.detailTextLabel.font = self.detailTextFont;
+ cell.detailTextLabel.textColor = self.detailTextColor;
}
@end

Powered by Google App Engine
This is Rietveld 408576698