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

Unified Diff: ios/chrome/browser/ui/suggestions/suggestions_collection_updater.mm

Issue 2640473002: Suggestions UI - favicon item (Closed)
Patch Set: Fix tests Created 3 years, 11 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/suggestions/suggestions_collection_updater.mm
diff --git a/ios/chrome/browser/ui/suggestions/suggestions_collection_updater.mm b/ios/chrome/browser/ui/suggestions/suggestions_collection_updater.mm
index 272ef9833d841acbfa19625573d10ac592d7dd41..1400e88cd5ba28345e2667edc4a3832b7763e0fc 100644
--- a/ios/chrome/browser/ui/suggestions/suggestions_collection_updater.mm
+++ b/ios/chrome/browser/ui/suggestions/suggestions_collection_updater.mm
@@ -10,6 +10,7 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/suggestions/suggestions_article_item.h"
#import "ios/chrome/browser/ui/suggestions/suggestions_expandable_item.h"
+#import "ios/chrome/browser/ui/suggestions/suggestions_favicon_item.h"
lpromero 2017/01/18 09:34:38 Should it be SuggestionsFaviconsItem?
gambard 2017/01/18 12:37:57 In all class names favicon is used. So I followed
#import "ios/chrome/browser/ui/suggestions/suggestions_item.h"
#import "ios/chrome/browser/ui/suggestions/suggestions_stack_item.h"
#import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h"
@@ -30,18 +31,35 @@
[collectionViewController loadModel];
CollectionViewModel* model = collectionViewController.collectionViewModel;
NSInteger sectionIdentifier = kSectionIdentifierEnumZero;
+
+ // Stack Item.
[model addSectionWithIdentifier:sectionIdentifier];
[model addItem:[[SuggestionsStackItem alloc] initWithType:ItemTypeStack
title:@"The title"
subtitle:@"The subtitle"]
toSectionWithIdentifier:sectionIdentifier++];
lpromero 2017/01/18 09:34:38 I am not a fan of using incrementing sectionIdenti
gambard 2017/01/18 12:37:57 I know, but once again, this is for demo :) The co
+ // Favicon Item.
+ [model addSectionWithIdentifier:sectionIdentifier];
+ SuggestionsFaviconItem* faviconItem =
+ [[SuggestionsFaviconItem alloc] initWithType:ItemTypeFavicon];
+ for (NSInteger i = 0; i < 6; i++) {
+ [faviconItem addFavicon:[UIImage imageNamed:@"bookmark_gray_star"]
+ withTitle:@"Super website! Incredible!"];
+ }
+ faviconItem.delegate = _collectionViewController;
+ [model addItem:faviconItem toSectionWithIdentifier:sectionIdentifier++];
+
for (NSInteger i = 0; i < 3; i++) {
[model addSectionWithIdentifier:sectionIdentifier];
+
+ // Standard Item.
[model addItem:[[SuggestionsItem alloc] initWithType:ItemTypeText
title:@"The title"
subtitle:@"The subtitle"]
toSectionWithIdentifier:sectionIdentifier];
+
+ // Article Item.
[model addItem:[[SuggestionsArticleItem alloc]
initWithType:ItemTypeArticle
title:@"Title of an Article"
@@ -50,6 +68,8 @@
image:[UIImage
imageNamed:@"distillation_success"]]
toSectionWithIdentifier:sectionIdentifier];
+
+ // Expandable Item.
SuggestionsExpandableItem* expandableItem =
[[SuggestionsExpandableItem alloc]
initWithType:ItemTypeExpand
@@ -104,7 +124,7 @@
}
- (BOOL)shouldUseCustomStyleForSection:(NSInteger)section {
- return section == 0;
+ return section == 0 || section == 1;
lpromero 2017/01/18 09:34:38 Here you should translate to sectionIdentifier and
gambard 2017/01/18 12:37:57 Same as the other comment. This will be rewritten
}
@end

Powered by Google App Engine
This is Rietveld 408576698