Make home send tap commands to live wallpaper.
(This only applies to taps on empty spaces)
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 63e01bb..6dd18d3 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -58,6 +58,8 @@
private RectF mDragRect = new RectF();
private boolean mDirtyTag;
+
+ private boolean mLastDownOnOccupiedCell = false;
public CellLayout(Context context) {
this(context, null);
@@ -176,6 +178,8 @@
}
}
}
+
+ mLastDownOnOccupiedCell = found;
if (!found) {
int cellXY[] = mCellXY;
@@ -1039,6 +1043,10 @@
", y=" + cellY + "]";
}
}
+
+ public boolean lastDownOnOccupiedCell() {
+ return mLastDownOnOccupiedCell;
+ }
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b2f0a4d..d4a9d95 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -77,7 +77,7 @@
private float mLastMotionX;
private float mLastMotionY;
-
+
private final static int TOUCH_STATE_REST = 0;
private final static int TOUCH_STATE_SCROLLING = 1;
@@ -735,10 +735,22 @@
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
+
+ if (mTouchState != TOUCH_STATE_SCROLLING) {
+
+ final CellLayout currentScreen = (CellLayout)getChildAt(mCurrentScreen);
+ if (!currentScreen.lastDownOnOccupiedCell()) {
+ // Send a tap to the wallpaper if the last down was on empty space
+ mWallpaperManager.sendWallpaperCommand(getWindowToken(),
+ "android.wallpaper.tap", (int) ev.getX(), (int) ev.getY(), 0, null);
+ }
+ }
+
// Release the drag
clearChildrenCache();
mTouchState = TOUCH_STATE_REST;
mAllowLongPress = false;
+
break;
}
@@ -768,7 +780,7 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
-
+
if (mLauncher.isWorkspaceLocked()) {
return false; // We don't want the events. Let them fall through to the all apps view.
}