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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm

Issue 2736653002: Suggested Articles can be dismissed (Closed)
Patch Set: Cleanup 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/content_suggestions/content_suggestions_article_item.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
index 2ee2912b75f08daaea65b9ca5ca31bf525d00060..009a3ddb4feb95ca585652704d252154ff487de5 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
@@ -56,16 +56,29 @@ const CGFloat kStandardSpacing = 8;
_subtitle = [subtitle copy];
_articleURL = url;
_delegate = delegate;
+ _image = [self emptyImageBackground];
}
return self;
}
+- (UIImage*)emptyImageBackground {
+ // TODO(crbug.com/698171): Remove this function once we have real background
+ // image.
+ UIColor* color = [UIColor lightGrayColor];
+ CGRect rect = CGRectMake(0, 0, 1, 1);
+ UIGraphicsBeginImageContext(rect.size);
+ [color setFill];
+ UIRectFill(rect);
+ UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+ return image;
lpromero 2017/03/06 10:29:00 No action needed: This seems orthogonal to the ini
gambard 2017/03/06 12:16:00 It should have been removed before sending for rev
lpromero 2017/03/06 13:02:30 No problem :)
+}
+
- (void)configureCell:(ContentSuggestionsArticleCell*)cell {
[super configureCell:cell];
- if (!self.image && !self.imageFetched) {
+ if (!self.imageFetched) {
self.imageFetched = YES;
- // Fetch the image. During the fetch the cell's image should still be set to
- // nil.
+ // Fetch the image. During the fetch the cell's image should still be set.
[self.delegate loadImageForArticleItem:self];
}
cell.titleLabel.text = self.title;
@@ -156,9 +169,9 @@ const CGFloat kStandardSpacing = 8;
CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds);
self.titleLabel.preferredMaxLayoutWidth =
- parentWidth - self.imageView.bounds.size.width - 3 * kStandardSpacing;
+ parentWidth - kImageSize - 3 * kStandardSpacing;
self.subtitleLabel.preferredMaxLayoutWidth =
- parentWidth - self.imageView.bounds.size.width - 3 * kStandardSpacing;
+ parentWidth - kImageSize - 3 * kStandardSpacing;
lpromero 2017/03/06 10:29:00 No action needed: Idem, was this related to deleti
gambard 2017/03/06 12:16:00 Same.
// Re-layout with the new preferred width to allow the label to adjust its
// height.

Powered by Google App Engine
This is Rietveld 408576698