| Index: ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.mm
|
| diff --git a/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.mm b/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5aef7f9f70db2178fa2962da7a01ab93bd93b575
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.mm
|
| @@ -0,0 +1,79 @@
|
| +// 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/payments/cells/payments_selector_edit_item.h"
|
| +
|
| +#import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h"
|
| +#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.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 PaymentsSelectorEditItem
|
| +
|
| +@synthesize accessoryType = _accessoryType;
|
| +@synthesize name = _name;
|
| +@synthesize value = _value;
|
| +@synthesize autofillUIType = _autofillUIType;
|
| +@synthesize required = _required;
|
| +@synthesize nameFont = _nameFont;
|
| +@synthesize nameColor = _nameColor;
|
| +@synthesize valueFont = _valueFont;
|
| +@synthesize valueColor = _valueColor;
|
| +
|
| +- (instancetype)initWithType:(NSInteger)type {
|
| + self = [super initWithType:type];
|
| + if (self) {
|
| + self.cellClass = [CollectionViewDetailCell class];
|
| + }
|
| + return self;
|
| +}
|
| +
|
| +- (UIFont*)nameFont {
|
| + if (!_nameFont) {
|
| + _nameFont = [MDCTypography body2Font];
|
| + }
|
| + return _nameFont;
|
| +}
|
| +
|
| +- (UIColor*)nameColor {
|
| + if (!_nameColor) {
|
| + _nameColor = [[MDCPalette greyPalette] tint900];
|
| + }
|
| + return _nameColor;
|
| +}
|
| +
|
| +- (UIFont*)valueFont {
|
| + if (!_valueFont) {
|
| + _valueFont = [MDCTypography body1Font];
|
| + }
|
| + return _valueFont;
|
| +}
|
| +
|
| +- (UIColor*)valueColor {
|
| + if (!_valueColor) {
|
| + _valueColor = [[MDCPalette cr_bluePalette] tint600];
|
| + }
|
| + return _valueColor;
|
| +}
|
| +
|
| +#pragma mark CollectionViewItem
|
| +
|
| +- (void)configureCell:(CollectionViewDetailCell*)cell {
|
| + [super configureCell:cell];
|
| + cell.accessoryType = self.accessoryType;
|
| + NSString* textLabelFormat = self.required ? @"%@*" : @"%@";
|
| + cell.textLabel.text = [NSString stringWithFormat:textLabelFormat, self.name];
|
| + cell.detailTextLabel.text = self.value;
|
| +
|
| + // Styling.
|
| + cell.textLabel.font = self.nameFont;
|
| + cell.textLabel.textColor = self.nameColor;
|
| + cell.detailTextLabel.font = self.valueFont;
|
| + cell.detailTextLabel.textColor = self.valueColor;
|
| +}
|
| +
|
| +@end
|
|
|