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

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

Issue 2817953002: CollectionViewTextItem no longer styles CollectionViewTextCell (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
diff --git a/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm b/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
index 10a7895d8c17fa7a71eb4118b4df4302025f9874..d923e66ae8f1726cdc4d555a82e41782423a909f 100644
--- a/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
@@ -10,10 +10,13 @@
#include "components/browsing_data/core/pref_names.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.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"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
+#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
+#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#include "ui/base/l10n/l10n_util_mac.h"
namespace {
@@ -144,6 +147,35 @@ initWithPrefs:(PrefService*)prefs
return item;
}
+#pragma mark - UICollectionViewDataSource
+
+- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
+ cellForItemAtIndexPath:(nonnull NSIndexPath*)indexPath {
+ UICollectionViewCell* cell =
+ [super collectionView:collectionView cellForItemAtIndexPath:indexPath];
+
+ NSInteger itemType =
+ [self.collectionViewModel itemTypeForIndexPath:indexPath];
+ switch (itemType) {
+ case ItemTypePastHour:
+ case ItemTypePastDay:
+ case ItemTypePastWeek:
+ case ItemTypeLastFourWeeks:
+ case ItemTypeBeginningOfTime: {
+ 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];
+ break;
+ }
+ default:
+ break;
+ }
+ return cell;
+}
+
#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView*)collectionView

Powered by Google App Engine
This is Rietveld 408576698