Commit 6eadc4cb authored by sczs's avatar sczs Committed by Commit Bot

[ios] Disables History searchBar while editing.

This is a preparation CL to remove animations when populating
the history TableView and when performing a search.

In order achieve that we need to reload all the content of the
TableView instead of inserting/removing specific entries. This
causes previously selected items to deselect when searching.
For this reason there's no purpose to searching while editing
is enabled, furthermore selecting the search bar will deselect
selected items, which can be frustrating for the user.

This CL disables the searchBar while the table is on Edit mode.
The user can still search something and edit the results of the
query, but it can't perform a new search query before exiting
edit mode. This is the behavior of the legacy implementation.

Screenshots:
Enabled
https://drive.google.com/open?id=1ZdplK968U4XgBE1cFSB9L4scblJwFeBN
https://drive.google.com/open?id=1dH47e9tPHmDd2eUuOUVIt-W3Nay4v_A1

Disabled
https://drive.google.com/open?id=1Gp4IXNawohaZnlwSnQTSJ0LLbvaFW6Iw
https://drive.google.com/open?id=1aDPPjOd3DqX99vncP2wNXNHx_XKRyGhM

Bug: 859736
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I705a936f8bb339ab29a1431d7d4d969d77337d71
Reviewed-on: https://chromium-review.googlesource.com/1148890Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577944}
parent 9d82efeb
......@@ -62,6 +62,8 @@ const NSInteger kEntriesStatusSectionIdentifier = kSectionIdentifierEnumZero;
const int kMaxFetchCount = 100;
// Separation space between sections.
const CGFloat kSeparationSpaceBetweenSections = 9;
// The Alpha value used by the SearchBar when disabled.
const CGFloat kAlphaForDisabledSearchBar = 0.5;
} // namespace
@interface HistoryTableViewController ()<HistoryEntriesStatusItemDelegate,
......@@ -848,6 +850,8 @@ const CGFloat kSeparationSpaceBetweenSections = 9;
self.clearBrowsingDataButton, spaceButton, self.editButton
]
animated:animated];
[self.searchController.searchBar setUserInteractionEnabled:YES];
self.searchController.searchBar.alpha = 1.0;
[self updateToolbarButtons];
}
......@@ -860,6 +864,8 @@ const CGFloat kSeparationSpaceBetweenSections = 9;
action:nil];
[self setToolbarItems:@[ self.deleteButton, spaceButton, self.cancelButton ]
animated:animated];
[self.searchController.searchBar setUserInteractionEnabled:NO];
self.searchController.searchBar.alpha = kAlphaForDisabledSearchBar;
[self updateToolbarButtons];
}
......
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