Commit 416fb111 authored by Eugene But's avatar Eugene But Committed by Commit Bot

[ios] Add fade in and fade out Pull To Action animation to Identity Disk

This CL adds Identity Disk to toolbar view instead of header view.
Pull To Action UI uses toolbar view screenshot for fade in and fade out
animations, which creates smoother transition experience.

Bug: 1022441
Change-Id: Ib6aeecdb04143c362041246897f78eac2e741ac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986242Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Auto-Submit: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732918}
parent a0616dcc
......@@ -68,9 +68,6 @@ CGFloat ToolbarHeight() {
@property(nonatomic, strong) NSLayoutConstraint* fakeToolbarTopConstraint;
@property(nonatomic, strong) NSLayoutConstraint* hintLabelLeadingConstraint;
@property(nonatomic, strong) NSLayoutConstraint* voiceSearchTrailingConstraint;
// Layout constraints for Identity Disc that need to be adjusted based on
// device size class changes.
@property(nonatomic, strong) NSLayoutConstraint* identityDiscTopConstraint;
// Layout constraint for the invisible button that is where the omnibox should
// be and that focuses the omnibox when tapped.
@property(nonatomic, strong) NSLayoutConstraint* invisibleOmniboxConstraint;
......@@ -108,23 +105,19 @@ CGFloat ToolbarHeight() {
- (void)setIdentityDiscView:(UIView*)identityDiscView {
DCHECK(identityDiscView);
_identityDiscView = identityDiscView;
[self addSubview:_identityDiscView];
[self.toolBarView addSubview:_identityDiscView];
// Sets the layout constraints for size of Identity Disc and the placement
// based on whether there is a top toolbar or not.
// Sets the layout constraints for size of Identity Disc and toolbar.
self.identityDiscView.translatesAutoresizingMaskIntoConstraints = NO;
id<LayoutGuideProvider> layoutGuide = self.safeAreaLayoutGuide;
self.identityDiscTopConstraint = [self.identityDiscView.topAnchor
constraintEqualToAnchor:self.topAnchor
constant:self.safeAreaInsets.top];
CGFloat dimension =
ntp_home::kIdentityAvatarDimension + 2 * ntp_home::kIdentityAvatarMargin;
[NSLayoutConstraint activateConstraints:@[
[self.identityDiscView.heightAnchor constraintEqualToConstant:dimension],
[self.identityDiscView.widthAnchor constraintEqualToConstant:dimension],
[self.identityDiscView.trailingAnchor
constraintEqualToAnchor:layoutGuide.trailingAnchor],
self.identityDiscTopConstraint
constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor],
[self.identityDiscView.topAnchor
constraintEqualToAnchor:self.toolBarView.topAnchor],
]];
}
......@@ -403,7 +396,6 @@ CGFloat ToolbarHeight() {
}
- (void)updateForTopSafeAreaInset:(CGFloat)topSafeAreaInset {
self.identityDiscTopConstraint.constant = topSafeAreaInset;
self.invisibleOmniboxConstraint.constant = topSafeAreaInset;
}
......
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