From 090ccc50ee6d6895db77ffc4afcf7dd66f30597a Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 30 Sep 2013 16:40:17 -0700 Subject: Fix flicker when long pressing to drag and drop Initial creation of drag shadow now uses the same layout logic as drag hovering so that the shadow does not jump upon first creation. Removed setPressed from onLongClick listener to avoid toggling of pressed state when drag was started. Bug: 10991974 Change-Id: I186cd62060e3a79913aa89fb7af989f3497e0b10 --- src/com/android/dialer/list/PhoneFavoriteListView.java | 11 ++--------- src/com/android/dialer/list/PhoneFavoriteTileView.java | 1 - src/com/android/dialer/list/PhoneFavoritesTileAdapter.java | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java index 10b9e9a96..b685e8231 100644 --- a/src/com/android/dialer/list/PhoneFavoriteListView.java +++ b/src/com/android/dialer/list/PhoneFavoriteListView.java @@ -306,14 +306,6 @@ public class PhoneFavoriteListView extends ListView implements SwipeHelperCallba } } - private FrameLayout.LayoutParams getDragShadowLayoutParams() { - final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( - mDragShadowWidth, mDragShadowHeight); - lp.leftMargin = mDragShadowLeft; - lp.topMargin = mDragShadowTop; - return lp; - } - /** * @return True if the drag is started. */ @@ -361,7 +353,8 @@ public class PhoneFavoriteListView extends ListView implements SwipeHelperCallba mDragShadowOverlay.setVisibility(VISIBLE); mDragShadowOverlay.setAlpha(DRAG_SHADOW_ALPHA); - mDragShadowOverlay.setLayoutParams(getDragShadowLayoutParams()); + mDragShadowOverlay.setX(mDragShadowLeft); + mDragShadowOverlay.setY(mDragShadowTop); // x and y passed in are the coordinates of where the user has touched down, calculate // the offset to the top left coordinate of the dragged child. This will be used for diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java index 765745172..ac89fd693 100644 --- a/src/com/android/dialer/list/PhoneFavoriteTileView.java +++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java @@ -96,7 +96,6 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { - setPressed(false); final PhoneFavoriteTileView view = (PhoneFavoriteTileView) v; // NOTE The drag shadow is handled in the ListView. if (view instanceof PhoneFavoriteRegularRowView) { diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index ce18a2b87..a4a2cb418 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -772,7 +772,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements setVisibility(View.VISIBLE); } } - setPressed(false); } private void addTileFromEntry(ContactEntry entry, int childIndex, boolean isLastRow) { -- cgit v1.2.3