Commit 2374bcca authored by Ewann's avatar Ewann Committed by Chromium LUCI CQ

[iOS][Settings] Updates TableViewURLItem

This CL updates the TableViewURLItem according to this mock:
http://slides/1oQp4K1J_Ue0U6Obsy-73PWD9wzuU4OhDEJczu82kXk8#slide=id.g5402559cba_0_444

Bug: 922511
Change-Id: I0ea43a1d5d1ad8ba156aac1586327c854627b4e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587046
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837076}
parent 663e5a70
...@@ -45,7 +45,7 @@ class GURL; ...@@ -45,7 +45,7 @@ class GURL;
@property(nonatomic, readonly, strong) FaviconView* faviconView; @property(nonatomic, readonly, strong) FaviconView* faviconView;
// Container View for the faviconView. // Container View for the faviconView.
@property(nonatomic, readonly, strong) UIImageView* faviconContainerView; @property(nonatomic, readonly, strong) UIView* faviconContainerView;
// The image view used to display the favicon badge. // The image view used to display the favicon badge.
@property(nonatomic, readonly, strong) @property(nonatomic, readonly, strong)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_url_cell_favicon_badge_view.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_url_cell_favicon_badge_view.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#include "ios/chrome/browser/ui/util/ui_util.h" #include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/ui/colors/UIColor+cr_semantic_colors.h" #import "ios/chrome/common/ui/colors/UIColor+cr_semantic_colors.h"
...@@ -24,15 +25,18 @@ ...@@ -24,15 +25,18 @@
namespace { namespace {
// The width and height of the favicon ImageView. // The width and height of the favicon ImageView.
const CGFloat kFaviconWidth = 16; const CGFloat kFaviconWidth = 16;
// The legacy width and height of the favicon container view.
const CGFloat kFaviconContainerLegacyWidth = 28;
// The width and height of the favicon container view. // The width and height of the favicon container view.
const CGFloat kFaviconContainerWidth = 28; const CGFloat kFaviconContainerWidth = 30;
// Default delimiter to use between the hostname and the supplemental URL text // Default delimiter to use between the hostname and the supplemental URL text
// if text is specified but not the delimiter. // if text is specified but not the delimiter.
const char kDefaultSupplementalURLTextDelimiter[] = "•"; const char kDefaultSupplementalURLTextDelimiter[] = "•";
} // Corner radius of the favicon ImageView.
const CGFloat kFavIconCornerRadius = 7.0;
#pragma mark - TableViewURLCellFaviconBadgeView // Width of the favicon border ImageView.
const CGFloat kFavIconBorderWidth = 1.5;
} // namespace
#pragma mark - TableViewURLItem #pragma mark - TableViewURLItem
...@@ -134,14 +138,24 @@ const char kDefaultSupplementalURLTextDelimiter[] = "•"; ...@@ -134,14 +138,24 @@ const char kDefaultSupplementalURLTextDelimiter[] = "•";
- (instancetype)initWithStyle:(UITableViewCellStyle)style - (instancetype)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString*)reuseIdentifier { reuseIdentifier:(NSString*)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) { if (self) {
UIImage* containerBackground = if (base::FeatureList::IsEnabled(kSettingsRefresh)) {
[[UIImage imageNamed:@"table_view_cell_favicon_background"] _faviconContainerView = [[UIView alloc] init];
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; _faviconContainerView.layer.borderColor =
_faviconContainerView = [UIColor colorNamed:kFaviconBackgroundColor].CGColor;
[[UIImageView alloc] initWithImage:containerBackground]; _faviconContainerView.layer.borderWidth = kFavIconBorderWidth;
_faviconContainerView.tintColor = _faviconContainerView.layer.cornerRadius = kFavIconCornerRadius;
[UIColor colorNamed:kFaviconBackgroundColor]; _faviconContainerView.layer.masksToBounds = YES;
} else {
UIImage* containerBackground =
[[UIImage imageNamed:@"table_view_cell_favicon_background"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
_faviconContainerView =
[[UIImageView alloc] initWithImage:containerBackground];
_faviconContainerView.tintColor =
[UIColor colorNamed:kFaviconBackgroundColor];
}
_faviconView = [[FaviconView alloc] init]; _faviconView = [[FaviconView alloc] init];
_faviconView.contentMode = UIViewContentModeScaleAspectFit; _faviconView.contentMode = UIViewContentModeScaleAspectFit;
...@@ -220,9 +234,12 @@ const char kDefaultSupplementalURLTextDelimiter[] = "•"; ...@@ -220,9 +234,12 @@ const char kDefaultSupplementalURLTextDelimiter[] = "•";
[_faviconView.centerXAnchor [_faviconView.centerXAnchor
constraintEqualToAnchor:_faviconContainerView.centerXAnchor], constraintEqualToAnchor:_faviconContainerView.centerXAnchor],
[_faviconContainerView.heightAnchor [_faviconContainerView.heightAnchor
constraintEqualToConstant:kFaviconContainerWidth], constraintEqualToConstant:base::FeatureList::IsEnabled(
kSettingsRefresh)
? kFaviconContainerWidth
: kFaviconContainerLegacyWidth],
[_faviconContainerView.widthAnchor [_faviconContainerView.widthAnchor
constraintEqualToConstant:kFaviconContainerWidth], constraintEqualToAnchor:_faviconContainerView.heightAnchor],
[_faviconContainerView.leadingAnchor [_faviconContainerView.leadingAnchor
constraintEqualToAnchor:self.contentView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor
constant:kTableViewHorizontalSpacing], constant:kTableViewHorizontalSpacing],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment