Improving widget handling for pinItemRequest

> Preloading widget view while dragging for smoother
  transition
> Skipping config activity and sending confirmation to
  the caller when widget is dropped

Bug: 33584624
Change-Id: Ib23e5964298296d12d9c93f38aefdf924a07368e
This commit is contained in:
Sunny Goyal
2017-01-25 11:30:06 -08:00
parent cd64d62a7e
commit 8a0dc38aeb
7 changed files with 114 additions and 20 deletions

View File

@@ -150,16 +150,7 @@ public class WidgetsContainerView extends BaseContainerView
// Return if global dragging is not enabled
if (!mLauncher.isDraggingEnabled()) return false;
boolean status = beginDragging(v);
if (status && v.getTag() instanceof PendingAddWidgetInfo) {
WidgetHostViewLoader hostLoader = new WidgetHostViewLoader(mLauncher, v);
boolean preloadStatus = hostLoader.preloadWidget();
if (LOGD) {
Log.d(TAG, String.format("preloading widget [status=%s]", preloadStatus));
}
mLauncher.getDragController().addDragListener(hostLoader);
}
return status;
return beginDragging(v);
}
private boolean beginDragging(View v) {
@@ -222,6 +213,8 @@ public class WidgetsContainerView extends BaseContainerView
bounds.right -= padding;
}
scale = bounds.width() / (float) preview.getWidth();
mLauncher.getDragController().addDragListener(new WidgetHostViewLoader(mLauncher, v));
} else {
PendingAddShortcutInfo createShortcutInfo = (PendingAddShortcutInfo) v.getTag();
Drawable icon = createShortcutInfo.activityInfo.getFullResIcon(mIconCache);