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

Unified Diff: ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm

Issue 2768933005: Use CollectionViewTextItem instead of a cast (Closed)
Patch Set: Remove MDFRoboto Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
diff --git a/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm b/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
index 20a40cab593f4dcfb182a3f7ddb14b80b0e2ffc6..13c22d51c03624439ae4595cfd87c3884d958811 100644
--- a/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
@@ -170,16 +170,21 @@ typedef NS_ENUM(NSInteger, ItemType) {
}
- (CollectionViewItem*)profileSectionHeader {
- CollectionViewTextItem* header = [
- [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader] autorelease];
+ CollectionViewTextItem* header = [self genericHeader];
header.text = l10n_util::GetNSString(IDS_IOS_AUTOFILL_ADDRESSES_GROUP_NAME);
return header;
}
- (CollectionViewItem*)cardSectionHeader {
+ CollectionViewTextItem* header = [self genericHeader];
+ header.text = l10n_util::GetNSString(IDS_IOS_AUTOFILL_CREDITCARDS_GROUP_NAME);
+ return header;
+}
+
+- (CollectionViewTextItem*)genericHeader {
CollectionViewTextItem* header = [
[[CollectionViewTextItem alloc] initWithType:ItemTypeHeader] autorelease];
- header.text = l10n_util::GetNSString(IDS_IOS_AUTOFILL_CREDITCARDS_GROUP_NAME);
+ header.textColor = [[MDCPalette greyPalette] tint500];
return header;
}
@@ -269,20 +274,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
return cell;
}
-- (UICollectionReusableView*)collectionView:(UICollectionView*)collectionView
- viewForSupplementaryElementOfKind:(NSString*)kind
- atIndexPath:(NSIndexPath*)indexPath {
- UICollectionReusableView* view = [super collectionView:collectionView
- viewForSupplementaryElementOfKind:kind
- atIndexPath:indexPath];
- MDCCollectionViewTextCell* textCell =
- base::mac::ObjCCast<MDCCollectionViewTextCell>(view);
- if (textCell) {
- textCell.textLabel.textColor = [[MDCPalette greyPalette] tint500];
- }
- return view;
-}
-
#pragma mark - Switch Callbacks
- (void)autofillSwitchChanged:(UISwitch*)switchView {

Powered by Google App Engine
This is Rietveld 408576698