Commit 3b2f3d5d authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Fade in the toolbar separator on iPad NTP

This CL changes the separator displayed on the iPad NTP. Instead of
being always visible the separator is now fade in when the fake
omnibox is reaching the real omnibox.

Bug: 968520
Change-Id: I5421094499a57d023d1a5c533bab68a4a76b6e95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643570
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665937}
parent b36394ca
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
@property(nonatomic, strong, readonly) ToolbarToolsMenuButton* toolsMenuButton; @property(nonatomic, strong, readonly) ToolbarToolsMenuButton* toolsMenuButton;
// Button to display the tools menu. // Button to display the tools menu.
@property(nonatomic, strong, readonly) ToolbarButton* omniboxButton; @property(nonatomic, strong, readonly) ToolbarButton* omniboxButton;
// Separator between the toolbar and the content.
@property(nonatomic, strong, readonly) UIView* separator;
@end @end
......
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
// Progress bar displayed below the toolbar, redefined as readwrite. // Progress bar displayed below the toolbar, redefined as readwrite.
@property(nonatomic, strong, readwrite) ToolbarProgressBar* progressBar; @property(nonatomic, strong, readwrite) ToolbarProgressBar* progressBar;
// Separator below the toolbar, redefined as readwrite.
@property(nonatomic, strong, readwrite) UIView* separator;
#pragma mark** Buttons in the leading stack view. ** #pragma mark** Buttons in the leading stack view. **
// Button to navigate back, redefined as readwrite. // Button to navigate back, redefined as readwrite.
@property(nonatomic, strong, readwrite) ToolbarButton* backButton; @property(nonatomic, strong, readwrite) ToolbarButton* backButton;
...@@ -151,21 +154,7 @@ ...@@ -151,21 +154,7 @@
[self setUpLocationBar]; [self setUpLocationBar];
[self setUpProgressBar]; [self setUpProgressBar];
[self setUpCollapsedToolbarButton]; [self setUpCollapsedToolbarButton];
[self setUpSeparator];
// Add the separator here as there is no need to have a property.
UIView* separator = [[UIView alloc] init];
separator.backgroundColor = [UIColor colorWithWhite:0
alpha:kToolbarSeparatorAlpha];
separator.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:separator];
[NSLayoutConstraint activateConstraints:@[
[separator.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[separator.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
[separator.topAnchor constraintEqualToAnchor:self.bottomAnchor],
[separator.heightAnchor
constraintEqualToConstant:ui::AlignValueToUpperPixel(
kToolbarSeparatorHeight)],
]];
[self setUpConstraints]; [self setUpConstraints];
} }
...@@ -322,6 +311,15 @@ ...@@ -322,6 +311,15 @@
[self addSubview:self.collapsedToolbarButton]; [self addSubview:self.collapsedToolbarButton];
} }
// Sets the separator up.
- (void)setUpSeparator {
self.separator = [[UIView alloc] init];
self.separator.backgroundColor =
[UIColor colorWithWhite:0 alpha:kToolbarSeparatorAlpha];
self.separator.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:self.separator];
}
// Sets the constraints up. // Sets the constraints up.
- (void)setUpConstraints { - (void)setUpConstraints {
id<LayoutGuideProvider> safeArea = self.safeAreaLayoutGuide; id<LayoutGuideProvider> safeArea = self.safeAreaLayoutGuide;
...@@ -329,6 +327,16 @@ ...@@ -329,6 +327,16 @@
self.contractedConstraints = [NSMutableArray array]; self.contractedConstraints = [NSMutableArray array];
self.contractedNoMarginConstraints = [NSMutableArray array]; self.contractedNoMarginConstraints = [NSMutableArray array];
// Separator constraints.
[NSLayoutConstraint activateConstraints:@[
[self.separator.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[self.separator.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
[self.separator.topAnchor constraintEqualToAnchor:self.bottomAnchor],
[self.separator.heightAnchor
constraintEqualToConstant:ui::AlignValueToUpperPixel(
kToolbarSeparatorHeight)],
]];
// Leading StackView constraints // Leading StackView constraints
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[self.leadingStackView.leadingAnchor [self.leadingStackView.leadingAnchor
......
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
(progress - 1)); (progress - 1));
} }
self.view.locationBarContainer.alpha = progress; self.view.locationBarContainer.alpha = progress;
self.view.separator.alpha = progress;
// When the locationBarContainer is hidden, show the |fakeOmniboxTarget|. // When the locationBarContainer is hidden, show the |fakeOmniboxTarget|.
if (progress == 0 && !self.view.fakeOmniboxTarget) { if (progress == 0 && !self.view.fakeOmniboxTarget) {
......
...@@ -34,6 +34,9 @@ const CGFloat kToolsMenuOffset = -7; ...@@ -34,6 +34,9 @@ const CGFloat kToolsMenuOffset = -7;
// The blur visual effect view, redefined as readwrite. // The blur visual effect view, redefined as readwrite.
@property(nonatomic, strong, readwrite) UIView* blur; @property(nonatomic, strong, readwrite) UIView* blur;
// Separator above the toolbar, redefined as readwrite.
@property(nonatomic, strong, readwrite) UIView* separator;
// The stack view containing the buttons. // The stack view containing the buttons.
@property(nonatomic, strong) UIStackView* stackView; @property(nonatomic, strong) UIStackView* stackView;
...@@ -145,11 +148,11 @@ const CGFloat kToolsMenuOffset = -7; ...@@ -145,11 +148,11 @@ const CGFloat kToolsMenuOffset = -7;
self.toolsMenuButton self.toolsMenuButton
]; ];
UIView* separator = [[UIView alloc] init]; self.separator = [[UIView alloc] init];
separator.backgroundColor = [UIColor colorWithWhite:0 self.separator.backgroundColor =
alpha:kToolbarSeparatorAlpha]; [UIColor colorWithWhite:0 alpha:kToolbarSeparatorAlpha];
separator.translatesAutoresizingMaskIntoConstraints = NO; self.separator.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:separator]; [self addSubview:self.separator];
self.stackView = self.stackView =
[[UIStackView alloc] initWithArrangedSubviews:self.allButtons]; [[UIStackView alloc] initWithArrangedSubviews:self.allButtons];
...@@ -170,10 +173,10 @@ const CGFloat kToolsMenuOffset = -7; ...@@ -170,10 +173,10 @@ const CGFloat kToolsMenuOffset = -7;
constraintEqualToAnchor:self.topAnchor constraintEqualToAnchor:self.topAnchor
constant:kBottomButtonsBottomMargin], constant:kBottomButtonsBottomMargin],
[separator.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], [self.separator.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[separator.trailingAnchor constraintEqualToAnchor:self.trailingAnchor], [self.separator.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
[separator.bottomAnchor constraintEqualToAnchor:self.topAnchor], [self.separator.bottomAnchor constraintEqualToAnchor:self.topAnchor],
[separator.heightAnchor [self.separator.heightAnchor
constraintEqualToConstant:ui::AlignValueToUpperPixel( constraintEqualToConstant:ui::AlignValueToUpperPixel(
kToolbarSeparatorHeight)], kToolbarSeparatorHeight)],
]]; ]];
......
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