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;
// GridCell dimensions.
extern const CGFloat kGridCellCornerRadius;
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 kGridCellHeaderLeadingInset;
extern const CGFloat kGridCellHeaderTrailingInset;
......
......@@ -12,6 +12,7 @@
#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/transitions/grid_transition_layout.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -64,7 +65,7 @@ NSIndexPath* CreateIndexPath(NSInteger index) {
forCellWithReuseIdentifier:kCellIdentifier];
collectionView.dataSource = self;
collectionView.delegate = self;
collectionView.backgroundColor = [UIColor blackColor];
collectionView.backgroundColor = UIColorFromRGB(kGridBackgroundColor);
if (@available(iOS 11, *))
collectionView.contentInsetAdjustmentBehavior =
UIScrollViewContentInsetAdjustmentAlways;
......
......@@ -44,15 +44,9 @@
UIButton* leadingButton = [UIButton buttonWithType:UIButtonTypeSystem];
leadingButton.translatesAutoresizingMaskIntoConstraints = NO;
leadingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
leadingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
leadingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
UIButton* trailingButton = [UIButton buttonWithType:UIButtonTypeSystem];
trailingButton.translatesAutoresizingMaskIntoConstraints = NO;
trailingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleBody];
trailingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
trailingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
UIButton* centerButton = [UIButton buttonWithType:UIButtonTypeSystem];
centerButton.translatesAutoresizingMaskIntoConstraints = NO;
......
......@@ -14,6 +14,10 @@
// The color of the text buttons in the toolbars.
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.
extern const CGFloat kTabGridToolbarHorizontalInset;
......
......@@ -11,6 +11,10 @@
// The color of the text buttons in the toolbars.
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.
const CGFloat kTabGridToolbarHorizontalInset = 16.0f;
......
......@@ -45,9 +45,6 @@
UIButton* leadingButton = [UIButton buttonWithType:UIButtonTypeSystem];
leadingButton.translatesAutoresizingMaskIntoConstraints = NO;
leadingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
leadingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
leadingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
// The segmented control has an intrinsic size.
......@@ -56,9 +53,6 @@
UIButton* trailingButton = [UIButton buttonWithType:UIButtonTypeSystem];
trailingButton.translatesAutoresizingMaskIntoConstraints = NO;
trailingButton.titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleBody];
trailingButton.titleLabel.adjustsFontForContentSizeCategory = YES;
trailingButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor);
[toolbar.contentView addSubview:leadingButton];
......
......@@ -4,7 +4,6 @@
#import "ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.h"
#import "base/logging.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_consumer.h"
......@@ -14,6 +13,7 @@
#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_top_toolbar.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -371,6 +371,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
// Adds the remote tabs view controller as a contained view controller, and
// sets constraints.
- (void)setupRemoteTabsViewController {
// TODO(crbug.com/804588) : Create remote tabs.
UIView* contentView = self.scrollContentView;
UIViewController* viewController = self.remoteTabsViewController;
viewController.view.translatesAutoresizingMaskIntoConstraints = NO;
......@@ -401,7 +402,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
UILabel* topLabel = [[UILabel alloc] init];
topLabel.translatesAutoresizingMaskIntoConstraints = NO;
topLabel.text = l10n_util::GetNSString(titleStringID);
topLabel.textColor = [UIColor whiteColor];
topLabel.textColor = UIColorFromRGB(kTabGridEmptyStateTitleTextColor);
topLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2];
topLabel.adjustsFontForContentSizeCategory = YES;
topLabel.numberOfLines = 0;
......@@ -410,7 +411,7 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
UILabel* bottomLabel = [[UILabel alloc] init];
bottomLabel.translatesAutoresizingMaskIntoConstraints = NO;
bottomLabel.text = l10n_util::GetNSString(bodyStringID);
bottomLabel.textColor = [UIColor whiteColor];
bottomLabel.textColor = UIColorFromRGB(kTabGridEmptyStateBodyTextColor);
bottomLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
bottomLabel.adjustsFontForContentSizeCategory = YES;
bottomLabel.numberOfLines = 0;
......@@ -526,8 +527,8 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
self.topToolbar.trailingButton.hidden = YES;
self.bottomToolbar.hidden = NO;
self.floatingButton.hidden = YES;
self.doneButton = self.bottomToolbar.leadingButton;
self.closeAllButton = self.bottomToolbar.trailingButton;
self.doneButton = self.bottomToolbar.trailingButton;
self.closeAllButton = self.bottomToolbar.leadingButton;
self.newTabButton = self.bottomToolbar.centerButton;
break;
case TabGridConfigurationFloatingButton:
......@@ -557,6 +558,12 @@ typedef NS_ENUM(NSUInteger, TabGridConfiguration) {
[self.closeAllButton
setTitle:l10n_util::GetNSString(IDS_IOS_TAB_GRID_CLOSE_ALL_BUTTON)
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 addTarget:self
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