Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: ios/chrome/browser/payments/cells/autofill_profile_item.mm

Issue 2814793003: Adds accessoryType property to CollectionViewItem (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/autofill_profile_item.h" 5 #import "ios/chrome/browser/payments/cells/autofill_profile_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/chrome/browser/ui/uikit_ui_util.h" 8 #import "ios/chrome/browser/ui/uikit_ui_util.h"
9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
10 10
(...skipping 12 matching lines...) Expand all
23 const CGFloat kVerticalSpacingBetweenLabels = 8; 23 const CGFloat kVerticalSpacingBetweenLabels = 8;
24 } // namespace 24 } // namespace
25 25
26 @implementation AutofillProfileItem 26 @implementation AutofillProfileItem
27 27
28 @synthesize name = _name; 28 @synthesize name = _name;
29 @synthesize address = _address; 29 @synthesize address = _address;
30 @synthesize phoneNumber = _phoneNumber; 30 @synthesize phoneNumber = _phoneNumber;
31 @synthesize email = _email; 31 @synthesize email = _email;
32 @synthesize notification = _notification; 32 @synthesize notification = _notification;
33 @synthesize accessoryType = _accessoryType;
34 33
35 #pragma mark CollectionViewItem 34 #pragma mark CollectionViewItem
36 35
37 - (instancetype)initWithType:(NSInteger)type { 36 - (instancetype)initWithType:(NSInteger)type {
38 self = [super initWithType:type]; 37 self = [super initWithType:type];
39 if (self) { 38 if (self) {
40 self.cellClass = [AutofillProfileCell class]; 39 self.cellClass = [AutofillProfileCell class];
41 } 40 }
42 return self; 41 return self;
43 } 42 }
44 43
45 - (void)configureCell:(AutofillProfileCell*)cell { 44 - (void)configureCell:(AutofillProfileCell*)cell {
46 [super configureCell:cell]; 45 [super configureCell:cell];
47 cell.accessoryType = self.accessoryType;
48 cell.nameLabel.text = self.name; 46 cell.nameLabel.text = self.name;
49 cell.addressLabel.text = self.address; 47 cell.addressLabel.text = self.address;
50 cell.phoneNumberLabel.text = self.phoneNumber; 48 cell.phoneNumberLabel.text = self.phoneNumber;
51 cell.emailLabel.text = self.email; 49 cell.emailLabel.text = self.email;
52 cell.notificationLabel.text = self.notification; 50 cell.notificationLabel.text = self.notification;
53 } 51 }
54 52
55 @end 53 @end
56 54
57 @implementation AutofillProfileCell { 55 @implementation AutofillProfileCell {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 172
175 #pragma mark - UICollectionReusableView 173 #pragma mark - UICollectionReusableView
176 174
177 - (void)prepareForReuse { 175 - (void)prepareForReuse {
178 [super prepareForReuse]; 176 [super prepareForReuse];
179 self.nameLabel.text = nil; 177 self.nameLabel.text = nil;
180 self.addressLabel.text = nil; 178 self.addressLabel.text = nil;
181 self.phoneNumberLabel.text = nil; 179 self.phoneNumberLabel.text = nil;
182 self.emailLabel.text = nil; 180 self.emailLabel.text = nil;
183 self.notificationLabel.text = nil; 181 self.notificationLabel.text = nil;
184 self.accessoryType = MDCCollectionViewCellAccessoryNone;
185 } 182 }
186 183
187 #pragma mark - NSObject(Accessibility) 184 #pragma mark - NSObject(Accessibility)
188 185
189 - (NSString*)accessibilityLabel { 186 - (NSString*)accessibilityLabel {
190 return [NSString 187 return [NSString
191 stringWithFormat:@"%@, %@, %@, %@, %@", self.nameLabel.text, 188 stringWithFormat:@"%@, %@, %@, %@, %@", self.nameLabel.text,
192 self.addressLabel.text, self.phoneNumberLabel.text, 189 self.addressLabel.text, self.phoneNumberLabel.text,
193 self.emailLabel.text, self.notificationLabel.text]; 190 self.emailLabel.text, self.notificationLabel.text];
194 } 191 }
195 192
196 @end 193 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/cells/autofill_profile_item.h ('k') | ios/chrome/browser/payments/cells/payment_method_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698