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/cells/payment_method_item.h" | 5 #import "ios/chrome/browser/payments/cells/payment_method_item.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
8 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 8 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
9 | 9 |
10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 @implementation PaymentMethodItem | 26 @implementation PaymentMethodItem |
27 | 27 |
28 @synthesize methodID = _methodID; | 28 @synthesize methodID = _methodID; |
29 @synthesize methodDetail = _methodDetail; | 29 @synthesize methodDetail = _methodDetail; |
30 @synthesize methodAddress = _methodAddress; | 30 @synthesize methodAddress = _methodAddress; |
31 @synthesize notification = _notification; | 31 @synthesize notification = _notification; |
32 @synthesize methodTypeIcon = _methodTypeIcon; | 32 @synthesize methodTypeIcon = _methodTypeIcon; |
33 @synthesize reserveRoomForAccessoryType = _reserveRoomForAccessoryType; | 33 @synthesize reserveRoomForAccessoryType = _reserveRoomForAccessoryType; |
34 @synthesize accessoryType = _accessoryType; | |
35 | 34 |
36 #pragma mark CollectionViewItem | 35 #pragma mark CollectionViewItem |
37 | 36 |
38 - (instancetype)initWithType:(NSInteger)type { | 37 - (instancetype)initWithType:(NSInteger)type { |
39 self = [super initWithType:type]; | 38 self = [super initWithType:type]; |
40 if (self) { | 39 if (self) { |
41 self.cellClass = [PaymentMethodCell class]; | 40 self.cellClass = [PaymentMethodCell class]; |
42 } | 41 } |
43 return self; | 42 return self; |
44 } | 43 } |
45 | 44 |
46 - (void)configureCell:(PaymentMethodCell*)cell { | 45 - (void)configureCell:(PaymentMethodCell*)cell { |
47 [super configureCell:cell]; | 46 [super configureCell:cell]; |
48 cell.methodIDLabel.text = self.methodID; | 47 cell.methodIDLabel.text = self.methodID; |
49 cell.methodDetailLabel.text = self.methodDetail; | 48 cell.methodDetailLabel.text = self.methodDetail; |
50 cell.methodAddressLabel.text = self.methodAddress; | 49 cell.methodAddressLabel.text = self.methodAddress; |
51 cell.notificationLabel.text = self.notification; | 50 cell.notificationLabel.text = self.notification; |
52 cell.methodTypeIconView.image = self.methodTypeIcon; | 51 cell.methodTypeIconView.image = self.methodTypeIcon; |
53 cell.reserveRoomForAccessoryType = self.reserveRoomForAccessoryType; | 52 cell.reserveRoomForAccessoryType = self.reserveRoomForAccessoryType; |
54 cell.accessoryType = self.accessoryType; | |
55 } | 53 } |
56 | 54 |
57 @end | 55 @end |
58 | 56 |
59 @implementation PaymentMethodCell { | 57 @implementation PaymentMethodCell { |
60 UIStackView* _stackView; | 58 UIStackView* _stackView; |
61 NSLayoutConstraint* _iconHeightConstraint; | 59 NSLayoutConstraint* _iconHeightConstraint; |
62 NSLayoutConstraint* _iconWidthConstraint; | 60 NSLayoutConstraint* _iconWidthConstraint; |
63 } | 61 } |
64 | 62 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 183 |
186 #pragma mark - UICollectionReusableView | 184 #pragma mark - UICollectionReusableView |
187 | 185 |
188 - (void)prepareForReuse { | 186 - (void)prepareForReuse { |
189 [super prepareForReuse]; | 187 [super prepareForReuse]; |
190 self.methodIDLabel.text = nil; | 188 self.methodIDLabel.text = nil; |
191 self.methodDetailLabel.text = nil; | 189 self.methodDetailLabel.text = nil; |
192 self.methodAddressLabel.text = nil; | 190 self.methodAddressLabel.text = nil; |
193 self.notificationLabel.text = nil; | 191 self.notificationLabel.text = nil; |
194 self.methodTypeIconView.image = nil; | 192 self.methodTypeIconView.image = nil; |
195 self.accessoryType = MDCCollectionViewCellAccessoryNone; | |
196 } | 193 } |
197 | 194 |
198 #pragma mark - Accessibility | 195 #pragma mark - Accessibility |
199 | 196 |
200 - (NSString*)accessibilityLabel { | 197 - (NSString*)accessibilityLabel { |
201 return [NSString stringWithFormat:@"%@, %@, %@, %@", self.methodIDLabel.text, | 198 return [NSString stringWithFormat:@"%@, %@, %@, %@", self.methodIDLabel.text, |
202 self.methodDetailLabel.text, | 199 self.methodDetailLabel.text, |
203 self.methodAddressLabel.text, | 200 self.methodAddressLabel.text, |
204 self.notificationLabel.text]; | 201 self.notificationLabel.text]; |
205 } | 202 } |
206 | 203 |
207 @end | 204 @end |
OLD | NEW |