summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2014-09-24 03:21:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-24 03:21:33 +0000
commit4285afce9db42f8f7a32caecd41549b27ea50052 (patch)
tree5ad173bea789a5a63dc6939c3e630b146e34bec3
parent9e95e4e346df8bdf8aa675a21bfb3f42074dca45 (diff)
parent277a3b2505b79c3634fc5f9f5a0924f47e616529 (diff)
am 277a3b25: am 2292a202: Merge "Drag and drop for PhoneFavoriteTileView but not when dialpad is open" into lmp-dev
* commit '277a3b2505b79c3634fc5f9f5a0924f47e616529': Drag and drop for PhoneFavoriteTileView but not when dialpad is open
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteListView.java3
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteTileView.java9
2 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java
index 667681e01..ec31bd31f 100644
--- a/src/com/android/dialer/list/PhoneFavoriteListView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteListView.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Handler;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.DragEvent;
@@ -149,7 +150,7 @@ public class PhoneFavoriteListView extends GridView implements OnDragDropListene
final int eY = (int) event.getY();
switch (action) {
case DragEvent.ACTION_DRAG_STARTED: {
- if (PhoneFavoriteTileView.EMPTY_CLIP_DATA != event.getClipData()) {
+ if (!PhoneFavoriteTileView.DRAG_PHONE_FAVORITE_TILE.equals(event.getLocalState())) {
// Ignore any drag events that were not propagated by long pressing
// on a {@link PhoneFavoriteTileView}
return false;
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index 2aedd9479..56d0b5d22 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -56,7 +56,11 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
// Dummy clip data object that is attached to drag shadows so that text views
// don't crash with an NPE if the drag shadow is released in their bounds
- static final ClipData EMPTY_CLIP_DATA = ClipData.newPlainText("", "");
+ private static final ClipData EMPTY_CLIP_DATA = ClipData.newPlainText("", "");
+
+ // Constant to pass to the drag event so that the drag action only happens when a phone favorite
+ // tile is long pressed.
+ static final String DRAG_PHONE_FAVORITE_TILE = "PHONE_FAVORITE_TILE";
public PhoneFavoriteTileView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -72,7 +76,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
public boolean onLongClick(View v) {
final PhoneFavoriteTileView view = (PhoneFavoriteTileView) v;
// NOTE The drag shadow is handled in the ListView.
- view.startDrag(EMPTY_CLIP_DATA, new View.DragShadowBuilder(), null, 0);
+ view.startDrag(EMPTY_CLIP_DATA, new View.DragShadowBuilder(),
+ DRAG_PHONE_FAVORITE_TILE, 0);
return true;
}
});