Fixing bug where widget preview wasn't fully updated upon drop
-> The prebound widget is now added to the DragLayer to ensure
that it goes through all necessary measure/layout/attach etc.
Change-Id: I53ca32e88fcbc2211d2747c3b067816c0d518e30
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 2f8d128..ff1118c 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -570,6 +570,8 @@
mLauncher.getAppWidgetHost().createView(mContext, mWidgetLoadingId, pInfo);
info.boundWidget = hostView;
mWidgetCleanupState = WIDGET_INFLATED;
+ hostView.setVisibility(INVISIBLE);
+ mLauncher.getDragLayer().addView(hostView);
}
};
post(mInflateWidgetRunnable);
@@ -596,6 +598,7 @@
AppWidgetHostView widget = info.boundWidget;
int widgetId = widget.getAppWidgetId();
mLauncher.getAppWidgetHost().deleteAppWidgetId(widgetId);
+ mLauncher.getDragLayer().removeView(widget);
}
mWidgetCleanupState = WIDGET_NO_CLEANUP_REQUIRED;
mWidgetLoadingId = -1;