Commit c52143f5 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Deletes BookmarkContextBar and uses UIToolbar instead

- Deletes BookmarkContextBar files and usage from BookmarkHomeVC.
- Uses BookmarkHomeVC navigationController UIToolbar instead.
- Creates accessibilityIdentifiers for toolbar buttons.
- Changes the BookmarkTableCell margins since these were giving the effect of shrinking row height.

Screenshots
Old: https://drive.google.com/open?id=1v3GQRiiPiIzJNZ7Lxd-pgpaaqP15b0PR
New: https://drive.google.com/open?id=1z5mOT3p1NBj62EaMKfR2P5WSD2irQmyX

Bug: 839435
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I155365b6f9520010153ce97187ef1f6a2a8514f7
Reviewed-on: https://chromium-review.googlesource.com/1054123
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558114}
parent a242af07
......@@ -95,7 +95,6 @@ source_set("bookmarks") {
"//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication:authentication_ui",
"//ios/chrome/browser/ui/bookmarks/bars",
"//ios/chrome/browser/ui/bookmarks/cells",
"//ios/chrome/browser/ui/colors",
"//ios/chrome/browser/ui/commands",
......@@ -120,10 +119,7 @@ source_set("bookmarks") {
"//ui/gfx",
"//url",
]
allow_circular_includes_from = [
"//ios/chrome/browser/ui/bookmarks/bars",
"//ios/chrome/browser/ui/bookmarks/cells",
]
allow_circular_includes_from = [ "//ios/chrome/browser/ui/bookmarks/cells" ]
libs = [
"CoreGraphics.framework",
"QuartzCore.framework",
......
# Copyright 2016 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.
source_set("bars") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"bookmark_context_bar.h",
"bookmark_context_bar.mm",
]
deps = [
"//base",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/colors",
"//ios/third_party/material_components_ios",
"//ui/base",
]
libs = [ "UIKit.framework" ]
}
// 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_CHROME_BROWSER_UI_BOOKMARKS_BARS_BOOKMARK_CONTEXT_BAR_H_
#define IOS_CHROME_BROWSER_UI_BOOKMARKS_BARS_BOOKMARK_CONTEXT_BAR_H_
#import <UIKit/UIKit.h>
// Delegate for BookmarkContextBar. Used to pass on button actions.
@protocol ContextBarDelegate<NSObject>
// Called when the leading button is clicked.
- (void)leadingButtonClicked;
// Called when the center button is clicked.
- (void)centerButtonClicked;
// Called when the trailing button is clicked.
- (void)trailingButtonClicked;
@end
typedef NS_ENUM(NSInteger, ContextBarButton) {
ContextBarLeadingButton,
ContextBarCenterButton,
ContextBarTrailingButton
};
typedef NS_ENUM(NSInteger, ContextBarButtonStyle) {
ContextBarButtonStyleDefault,
ContextBarButtonStyleDelete,
};
// View with 3 customizable buttons in a row.
@interface BookmarkContextBar : UIView
@property(nonatomic, weak) id<ContextBarDelegate> delegate;
// Methods for setting button's title, style and visibility.
- (void)setButtonTitle:(NSString*)title forButton:(ContextBarButton)button;
- (void)setButtonStyle:(ContextBarButtonStyle)style
forButton:(ContextBarButton)button;
- (void)setButtonVisibility:(BOOL)visible forButton:(ContextBarButton)button;
- (void)setButtonEnabled:(BOOL)enabled forButton:(ContextBarButton)button;
- (void)updateHeight;
@end
#endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BARS_BOOKMARK_CONTEXT_BAR_H_
......@@ -90,9 +90,6 @@ class BookmarkNode;
// The app bar for the bookmarks.
@property(nonatomic, readonly) MDCAppBar* appBar;
// The context bar at the bottom of the bookmarks.
@property(nonatomic, readonly) BookmarkContextBar* contextBar;
// This view is created and used if the model is not fully loaded yet by the
// time this controller starts.
@property(nonatomic, readonly) BookmarkHomeWaitingView* waitForModelView;
......
......@@ -25,7 +25,6 @@ TEST_F(BookmarkHomeViewControllerTest, LoadBookmarks) {
dispatcher:nil];
EXPECT_EQ(nil, controller.appBar);
EXPECT_EQ(nil, controller.contextBar);
EXPECT_EQ(nil, controller.bookmarksTableView);
[controller setRootNode:_bookmarkModel->mobile_node()];
......@@ -34,7 +33,6 @@ TEST_F(BookmarkHomeViewControllerTest, LoadBookmarks) {
EXPECT_NE(nil, controller);
EXPECT_NE(nil, controller.appBar);
EXPECT_NE(nil, controller.contextBar);
EXPECT_NE(nil, controller.bookmarksTableView);
}
}
......
......@@ -11,5 +11,13 @@
extern NSString* const kBookmarkEditDeleteButtonIdentifier;
// Accessibility identifier of the BookmarkFolderEditorVC toolbar delete button.
extern NSString* const kBookmarkFolderEditorDeleteButtonIdentifier;
// Accessibility identifier of the BookmarkHomeVC leading button.
extern NSString* const kBookmarkHomeLeadingButtonIdentifier;
// Accessibility identifier of the BookmarkHomeVC center button.
extern NSString* const kBookmarkHomeCenterButtonIdentifier;
// Accessibility identifier of the BookmarkHomeVC trailing button.
extern NSString* const kBookmarkHomeTrailingButtonIdentifier;
// Accessibility identifier of the BookmarkHomeVC UIToolbar.
extern NSString* const kBookmarkHomeUIToolbarIdentifier;
#endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UI_CONSTANTS_H_
......@@ -12,3 +12,11 @@ NSString* const kBookmarkEditDeleteButtonIdentifier =
@"kBookmarkEditDeleteButtonIdentifier";
NSString* const kBookmarkFolderEditorDeleteButtonIdentifier =
@"kBookmarkFolderEditorDeleteButtonIdentifier";
NSString* const kBookmarkHomeLeadingButtonIdentifier =
@"kBookmarkHomeLeadingButtonIdentifier";
NSString* const kBookmarkHomeCenterButtonIdentifier =
@"kBookmarkHomeCenterButtonIdentifier";
NSString* const kBookmarkHomeTrailingButtonIdentifier =
@"kBookmarkHomeTrailingButtonIdentifier";
NSString* const kBookmarkHomeUIToolbarIdentifier =
@"kBookmarkHomeUIToolbarIdentifier";
......@@ -87,18 +87,12 @@ const CGFloat kBookmarkTableCellImagePadding = 16.0;
constraintEqualToConstant:kBookmarkTableCellImageSize]
.active = YES;
// Create stack view.
// Create and configure StackView.
UIStackView* contentStack = [[UIStackView alloc]
initWithArrangedSubviews:@[ _iconView, _placeholderLabel, _titleText ]];
[self.contentView addSubview:contentStack];
contentStack.layoutMargins = UIEdgeInsetsMake(
0, kBookmarkTableCellImagePadding, 0, kBookmarkTableCellImagePadding);
contentStack.layoutMarginsRelativeArrangement = YES;
contentStack.spacing = kBookmarkTableCellImagePadding;
contentStack.alignment = UIStackViewAlignmentCenter;
// Configure stack view layout.
contentStack.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[contentStack.topAnchor
......@@ -106,9 +100,11 @@ const CGFloat kBookmarkTableCellImagePadding = 16.0;
[contentStack.bottomAnchor
constraintEqualToAnchor:self.contentView.bottomAnchor],
[contentStack.leadingAnchor
constraintEqualToAnchor:self.contentView.leadingAnchor],
constraintEqualToAnchor:self.contentView.leadingAnchor
constant:kBookmarkTableCellImagePadding],
[contentStack.trailingAnchor
constraintEqualToAnchor:self.contentView.trailingAnchor]
constraintEqualToAnchor:self.contentView.trailingAnchor
constant:-kBookmarkTableCellImagePadding]
]];
// Add separator view.
......
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