forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This CL makes visual improvements to the toolbar inside the tab grid. - The toolbar is overlaid the tab grid, with a dark blur effect view. - The toolbar properly responds to status bar height changes (such as in-call status, or horizontal no status bar). - The tab grid contents properly inset according to status bar height changes. Screenshots: https://drive.google.com/open?id=0BwS6YyQeisH5MHM4czh6akxwWDQ BUG=686770 Review-Url: https://codereview.chromium.org/2723453003 Cr-Commit-Position: refs/heads/master@{#457783}
- Loading branch information
Showing
5 changed files
with
107 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_TOOLBAR_H_ | ||
#define IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_TOOLBAR_H_ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
// The toolbar in the tab grid, which has a done button, incognito button, and | ||
// an overflow menu button. The toolbar has an intrinsic height, and its buttons | ||
// are anchored to the bottom of the toolbar, should the parent set a larger | ||
// frame on the toolbar. The toolbar has a dark blur visual effect as the | ||
// background. | ||
@interface TabGridToolbar : UIView | ||
@end | ||
|
||
#endif // IOS_CLEAN_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_TOOLBAR_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.h" | ||
|
||
#import "ios/clean/chrome/browser/ui/tab_grid/ui_stack_view+cr_tab_grid.h" | ||
|
||
#if !defined(__has_feature) || !__has_feature(objc_arc) | ||
#error "This file requires ARC support." | ||
#endif | ||
|
||
namespace { | ||
const CGFloat kToolbarHeight = 44.0f; | ||
} | ||
|
||
@implementation TabGridToolbar | ||
|
||
- (instancetype)init { | ||
if (self = [super init]) { | ||
UIVisualEffect* blurEffect = | ||
[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; | ||
UIVisualEffectView* toolbarView = | ||
[[UIVisualEffectView alloc] initWithEffect:blurEffect]; | ||
toolbarView.autoresizingMask = | ||
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; | ||
[self addSubview:toolbarView]; | ||
|
||
UIStackView* toolbarContent = [UIStackView cr_tabGridToolbarStackView]; | ||
[toolbarView.contentView addSubview:toolbarContent]; | ||
|
||
// Sets the stackview to a fixed height, anchored to the bottom of the | ||
// blur view. | ||
toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; | ||
[NSLayoutConstraint activateConstraints:@[ | ||
[toolbarContent.heightAnchor constraintEqualToConstant:kToolbarHeight], | ||
[toolbarContent.leadingAnchor | ||
constraintEqualToAnchor:toolbarView.contentView.leadingAnchor], | ||
[toolbarContent.trailingAnchor | ||
constraintEqualToAnchor:toolbarView.contentView.trailingAnchor], | ||
[toolbarContent.bottomAnchor | ||
constraintEqualToAnchor:toolbarView.contentView.bottomAnchor] | ||
]]; | ||
} | ||
return self; | ||
} | ||
|
||
#pragma mark - UIView | ||
|
||
// Returns an intrinsic height so that explicit height constraints are | ||
// not necessary. Status bar conditional logic can be set using this | ||
// intrinsic size. | ||
- (CGSize)intrinsicContentSize { | ||
return CGSizeMake(UIViewNoIntrinsicMetric, kToolbarHeight); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters