When an app is chosen in All Apps, tapping a workspace screen adds it to that screen.

This commit is contained in:
Patrick Dubroy
2010-09-07 17:49:27 -07:00
parent b1254a6bdb
commit 2b9ff37edb
4 changed files with 64 additions and 11 deletions
+20 -3
View File
@@ -368,8 +368,7 @@ public class Workspace extends SmoothPagedView
public boolean onTouch(View v, MotionEvent event) {
// this is an intercepted event being forwarded from a cell layout
if (mIsSmall) {
unshrink((CellLayout)v);
mLauncher.onWorkspaceUnshrink();
mLauncher.onWorkspaceClick((CellLayout) v);
return true;
}
return false;
@@ -630,7 +629,7 @@ public class Workspace extends SmoothPagedView
}
// We call this when we trigger an unshrink by clicking on the CellLayout cl
private void unshrink(CellLayout clThatWasClicked) {
public void unshrink(CellLayout clThatWasClicked) {
int newCurrentPage = mCurrentPage;
final int screenCount = getChildCount();
for (int i = 0; i < screenCount; i++) {
@@ -974,6 +973,24 @@ public class Workspace extends SmoothPagedView
onDropExternal(x, y, dragInfo, cellLayout, false);
}
/**
* Add the item specified by dragInfo to the given layout.
* This is basically the equivalent of onDropExternal, except it's not initiated
* by drag and drop.
* @return true if successful
*/
public boolean addExternalItemToScreen(Object dragInfo, View layout) {
CellLayout cl = (CellLayout) layout;
ItemInfo info = (ItemInfo) dragInfo;
final CellLayout.CellInfo cellInfo = cl.updateOccupiedCells(null, null);
if (cellInfo.findCellForSpan(mTempEstimate, info.spanX, info.spanY)) {
onDropExternal(0, 0, dragInfo, cl, false);
return true;
}
return false;
}
private void onDropExternal(int x, int y, Object dragInfo,
CellLayout cellLayout, boolean insertAtFirst) {
// Drag from somewhere else