Decoupling some dragController methods
Change-Id: I7c4ab5f1504c49eaa0566afe643d7672faa80205
This commit is contained in:
1 parent
ba1a2b9b62
commit
deb91c46eb
4 files changed
+35
-55
No files matched your search
@@ -27,7 +27,6 @@ import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.IBinder;
|
||||
import android.view.DragEvent;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
@@ -44,7 +43,6 @@ import com.android.launcher3.WorkspaceItemInfo;
|
||||
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -86,21 +84,14 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
private DropTarget.DragObject mDragObject;
|
||||
|
||||
/** Who can receive drop events */
|
||||
private ArrayList<DropTarget> mDropTargets = new ArrayList<>();
|
||||
private ArrayList<DragListener> mListeners = new ArrayList<>();
|
||||
|
||||
/** The window token used as the parent for the DragView. */
|
||||
private IBinder mWindowToken;
|
||||
|
||||
private View mMoveTarget;
|
||||
private final ArrayList<DropTarget> mDropTargets = new ArrayList<>();
|
||||
private final ArrayList<DragListener> mListeners = new ArrayList<>();
|
||||
|
||||
private DropTarget mLastDropTarget;
|
||||
|
||||
private int mLastTouchClassification;
|
||||
private int mDistanceSinceScroll = 0;
|
||||
|
||||
private Rect mDragLayerRect = new Rect();
|
||||
|
||||
private boolean mIsInPreDrag;
|
||||
|
||||
/**
|
||||
@@ -153,8 +144,7 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
android.os.Debug.startMethodTracing("Launcher");
|
||||
}
|
||||
|
||||
// Hide soft keyboard, if visible
|
||||
UiThreadHelper.hideKeyboardAsync(mLauncher, mWindowToken);
|
||||
mLauncher.hideKeyboard();
|
||||
AbstractFloatingView.closeOpenViews(mLauncher, false, TYPE_DISCOVERY_BOUNCE);
|
||||
|
||||
mOptions = options;
|
||||
@@ -362,9 +352,9 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
* Clamps the position to the drag layer bounds.
|
||||
*/
|
||||
private Point getClampedDragLayerPos(float x, float y) {
|
||||
mLauncher.getDragLayer().getLocalVisibleRect(mDragLayerRect);
|
||||
mTmpPoint.x = (int) Math.max(mDragLayerRect.left, Math.min(x, mDragLayerRect.right - 1));
|
||||
mTmpPoint.y = (int) Math.max(mDragLayerRect.top, Math.min(y, mDragLayerRect.bottom - 1));
|
||||
mLauncher.getDragLayer().getLocalVisibleRect(mRectTemp);
|
||||
mTmpPoint.x = (int) Math.max(mRectTemp.left, Math.min(x, mRectTemp.right - 1));
|
||||
mTmpPoint.y = (int) Math.max(mRectTemp.top, Math.min(y, mRectTemp.bottom - 1));
|
||||
return mTmpPoint;
|
||||
}
|
||||
|
||||
@@ -439,17 +429,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
return mDragDriver != null && mDragDriver.onDragEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the view that should handle move events.
|
||||
*/
|
||||
public void setMoveTarget(View view) {
|
||||
mMoveTarget = view;
|
||||
}
|
||||
|
||||
public boolean dispatchUnhandledMove(View focused, int direction) {
|
||||
return mMoveTarget != null && mMoveTarget.dispatchUnhandledMove(focused, direction);
|
||||
}
|
||||
|
||||
private void handleMoveEvent(int x, int y) {
|
||||
mDragObject.dragView.move(x, y);
|
||||
|
||||
@@ -593,10 +572,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
return mLauncher.getWorkspace();
|
||||
}
|
||||
|
||||
public void setWindowToken(IBinder token) {
|
||||
mWindowToken = token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the drag listener which will be notified when a drag starts or ends.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user