Commit d9f7d6bd authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

[TabSelectionEditor] Long press to select/deselect items

Change-Id: I20e36b47a4e4111269e660142819a9e22bc2f544
Bug: 987206, 970266
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1719614
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682121}
parent 25c9537d
......@@ -140,6 +140,10 @@ class TabGridViewBinder {
item.get(TabProperties.SELECTABLE_TAB_CLICKED_LISTENER).run(holder.getTabId());
selectionHolder.selectableTabGridView.onClick();
});
selectionHolder.itemView.setOnLongClickListener(view -> {
item.get(TabProperties.SELECTABLE_TAB_CLICKED_LISTENER).run(holder.getTabId());
return selectionHolder.selectableTabGridView.onLongClick(view);
});
} else if (TabProperties.TITLE == propertyKey) {
String title = item.get(TabProperties.TITLE);
selectionHolder.actionButton.setContentDescription(
......
......@@ -82,6 +82,7 @@ public class TabListCoordinator implements Destroyable {
* @param dialogHandler A handler to handle requests about updating TabGridDialog.
* @param itemViewTypeCallback Callback that returns the view type for each item in the list.
* @param selectionDelegateProvider Provider to provide selected Tabs for a selectable tab list.
* It's NULL when selection is not possible.
* @param parentView {@link ViewGroup} The root view of the UI.
* @param dynamicResourceLoader The {@link DynamicResourceLoader} to register dynamic UI
* resource for compositor layer animation.
......@@ -98,7 +99,7 @@ public class TabListCoordinator implements Destroyable {
.GridCardOnClickListenerProvider gridCardOnClickListenerProvider,
@Nullable TabListMediator.TabGridDialogHandler dialogHandler,
SimpleRecyclerViewMcpBase.ItemViewTypeCallback<PropertyModel> itemViewTypeCallback,
TabListMediator.SelectionDelegateProvider selectionDelegateProvider,
@Nullable TabListMediator.SelectionDelegateProvider selectionDelegateProvider,
@NonNull ViewGroup parentView, @Nullable DynamicResourceLoader dynamicResourceLoader,
boolean attachToParent, String componentName) {
TabListModel tabListModel = new TabListModel();
......@@ -180,7 +181,7 @@ public class TabListCoordinator implements Destroyable {
createGroupButtonProvider, selectionDelegateProvider,
gridCardOnClickListenerProvider, dialogHandler, componentName);
if (mMode == TabListMode.GRID) {
if (mMode == TabListMode.GRID && selectionDelegateProvider == null) {
ItemTouchHelper touchHelper = new ItemTouchHelper(mMediator.getItemTouchHelperCallback(
context.getResources().getDimension(R.dimen.swipe_to_dismiss_threshold),
context.getResources().getDimension(R.dimen.tab_grid_merge_threshold),
......
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