Make home send tap commands to live wallpaper.
(This only applies to taps on empty spaces)
This commit is contained in:
@@ -59,6 +59,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
|
|
||||||
private boolean mDirtyTag;
|
private boolean mDirtyTag;
|
||||||
|
|
||||||
|
private boolean mLastDownOnOccupiedCell = false;
|
||||||
|
|
||||||
public CellLayout(Context context) {
|
public CellLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
@@ -177,6 +179,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mLastDownOnOccupiedCell = found;
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
int cellXY[] = mCellXY;
|
int cellXY[] = mCellXY;
|
||||||
pointToCellExact(x, y, cellXY);
|
pointToCellExact(x, y, cellXY);
|
||||||
@@ -1039,6 +1043,10 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
|
|||||||
", y=" + cellY + "]";
|
", y=" + cellY + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean lastDownOnOccupiedCell() {
|
||||||
|
return mLastDownOnOccupiedCell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -735,10 +735,22 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
|||||||
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
case MotionEvent.ACTION_UP:
|
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
|
// Release the drag
|
||||||
clearChildrenCache();
|
clearChildrenCache();
|
||||||
mTouchState = TOUCH_STATE_REST;
|
mTouchState = TOUCH_STATE_REST;
|
||||||
mAllowLongPress = false;
|
mAllowLongPress = false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user