added support for dragging widgets and app icons to mini screens

- gave mini screens a rounded rect background
- mini screens change color when dragged over
- added a way to specify the active region of dragged items, to allow for clipping of whitespace at borders
- fixed: feedback while dragging was often one cell off
- fixed: bug when adding to almost-full screen
- removed unused classes

Change-Id: I2fbd2aaaee6831b288cca8dec75e7b446068e8d1
This commit is contained in:
Michael Jurka
2010-08-19 13:52:27 -07:00
parent 01f0ed4126
commit a63c452f5b
12 changed files with 333 additions and 314 deletions

View File

@@ -166,12 +166,26 @@ public class CustomizePagedView extends PagedView
final View animView = v;
switch (mCustomizationType) {
case WidgetCustomization:
// We assume that the view v is a TextView with a compound drawable on top, and that the
// whole text view is centered horizontally and top aligned. We get a more precise
// drag point using this information
final TextView textView = (TextView) animView;
final Drawable[] drawables = textView.getCompoundDrawables();
final Drawable icon = drawables[1];
int dragPointOffsetX = 0;
int dragPointOffsetY = 0;
Rect bounds = null;
if (icon != null) {
bounds = icon.getBounds();
bounds.left = (v.getWidth() - bounds.right) / 2;
bounds.right += bounds.left;
}
AppWidgetProviderInfo appWidgetInfo = (AppWidgetProviderInfo) v.getTag();
LauncherAppWidgetInfo dragInfo = new LauncherAppWidgetInfo(appWidgetInfo.provider);
dragInfo.minWidth = appWidgetInfo.minWidth;
dragInfo.minHeight = appWidgetInfo.minHeight;
mDragController.startDrag(v, this, dragInfo, DragController.DRAG_ACTION_COPY);
mLauncher.hideCustomizationDrawer();
mDragController.startDrag(v, this, dragInfo, DragController.DRAG_ACTION_COPY, bounds);
return true;
case FolderCustomization:
// animate some feedback to the long press