diff options
author | Yorke Lee <yorkelee@google.com> | 2013-08-20 09:52:51 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-20 09:52:51 -0700 |
commit | 5afb4e8a1dc712dfc95d4ee944ce1c166f72e03d (patch) | |
tree | ff07e90aa5124e851274883ebc074b41390ad34c | |
parent | b5daca78200ab1f174d8c0c312251d70bd3542f3 (diff) | |
parent | 68f2326059c3d2b7d45810ecc4207d837e4b4c3d (diff) |
am 68f23260: Merge "Prevent multiple swipes at one time" into klp-dev
* commit '68f2326059c3d2b7d45810ecc4207d837e4b4c3d':
Prevent multiple swipes at one time
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoritesTileAdapter.java | 15 | ||||
-rw-r--r-- | src/com/android/dialer/list/SwipeHelper.java | 2 | ||||
-rw-r--r-- | src/com/android/dialer/list/SwipeableListView.java | 6 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index c7c8ae83c..88520dd24 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -89,6 +89,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements /** Position of the contact pending removal. */ private int mPotentialRemoveEntryIndex = -1; + private boolean mAwaitingRemove = false; + private ContactPhotoManager mPhotoManager; protected int mNumFrequents; protected int mNumStarred; @@ -305,6 +307,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements mContactEntries.add(contact); } + mAwaitingRemove = false; + arrangeContactsByPinnedPosition(mContactEntries); notifyDataSetChanged(); @@ -636,6 +640,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements unstarAndUnpinContact(entry.lookupKey); notifyDataSetChanged(); removed = true; + mAwaitingRemove = true; } cleanTempVariables(); return removed; @@ -1000,7 +1005,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements @Override public boolean onInterceptTouchEvent(MotionEvent ev) { - if (mSwipeHelper != null) { + if (mSwipeHelper != null && isSwipeEnabled()) { return mSwipeHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev); } else { return super.onInterceptTouchEvent(ev); @@ -1009,7 +1014,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements @Override public boolean onTouchEvent(MotionEvent ev) { - if (mSwipeHelper != null) { + if (mSwipeHelper != null && isSwipeEnabled()) { return mSwipeHelper.onTouchEvent(ev) || super.onTouchEvent(ev); } else { return super.onTouchEvent(ev); @@ -1166,5 +1171,11 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements @Override public void onTouch() { removePendingContactEntry(); + return; + } + + @Override + public boolean isSwipeEnabled() { + return !mAwaitingRemove; } } diff --git a/src/com/android/dialer/list/SwipeHelper.java b/src/com/android/dialer/list/SwipeHelper.java index 3bcad2d95..f493c9dbb 100644 --- a/src/com/android/dialer/list/SwipeHelper.java +++ b/src/com/android/dialer/list/SwipeHelper.java @@ -465,5 +465,7 @@ public class SwipeHelper { public void onSwipe(View view); public void onTouch(); + + public boolean isSwipeEnabled(); } }
\ No newline at end of file diff --git a/src/com/android/dialer/list/SwipeableListView.java b/src/com/android/dialer/list/SwipeableListView.java index 504b1403b..29c4f674b 100644 --- a/src/com/android/dialer/list/SwipeableListView.java +++ b/src/com/android/dialer/list/SwipeableListView.java @@ -76,7 +76,7 @@ public class SwipeableListView extends ListView implements SwipeHelperCallback { } public boolean isSwipeEnabled() { - return mEnableSwipe; + return mEnableSwipe && mOnItemGestureListener.isSwipeEnabled(); } public void setOnItemSwipeListener(OnItemGestureListener listener) { @@ -85,7 +85,7 @@ public class SwipeableListView extends ListView implements SwipeHelperCallback { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { - if (mEnableSwipe) { + if (isSwipeEnabled()) { return mSwipeHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev); } else { return super.onInterceptTouchEvent(ev); @@ -97,7 +97,7 @@ public class SwipeableListView extends ListView implements SwipeHelperCallback { if (mOnItemGestureListener != null) { mOnItemGestureListener.onTouch(); } - if (mEnableSwipe) { + if (isSwipeEnabled()) { return mSwipeHelper.onTouchEvent(ev) || super.onTouchEvent(ev); } else { return super.onTouchEvent(ev); |