diff options
Diffstat (limited to 'src/com/android/launcher3/CheckLongPressHelper.java')
-rw-r--r-- | src/com/android/launcher3/CheckLongPressHelper.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/launcher3/CheckLongPressHelper.java b/src/com/android/launcher3/CheckLongPressHelper.java index 10ca6a371..381b678f9 100644 --- a/src/com/android/launcher3/CheckLongPressHelper.java +++ b/src/com/android/launcher3/CheckLongPressHelper.java @@ -22,6 +22,7 @@ import com.android.launcher3.util.Thunk; public class CheckLongPressHelper { @Thunk View mView; + @Thunk View.OnLongClickListener mListener; @Thunk boolean mHasPerformedLongPress; private CheckForLongPress mPendingCheckForLongPress; @@ -29,7 +30,13 @@ public class CheckLongPressHelper { public void run() { if ((mView.getParent() != null) && mView.hasWindowFocus() && !mHasPerformedLongPress) { - if (mView.performLongClick()) { + boolean handled; + if (mListener != null) { + handled = mListener.onLongClick(mView); + } else { + handled = mView.performLongClick(); + } + if (handled) { mView.setPressed(false); mHasPerformedLongPress = true; } @@ -41,6 +48,11 @@ public class CheckLongPressHelper { mView = v; } + public CheckLongPressHelper(View v, View.OnLongClickListener listener) { + mView = v; + mListener = listener; + } + public void postCheckForLongPress() { mHasPerformedLongPress = false; |