Commit b6ace0f9 authored by Yue Zhang's avatar Yue Zhang Committed by Commit Bot

Enable drag-and-drop for StartSurface variations without MRU ordering

Bug: 1005931
Change-Id: Ie56ba62a695b9895fdd5b67ef9547aa8c59bc1fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893507
Commit-Queue: Yue Zhang <yuezhanggg@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711758}
parent 72f4d7ce
......@@ -83,13 +83,14 @@ public class TabGridItemTouchHelperCallback extends ItemTouchHelper.SimpleCallba
boolean isTabGroupEnabled = FeatureUtilities.isTabGroupsAndroidEnabled();
boolean isTabGroupUiImprovementEnabled =
FeatureUtilities.isTabGroupsAndroidUiImprovementsEnabled();
boolean isStartSurfaceEnabled = FeatureUtilities.isStartSurfaceEnabled();
boolean isMRUEnabledInTabSwitcher =
TabSwitcherMediator.isShowingTabsInMRUOrder() && mActionsOnAllRelatedTabs;
// Only enable drag for users with group disabled, or with group and group ui improvement
// enabled at the same time. Also, disable drag for start surface for now.
// enabled at the same time. Also, disable drag for MRU-order tab switcher in start surface.
// TODO(crbug.com/1005931): Figure out how drag-to-reorder lives in StartSurface MRU
// ordering scenario.
boolean isDragEnabled =
!isStartSurfaceEnabled && (!isTabGroupEnabled || isTabGroupUiImprovementEnabled);
boolean isDragEnabled = !isMRUEnabledInTabSwitcher
&& (!isTabGroupEnabled || isTabGroupUiImprovementEnabled);
mDragFlags = isDragEnabled ? ItemTouchHelper.START | ItemTouchHelper.END
| ItemTouchHelper.UP | ItemTouchHelper.DOWN
: 0;
......
......@@ -133,7 +133,7 @@ public class TabSwitcherCoordinator implements Destroyable, TabSwitcher,
if (FeatureUtilities.isTabGroupsAndroidUiImprovementsEnabled()
&& mode == TabListCoordinator.TabListMode.GRID
&& !FeatureUtilities.isStartSurfaceEnabled()) {
&& !TabSwitcherMediator.isShowingTabsInMRUOrder()) {
mTabGridIphItemCoordinator = new TabGridIphItemCoordinator(
context, mTabListCoordinator.getContainerView(), container);
mMediator.setIphProvider(mTabGridIphItemCoordinator.getIphProvider());
......
......@@ -275,9 +275,7 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
// TODO(crbug.com/982018): Let the start surface pass in the parameter and add unit test for
// it. This is a temporary solution to keep this change minimum.
String feature = ChromeFeatureList.getFieldTrialParamByFeature(
ChromeFeatureList.START_SURFACE_ANDROID, "start_surface_variation");
mShowTabsInMruOrder = feature.equals("twopanes") || feature.equals("single");
mShowTabsInMruOrder = isShowingTabsInMRUOrder();
}
/**
......@@ -538,6 +536,16 @@ class TabSwitcherMediator implements TabSwitcher.Controller, TabListRecyclerView
mIphProvider = iphProvider;
}
/**
* Check if tabs should show in MRU order in current start surface tab switcher.
* @return whether tabs should show in MRU order
*/
static boolean isShowingTabsInMRUOrder() {
String feature = ChromeFeatureList.getFieldTrialParamByFeature(
ChromeFeatureList.START_SURFACE_ANDROID, "start_surface_variation");
return feature.equals("twopanes") || feature.equals("single");
}
/**
* Destroy any members that needs clean up.
*/
......
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