resolved conflicts for merge of 13ef17a3 to mnc-dr-dev

b/22609402
Change-Id: I140cf972d57e14737a6f91c0b4a8ec6c7ff1af2b
This commit is contained in:
Hyunyoung Song authored and Ed Heyl committed 2015-07-22 11:31:04 -07:00
1 parent a83129f0bc
commit e612775922
630 files changed
+23760 -21646

No files matched your search

+27 -38
View File
@@ -16,10 +16,8 @@
package com.android.launcher3;
import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.Log;
/**
* Interface defining an object that can receive a drag.
@@ -29,7 +27,7 @@ public interface DropTarget {
public static final String TAG = "DropTarget";
class DragObject {
public static class DragObject {
public int x = -1;
public int y = -1;
@@ -54,6 +52,9 @@ public interface DropTarget {
/** Where the drag originated */
public DragSource dragSource = null;
/** The object is part of an accessible drag operation */
public boolean accessibleDrag;
/** Post drag animation runnable */
public Runnable postAnimationRunnable = null;
@@ -65,42 +66,28 @@ public interface DropTarget {
public DragObject() {
}
}
public static class DragEnforcer implements DragController.DragListener {
int dragParity = 0;
/**
* This is used to compute the visual center of the dragView. This point is then
* used to visualize drop locations and determine where to drop an item. 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.
*/
public final float[] getVisualCenter(float[] recycle) {
final float res[] = (recycle == null) ? new float[2] : recycle;
public DragEnforcer(Context context) {
Launcher launcher = (Launcher) context;
launcher.getDragController().addDragListener(this);
}
// 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;
void onDragEnter() {
dragParity++;
if (dragParity != 1) {
Log.e(TAG, "onDragEnter: Drag contract violated: " + dragParity);
}
}
// 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;
void onDragExit() {
dragParity--;
if (dragParity != 0) {
Log.e(TAG, "onDragExit: Drag contract violated: " + dragParity);
}
}
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
if (dragParity != 0) {
Log.e(TAG, "onDragEnter: Drag contract violated: " + dragParity);
}
}
@Override
public void onDragEnd() {
if (dragParity != 0) {
Log.e(TAG, "onDragExit: Drag contract violated: " + dragParity);
}
return res;
}
}
@@ -113,7 +100,7 @@ public interface DropTarget {
/**
* Handle an object being dropped on the DropTarget
*
*
* @param source DragSource where the drag started
* @param x X coordinate of the drop location
* @param y Y coordinate of the drop location
@@ -138,12 +125,12 @@ public interface DropTarget {
* of onDrop(). (This is only called on objects that are set as the DragController's
* fling-to-delete target.
*/
void onFlingToDelete(DragObject dragObject, int x, int y, PointF vec);
void onFlingToDelete(DragObject dragObject, PointF vec);
/**
* Check if a drop action can occur at, or near, the requested location.
* This will be called just before onDrop.
*
*
* @param source DragSource where the drag started
* @param x X coordinate of the drop location
* @param y Y coordinate of the drop location
@@ -157,6 +144,8 @@ public interface DropTarget {
*/
boolean acceptDrop(DragObject dragObject);
void prepareAccessibilityDrop();
// These methods are implemented in Views
void getHitRectRelativeToDragLayer(Rect outRect);
void getLocationInDragLayer(int[] loc);