Lowering long press time for workspace items.

Change-Id: I6a3b0e13681f07d0e50bf2dcec777037c4ef51a5
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index ff7e10f..c005edf 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -30,6 +30,7 @@
 import android.os.Parcelable;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.AccelerateInterpolator;
@@ -53,6 +54,8 @@
     FolderInfo mInfo;
     private static boolean sStaticValuesDirty = true;
 
+    private CheckLongPressHelper mLongPressHelper;
+
     // The number of icons to display in the
     private static final int NUM_ITEMS_IN_PREVIEW = 3;
     private static final int CONSUMPTION_ANIMATION_DURATION = 100;
@@ -95,10 +98,16 @@
 
     public FolderIcon(Context context, AttributeSet attrs) {
         super(context, attrs);
+        init();
     }
 
     public FolderIcon(Context context) {
         super(context);
+        init();
+    }
+
+    private void init() {
+        mLongPressHelper = new CheckLongPressHelper(this);
     }
 
     public boolean isDropEnabled() {
@@ -591,4 +600,29 @@
         setContentDescription(String.format(mContext.getString(R.string.folder_name_format),
                 title));
     }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        // Call the superclass onTouchEvent first, because sometimes it changes the state to
+        // isPressed() on an ACTION_UP
+        boolean result = super.onTouchEvent(event);
+
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                mLongPressHelper.postCheckForLongPress();
+                break;
+            case MotionEvent.ACTION_CANCEL:
+            case MotionEvent.ACTION_UP:
+                mLongPressHelper.cancelLongPress();
+                break;
+        }
+        return result;
+    }
+
+    @Override
+    public void cancelLongPress() {
+        super.cancelLongPress();
+
+        mLongPressHelper.cancelLongPress();
+    }
 }