Commit 9c4d192f authored by edchin's avatar edchin Committed by Commit Bot

[ios] Miscellaneous polishing on tab grid

- sets grid background color
- sets colors for empty state
- switches done and close all buttons for bottom toolbar

Bug: 818198
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Iaae31633889c8f013c5ea1da59176f75186df434
Reviewed-on: https://chromium-review.googlesource.com/967278Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543850}
parent bc269b60
...@@ -41,7 +41,7 @@ extern const int kGridDarkThemeCellCloseButtonTintColor; ...@@ -41,7 +41,7 @@ extern const int kGridDarkThemeCellCloseButtonTintColor;
// GridCell dimensions. // GridCell dimensions.
extern const CGFloat kGridCellCornerRadius; extern const CGFloat kGridCellCornerRadius;
extern const CGFloat kGridCellIconCornerRadius; extern const CGFloat kGridCellIconCornerRadius;
// Height of the cell header containing the icon, title, and close button. // The cell header contains the icon, title, and close button.
extern const CGFloat kGridCellHeaderHeight; extern const CGFloat kGridCellHeaderHeight;
extern const CGFloat kGridCellHeaderLeadingInset; extern const CGFloat kGridCellHeaderLeadingInset;
extern const CGFloat kGridCellHeaderTrailingInset; extern const CGFloat kGridCellHeaderTrailingInset;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#import "ios/chrome/browser/ui/tab_grid/grid_item.h" #import "ios/chrome/browser/ui/tab_grid/grid_item.h"
#import "ios/chrome/browser/ui/tab_grid/grid_layout.h" #import "ios/chrome/browser/ui/tab_grid/grid_layout.h"
#import "ios/chrome/browser/ui/tab_grid/transitions/grid_transition_layout.h" #import "ios/chrome/browser/ui/tab_grid/transitions/grid_transition_layout.h"
#import "ios/chrome/browser/ui/uikit_ui_util.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."
...@@ -64,7 +65,7 @@ NSIndexPath* CreateIndexPath(NSInteger index) { ...@@ -64,7 +65,7 @@ NSIndexPath* CreateIndexPath(NSInteger index) {
forCellWithReuseIdentifier:kCellIdentifier]; forCellWithReuseIdentifier:kCellIdentifier];
collectionView.dataSource = self; collectionView.dataSource = self;
collectionView.delegate = self; collectionView.delegate = self;
collectionView.backgroundColor = [UIColor blackColor]; collectionView.backgroundColor = UIColorFromRGB(kGridBackgroundColor);
if (@available(iOS 11, *)) if (@available(iOS 11, *))
collectionView.contentInsetAdjustmentBehavior = collectionView.contentInsetAdjustmentBehavior =
UIScrollViewContentInsetAdjustmentAlways; UIScrollViewContentInsetAdjustmentAlways;
......
...@@ -44,15 +44,9 @@ ...@@ -44,15 +44,9 @@
UIButton* leadingButton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton* leadingButton = [UIButton buttonWithType:UIButtonTypeSystem];
leadingButton.translatesAutoresizingMaskIntoConstraints = NO; leadingButton.translatesAutoresizingMaskIntoConstraints = NO;
leadingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
leadingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
leadingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); leadingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
UIButton* trailingButton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton* trailingButton = [UIButton buttonWithType:UIButtonTypeSystem];
trailingButton.translatesAutoresizingMaskIntoConstraints = NO; trailingButton.translatesAutoresizingMaskIntoConstraints = NO;
trailingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleBody];
trailingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
trailingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); trailingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
UIButton* centerButton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton* centerButton = [UIButton buttonWithType:UIButtonTypeSystem];
centerButton.translatesAutoresizingMaskIntoConstraints = NO; centerButton.translatesAutoresizingMaskIntoConstraints = NO;
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
// The color of the text buttons in the toolbars. // The color of the text buttons in the toolbars.
extern const int kTabGridToolbarTextButtonColor; extern const int kTabGridToolbarTextButtonColor;
// Colors for the empty state.
extern const int kTabGridEmptyStateTitleTextColor;
extern const int kTabGridEmptyStateBodyTextColor;
// The distance the toolbar content is inset from either side. // The distance the toolbar content is inset from either side.
extern const CGFloat kTabGridToolbarHorizontalInset; extern const CGFloat kTabGridToolbarHorizontalInset;
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
// The color of the text buttons in the toolbars. // The color of the text buttons in the toolbars.
const int kTabGridToolbarTextButtonColor = 0xFFFFFF; const int kTabGridToolbarTextButtonColor = 0xFFFFFF;
// Colors for the empty state.
const int kTabGridEmptyStateTitleTextColor = 0xF8F9FA;
const int kTabGridEmptyStateBodyTextColor = 0xBDC1C6;
// The distance the toolbar content is inset from either side. // The distance the toolbar content is inset from either side.
const CGFloat kTabGridToolbarHorizontalInset = 16.0f; const CGFloat kTabGridToolbarHorizontalInset = 16.0f;
......
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
UIButton* leadingButton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton* leadingButton = [UIButton buttonWithType:UIButtonTypeSystem];
leadingButton.translatesAutoresizingMaskIntoConstraints = NO; leadingButton.translatesAutoresizingMaskIntoConstraints = NO;
leadingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
leadingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
leadingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); leadingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
// The segmented control has an intrinsic size. // The segmented control has an intrinsic size.
...@@ -56,9 +53,6 @@ ...@@ -56,9 +53,6 @@
UIButton* trailingButton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton* trailingButton = [UIButton buttonWithType:UIButtonTypeSystem];
trailingButton.translatesAutoresizingMaskIntoConstraints = NO; trailingButton.translatesAutoresizingMaskIntoConstraints = NO;
trailingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleBody];
trailingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
trailingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); trailingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
[toolbar.contentView addSubview:leadingButton]; [toolbar.contentView addSubview:leadingButton];
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#import "ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.h" #import "ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.h"
#import "base/logging.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#import "ios/chrome/browser/ui/tab_grid/grid_commands.h" #import "ios/chrome/browser/ui/tab_grid/grid_commands.h"
#import "ios/chrome/browser/ui/tab_grid/grid_consumer.h" #import "ios/chrome/browser/ui/tab_grid/grid_consumer.h"
...@@ -14,6 +13,7 @@ ...@@ -14,6 +13,7 @@
#import "ios/chrome/browser/ui/tab_grid/tab_grid_constants.h" #import "ios/chrome/browser/ui/tab_grid/tab_grid_constants.h"
#import "ios/chrome/browser/ui/tab_grid/tab_grid_page_control.h" #import "ios/chrome/browser/ui/tab_grid/tab_grid_page_control.h"
#import "ios/chrome/browser/ui/tab_grid/tab_grid_top_toolbar.h" #import "ios/chrome/browser/ui/tab_grid/tab_grid_top_toolbar.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -371,6 +371,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) { ...@@ -371,6 +371,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
// Adds the remote tabs view controller as a contained view controller, and // Adds the remote tabs view controller as a contained view controller, and
// sets constraints. // sets constraints.
- (void)setupRemoteTabsViewController { - (void)setupRemoteTabsViewController {
// TODO(crbug.com/804588) : Create remote tabs.
UIView* contentView = self.scrollContentView; UIView* contentView = self.scrollContentView;
UIViewController* viewController = self.remoteTabsViewController; UIViewController* viewController = self.remoteTabsViewController;
viewController.view.translatesAutoresizingMaskIntoConstraints = NO; viewController.view.translatesAutoresizingMaskIntoConstraints = NO;
...@@ -401,7 +402,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) { ...@@ -401,7 +402,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
UILabel* topLabel = [[UILabel alloc] init]; UILabel* topLabel = [[UILabel alloc] init];
topLabel.translatesAutoresizingMaskIntoConstraints = NO; topLabel.translatesAutoresizingMaskIntoConstraints = NO;
topLabel.text = l10n_util::GetNSString(titleStringID); topLabel.text = l10n_util::GetNSString(titleStringID);
topLabel.textColor = [UIColor whiteColor]; topLabel.textColor = UIColorFromRGB(kTabGridEmptyStateTitleTextColor);
topLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2]; topLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2];
topLabel.adjustsFontForContentSizeCategory = YES; topLabel.adjustsFontForContentSizeCategory = YES;
topLabel.numberOfLines = 0; topLabel.numberOfLines = 0;
...@@ -410,7 +411,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) { ...@@ -410,7 +411,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
UILabel* bottomLabel = [[UILabel alloc] init]; UILabel* bottomLabel = [[UILabel alloc] init];
bottomLabel.translatesAutoresizingMaskIntoConstraints = NO; bottomLabel.translatesAutoresizingMaskIntoConstraints = NO;
bottomLabel.text = l10n_util::GetNSString(bodyStringID); bottomLabel.text = l10n_util::GetNSString(bodyStringID);
bottomLabel.textColor = [UIColor whiteColor]; bottomLabel.textColor = UIColorFromRGB(kTabGridEmptyStateBodyTextColor);
bottomLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; bottomLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
bottomLabel.adjustsFontForContentSizeCategory = YES; bottomLabel.adjustsFontForContentSizeCategory = YES;
bottomLabel.numberOfLines = 0; bottomLabel.numberOfLines = 0;
...@@ -526,8 +527,8 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) { ...@@ -526,8 +527,8 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
self.topToolbar.trailingButton.hidden = YES; self.topToolbar.trailingButton.hidden = YES;
self.bottomToolbar.hidden = NO; self.bottomToolbar.hidden = NO;
self.floatingButton.hidden = YES; self.floatingButton.hidden = YES;
self.doneButton = self.bottomToolbar.leadingButton; self.doneButton = self.bottomToolbar.trailingButton;
self.closeAllButton = self.bottomToolbar.trailingButton; self.closeAllButton = self.bottomToolbar.leadingButton;
self.newTabButton = self.bottomToolbar.centerButton; self.newTabButton = self.bottomToolbar.centerButton;
break; break;
case TabGridConfigurationFloatingButton: case TabGridConfigurationFloatingButton:
...@@ -557,6 +558,12 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) { ...@@ -557,6 +558,12 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
[self.closeAllButton [self.closeAllButton
setTitle:l10n_util::GetNSString(IDS_IOS_TAB_GRID_CLOSE_ALL_BUTTON) setTitle:l10n_util::GetNSString(IDS_IOS_TAB_GRID_CLOSE_ALL_BUTTON)
forState:UIControlStateNormal]; forState:UIControlStateNormal];
self.doneButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
self.closeAllButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleBody];
self.doneButton.titleLabel.adjustsFontForContentSizeCategory = YES;
self.closeAllButton.titleLabel.adjustsFontForContentSizeCategory = YES;
self.doneButton.accessibilityIdentifier = kTabGridDoneButtonAccessibilityID; self.doneButton.accessibilityIdentifier = kTabGridDoneButtonAccessibilityID;
[self.doneButton addTarget:self [self.doneButton addTarget:self
action:@selector(doneButtonTapped:) action:@selector(doneButtonTapped:)
......
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