Allow overriding DragController and drag use cases
Test: Manually verified Launcher3 works fine
Bug: 233864888
Change-Id: Ifb2fe19c0a2b332862b36b1ac0100e0f5301a5a6
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index cc57a7b..a93b40d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -305,7 +305,6 @@
Workspace<?> mWorkspace;
@Thunk
DragLayer mDragLayer;
- private DragController mDragController;
private WidgetManagerHelper mAppWidgetManager;
private LauncherAppWidgetHost mAppWidgetHost;
@@ -369,6 +368,7 @@
private RotationHelper mRotationHelper;
protected LauncherOverlayManager mOverlayManager;
+ protected DragController mDragController;
// If true, overlay callbacks are deferred
private boolean mDeferOverlayCallbacks;
private final Runnable mDeferredOverlayCallbacks = this::checkIfOverlayStillDeferred;
@@ -465,7 +465,7 @@
mIconCache = app.getIconCache();
mAccessibilityDelegate = createAccessibilityDelegate();
- mDragController = new LauncherDragController(this);
+ initDragController();
mAllAppsController = new AllAppsTransitionController(this);
mStateManager = new StateManager<>(this, NORMAL);
@@ -614,6 +614,13 @@
super.onConfigurationChanged(newConfig);
}
+ /**
+ * Initializes the drag controller.
+ */
+ protected void initDragController() {
+ mDragController = new LauncherDragController(this);
+ }
+
@Override
public void onIdpChanged(boolean modelPropertiesChanged) {
initDeviceProfile(mDeviceProfile.inv);
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index c482ed5..e6dea8f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -159,7 +159,7 @@
private LayoutTransition mLayoutTransition;
@Thunk final WallpaperManager mWallpaperManager;
- private ShortcutAndWidgetContainer mDragSourceInternal;
+ protected ShortcutAndWidgetContainer mDragSourceInternal;
@Thunk final IntSparseArrayMap<CellLayout> mWorkspaceScreens = new IntSparseArrayMap<>();
@Thunk final IntArray mScreenOrder = new IntArray();
@@ -195,7 +195,7 @@
@Thunk final Launcher mLauncher;
@Thunk DragController mDragController;
- private final int[] mTempXY = new int[2];
+ protected final int[] mTempXY = new int[2];
private final float[] mTempFXY = new float[2];
private final Rect mTempRect = new Rect();
@Thunk float[] mDragViewVisualCenter = new float[2];