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

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm

Issue 2721343002: Make publisher information RTL friendly (Closed)
Patch Set: Fix dependency 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 unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/content_suggestions/content_suggestions_article_i tem.h" 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i tem.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 8 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
9 #import "ios/chrome/browser/ui/uikit_ui_util.h" 9 #import "ios/chrome/browser/ui/uikit_ui_util.h"
10 #import "ios/chrome/browser/ui/util/i18n_string.h"
10 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 11 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
11 12
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 13 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 14 #error "This file requires ARC support."
14 #endif 15 #endif
15 16
16 namespace { 17 namespace {
17 const CGFloat kImageSize = 72; 18 const CGFloat kImageSize = 72;
18 // When updating this, make sure to update |layoutSubviews|. 19 // When updating this, make sure to update |layoutSubviews|.
19 const CGFloat kStandardSpacing = 8; 20 const CGFloat kStandardSpacing = 8;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return self; 133 return self;
133 } 134 }
134 135
135 - (void)setPublisherName:(NSString*)publisherName date:(base::Time)publishDate { 136 - (void)setPublisherName:(NSString*)publisherName date:(base::Time)publishDate {
136 NSDate* date = [NSDate dateWithTimeIntervalSince1970:publishDate.ToDoubleT()]; 137 NSDate* date = [NSDate dateWithTimeIntervalSince1970:publishDate.ToDoubleT()];
137 NSString* dateString = 138 NSString* dateString =
138 [NSDateFormatter localizedStringFromDate:date 139 [NSDateFormatter localizedStringFromDate:date
139 dateStyle:NSDateFormatterMediumStyle 140 dateStyle:NSDateFormatterMediumStyle
140 timeStyle:NSDateFormatterNoStyle]; 141 timeStyle:NSDateFormatterNoStyle];
141 142
142 // TODO(crbug.com/694423): Make it RTL friendly. 143 self.publisherLabel.text = AdjustStringForLocaleDirection(
143 self.publisherLabel.text = 144 [NSString stringWithFormat:@"%@ - %@.", publisherName, dateString]);
144 [NSString stringWithFormat:@"%@ - %@.", publisherName, dateString];
145 } 145 }
146 146
147 #pragma mark - UIView 147 #pragma mark - UIView
148 148
149 // Implements -layoutSubviews as per instructions in documentation for 149 // Implements -layoutSubviews as per instructions in documentation for
150 // +[MDCCollectionViewCell cr_preferredHeightForWidth:forItem:]. 150 // +[MDCCollectionViewCell cr_preferredHeightForWidth:forItem:].
151 - (void)layoutSubviews { 151 - (void)layoutSubviews {
152 [super layoutSubviews]; 152 [super layoutSubviews];
153 153
154 // Adjust the text label preferredMaxLayoutWidth when the parent's width 154 // Adjust the text label preferredMaxLayoutWidth when the parent's width
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 @{ 191 @{
192 @"image" : _imageView, 192 @"image" : _imageView,
193 @"title" : _titleLabel, 193 @"title" : _titleLabel,
194 @"text" : _subtitleLabel, 194 @"text" : _subtitleLabel,
195 @"publish" : _publisherLabel, 195 @"publish" : _publisherLabel,
196 }, 196 },
197 @{ @"space" : @(kStandardSpacing) }); 197 @{ @"space" : @(kStandardSpacing) });
198 } 198 }
199 199
200 @end 200 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698