summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteDragAndDropListeners.java11
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java8
2 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoriteDragAndDropListeners.java b/src/com/android/dialer/list/PhoneFavoriteDragAndDropListeners.java
index 89f39ce0f..ac089c76f 100644
--- a/src/com/android/dialer/list/PhoneFavoriteDragAndDropListeners.java
+++ b/src/com/android/dialer/list/PhoneFavoriteDragAndDropListeners.java
@@ -17,7 +17,6 @@ package com.android.dialer.list;
import android.content.ClipData;
import android.graphics.Rect;
-import android.graphics.Canvas;
import android.util.Log;
import android.view.DragEvent;
import android.view.GestureDetector.SimpleOnGestureListener;
@@ -136,6 +135,9 @@ public class PhoneFavoriteDragAndDropListeners {
@Override
public boolean onDrag(View v, DragEvent event) {
+ if (DEBUG) {
+ Log.v(TAG, event.toString());
+ }
// Handles drag events.
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
@@ -198,6 +200,13 @@ public class PhoneFavoriteDragAndDropListeners {
}
break;
case DragEvent.ACTION_DRAG_ENDED:
+ if (mTileAdapter.getInDragging()) {
+ // If the drag and drop ends when the drop happens outside of any rows,
+ // we will end the drag here and put the item back to where it was dragged
+ // from before.
+ mTileAdapter.setInDragging(false);
+ mTileAdapter.dropToUnsupportedView();
+ }
break;
case DragEvent.ACTION_DRAG_LOCATION:
break;
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 58ebcff78..91ad110f2 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -521,6 +521,14 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter {
}
/**
+ * Invoked when the dragged item is dropped to unsupported location. We will then move the
+ * contact back to where it was dragged from.
+ */
+ public void dropToUnsupportedView() {
+ dropContactEntry(-1);
+ }
+
+ /**
* Sets an item to for pending removal. If the user does not click the undo button, the item
* will be removed at the next interaction.
*