From 7501adf4b71bb17d0785a5939efbcac4b39125c3 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 2 Jun 2015 11:24:28 -0700 Subject: Ensure that we use the system long press duration when dragging from AllApps. - Removing some old code out of LauncherAppState Bug: 21559400 Change-Id: I3c586094efb7ad8a17d2169bc8aaccf6b0df40a2 --- src/com/android/launcher3/CheckLongPressHelper.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/com/android/launcher3/CheckLongPressHelper.java') diff --git a/src/com/android/launcher3/CheckLongPressHelper.java b/src/com/android/launcher3/CheckLongPressHelper.java index 381b678f9..483c62249 100644 --- a/src/com/android/launcher3/CheckLongPressHelper.java +++ b/src/com/android/launcher3/CheckLongPressHelper.java @@ -21,9 +21,11 @@ import android.view.View; import com.android.launcher3.util.Thunk; public class CheckLongPressHelper { + @Thunk View mView; @Thunk View.OnLongClickListener mListener; @Thunk boolean mHasPerformedLongPress; + private int mLongPressTimeout = 300; private CheckForLongPress mPendingCheckForLongPress; class CheckForLongPress implements Runnable { @@ -53,14 +55,20 @@ public class CheckLongPressHelper { mListener = listener; } + /** + * Overrides the default long press timeout. + */ + public void setLongPressTimeout(int longPressTimeout) { + mLongPressTimeout = longPressTimeout; + } + public void postCheckForLongPress() { mHasPerformedLongPress = false; if (mPendingCheckForLongPress == null) { mPendingCheckForLongPress = new CheckForLongPress(); } - mView.postDelayed(mPendingCheckForLongPress, - LauncherAppState.getInstance().getLongPressTimeout()); + mView.postDelayed(mPendingCheckForLongPress, mLongPressTimeout); } public void cancelLongPress() { -- cgit v1.2.3