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

Side by Side Diff: ios/chrome/browser/ui/collection_view/cells/collection_view_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 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/collection_view/cells/collection_view_item.h" 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
6 6
7 #import "base/logging.h" 7 #import "base/logging.h"
8 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h"
9 8
10 #if !defined(__has_feature) || !__has_feature(objc_arc) 9 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support." 10 #error "This file requires ARC support."
12 #endif 11 #endif
13 12
14 @implementation CollectionViewItem 13 @implementation CollectionViewItem
15 14
15 @synthesize accessoryType = _accessoryType;
16 @synthesize type = _type; 16 @synthesize type = _type;
17 @synthesize cellClass = _cellClass; 17 @synthesize cellClass = _cellClass;
18 @synthesize accessibilityIdentifier = _accessibilityIdentifier; 18 @synthesize accessibilityIdentifier = _accessibilityIdentifier;
19 19
20 - (instancetype)initWithType:(NSInteger)type { 20 - (instancetype)initWithType:(NSInteger)type {
21 if ((self = [super init])) { 21 if ((self = [super init])) {
22 _type = type; 22 _type = type;
23 _cellClass = [MDCCollectionViewCell class]; 23 _cellClass = [MDCCollectionViewCell class];
24 } 24 }
25 return self; 25 return self;
26 } 26 }
27 27
28 - (instancetype)init { 28 - (instancetype)init {
29 NOTREACHED(); 29 NOTREACHED();
30 return nil; 30 return nil;
31 } 31 }
32 32
33 - (void)setCellClass:(Class)cellClass { 33 - (void)setCellClass:(Class)cellClass {
34 DCHECK([cellClass isSubclassOfClass:[MDCCollectionViewCell class]]); 34 DCHECK([cellClass isSubclassOfClass:[MDCCollectionViewCell class]]);
35 _cellClass = cellClass; 35 _cellClass = cellClass;
36 } 36 }
37 37
38 - (void)configureCell:(MDCCollectionViewCell*)cell { 38 - (void)configureCell:(MDCCollectionViewCell*)cell {
39 DCHECK([cell class] == self.cellClass); 39 DCHECK([cell class] == self.cellClass);
40 cell.accessoryType = self.accessoryType;
40 cell.accessibilityTraits = self.accessibilityTraits; 41 cell.accessibilityTraits = self.accessibilityTraits;
41 cell.accessibilityIdentifier = self.accessibilityIdentifier; 42 cell.accessibilityIdentifier = self.accessibilityIdentifier;
42 } 43 }
43 44
44 @end 45 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698