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