Commit 5e1332da authored by Mohamad Ahmadi's avatar Mohamad Ahmadi Committed by Commit Bot

[Payment Request] Makes cell section headers light grey

Bug:764473

before: https://drive.google.com/open?id=0B-GXJsF3pXyjUGVnaTFfTVBtamc
after: https://drive.google.com/open?id=0B-GXJsF3pXyjRzVBenpfYy1OZjg

Change-Id: I1df52d623da2b197f4385863fae4c16ddd16a240
Reviewed-on: https://chromium-review.googlesource.com/663839
Commit-Queue: Marc-Antoine Courteau <macourteau@chromium.org>
Reviewed-by: default avatarMarc-Antoine Courteau <macourteau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501628}
parent dbe1a962
......@@ -15,13 +15,21 @@
@interface PaymentsTextItem : CollectionViewItem<PaymentsIsSelectable>
// The main text to display.
@property(nonatomic, copy) NSString* text;
@property(nonatomic, nullable, copy) NSString* text;
// The secondary text to display.
@property(nonatomic, copy) NSString* detailText;
@property(nonatomic, nullable, copy) NSString* detailText;
// The color of the main text. Default is the 900 tint color of the grey
// palette.
@property(nonatomic, null_resettable, copy) UIColor* textColor;
// The color of the secondary text. Default is the 900 tint color of the grey
// palette.
@property(nonatomic, null_resettable, copy) UIColor* detailTextColor;
// The image to display.
@property(nonatomic, strong) UIImage* image;
@property(nonatomic, nullable, strong) UIImage* image;
// The accessory type for the represented cell.
@property(nonatomic) MDCCollectionViewCellAccessoryType accessoryType;
......@@ -38,13 +46,13 @@
@interface PaymentsTextCell : MDCCollectionViewCell
// UILabel corresponding to |text| from the item.
@property(nonatomic, readonly, strong) UILabel* textLabel;
@property(nonatomic, readonly, nullable, strong) UILabel* textLabel;
// UILabel corresponding to |detailText| from the item.
@property(nonatomic, readonly, strong) UILabel* detailTextLabel;
@property(nonatomic, readonly, nullable, strong) UILabel* detailTextLabel;
// UIImageView corresponding to |image| from the item.
@property(nonatomic, readonly, strong) UIImageView* imageView;
@property(nonatomic, readonly, nullable, strong) UIImageView* imageView;
@end
......
......@@ -30,6 +30,8 @@ const CGFloat kVerticalSpacingBetweenLabels = 8;
@synthesize text = _text;
@synthesize detailText = _detailText;
@synthesize textColor = _textColor;
@synthesize detailTextColor = _detailTextColor;
@synthesize image = _image;
@synthesize accessoryType = _accessoryType;
@synthesize complete = _complete;
......@@ -44,11 +46,27 @@ const CGFloat kVerticalSpacingBetweenLabels = 8;
return self;
}
- (UIColor*)textColor {
if (!_textColor) {
_textColor = [[MDCPalette greyPalette] tint900];
}
return _textColor;
}
- (UIColor*)detailTextColor {
if (!_detailTextColor) {
_detailTextColor = [[MDCPalette greyPalette] tint900];
}
return _detailTextColor;
}
- (void)configureCell:(PaymentsTextCell*)cell {
[super configureCell:cell];
cell.accessoryType = self.accessoryType;
cell.textLabel.text = self.text;
cell.textLabel.textColor = self.textColor;
cell.detailTextLabel.text = self.detailText;
cell.detailTextLabel.textColor = self.detailTextColor;
cell.imageView.image = self.image;
}
......@@ -107,12 +125,10 @@ const CGFloat kVerticalSpacingBetweenLabels = 8;
// Set default font and text colors for labels.
- (void)setDefaultViewStyling {
_textLabel.font = [MDCTypography body2Font];
_textLabel.textColor = [[MDCPalette greyPalette] tint900];
_textLabel.numberOfLines = 0;
_textLabel.lineBreakMode = NSLineBreakByWordWrapping;
_detailTextLabel.font = [MDCTypography body1Font];
_detailTextLabel.textColor = [[MDCPalette greyPalette] tint900];
_detailTextLabel.numberOfLines = 0;
_detailTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
}
......
......@@ -126,7 +126,7 @@ using ::payment_request_util::GetShippingSectionTitle;
return item;
}
- (CollectionViewItem*)shippingSectionHeaderItem {
- (PaymentsTextItem*)shippingSectionHeaderItem {
PaymentsTextItem* item = [[PaymentsTextItem alloc] init];
item.text = GetShippingSectionTitle(self.paymentRequest->shipping_type());
return item;
......@@ -177,7 +177,7 @@ using ::payment_request_util::GetShippingSectionTitle;
return item;
}
- (CollectionViewItem*)paymentMethodSectionHeaderItem {
- (PaymentsTextItem*)paymentMethodSectionHeaderItem {
if (!self.paymentRequest->selected_payment_method())
return nil;
PaymentsTextItem* item = [[PaymentsTextItem alloc] init];
......@@ -221,7 +221,7 @@ using ::payment_request_util::GetShippingSectionTitle;
return item;
}
- (CollectionViewItem*)contactInfoSectionHeaderItem {
- (PaymentsTextItem*)contactInfoSectionHeaderItem {
if (!self.paymentRequest->selected_contact_profile())
return nil;
PaymentsTextItem* item = [[PaymentsTextItem alloc] init];
......
......@@ -16,6 +16,7 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/payments/cells/page_info_item.h"
#import "ios/chrome/browser/ui/payments/cells/payments_text_item.h"
#import "ios/chrome/browser/ui/payments/cells/price_item.h"
#import "ios/chrome/browser/ui/payments/payment_request_view_controller_actions.h"
#include "ios/chrome/browser/ui/rtl_geometry.h"
......@@ -50,7 +51,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeSummaryPageInfo = kItemTypeEnumZero,
ItemTypeSpinner,
ItemTypeSummaryTotal,
ItemTypeShippingTitle,
ItemTypeShippingHeader,
ItemTypeShippingAddress,
ItemTypeShippingOption,
ItemTypePaymentHeader,
......@@ -193,9 +194,10 @@ typedef NS_ENUM(NSInteger, ItemType) {
if ([_dataSource requestShipping]) {
[model addSectionWithIdentifier:SectionIdentifierShipping];
CollectionViewItem* shippingSectionHeaderItem =
PaymentsTextItem* shippingSectionHeaderItem =
[_dataSource shippingSectionHeaderItem];
[shippingSectionHeaderItem setType:ItemTypeShippingTitle];
[shippingSectionHeaderItem setTextColor:[[MDCPalette greyPalette] tint500]];
[shippingSectionHeaderItem setType:ItemTypeShippingHeader];
[model setHeader:shippingSectionHeaderItem
forSectionWithIdentifier:SectionIdentifierShipping];
......@@ -459,10 +461,12 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (void)populatePaymentMethodSection {
CollectionViewModel* model = self.collectionViewModel;
CollectionViewItem* paymentMethodSectionHeaderItem =
PaymentsTextItem* paymentMethodSectionHeaderItem =
[_dataSource paymentMethodSectionHeaderItem];
if (paymentMethodSectionHeaderItem) {
[paymentMethodSectionHeaderItem setType:ItemTypePaymentHeader];
[paymentMethodSectionHeaderItem
setTextColor:[[MDCPalette greyPalette] tint500]];
[model setHeader:paymentMethodSectionHeaderItem
forSectionWithIdentifier:SectionIdentifierPayment];
}
......@@ -477,10 +481,12 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (void)populateContactInfoSection {
CollectionViewModel* model = self.collectionViewModel;
CollectionViewItem* contactInfoSectionHeaderItem =
PaymentsTextItem* contactInfoSectionHeaderItem =
[_dataSource contactInfoSectionHeaderItem];
if (contactInfoSectionHeaderItem) {
[contactInfoSectionHeaderItem setType:ItemTypeContactInfoHeader];
[contactInfoSectionHeaderItem
setTextColor:[[MDCPalette greyPalette] tint500]];
[model setHeader:contactInfoSectionHeaderItem
forSectionWithIdentifier:SectionIdentifierContactInfo];
}
......
......@@ -9,6 +9,7 @@
@class CollectionViewFooterItem;
@class CollectionViewItem;
@class PaymentsTextItem;
// Data source protocol for PaymentRequestViewController.
@protocol PaymentRequestViewControllerDataSource
......@@ -36,7 +37,7 @@
- (CollectionViewItem*)paymentSummaryItem;
// Returns the header item for the Shipping section.
- (CollectionViewItem*)shippingSectionHeaderItem;
- (PaymentsTextItem*)shippingSectionHeaderItem;
// Returns the Shipping Address item displayed in the Shipping section.
- (CollectionViewItem*)shippingAddressItem;
......@@ -45,13 +46,13 @@
- (CollectionViewItem*)shippingOptionItem;
// Returns the header item for the Payment Method section.
- (CollectionViewItem*)paymentMethodSectionHeaderItem;
- (PaymentsTextItem*)paymentMethodSectionHeaderItem;
// Returns the item displayed in the Payment Method section.
- (CollectionViewItem*)paymentMethodItem;
// Returns the header item for the Contact Info section.
- (CollectionViewItem*)contactInfoSectionHeaderItem;
- (PaymentsTextItem*)contactInfoSectionHeaderItem;
// Returns the item displayed in the Contact Info section.
- (CollectionViewItem*)contactInfoItem;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment