summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-02-14 20:54:05 -0800
committerAdam Cohen <adamcohen@google.com>2012-02-14 20:55:35 -0800
commitef3dd6efe03c988be1fe980fbed75333017e6760 (patch)
tree969d2b8e653baf7d62288a9ab96bf13705480d65 /src
parent038085598ca6180688767f90a759a5eda30e2daa (diff)
downloadandroid_packages_apps_Trebuchet-ef3dd6efe03c988be1fe980fbed75333017e6760.tar.gz
android_packages_apps_Trebuchet-ef3dd6efe03c988be1fe980fbed75333017e6760.tar.bz2
android_packages_apps_Trebuchet-ef3dd6efe03c988be1fe980fbed75333017e6760.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java3
-rw-r--r--src/com/android/launcher2/Workspace.java15
2 files changed, 4 insertions, 14 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 2f8d128c0..ff1118c2e 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -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;
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 9274f8134..4e731a2ed 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -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;