diff options
author | Sailesh Nepal <sail@google.com> | 2016-06-02 15:20:42 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-06-02 15:20:42 +0000 |
commit | 5401d78fb2741e79441fe557bbc3bfb71fe768da (patch) | |
tree | 17553c2bf4a02c86399e931c715d1320c4ad8ce9 /src/com/android | |
parent | bef81166d9a65469aff4b116e20d2c59777de95c (diff) | |
parent | eb66b0feeeefd4e6362f0b5063978a6c057606f5 (diff) |
Merge "Fix bug where a starred contact couldn\'t be removed" into nyc-dev
am: eb66b0feee
* commit 'eb66b0feeeefd4e6362f0b5063978a6c057606f5':
Fix bug where a starred contact couldn't be removed
Change-Id: I12a76d5dc73101bec87a05d3fab04f6d0be664a6
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/dialer/list/DragDropController.java | 20 | ||||
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoriteListView.java | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/com/android/dialer/list/DragDropController.java b/src/com/android/dialer/list/DragDropController.java index 8cd1046e6..66ba513a8 100644 --- a/src/com/android/dialer/list/DragDropController.java +++ b/src/com/android/dialer/list/DragDropController.java @@ -3,6 +3,8 @@ package com.android.dialer.list; import android.util.Log; import android.view.View; +import com.android.contacts.common.compat.CompatUtils; + import java.util.ArrayList; import java.util.List; @@ -33,13 +35,23 @@ public class DragDropController { /** * @return True if the drag is started, false if the drag is cancelled for some reason. */ - boolean handleDragStarted(int x, int y) { - final PhoneFavoriteSquareTileView tileView = mDragItemContainer.getViewForLocation(x, y); + boolean handleDragStarted(View v, int x, int y) { + int screenX = x; + int screenY = y; + // The coordinates in dragEvent of DragEvent.ACTION_DRAG_STARTED before NYC is window-related. + // This is fixed in NYC. + if (CompatUtils.isNCompatible()) { + v.getLocationOnScreen(mLocationOnScreen); + screenX = x + mLocationOnScreen[0]; + screenY = y + mLocationOnScreen[1]; + } + final PhoneFavoriteSquareTileView tileView = mDragItemContainer.getViewForLocation( + screenX, screenY); if (tileView == null) { return false; } for (int i = 0; i < mOnDragDropListeners.size(); i++) { - mOnDragDropListeners.get(i).onDragStarted(x, y, tileView); + mOnDragDropListeners.get(i).onDragStarted(screenX, screenY, tileView); } return true; @@ -80,4 +92,4 @@ public class DragDropController { } } -}
\ No newline at end of file +} diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java index ec31bd31f..aad8ad58f 100644 --- a/src/com/android/dialer/list/PhoneFavoriteListView.java +++ b/src/com/android/dialer/list/PhoneFavoriteListView.java @@ -155,7 +155,7 @@ public class PhoneFavoriteListView extends GridView implements OnDragDropListene // on a {@link PhoneFavoriteTileView} return false; } - if (!mDragDropController.handleDragStarted(eX, eY)) { + if (!mDragDropController.handleDragStarted(this, eX, eY)) { return false; } break; |