Convert the tap and drop live wallpaper commands coordinates to screen space.

This commit is contained in:
Romain Guy
2010-01-25 16:51:08 -08:00
parent 37fde2a9bc
commit 06762ab54d
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -565,8 +565,11 @@ public class CellLayout extends ViewGroup {
if (lp.dropped) {
lp.dropped = false;
final int[] cellXY = mCellXY;
getLocationOnScreen(cellXY);
mWallpaperManager.sendWallpaperCommand(getWindowToken(), "android.home.drop",
childLeft + lp.width / 2, childTop + lp.height / 2, 0, null);
cellXY[0] + childLeft + lp.width / 2,
cellXY[1] + childTop + lp.height / 2, 0, null);
}
}
}
+4 -2
View File
@@ -637,12 +637,14 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
case MotionEvent.ACTION_UP:
if (mTouchState != TOUCH_STATE_SCROLLING) {
final CellLayout currentScreen = (CellLayout)getChildAt(mCurrentScreen);
if (!currentScreen.lastDownOnOccupiedCell()) {
getLocationOnScreen(mTempCell);
// 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);
"android.wallpaper.tap",
mTempCell[0] + (int) ev.getX(),
mTempCell[1] + (int) ev.getY(), 0, null);
}
}