Refactoring common methods
Change-Id: Id6d3072dd3a6d7f54e9591abbeffd9bd51c7403d
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 6925477..786d4a2 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -27,7 +27,6 @@
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Build;
-import android.os.SystemClock;
import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
@@ -53,7 +52,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
/**
* Represents a set of icons chosen by the user or generated by the system.
@@ -704,17 +702,11 @@
}
public void onDragOver(DragObject d) {
- final DragView dragView = d.dragView;
final int scrollOffset = mScrollView.getScrollY();
- final float[] r = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset, dragView, null);
+ final float[] r = d.getVisualCenter(null);
r[0] -= getPaddingLeft();
r[1] -= getPaddingTop();
- final long downTime = SystemClock.uptimeMillis();
- final MotionEvent translatedEv = MotionEvent.obtain(
- downTime, downTime, MotionEvent.ACTION_MOVE, d.x, d.y, 0);
-
- translatedEv.recycle();
mTargetCell = mContent.findNearestArea(
(int) r[0], (int) r[1] + scrollOffset, 1, 1, mTargetCell);
if (isLayoutRtl()) {
@@ -730,32 +722,6 @@
}
}
- // This is used to compute the visual center of the dragView. The idea is that
- // the visual center represents the user's interpretation of where the item is, and hence
- // is the appropriate point to use when determining drop location.
- private float[] getDragViewVisualCenter(int x, int y, int xOffset, int yOffset,
- DragView dragView, float[] recycle) {
- float res[];
- if (recycle == null) {
- res = new float[2];
- } else {
- res = recycle;
- }
-
- // These represent the visual top and left of drag view if a dragRect was provided.
- // If a dragRect was not provided, then they correspond to the actual view left and
- // top, as the dragRect is in that case taken to be the entire dragView.
- // R.dimen.dragViewOffsetY.
- int left = x - xOffset;
- int top = y - yOffset;
-
- // In order to find the visual center, we shift by half the dragRect
- res[0] = left + dragView.getDragRegion().width() / 2;
- res[1] = top + dragView.getDragRegion().height() / 2;
-
- return res;
- }
-
OnAlarmListener mOnExitAlarmListener = new OnAlarmListener() {
public void onAlarm(Alarm alarm) {
completeDragExit();