am 81ce77ac: am f8bbd34d: Make home send tap commands to live wallpaper.

Merge commit '81ce77aca4b2dd402f9e883d905591588a326a19' into eclair-mr2-plus-aosp

* commit '81ce77aca4b2dd402f9e883d905591588a326a19':
  Make home send tap commands to live wallpaper.
This commit is contained in:
Mike Cleron
2009-10-23 17:03:16 -07:00
committed by Android Git Automerger
2 changed files with 22 additions and 2 deletions
@@ -58,6 +58,8 @@ public class CellLayout extends ViewGroup {
private RectF mDragRect = new RectF();
private boolean mDirtyTag;
private boolean mLastDownOnOccupiedCell = false;
public CellLayout(Context context) {
this(context, null);
@@ -176,6 +178,8 @@ public class CellLayout extends ViewGroup {
}
}
}
mLastDownOnOccupiedCell = found;
if (!found) {
int cellXY[] = mCellXY;
@@ -1039,6 +1043,10 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
", y=" + cellY + "]";
}
}
public boolean lastDownOnOccupiedCell() {
return mLastDownOnOccupiedCell;
}
}
+14 -2
View File
@@ -77,7 +77,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
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 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
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 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
@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.
}