Merge "Fixing bug where widget preview wasn't fully updated upon drop"

This commit is contained in:
Adam Cohen
2012-02-15 11:16:07 -08:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 14 deletions
@@ -570,6 +570,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
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 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
AppWidgetHostView widget = info.boundWidget;
int widgetId = widget.getAppWidgetId();
mLauncher.getAppWidgetHost().deleteAppWidgetId(widgetId);
mLauncher.getDragLayer().removeView(widget);
}
mWidgetCleanupState = WIDGET_NO_CLEANUP_REQUIRED;
mWidgetLoadingId = -1;
+1 -14
View File
@@ -3003,23 +3003,11 @@ public class Workspace extends SmoothPagedView
}
}
// The following methods deal with animating an item from external drop
void onPreDraw(View v) {
if (v instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) v;
for (int i = 0; i < vg.getChildCount(); i++) {
View child = vg.getChildAt(i);
onPreDraw(child);
}
} else if (v instanceof TextView) {
((TextView) v).onPreDraw();
}
}
public Bitmap createWidgetBitmap(PendingAddWidgetInfo widgetInfo) {
int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(widgetInfo.spanX,
widgetInfo.spanY, widgetInfo, false);
View layout = widgetInfo.boundWidget;
mLauncher.getDragLayer().removeView(layout);
layout.setVisibility(VISIBLE);
int width = MeasureSpec.makeMeasureSpec(unScaledSize[0], MeasureSpec.EXACTLY);
@@ -3030,7 +3018,6 @@ public class Workspace extends SmoothPagedView
layout.measure(width, height);
layout.layout(0, 0, unScaledSize[0], unScaledSize[1]);
onPreDraw(layout);
layout.draw(c);
c.setBitmap(null);
return b;