OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/chrome/browser/payments/payment_request_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_request_view_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #import "ios/chrome/browser/payments/cells/payment_method_item.h" | 22 #import "ios/chrome/browser/payments/cells/payment_method_item.h" |
23 #import "ios/chrome/browser/payments/cells/price_item.h" | 23 #import "ios/chrome/browser/payments/cells/price_item.h" |
24 #include "ios/chrome/browser/payments/payment_request.h" | 24 #include "ios/chrome/browser/payments/payment_request.h" |
25 #import "ios/chrome/browser/payments/payment_request_util.h" | 25 #import "ios/chrome/browser/payments/payment_request_util.h" |
26 #import "ios/chrome/browser/payments/payment_request_view_controller_actions.h" | 26 #import "ios/chrome/browser/payments/payment_request_view_controller_actions.h" |
27 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" | 27 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" |
28 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" | 28 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" |
29 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item
.h" | 29 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item
.h" |
30 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" | 30 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" |
31 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | 31 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 32 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h
" |
32 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" | 33 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" |
33 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 34 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
34 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 35 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
35 #include "ios/chrome/browser/ui/rtl_geometry.h" | 36 #include "ios/chrome/browser/ui/rtl_geometry.h" |
36 #include "ios/chrome/browser/ui/uikit_ui_util.h" | 37 #include "ios/chrome/browser/ui/uikit_ui_util.h" |
37 #include "ios/chrome/grit/ios_strings.h" | 38 #include "ios/chrome/grit/ios_strings.h" |
38 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" | 39 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" |
39 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" | 40 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
40 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 41 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
41 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 42 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 uppercaseStringWithLocale:[NSLocale currentLocale]]; | 272 uppercaseStringWithLocale:[NSLocale currentLocale]]; |
272 addAddressItem.accessibilityTraits |= UIAccessibilityTraitButton; | 273 addAddressItem.accessibilityTraits |= UIAccessibilityTraitButton; |
273 } | 274 } |
274 [model addItem:shippingAddressItem | 275 [model addItem:shippingAddressItem |
275 toSectionWithIdentifier:SectionIdentifierShipping]; | 276 toSectionWithIdentifier:SectionIdentifierShipping]; |
276 | 277 |
277 CollectionViewItem* shippingOptionItem = nil; | 278 CollectionViewItem* shippingOptionItem = nil; |
278 if (_paymentRequest->selected_shipping_option()) { | 279 if (_paymentRequest->selected_shipping_option()) { |
279 CollectionViewTextItem* selectedShippingOptionItem = | 280 CollectionViewTextItem* selectedShippingOptionItem = |
280 [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingOption]; | 281 [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingOption]; |
281 selectedShippingOptionItem.textFont = [MDCTypography body2Font]; | |
282 selectedShippingOptionItem.textColor = [[MDCPalette greyPalette] tint900]; | |
283 selectedShippingOptionItem.detailTextFont = [MDCTypography body1Font]; | |
284 selectedShippingOptionItem.detailTextColor = | |
285 [[MDCPalette greyPalette] tint900]; | |
286 shippingOptionItem = selectedShippingOptionItem; | 282 shippingOptionItem = selectedShippingOptionItem; |
287 | 283 |
288 _selectedShippingOptionItem = selectedShippingOptionItem; | 284 _selectedShippingOptionItem = selectedShippingOptionItem; |
289 [self fillShippingOptionItem:selectedShippingOptionItem | 285 [self fillShippingOptionItem:selectedShippingOptionItem |
290 withOption:_paymentRequest->selected_shipping_option()]; | 286 withOption:_paymentRequest->selected_shipping_option()]; |
291 selectedShippingOptionItem.accessoryType = | 287 selectedShippingOptionItem.accessoryType = |
292 MDCCollectionViewCellAccessoryDisclosureIndicator; | 288 MDCCollectionViewCellAccessoryDisclosureIndicator; |
293 selectedShippingOptionItem.accessibilityTraits |= | 289 selectedShippingOptionItem.accessibilityTraits |= |
294 UIAccessibilityTraitButton; | 290 UIAccessibilityTraitButton; |
295 } else { | 291 } else { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 #pragma mark UICollectionViewDataSource | 505 #pragma mark UICollectionViewDataSource |
510 | 506 |
511 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView | 507 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView |
512 cellForItemAtIndexPath:(nonnull NSIndexPath*)indexPath { | 508 cellForItemAtIndexPath:(nonnull NSIndexPath*)indexPath { |
513 UICollectionViewCell* cell = | 509 UICollectionViewCell* cell = |
514 [super collectionView:collectionView cellForItemAtIndexPath:indexPath]; | 510 [super collectionView:collectionView cellForItemAtIndexPath:indexPath]; |
515 | 511 |
516 NSInteger itemType = | 512 NSInteger itemType = |
517 [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 513 [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
518 switch (itemType) { | 514 switch (itemType) { |
| 515 case ItemTypePaymentTitle: |
| 516 case ItemTypeShippingTitle: |
| 517 case ItemTypeShippingOption: |
| 518 case ItemTypeContactInfoTitle: { |
| 519 CollectionViewTextCell* textCell = |
| 520 base::mac::ObjCCastStrict<CollectionViewTextCell>(cell); |
| 521 textCell.textLabel.font = [MDCTypography body2Font]; |
| 522 textCell.textLabel.textColor = [[MDCPalette greyPalette] tint900]; |
| 523 textCell.detailTextLabel.font = [MDCTypography body1Font]; |
| 524 textCell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint900]; |
| 525 break; |
| 526 } |
519 case ItemTypeAddShippingAddress: { | 527 case ItemTypeAddShippingAddress: { |
520 CollectionViewDetailCell* detailCell = | 528 CollectionViewDetailCell* detailCell = |
521 base::mac::ObjCCastStrict<CollectionViewDetailCell>(cell); | 529 base::mac::ObjCCastStrict<CollectionViewDetailCell>(cell); |
522 detailCell.detailTextLabel.font = [MDCTypography body2Font]; | 530 detailCell.detailTextLabel.font = [MDCTypography body2Font]; |
523 detailCell.detailTextLabel.textColor = | 531 detailCell.detailTextLabel.textColor = |
524 [[MDCPalette cr_bluePalette] tint700]; | 532 [[MDCPalette cr_bluePalette] tint700]; |
525 break; | 533 break; |
526 } | 534 } |
527 case ItemTypeFooterText: { | 535 case ItemTypeFooterText: { |
528 CollectionViewFooterCell* footerCell = | 536 CollectionViewFooterCell* footerCell = |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 637 |
630 - (BOOL)collectionView:(UICollectionView*)collectionView | 638 - (BOOL)collectionView:(UICollectionView*)collectionView |
631 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { | 639 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { |
632 // No background on the footer text item. | 640 // No background on the footer text item. |
633 NSInteger sectionIdentifier = | 641 NSInteger sectionIdentifier = |
634 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; | 642 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; |
635 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; | 643 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; |
636 } | 644 } |
637 | 645 |
638 @end | 646 @end |
OLD | NEW |