| 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/ui/settings/cells/autofill_edit_item.h" | 5 #import "ios/chrome/browser/ui/settings/cells/autofill_edit_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/rtl_geometry.h" | 8 #import "ios/chrome/browser/ui/rtl_geometry.h" |
| 9 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 9 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 10 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 10 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const CGFloat kLabelAndFieldGap = 5; | 24 const CGFloat kLabelAndFieldGap = 5; |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 @implementation AutofillEditItem | 27 @implementation AutofillEditItem |
| 28 | 28 |
| 29 @synthesize textFieldName = _textFieldName; | 29 @synthesize textFieldName = _textFieldName; |
| 30 @synthesize textFieldValue = _textFieldValue; | 30 @synthesize textFieldValue = _textFieldValue; |
| 31 @synthesize cardTypeIcon = _cardTypeIcon; | 31 @synthesize cardTypeIcon = _cardTypeIcon; |
| 32 @synthesize textFieldEnabled = _textFieldEnabled; | 32 @synthesize textFieldEnabled = _textFieldEnabled; |
| 33 @synthesize autofillType = _autofillType; | 33 @synthesize autofillType = _autofillType; |
| 34 @synthesize required = _required; |
| 34 | 35 |
| 35 - (instancetype)initWithType:(NSInteger)type { | 36 - (instancetype)initWithType:(NSInteger)type { |
| 36 self = [super initWithType:type]; | 37 self = [super initWithType:type]; |
| 37 if (self) { | 38 if (self) { |
| 38 self.cellClass = [AutofillEditCell class]; | 39 self.cellClass = [AutofillEditCell class]; |
| 39 } | 40 } |
| 40 return self; | 41 return self; |
| 41 } | 42 } |
| 42 | 43 |
| 43 #pragma mark CollectionViewItem | 44 #pragma mark CollectionViewItem |
| 44 | 45 |
| 45 - (void)configureCell:(AutofillEditCell*)cell { | 46 - (void)configureCell:(AutofillEditCell*)cell { |
| 46 [super configureCell:cell]; | 47 [super configureCell:cell]; |
| 47 cell.textLabel.text = self.textFieldName; | 48 NSString* textLabelFormat = self.required ? @"%@*" : @"%@"; |
| 49 cell.textLabel.text = |
| 50 [NSString stringWithFormat:textLabelFormat, self.textFieldName]; |
| 48 cell.textField.text = self.textFieldValue; | 51 cell.textField.text = self.textFieldValue; |
| 49 if (self.textFieldName.length) { | 52 if (self.textFieldName.length) { |
| 50 cell.textField.accessibilityIdentifier = | 53 cell.textField.accessibilityIdentifier = |
| 51 [NSString stringWithFormat:@"%@_textField", self.textFieldName]; | 54 [NSString stringWithFormat:@"%@_textField", self.textFieldName]; |
| 52 } | 55 } |
| 53 cell.textField.enabled = self.textFieldEnabled; | 56 cell.textField.enabled = self.textFieldEnabled; |
| 54 cell.textField.textColor = self.textFieldEnabled | 57 cell.textField.textColor = self.textFieldEnabled |
| 55 ? [[MDCPalette cr_bluePalette] tint500] | 58 ? [[MDCPalette cr_bluePalette] tint500] |
| 56 : [[MDCPalette greyPalette] tint500]; | 59 : [[MDCPalette greyPalette] tint500]; |
| 57 [cell.textField addTarget:self | 60 [cell.textField addTarget:self |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 196 } |
| 194 | 197 |
| 195 #pragma mark - Accessibility | 198 #pragma mark - Accessibility |
| 196 | 199 |
| 197 - (NSString*)accessibilityLabel { | 200 - (NSString*)accessibilityLabel { |
| 198 return [NSString | 201 return [NSString |
| 199 stringWithFormat:@"%@, %@", self.textLabel.text, self.textField.text]; | 202 stringWithFormat:@"%@, %@", self.textLabel.text, self.textField.text]; |
| 200 } | 203 } |
| 201 | 204 |
| 202 @end | 205 @end |
| OLD | NEW |