Make Launcher more forgiving when dragging desktop items.

This change adds nearby-area searching when dragging desktop items into already-occupied cells.  This approach tries harder to find a matching area, instead of strictly rejecting invalid moves.

We also draw a "snag" during the drag to show where an item would be dropped, but only if we would drop into an alternative cell.  This gives users better feedback about where things will drop.

http://b/issue?id=1634887
This commit is contained in:
Jeff Sharkey
2009-04-07 21:08:40 -07:00
parent bb760cc21e
commit 70864289fb
8 changed files with 273 additions and 78 deletions

View File

@@ -1,6 +1,7 @@
package com.android.launcher;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -33,6 +34,10 @@ public class UserFolder extends Folder implements DropTarget {
return (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && item.container != mInfo.id;
}
public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo, Rect recycle) {
return null;
}
public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
final ApplicationInfo item = (ApplicationInfo) dragInfo;