Merge "Revert "Not refresh predicted app in right click"" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
aeb890b43d
@@ -521,13 +521,17 @@ public abstract class DragController<T extends ActivityContext>
|
||||
|
||||
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 {
|
||||
|
||||
@@ -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.content.res.Resources;
|
||||
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 androidx.annotation.VisibleForTesting;
|
||||
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 @@ public class LauncherDragController extends DragController<Launcher> {
|
||||
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 @@ public class LauncherDragController extends DragController<Launcher> {
|
||||
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 @@ public class LauncherDragController extends DragController<Launcher> {
|
||||
|
||||
@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 @@ public class LauncherDragController extends DragController<Launcher> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user