Index: ios/chrome/browser/payments/cells/payments_text_item.mm |
diff --git a/ios/chrome/browser/payments/cells/payments_text_item.mm b/ios/chrome/browser/payments/cells/payments_text_item.mm |
index 274f93e6ed5942a5b3aecb23a689a299428c7926..ad422e6c45492212aed598a2538c27b3c2738c26 100644 |
--- a/ios/chrome/browser/payments/cells/payments_text_item.mm |
+++ b/ios/chrome/browser/payments/cells/payments_text_item.mm |
@@ -26,6 +26,8 @@ const CGFloat kHorizontalSpacingBetweenImageAndLabel = 8; |
@synthesize text = _text; |
@synthesize image = _image; |
+@synthesize textFont = _textFont; |
+@synthesize textColor = _textColor; |
#pragma mark CollectionViewItem |
@@ -37,10 +39,30 @@ const CGFloat kHorizontalSpacingBetweenImageAndLabel = 8; |
return self; |
} |
+- (UIFont*)textFont { |
+ if (!_textFont) { |
+ _textFont = [MDCTypography body1Font]; |
+ } |
+ return _textFont; |
+} |
+ |
+- (UIColor*)textColor { |
+ if (!_textColor) { |
+ _textColor = [[MDCPalette greyPalette] tint900]; |
+ } |
+ return _textColor; |
+} |
+ |
- (void)configureCell:(PaymentsTextCell*)cell { |
[super configureCell:cell]; |
cell.textLabel.text = self.text; |
cell.imageView.image = self.image; |
+ |
+ // Styling. |
+ cell.textLabel.font = self.textFont; |
+ cell.textLabel.textColor = self.textColor; |
+ cell.textLabel.numberOfLines = 0; |
gambard
2017/04/11 15:23:25
For me the item sets only the properties that migh
lpromero
2017/04/11 15:59:06
+1
Moe
2017/04/14 06:05:49
Done.
|
+ cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping; |
} |
@end |
@@ -61,7 +83,6 @@ const CGFloat kHorizontalSpacingBetweenImageAndLabel = 8; |
if (self) { |
self.isAccessibilityElement = YES; |
[self addSubviews]; |
- [self setDefaultViewStyling]; |
[self setViewConstraints]; |
} |
return self; |
@@ -81,14 +102,6 @@ const CGFloat kHorizontalSpacingBetweenImageAndLabel = 8; |
[contentView addSubview:_imageView]; |
} |
-// Set default font and text colors for labels. |
-- (void)setDefaultViewStyling { |
- _textLabel.font = [MDCTypography body1Font]; |
- _textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
- _textLabel.numberOfLines = 0; |
- _textLabel.lineBreakMode = NSLineBreakByWordWrapping; |
-} |
- |
// Set constraints on subviews. |
- (void)setViewConstraints { |
UIView* contentView = self.contentView; |