Removing drag and drop parity exceptions

Change-Id: I065c9376ebeedc6b11d1ac5805e0326bd7dd8f26
This commit is contained in:
Adam Cohen
2012-04-24 14:36:11 -07:00
parent cb3f98e983
commit 570f51446d

View File

@@ -19,6 +19,7 @@ package com.android.launcher2;
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.
@@ -26,6 +27,8 @@ import android.graphics.Rect;
*/
public interface DropTarget {
public static final String TAG = "DropTarget";
class DragObject {
public int x = -1;
public int y = -1;
@@ -75,28 +78,28 @@ public interface DropTarget {
void onDragEnter() {
dragParity++;
if (dragParity != 1) {
throw new RuntimeException("onDragEnter: Drag contract violated: " + dragParity);
Log.e(TAG, "onDragEnter: Drag contract violated: " + dragParity);
}
}
void onDragExit() {
dragParity--;
if (dragParity != 0) {
throw new RuntimeException("onDragExit: Drag contract violated: " + dragParity);
Log.e(TAG, "onDragExit: Drag contract violated: " + dragParity);
}
}
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
if (dragParity != 0) {
throw new RuntimeException("onDragEnter: Drag contract violated: " + dragParity);
Log.e(TAG, "onDragEnter: Drag contract violated: " + dragParity);
}
}
@Override
public void onDragEnd() {
if (dragParity != 0) {
throw new RuntimeException("onDragExit: Drag contract violated: " + dragParity);
Log.e(TAG, "onDragExit: Drag contract violated: " + dragParity);
}
}
}