Fixing small folder bugs
-> Preventing duplicate item adds
-> Stopping touch events from falling through to workspace
Change-Id: I0326a1bf442b1705d3790a701649788413e7a633
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 5a4358d..3a8a68d 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -29,6 +29,7 @@
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 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 @@
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 @@
}
findAndSetEmptyCells(item);
mInfo.add(item);
- createAndAddShortcut(item);
LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, item.cellX, item.cellY);
}