| Index: ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
|
| diff --git a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
|
| index 93334ac71449d00ff2baa6b38efb05b930023c65..6bc6740c2394df50f6efd8e9882e6afc9e044311 100644
|
| --- a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
|
| +++ b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
|
| @@ -27,6 +27,7 @@
|
| #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h"
|
| #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item.h"
|
| #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item.h"
|
| +#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h"
|
| #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
|
| #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
|
| #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.h"
|
| @@ -60,9 +61,9 @@ typedef NS_ENUM(NSInteger, SectionIdentifier) {
|
| };
|
|
|
| typedef NS_ENUM(NSInteger, ItemType) {
|
| - ItemTypeTextCheckmark = kItemTypeEnumZero,
|
| - ItemTypeTextDetail,
|
| + ItemTypeTextDetail = kItemTypeEnumZero,
|
| ItemTypeText,
|
| + ItemTypeSmallText,
|
| ItemTypeTextError,
|
| ItemTypeDetailBasic,
|
| ItemTypeDetailLeftMedium,
|
| @@ -116,18 +117,16 @@ const CGFloat kHorizontalImageFixedSize = 40;
|
| CollectionViewTextItem* textHeader = [
|
| [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader] autorelease];
|
| textHeader.text = @"CollectionViewTextCell";
|
| - textHeader.textFont = [MDCTypography body2Font];
|
| - textHeader.textColor = [[MDCPalette greyPalette] tint500];
|
| [model setHeader:textHeader
|
| forSectionWithIdentifier:SectionIdentifierTextCell];
|
|
|
| - CollectionViewTextItem* textCell = [[[CollectionViewTextItem alloc]
|
| - initWithType:ItemTypeTextCheckmark] autorelease];
|
| + CollectionViewTextItem* textCell =
|
| + [[[CollectionViewTextItem alloc] initWithType:ItemTypeText] autorelease];
|
| textCell.text = @"Text cell 1";
|
| textCell.accessoryType = MDCCollectionViewCellAccessoryCheckmark;
|
| [model addItem:textCell toSectionWithIdentifier:SectionIdentifierTextCell];
|
| - CollectionViewTextItem* textCell2 = [[[CollectionViewTextItem alloc]
|
| - initWithType:ItemTypeTextDetail] autorelease];
|
| + CollectionViewTextItem* textCell2 =
|
| + [[[CollectionViewTextItem alloc] initWithType:ItemTypeText] autorelease];
|
| textCell2.text =
|
| @"Text cell with text that is so long it must truncate at some point";
|
| textCell2.accessoryType = MDCCollectionViewCellAccessoryDetailButton;
|
| @@ -139,10 +138,9 @@ const CGFloat kHorizontalImageFixedSize = 40;
|
| @"wrap nicely at some point.";
|
| textCell3.numberOfDetailTextLines = 0;
|
| [model addItem:textCell3 toSectionWithIdentifier:SectionIdentifierTextCell];
|
| - CollectionViewTextItem* smallTextCell =
|
| - [[[CollectionViewTextItem alloc] initWithType:ItemTypeText] autorelease];
|
| + CollectionViewTextItem* smallTextCell = [[[CollectionViewTextItem alloc]
|
| + initWithType:ItemTypeSmallText] autorelease];
|
| smallTextCell.text = @"Text cell with small font but height of 48.";
|
| - smallTextCell.textFont = [smallTextCell.textFont fontWithSize:8];
|
| [model addItem:smallTextCell
|
| toSectionWithIdentifier:SectionIdentifierTextCell];
|
|
|
| @@ -351,6 +349,39 @@ const CGFloat kHorizontalImageFixedSize = 40;
|
| self.styler.cellStyle = MDCCollectionViewCellStyleCard;
|
| }
|
|
|
| +#pragma mark - UICollectionViewDataSource
|
| +
|
| +- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
|
| + cellForItemAtIndexPath:(NSIndexPath*)indexPath {
|
| + UICollectionViewCell* cell =
|
| + [super collectionView:collectionView cellForItemAtIndexPath:indexPath];
|
| +
|
| + NSInteger itemType =
|
| + [self.collectionViewModel itemTypeForIndexPath:indexPath];
|
| + switch (itemType) {
|
| + case ItemTypeHeader:
|
| + case ItemTypeText:
|
| + case ItemTypeSmallText: {
|
| + CollectionViewTextCell* textCell =
|
| + base::mac::ObjCCastStrict<CollectionViewTextCell>(cell);
|
| + textCell.textLabel.font = [MDCTypography body2Font];
|
| + textCell.textLabel.textColor = [[MDCPalette greyPalette] tint900];
|
| + textCell.detailTextLabel.font = [MDCTypography body1Font];
|
| + textCell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
|
| + if (itemType == ItemTypeHeader)
|
| + textCell.textLabel.textColor = [[MDCPalette greyPalette] tint500];
|
| + if (itemType == ItemTypeSmallText) {
|
| + textCell.textLabel.font =
|
| + [[MDCTypography fontLoader] regularFontOfSize:8];
|
| + }
|
| + break;
|
| + }
|
| + default:
|
| + break;
|
| + }
|
| + return cell;
|
| +}
|
| +
|
| #pragma mark MDCCollectionViewStylingDelegate
|
|
|
| - (CGFloat)collectionView:(nonnull UICollectionView*)collectionView
|
| @@ -363,9 +394,9 @@ const CGFloat kHorizontalImageFixedSize = 40;
|
| case ItemTypeSwitchDynamicHeight:
|
| case ItemTypeSwitchSync:
|
| case ItemTypeAccountControlDynamicHeight:
|
| - case ItemTypeTextCheckmark:
|
| case ItemTypeTextDetail:
|
| case ItemTypeText:
|
| + case ItemTypeSmallText:
|
| case ItemTypeTextError:
|
| case ItemTypeAutofillCVC:
|
| case ItemTypeAutofillStatus:
|
|
|