Revert "Not refresh predicted app in right click"
This reverts commit b17cde5c3a3b5112c90272fff79640025a116277.
Reason for revert: bug: b/400596380
Change-Id: I8f4d6755653d59ec6264bf93a2835c60122640be
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index d329a68..c50c008 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -521,13 +521,17 @@
mDragObject.dragComplete = true;
if (mIsInPreDrag) {
- mDragObject.cancelled = true;
+ if (dropTarget != null) {
+ dropTarget.onDragExit(mDragObject);
+ }
+ return;
}
+
// Drop onto the target.
boolean accepted = false;
if (dropTarget != null) {
dropTarget.onDragExit(mDragObject);
- if (!mIsInPreDrag && dropTarget.acceptDrop(mDragObject)) {
+ if (dropTarget.acceptDrop(mDragObject)) {
if (flingAnimation != null) {
flingAnimation.run();
} else {
diff --git a/src/com/android/launcher3/dragndrop/LauncherDragController.java b/src/com/android/launcher3/dragndrop/LauncherDragController.java
index e3b8965..4aa3673 100644
--- a/src/com/android/launcher3/dragndrop/LauncherDragController.java
+++ b/src/com/android/launcher3/dragndrop/LauncherDragController.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.dragndrop;
-import static android.view.View.VISIBLE;
-
import static com.android.launcher3.AbstractFloatingView.TYPE_DISCOVERY_BOUNCE;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherState.EDIT_MODE;
@@ -27,7 +25,6 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.HapticFeedbackConstants;
-import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.Nullable;
@@ -36,13 +33,10 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget;
-import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
-import com.android.launcher3.dragndrop.DragOptions.PreDragCondition;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.util.TouchUtil;
import com.android.launcher3.widget.util.WidgetDragScaleUtils;
/**
@@ -53,9 +47,6 @@
private static final boolean PROFILE_DRAWING_DURING_DRAG = false;
private final FlingToDeleteHelper mFlingToDeleteHelper;
- /** Whether or not the drag operation is triggered by mouse right click. */
- private boolean mIsInMouseRightClick = false;
-
public LauncherDragController(Launcher launcher) {
super(launcher);
mFlingToDeleteHelper = new FlingToDeleteHelper(launcher);
@@ -78,27 +69,6 @@
android.os.Debug.startMethodTracing("Launcher");
}
- if (mIsInMouseRightClick && options.preDragCondition == null
- && originalView instanceof View v) {
- options.preDragCondition = new PreDragCondition() {
-
- @Override
- public boolean shouldStartDrag(double distanceDragged) {
- return false;
- }
-
- @Override
- public void onPreDragStart(DragObject dragObject) {
- // Set it to visible so the text of FolderIcon would not flash (avoid it from
- // being invisible and then visible)
- v.setVisibility(VISIBLE);
- }
-
- @Override
- public void onPreDragEnd(DragObject dragObject, boolean dragStarted) { }
- };
- }
-
mActivity.hideKeyboard();
AbstractFloatingView.closeOpenViews(mActivity, false, TYPE_DISCOVERY_BOUNCE);
@@ -221,7 +191,7 @@
@Override
protected void exitDrag() {
- if (!mIsInPreDrag && !mActivity.isInState(EDIT_MODE)) {
+ if (!mActivity.isInState(EDIT_MODE)) {
mActivity.getStateManager().goToState(NORMAL, SPRING_LOADED_EXIT_DELAY);
}
}
@@ -248,13 +218,4 @@
dropCoordinates);
return mActivity.getWorkspace();
}
-
- /**
- * Intercepts touch events from a drag source view.
- */
- @Override
- public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
- mIsInMouseRightClick = TouchUtil.isMouseRightClickDownOrMove(ev);
- return super.onControllerInterceptTouchEvent(ev);
- }
}