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

Unified Diff: ios/chrome/browser/ui/collection_view/collection_view_controller.mm

Issue 2738743005: Add a way to reconfigure cell from IndexPaths (Closed)
Patch Set: Add tests 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/collection_view/collection_view_controller.mm
diff --git a/ios/chrome/browser/ui/collection_view/collection_view_controller.mm b/ios/chrome/browser/ui/collection_view/collection_view_controller.mm
index 3914205819c4c2e2e8292078ee5f2d8bd9978e74..c7338e3e8fd0d404e0e7683b6bc8fae35e076200 100644
--- a/ios/chrome/browser/ui/collection_view/collection_view_controller.mm
+++ b/ios/chrome/browser/ui/collection_view/collection_view_controller.mm
@@ -74,14 +74,15 @@
NSIndexPath* indexPath =
[self.collectionViewModel indexPathForItem:item
inSectionWithIdentifier:sectionIdentifier];
- MDCCollectionViewCell* cell =
- base::mac::ObjCCastStrict<MDCCollectionViewCell>(
- [self.collectionView cellForItemAtIndexPath:indexPath]);
+ [self reconfigureCellsAtIndexPath:indexPath withItem:item];
+ }
+}
- // |cell| may be nil if the row is not currently on screen.
- if (cell) {
- [item configureCell:cell];
- }
+- (void)reconfigureCellsAtIndexPaths:(NSArray*)indexPaths {
+ for (NSIndexPath* indexPath in indexPaths) {
+ CollectionViewItem* item =
+ [self.collectionViewModel itemAtIndexPath:indexPath];
+ [self reconfigureCellsAtIndexPath:indexPath withItem:item];
}
}
@@ -268,4 +269,19 @@
}
}
+#pragma mark - Private
+
+// Reconfigure the cell at |indexPath| by calling |configureCell:| with |item|.
lpromero 2017/03/08 17:30:19 Reconfigures
gambard 2017/03/09 09:02:04 Done.
+- (void)reconfigureCellsAtIndexPath:(NSIndexPath*)indexPath
lpromero 2017/03/08 17:30:19 cell
gambard 2017/03/09 09:02:03 Done.
+ withItem:(CollectionViewItem*)item {
+ MDCCollectionViewCell* cell =
+ base::mac::ObjCCastStrict<MDCCollectionViewCell>(
+ [self.collectionView cellForItemAtIndexPath:indexPath]);
+
+ // |cell| may be nil if the row is not currently on screen.
+ if (cell) {
+ [item configureCell:cell];
+ }
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698