From 0c872ba544ecfd9b106bb66137da8680927590de Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Thu, 5 May 2011 10:34:16 -0700 Subject: [PATCH] Fixing small folder bugs -> Preventing duplicate item adds -> Stopping touch events from falling through to workspace Change-Id: I0326a1bf442b1705d3790a701649788413e7a633 --- src/com/android/launcher2/Folder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index 5a4358d2fd..3a8a68d56a 100644 --- a/src/com/android/launcher2/Folder.java +++ b/src/com/android/launcher2/Folder.java @@ -29,6 +29,7 @@ import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; @@ -40,6 +41,7 @@ import android.widget.AdapterView.OnItemLongClickListener; import com.android.launcher.R; import com.android.launcher2.FolderInfo.FolderListener; +import com.android.launcher2.Workspace.ShrinkState; /** * Represents a set of icons chosen by the user or generated by the system. @@ -144,6 +146,14 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL return true; } + /** + * We need to handle touch events to prevent them from falling through to the workspace below. + */ + @Override + public boolean onTouchEvent(MotionEvent ev) { + return true; + } + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { if (!view.isInTouchMode()) { return false; @@ -353,7 +363,6 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL } findAndSetEmptyCells(item); mInfo.add(item); - createAndAddShortcut(item); LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, item.cellX, item.cellY); }