Commit 90ed0473 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Changes ChromeTableView Section header and separation height.

- Adds a constraint to make Section headers height at least 44.
- Adds a separation of 9 between tableview sections.

Screenshot:
https://drive.google.com/open?id=1wKgKV4UOpc4JhZYrlxtkv3mTtCwPATyZ

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I3d86eb345e901e8c39c39bfcc78a697c65ed745e
Reviewed-on: https://chromium-review.googlesource.com/1084324
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565129}
parent 0b449f8e
...@@ -52,6 +52,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -52,6 +52,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
const NSInteger kEntriesStatusSectionIdentifier = kSectionIdentifierEnumZero; const NSInteger kEntriesStatusSectionIdentifier = kSectionIdentifierEnumZero;
// Maximum number of entries to retrieve in a single query to history service. // Maximum number of entries to retrieve in a single query to history service.
const int kMaxFetchCount = 100; const int kMaxFetchCount = 100;
// Separation space between sections.
const CGFloat kSeparationSpaceBetweenSections = 9;
} }
@interface HistoryTableViewController ()<HistoryEntriesStatusItemDelegate, @interface HistoryTableViewController ()<HistoryEntriesStatusItemDelegate,
...@@ -422,6 +424,11 @@ const int kMaxFetchCount = 100; ...@@ -422,6 +424,11 @@ const int kMaxFetchCount = 100;
return UITableViewAutomaticDimension; return UITableViewAutomaticDimension;
} }
- (CGFloat)tableView:(UITableView*)tableView
heightForFooterInSection:(NSInteger)section {
return kSeparationSpaceBetweenSections;
}
- (void)tableView:(UITableView*)tableView - (void)tableView:(UITableView*)tableView
didSelectRowAtIndexPath:(NSIndexPath*)indexPath { didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
DCHECK_EQ(tableView, self.tableView); DCHECK_EQ(tableView, self.tableView);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h" #import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#import "ios/chrome/browser/ui/history/history_ui_constants.h" #import "ios/chrome/browser/ui/history/history_ui_constants.h"
#import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_constants.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_constants.h"
#import "ios/chrome/browser/ui/table_view/table_view_model.h"
#import "ios/chrome/browser/ui/table_view/table_view_navigation_controller_constants.h" #import "ios/chrome/browser/ui/table_view/table_view_navigation_controller_constants.h"
#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/ui/ui_util.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
...@@ -72,8 +73,13 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -72,8 +73,13 @@ id<GREYMatcher> TitleOfTestPage() {
web::test::HttpServer::MakeUrl(kURLOfTestPage), web::test::HttpServer::MakeUrl(kURLOfTestPage),
std::string(kHTMLOfTestPage), std::string(kHTMLOfTestPage),
}}); }});
[NSUserDefaults.standardUserDefaults setObject:@{} if (IsUIRefreshPhase1Enabled()) {
forKey:kCollapsedSectionsKey]; [NSUserDefaults.standardUserDefaults setObject:@{}
forKey:kTableViewModelCollapsedKey];
} else {
[NSUserDefaults.standardUserDefaults setObject:@{}
forKey:kCollapsedSectionsKey];
}
} }
// Closes the recent tabs panel. // Closes the recent tabs panel.
...@@ -197,7 +203,8 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -197,7 +203,8 @@ id<GREYMatcher> TitleOfTestPage() {
l10n_util::GetNSString(IDS_IOS_RECENT_TABS_OTHER_DEVICES); l10n_util::GetNSString(IDS_IOS_RECENT_TABS_OTHER_DEVICES);
id<GREYMatcher> otherDevicesMatcher = id<GREYMatcher> otherDevicesMatcher =
IsUIRefreshPhase1Enabled() IsUIRefreshPhase1Enabled()
? grey_accessibilityLabel(otherDevicesLabel) ? grey_allOf(grey_accessibilityLabel(otherDevicesLabel),
grey_sufficientlyVisible(), nil)
: chrome_test_util::ButtonWithAccessibilityLabel(otherDevicesLabel); : chrome_test_util::ButtonWithAccessibilityLabel(otherDevicesLabel);
[[EarlGrey selectElementWithMatcher:otherDevicesMatcher] [[EarlGrey selectElementWithMatcher:otherDevicesMatcher]
performAction:grey_tap()]; performAction:grey_tap()];
......
...@@ -85,6 +85,8 @@ NSString* const kOtherDeviceCollapsedKey = @"OtherDevicesCollapsed"; ...@@ -85,6 +85,8 @@ NSString* const kOtherDeviceCollapsedKey = @"OtherDevicesCollapsed";
NSString* const kRecentlyClosedCollapsedKey = @"RecentlyClosedCollapsed"; NSString* const kRecentlyClosedCollapsedKey = @"RecentlyClosedCollapsed";
// Estimated Table Row height. // Estimated Table Row height.
const CGFloat kEstimatedRowHeight = 56; const CGFloat kEstimatedRowHeight = 56;
// Separation space between sections.
const CGFloat kSeparationSpaceBetweenSections = 9;
// The UI displays relative time for up to this number of hours and then // The UI displays relative time for up to this number of hours and then
// switches to absolute values. // switches to absolute values.
const int kRelativeTimeMaxHours = 4; const int kRelativeTimeMaxHours = 4;
...@@ -618,6 +620,16 @@ const int kRelativeTimeMaxHours = 4; ...@@ -618,6 +620,16 @@ const int kRelativeTimeMaxHours = 4;
} }
} }
- (CGFloat)tableView:(UITableView*)tableView
heightForFooterInSection:(NSInteger)section {
// If section is collapsed there's no need to add a separation space.
return [self.tableViewModel
sectionIsCollapsed:[self.tableViewModel
sectionIdentifierForSection:section]]
? 1.0
: kSeparationSpaceBetweenSections;
}
#pragma mark - UITableViewDataSource #pragma mark - UITableViewDataSource
- (UITableViewCell*)tableView:(UITableView*)tableView - (UITableViewCell*)tableView:(UITableView*)tableView
...@@ -669,12 +681,6 @@ const int kRelativeTimeMaxHours = 4; ...@@ -669,12 +681,6 @@ const int kRelativeTimeMaxHours = 4;
return iter->get(); return iter->get();
} }
// TO IMPLEMENT. Remove this depending on which TableStyle we'll use.
- (CGFloat)tableView:(UITableView*)tableView
heightForFooterInSection:(NSInteger)section {
return 1.0;
}
// Retrieves favicon from FaviconLoader and sets image in URLCell. // Retrieves favicon from FaviconLoader and sets image in URLCell.
- (void)loadFaviconForCell:(UITableViewCell*)cell - (void)loadFaviconForCell:(UITableViewCell*)cell
indexPath:(NSIndexPath*)indexPath { indexPath:(NSIndexPath*)indexPath {
......
...@@ -87,6 +87,8 @@ ...@@ -87,6 +87,8 @@
// Set and activate constraints. // Set and activate constraints.
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[self.contentView.heightAnchor constraintGreaterThanOrEqualToConstant:
kTableViewHeaderFooterViewHeight],
[horizontalStack.leadingAnchor [horizontalStack.leadingAnchor
constraintEqualToAnchor:self.contentView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor
constant:kTableViewHorizontalSpacing], constant:kTableViewHorizontalSpacing],
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
// The minimum height for a TableViewHeaderFooterView.
extern const CGFloat kTableViewHeaderFooterViewHeight;
// The horizontal spacing between views and the container view of a cell. // The horizontal spacing between views and the container view of a cell.
extern const CGFloat kTableViewHorizontalSpacing; extern const CGFloat kTableViewHorizontalSpacing;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
const CGFloat kTableViewHeaderFooterViewHeight = 44.0;
const CGFloat kTableViewHorizontalSpacing = 16.0; const CGFloat kTableViewHorizontalSpacing = 16.0;
const CGFloat kTableViewVerticalSpacing = 8.0; const CGFloat kTableViewVerticalSpacing = 8.0;
const CGFloat kTableViewSubViewHorizontalSpacing = 12.0; const CGFloat kTableViewSubViewHorizontalSpacing = 12.0;
......
...@@ -111,6 +111,8 @@ constexpr float kRotationNinetyCCW = -(90 / 180.0) * M_PI; ...@@ -111,6 +111,8 @@ constexpr float kRotationNinetyCCW = -(90 / 180.0) * M_PI;
// Set and activate constraints. // Set and activate constraints.
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[self.contentView.heightAnchor constraintGreaterThanOrEqualToConstant:
kTableViewHeaderFooterViewHeight],
[horizontalStack.leadingAnchor [horizontalStack.leadingAnchor
constraintEqualToAnchor:self.contentView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor
constant:kTableViewHorizontalSpacing], constant:kTableViewHorizontalSpacing],
......
...@@ -84,6 +84,8 @@ ...@@ -84,6 +84,8 @@
// Set and activate constraints. // Set and activate constraints.
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
// Container Constraints. // Container Constraints.
[self.contentView.heightAnchor constraintGreaterThanOrEqualToConstant:
kTableViewHeaderFooterViewHeight],
[containerView.leadingAnchor [containerView.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