Commit a80bd36e authored by edchin's avatar edchin Committed by Commit Bot

[ios] Dark theme remote tabs

Bug: 804589
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ic87877e2e9c3e1a8ddf619abea5fb83af250f7ea
Reviewed-on: https://chromium-review.googlesource.com/1089821
Commit-Queue: edchin <edchin@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565476}
parent 8734e10b
......@@ -442,6 +442,8 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
// The styler must be set before the view controller is loaded.
ChromeTableViewStyler* styler = [[ChromeTableViewStyler alloc] init];
styler.tableViewBackgroundColor = UIColorFromRGB(kGridBackgroundColor);
styler.cellTitleColor = UIColorFromRGB(kGridDarkThemeCellTitleColor);
styler.headerFooterTitleColor = UIColorFromRGB(kGridDarkThemeCellTitleColor);
self.remoteTabsViewController.styler = styler;
UIView* contentView = self.scrollContentView;
......
......@@ -29,15 +29,16 @@
- (void)configureHeaderFooterView:(UITableViewHeaderFooterView*)headerFooter
withStyler:(ChromeTableViewStyler*)styler {
[super configureHeaderFooterView:headerFooter withStyler:styler];
// Set the contentView backgroundColor, not the header's.
headerFooter.contentView.backgroundColor = styler.tableViewBackgroundColor;
TableViewActivityIndicatorHeaderFooterView* header =
base::mac::ObjCCastStrict<TableViewActivityIndicatorHeaderFooterView>(
headerFooter);
header.titleLabel.text = self.text;
header.subtitleLabel.text = self.subtitleText;
// Use colors from styler if available.
if (styler.tableViewBackgroundColor)
header.contentView.backgroundColor = styler.tableViewBackgroundColor;
if (styler.headerFooterTitleColor)
header.titleLabel.textColor = styler.headerFooterTitleColor;
}
@end
......
......@@ -37,10 +37,6 @@ constexpr float kRotationNinetyCCW = -(90 / 180.0) * M_PI;
- (void)configureHeaderFooterView:(UITableViewHeaderFooterView*)headerFooter
withStyler:(ChromeTableViewStyler*)styler {
[super configureHeaderFooterView:headerFooter withStyler:styler];
// Set the contentView backgroundColor, not the header's.
headerFooter.contentView.backgroundColor = styler.tableViewBackgroundColor;
TableViewDisclosureHeaderFooterView* header =
base::mac::ObjCCastStrict<TableViewDisclosureHeaderFooterView>(
headerFooter);
......@@ -49,6 +45,11 @@ constexpr float kRotationNinetyCCW = -(90 / 180.0) * M_PI;
DisclosureDirection direction =
self.collapsed ? DisclosureDirectionUp : DisclosureDirectionDown;
[header setInitialDirection:direction];
// Use colors from styler if available.
if (styler.tableViewBackgroundColor)
header.contentView.backgroundColor = styler.tableViewBackgroundColor;
if (styler.headerFooterTitleColor)
header.titleLabel.textColor = styler.headerFooterTitleColor;
}
@end
......
......@@ -7,6 +7,7 @@
#include "base/mac/foundation_util.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -41,6 +42,8 @@ const CGFloat kMargin = 16;
cell.signinPromoView.textLabel.text = self.text;
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[self.configurator configureSigninPromoView:cell.signinPromoView];
if (styler.cellTitleColor)
cell.signinPromoView.textLabel.textColor = styler.cellTitleColor;
}
@end
......
......@@ -22,6 +22,8 @@ typedef NS_ENUM(UInt32, TextItemColor) {
@property(nonatomic, assign) NSTextAlignment textAlignment;
// Hex color for the cell's textLabel. Default is TextItemColorLightGrey.
// ChromeTableViewStyler's |cellTitleColor| takes precedence over the default
// color, but not over |textColor|.
@property(nonatomic, assign) TextItemColor textColor;
@property(nonatomic, readwrite, strong) NSString* text;
......
......@@ -35,9 +35,13 @@
base::mac::ObjCCastStrict<TableViewTextCell>(tableCell);
cell.textLabel.text = self.text;
cell.textLabel.backgroundColor = styler.tableViewBackgroundColor;
cell.textLabel.textColor = self.textColor
? UIColorFromRGB(self.textColor, 1.0)
: UIColorFromRGB(TextItemColorLightGrey, 1.0);
// This item's text color takes precedence over the global styler.
if (self.textColor)
cell.textLabel.textColor = UIColorFromRGB(self.textColor);
else if (styler.cellTitleColor)
cell.textLabel.textColor = styler.cellTitleColor;
else
cell.textLabel.textColor = UIColorFromRGB(TextItemColorLightGrey);
cell.textLabel.textAlignment =
self.textAlignment ? self.textAlignment : NSTextAlignmentLeft;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
......
......@@ -52,13 +52,17 @@ const CGFloat kFaviconContainerWidth = 28;
}
cell.metadataLabel.text = self.metadata;
cell.metadataLabel.hidden = ([self.metadata length] == 0);
cell.cellUniqueIdentifier = self.uniqueIdentifier;
cell.accessibilityTraits |= UIAccessibilityTraitButton;
// Use colors from styler if available.
if (styler.tableViewBackgroundColor) {
cell.faviconContainerView.backgroundColor = styler.tableViewBackgroundColor;
cell.titleLabel.backgroundColor = styler.tableViewBackgroundColor;
cell.URLLabel.backgroundColor = styler.tableViewBackgroundColor;
cell.metadataLabel.backgroundColor = styler.tableViewBackgroundColor;
cell.accessibilityTraits |= UIAccessibilityTraitButton;
}
if (styler.cellTitleColor)
cell.titleLabel.textColor = styler.cellTitleColor;
}
- (NSString*)uniqueIdentifier {
......
......@@ -13,6 +13,9 @@
// opaque color, cells can choose to make themselves opaque and draw their own
// background as a performance optimization.
@property(nonatomic, readwrite, strong) UIColor* tableViewBackgroundColor;
// Text colors.
@property(nonatomic, readwrite, strong) UIColor* cellTitleColor;
@property(nonatomic, readwrite, strong) UIColor* headerFooterTitleColor;
@end
......
......@@ -11,6 +11,8 @@
@implementation ChromeTableViewStyler
@synthesize tableViewBackgroundColor = _tableViewBackgroundColor;
@synthesize cellTitleColor = _cellTitleColor;
@synthesize headerFooterTitleColor = _headerFooterTitleColor;
- (instancetype)init {
if ((self = [super init])) {
......
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