Commit 6d4ada06 authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

[ios] Adds MDCAppBar support to ChromeTableViewController.

Initially appbar support was added to SettingsRootTableViewController,
as that was the only view controller which needed it.  But now, we
expect to support MDCAppBar in bookmarks screens as well, so this CL
moves it to a common base class.  We follow the pattern set by
CollectionViewController and include an appBarStyle parameter which
determines whether or not an MDCAppBar is created.

BUG=839439,839450,839460

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I057b15113987d91451ca3a104aba95dd17667cda
Reviewed-on: https://chromium-review.googlesource.com/1043006
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555892}
parent f28e1c43
...@@ -29,6 +29,13 @@ class ChromeBrowserState; ...@@ -29,6 +29,13 @@ class ChromeBrowserState;
// Delegate for this HistoryTableView. // Delegate for this HistoryTableView.
@property(nonatomic, weak) id<HistoryLocalCommands> localDispatcher; @property(nonatomic, weak) id<HistoryLocalCommands> localDispatcher;
// Initializers.
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTableViewStyle:(UITableViewStyle)style
appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE;
@end @end
#endif // IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_TABLE_VIEW_CONTROLLER_H_ #endif // IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_TABLE_VIEW_CONTROLLER_H_
...@@ -110,6 +110,11 @@ const int kMaxFetchCount = 100; ...@@ -110,6 +110,11 @@ const int kMaxFetchCount = 100;
#pragma mark - ViewController Lifecycle. #pragma mark - ViewController Lifecycle.
- (instancetype)init {
return [super initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self loadModel]; [self loadModel];
...@@ -474,6 +479,8 @@ const int kMaxFetchCount = 100; ...@@ -474,6 +479,8 @@ const int kMaxFetchCount = 100;
#pragma mark - UIScrollViewDelegate #pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView*)scrollView { - (void)scrollViewDidScroll:(UIScrollView*)scrollView {
[super scrollViewDidScroll:scrollView];
if (self.hasFinishedLoading) if (self.hasFinishedLoading)
return; return;
......
...@@ -161,8 +161,7 @@ PopupMenuCommandType CommandTypeFromPopupType(PopupMenuType type) { ...@@ -161,8 +161,7 @@ PopupMenuCommandType CommandTypeFromPopupType(PopupMenuType type) {
self.requestStartTime = [NSDate timeIntervalSinceReferenceDate]; self.requestStartTime = [NSDate timeIntervalSinceReferenceDate];
PopupMenuTableViewController* tableViewController = PopupMenuTableViewController* tableViewController =
[[PopupMenuTableViewController alloc] [[PopupMenuTableViewController alloc] init];
initWithStyle:UITableViewStyleGrouped];
tableViewController.dispatcher = tableViewController.dispatcher =
static_cast<id<ApplicationCommands, BrowserCommands>>(self.dispatcher); static_cast<id<ApplicationCommands, BrowserCommands>>(self.dispatcher);
tableViewController.baseViewController = self.baseViewController; tableViewController.baseViewController = self.baseViewController;
......
...@@ -27,6 +27,13 @@ ...@@ -27,6 +27,13 @@
// result of an interaction with the popup. // result of an interaction with the popup.
@property(nonatomic, weak) UIViewController* baseViewController; @property(nonatomic, weak) UIViewController* baseViewController;
// Initializers.
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTableViewStyle:(UITableViewStyle)style
appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE;
// Sets the |items| to be displayed by this Table View. Removes all the // Sets the |items| to be displayed by this Table View. Removes all the
// currently presented items. // currently presented items.
- (void)setPopupMenuItems: - (void)setPopupMenuItems:
......
...@@ -33,6 +33,11 @@ const CGFloat kScrollIndicatorVerticalInsets = 11; ...@@ -33,6 +33,11 @@ const CGFloat kScrollIndicatorVerticalInsets = 11;
@synthesize commandHandler = _commandHandler; @synthesize commandHandler = _commandHandler;
@synthesize dispatcher = _dispatcher; @synthesize dispatcher = _dispatcher;
- (instancetype)init {
return [super initWithTableViewStyle:UITableViewStyleGrouped
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
}
#pragma mark - UIViewController #pragma mark - UIViewController
- (void)viewDidLoad { - (void)viewDidLoad {
......
...@@ -34,6 +34,13 @@ class ChromeBrowserState; ...@@ -34,6 +34,13 @@ class ChromeBrowserState;
@property(nonatomic, weak) id<RecentTabsHandsetViewControllerCommand> @property(nonatomic, weak) id<RecentTabsHandsetViewControllerCommand>
handsetCommandHandler; handsetCommandHandler;
// Initializers.
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTableViewStyle:(UITableViewStyle)style
appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE;
@end @end
#endif // IOS_CHROME_BROWSER_UI_RECENT_TABS_RECENT_TABS_TABLE_VIEW_CONTROLLER_H_ #endif // IOS_CHROME_BROWSER_UI_RECENT_TABS_RECENT_TABS_TABLE_VIEW_CONTROLLER_H_
...@@ -119,7 +119,8 @@ const int kRelativeTimeMaxHours = 4; ...@@ -119,7 +119,8 @@ const int kRelativeTimeMaxHours = 4;
#pragma mark - Public Interface #pragma mark - Public Interface
- (instancetype)init { - (instancetype)init {
self = [super initWithStyle:UITableViewStylePlain]; self = [super initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
if (self) { if (self) {
_sessionState = SessionsSyncUserState::USER_SIGNED_OUT; _sessionState = SessionsSyncUserState::USER_SIGNED_OUT;
_syncedSessions.reset(new synced_sessions::SyncedSessions()); _syncedSessions.reset(new synced_sessions::SyncedSessions());
......
...@@ -11,6 +11,13 @@ ...@@ -11,6 +11,13 @@
// cookies, caches, passwords, and autofill). // cookies, caches, passwords, and autofill).
@interface ClearBrowsingDataTableViewController : ChromeTableViewController @interface ClearBrowsingDataTableViewController : ChromeTableViewController
// Initializers.
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTableViewStyle:(UITableViewStyle)style
appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE;
@end @end
#endif // IOS_CHROME_BROWSER_UI_HISTORY_CLEAR_BROWSING_DATA_TABLE_VIEW_CONTROLLER_H_ #endif // IOS_CHROME_BROWSER_UI_HISTORY_CLEAR_BROWSING_DATA_TABLE_VIEW_CONTROLLER_H_
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
#pragma mark - ViewController Lifecycle. #pragma mark - ViewController Lifecycle.
- (instancetype)init {
return [super initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
}
- (void)viewDidLoad { - (void)viewDidLoad {
// TableView configuration // TableView configuration
self.tableView.estimatedRowHeight = 56; self.tableView.estimatedRowHeight = 56;
......
...@@ -15,39 +15,6 @@ ...@@ -15,39 +15,6 @@
// AppBar. // AppBar.
@interface SettingsRootTableViewController @interface SettingsRootTableViewController
: ChromeTableViewController<AppBarPresenting> : ChromeTableViewController<AppBarPresenting>
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithNibName:(NSString*)name
bundle:(NSBundle*)bundle NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder*)decoder NS_UNAVAILABLE;
#pragma mark UIScrollViewDelegate
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewDidScroll:(UIScrollView*)scrollView NS_REQUIRES_SUPER;
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView
willDecelerate:(BOOL)decelerate NS_REQUIRES_SUPER;
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView
NS_REQUIRES_SUPER;
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint*)targetContentOffset
NS_REQUIRES_SUPER;
@end @end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_TABLE_VIEW_CONTROLLER_H_ #endif // IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_TABLE_VIEW_CONTROLLER_H_
...@@ -13,37 +13,7 @@ ...@@ -13,37 +13,7 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
@interface SettingsRootTableViewController ()
// The AppBar for this view controller.
@property(nonatomic, readwrite, strong) MDCAppBar* appBar;
@end
@implementation SettingsRootTableViewController @implementation SettingsRootTableViewController
@synthesize appBar = _appBar;
- (instancetype)initWithStyle:(UITableViewStyle)style {
if ((self = [super initWithStyle:style])) {
// Configure the AppBar.
_appBar = [[MDCAppBar alloc] init];
[self addChildViewController:_appBar.headerViewController];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Configure the app bar. This cannot be in a shared base class because
// UITableViewControllers normally do not use MDC styling, but this one does
// in order to match the other Settings screens.
ConfigureAppBarWithCardStyle(self.appBar);
self.appBar.headerViewController.headerView.trackingScrollView =
self.tableView;
// Add the AppBar's views after all other views have been registered.
[self.appBar addSubviewsToParent];
}
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
...@@ -56,51 +26,4 @@ ...@@ -56,51 +26,4 @@
self.navigationItem.rightBarButtonItem = doneButton; self.navigationItem.rightBarButtonItem = doneButton;
} }
- (UIViewController*)childViewControllerForStatusBarHidden {
return self.appBar.headerViewController;
}
- (UIViewController*)childViewControllerForStatusBarStyle {
return self.appBar.headerViewController;
}
#pragma mark UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView*)scrollView {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView trackingScrollViewDidScroll];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView trackingScrollViewDidEndDecelerating];
}
}
- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView
willDecelerate:(BOOL)decelerate {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView trackingScrollViewDidEndDraggingWillDecelerate:decelerate];
}
}
- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint*)targetContentOffset {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView
trackingScrollViewWillEndDraggingWithVelocity:velocity
targetContentOffset:targetContentOffset];
}
}
@end @end
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
@interface TableCellCatalogViewController : SettingsRootTableViewController @interface TableCellCatalogViewController : SettingsRootTableViewController
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTableViewStyle:(UITableViewStyle)style
- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE;
@end @end
......
...@@ -33,7 +33,9 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -33,7 +33,9 @@ typedef NS_ENUM(NSInteger, ItemType) {
@implementation TableCellCatalogViewController @implementation TableCellCatalogViewController
- (instancetype)init { - (instancetype)init {
if ((self = [super initWithStyle:UITableViewStyleGrouped])) { if ((self = [super
initWithTableViewStyle:UITableViewStyleGrouped
appBarStyle:ChromeTableViewControllerStyleWithAppBar])) {
} }
return self; return self;
} }
......
...@@ -18,6 +18,8 @@ source_set("table_view") { ...@@ -18,6 +18,8 @@ source_set("table_view") {
":styler", ":styler",
"//base", "//base",
"//ios/chrome/browser/ui/list_model", "//ios/chrome/browser/ui/list_model",
"//ios/chrome/browser/ui/material_components",
"//ios/third_party/material_components_ios",
] ]
public_deps = [ public_deps = [
"//ios/chrome/browser/ui/table_view/cells", "//ios/chrome/browser/ui/table_view/cells",
......
...@@ -7,13 +7,19 @@ ...@@ -7,13 +7,19 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/material_components/app_bar_presenting.h"
#import "ios/chrome/browser/ui/table_view/table_view_model.h" #import "ios/chrome/browser/ui/table_view/table_view_model.h"
@class ChromeTableViewStyler; @class ChromeTableViewStyler;
@class TableViewItem; @class TableViewItem;
typedef NS_ENUM(NSInteger, ChromeTableViewControllerStyle) {
ChromeTableViewControllerStyleNoAppBar,
ChromeTableViewControllerStyleWithAppBar,
};
// Chrome-specific TableViewController. // Chrome-specific TableViewController.
@interface ChromeTableViewController : UITableViewController @interface ChromeTableViewController : UITableViewController<AppBarPresenting>
// The model of this controller. // The model of this controller.
@property(nonatomic, readonly, strong) @property(nonatomic, readonly, strong)
...@@ -25,10 +31,15 @@ ...@@ -25,10 +31,15 @@
@property(nonatomic, readonly, strong) ChromeTableViewStyler* styler; @property(nonatomic, readonly, strong) ChromeTableViewStyler* styler;
// Initializers. // Initializers.
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER; - (instancetype)initWithTableViewStyle:(UITableViewStyle)style
appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle
NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithNibName:(NSString*)nibNameOrNil - (instancetype)initWithNibName:(NSString*)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
// Initializes the collection view model. Must be called by subclasses if they // Initializes the collection view model. Must be called by subclasses if they
// override this method in order to get a clean tableViewModel. // override this method in order to get a clean tableViewModel.
...@@ -38,6 +49,33 @@ ...@@ -38,6 +49,33 @@
// |configureCell:| on each cell. // |configureCell:| on each cell.
- (void)reconfigureCellsForItems:(NSArray*)items; - (void)reconfigureCellsForItems:(NSArray*)items;
#pragma mark UIScrollViewDelegate
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewDidScroll:(UIScrollView*)scrollView NS_REQUIRES_SUPER;
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView
willDecelerate:(BOOL)decelerate NS_REQUIRES_SUPER;
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView
NS_REQUIRES_SUPER;
// Updates the MDCFlexibleHeader with changes to the table view scroll
// state. Must be called by subclasses if they override this method in order to
// maintain this functionality.
- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint*)targetContentOffset
NS_REQUIRES_SUPER;
@end @end
#endif // IOS_CHROME_BROWSER_UI_TABLE_VIEW_CHROME_TABLE_VIEW_CONTROLLER_H_ #endif // IOS_CHROME_BROWSER_UI_TABLE_VIEW_CHROME_TABLE_VIEW_CONTROLLER_H_
...@@ -4,28 +4,43 @@ ...@@ -4,28 +4,43 @@
#import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h"
#import "ios/chrome/browser/ui/material_components/utils.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_header_footer_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_header_footer_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_item.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h"
#import "ios/chrome/browser/ui/table_view/table_view_model.h" #import "ios/chrome/browser/ui/table_view/table_view_model.h"
#import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
@implementation ChromeTableViewController @implementation ChromeTableViewController
@synthesize appBar = _appBar;
@synthesize styler = _styler; @synthesize styler = _styler;
@synthesize tableViewModel = _tableViewModel; @synthesize tableViewModel = _tableViewModel;
#pragma mark - Public Interface #pragma mark - Public Interface
- (instancetype)initWithStyle:(UITableViewStyle)style { - (instancetype)initWithTableViewStyle:(UITableViewStyle)style
appBarStyle:
(ChromeTableViewControllerStyle)appBarStyle {
if ((self = [super initWithStyle:style])) { if ((self = [super initWithStyle:style])) {
_styler = [[ChromeTableViewStyler alloc] init]; _styler = [[ChromeTableViewStyler alloc] init];
if (appBarStyle == ChromeTableViewControllerStyleWithAppBar) {
_appBar = [[MDCAppBar alloc] init];
[self addChildViewController:_appBar.headerViewController];
}
} }
return self; return self;
} }
- (instancetype)init {
return [self initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
}
- (void)loadModel { - (void)loadModel {
_tableViewModel = [[TableViewModel alloc] init]; _tableViewModel = [[TableViewModel alloc] init];
} }
...@@ -46,9 +61,19 @@ ...@@ -46,9 +61,19 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self.tableView setBackgroundColor:self.styler.tableViewBackgroundColor]; [self.tableView setBackgroundColor:self.styler.tableViewBackgroundColor];
[self.tableView setSeparatorColor:[UIColor lightGrayColor]]; [self.tableView setSeparatorColor:[UIColor lightGrayColor]];
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 56, 0, 0)]; [self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 56, 0, 0)];
// Configure the app bar if needed.
if (_appBar) {
ConfigureAppBarWithCardStyle(self.appBar);
self.appBar.headerViewController.headerView.trackingScrollView =
self.tableView;
// Add the AppBar's views after all other views have been registered.
[self.appBar addSubviewsToParent];
}
} }
#pragma mark - UITableViewDataSource #pragma mark - UITableViewDataSource
...@@ -111,4 +136,51 @@ ...@@ -111,4 +136,51 @@
return view; return view;
} }
#pragma mark - MDCAppBar support
- (UIViewController*)childViewControllerForStatusBarHidden {
return self.appBar.headerViewController;
}
- (UIViewController*)childViewControllerForStatusBarStyle {
return self.appBar.headerViewController;
}
- (void)scrollViewDidScroll:(UIScrollView*)scrollView {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView trackingScrollViewDidScroll];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView trackingScrollViewDidEndDecelerating];
}
}
- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView
willDecelerate:(BOOL)decelerate {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView trackingScrollViewDidEndDraggingWillDecelerate:decelerate];
}
}
- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint*)targetContentOffset {
MDCFlexibleHeaderView* headerView =
self.appBar.headerViewController.headerView;
if (scrollView == headerView.trackingScrollView) {
[headerView
trackingScrollViewWillEndDraggingWithVelocity:velocity
targetContentOffset:targetContentOffset];
}
}
@end @end
...@@ -64,8 +64,9 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -64,8 +64,9 @@ typedef NS_ENUM(NSInteger, ItemType) {
using ChromeTableViewControllerTest = PlatformTest; using ChromeTableViewControllerTest = PlatformTest;
TEST_F(ChromeTableViewControllerTest, CellForItemAtIndexPath) { TEST_F(ChromeTableViewControllerTest, CellForItemAtIndexPath) {
ChromeTableViewController* controller = ChromeTableViewController* controller = [[ChromeTableViewController alloc]
[[ChromeTableViewController alloc] initWithStyle:UITableViewStylePlain]; initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
[controller loadModel]; [controller loadModel];
[[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo]; [[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo];
...@@ -81,8 +82,9 @@ TEST_F(ChromeTableViewControllerTest, CellForItemAtIndexPath) { ...@@ -81,8 +82,9 @@ TEST_F(ChromeTableViewControllerTest, CellForItemAtIndexPath) {
} }
TEST_F(ChromeTableViewControllerTest, HeaderForItemAtSection) { TEST_F(ChromeTableViewControllerTest, HeaderForItemAtSection) {
ChromeTableViewController* controller = ChromeTableViewController* controller = [[ChromeTableViewController alloc]
[[ChromeTableViewController alloc] initWithStyle:UITableViewStylePlain]; initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
[controller loadModel]; [controller loadModel];
[[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo]; [[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo];
...@@ -97,8 +99,9 @@ TEST_F(ChromeTableViewControllerTest, HeaderForItemAtSection) { ...@@ -97,8 +99,9 @@ TEST_F(ChromeTableViewControllerTest, HeaderForItemAtSection) {
} }
TEST_F(ChromeTableViewControllerTest, FooterForItemAtSection) { TEST_F(ChromeTableViewControllerTest, FooterForItemAtSection) {
ChromeTableViewController* controller = ChromeTableViewController* controller = [[ChromeTableViewController alloc]
[[ChromeTableViewController alloc] initWithStyle:UITableViewStylePlain]; initWithTableViewStyle:UITableViewStylePlain
appBarStyle:ChromeTableViewControllerStyleNoAppBar];
[controller loadModel]; [controller loadModel];
[[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo]; [[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo];
......
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