summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java14
-rw-r--r--src/com/android/launcher2/LauncherAppWidgetHost.java15
2 files changed, 13 insertions, 16 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 94a6a2b..ef33272 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -525,20 +525,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
public void onPackagesUpdated() {
- // TODO: this isn't ideal, but we actually need to delay here. This call is triggered
- // by a broadcast receiver, and in order for it to work correctly, we need to know that
- // the AppWidgetService has already received and processed the same broadcast. Since there
- // is no guarantee about ordering of broadcast receipt, we just delay here. This is a
- // workaround until we add a callback from AppWidgetService to AppWidgetHost when widget
- // packages are added, updated or removed.
- postDelayed(new Runnable() {
- public void run() {
- updatePackages();
- }
- }, 1500);
- }
-
- public void updatePackages() {
// Get the list of widgets and shortcuts
mWidgets.clear();
List<AppWidgetProviderInfo> widgets =
diff --git a/src/com/android/launcher2/LauncherAppWidgetHost.java b/src/com/android/launcher2/LauncherAppWidgetHost.java
index 68d4903..35c60a0 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHost.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHost.java
@@ -27,8 +27,12 @@ import android.content.Context;
* always pick up and move widgets.
*/
public class LauncherAppWidgetHost extends AppWidgetHost {
- public LauncherAppWidgetHost(Context context, int hostId) {
- super(context, hostId);
+
+ Launcher mLauncher;
+
+ public LauncherAppWidgetHost(Launcher launcher, int hostId) {
+ super(launcher, hostId);
+ mLauncher = launcher;
}
@Override
@@ -42,4 +46,11 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
super.stopListening();
clearViews();
}
+
+ @Override
+ protected void onProvidersChanged() {
+ // Once we get the message that widget packages are updated, we need to rebind items
+ // in AppsCustomize accordingly.
+ mLauncher.bindPackagesUpdated();
+ }
}