From 49643eb1d18567aeb5a4bd0e881ee5a57d744776 Mon Sep 17 00:00:00 2001 From: Romain Guy <> Date: Thu, 26 Mar 2009 10:08:23 -0700 Subject: [PATCH] Automated import from //branches/cupcake/...@142933,142933 --- src/com/android/launcher/Launcher.java | 36 +++++++-------------- src/com/android/launcher/LauncherModel.java | 2 +- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java index 245d03c1a0..7b7802e1f8 100644 --- a/src/com/android/launcher/Launcher.java +++ b/src/com/android/launcher/Launcher.java @@ -1237,6 +1237,8 @@ public final class Launcher extends Activity implements View.OnClickListener, On return; } + mAllAppsGrid.setAdapter(drawerAdapter); + final Workspace workspace = mWorkspace; int count = workspace.getChildCount(); for (int i = 0; i < count; i++) { @@ -1260,7 +1262,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On mBinder.mTerminate = true; } - mBinder = new DesktopBinder(this, shortcuts, appWidgets, drawerAdapter); + mBinder = new DesktopBinder(this, shortcuts, appWidgets); mBinder.startBindingItems(); } @@ -1314,7 +1316,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On if (end >= count) { finishBindDesktopItems(); - binder.startBindingDrawer(); + binder.startBindingAppWidgetsWhenIdle(); } else { binder.obtainMessage(DesktopBinder.MESSAGE_BIND_ITEMS, i, count).sendToTarget(); } @@ -1361,12 +1363,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On mDrawer.unlock(); } - private void bindDrawer(Launcher.DesktopBinder binder, - ApplicationsAdapter drawerAdapter) { - mAllAppsGrid.setAdapter(drawerAdapter); - binder.startBindingAppWidgetsWhenIdle(); - } - private void bindAppWidgets(Launcher.DesktopBinder binder, LinkedList appWidgets) { @@ -1377,10 +1373,14 @@ public final class Launcher extends Activity implements View.OnClickListener, On final LauncherAppWidgetInfo item = appWidgets.removeFirst(); final int appWidgetId = item.appWidgetId; - final AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId); + final AppWidgetProviderInfo appWidgetInfo = + mAppWidgetManager.getAppWidgetInfo(appWidgetId); item.hostView = mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo); - if (LOGD) d(LOG_TAG, String.format("about to setAppWidget for id=%d, info=%s", appWidgetId, appWidgetInfo)); + if (LOGD) { + d(LOG_TAG, String.format("about to setAppWidget for id=%d, info=%s", + appWidgetId, appWidgetInfo)); + } item.hostView.setAppWidget(appWidgetId, appWidgetInfo); item.hostView.setTag(item); @@ -1968,25 +1968,21 @@ public final class Launcher extends Activity implements View.OnClickListener, On private static class DesktopBinder extends Handler implements MessageQueue.IdleHandler { static final int MESSAGE_BIND_ITEMS = 0x1; static final int MESSAGE_BIND_APPWIDGETS = 0x2; - static final int MESSAGE_BIND_DRAWER = 0x3; // Number of items to bind in every pass static final int ITEMS_COUNT = 6; private final ArrayList mShortcuts; private final LinkedList mAppWidgets; - private final ApplicationsAdapter mDrawerAdapter; private final WeakReference mLauncher; - public boolean mTerminate = false; + public volatile boolean mTerminate = false; DesktopBinder(Launcher launcher, ArrayList shortcuts, - ArrayList appWidgets, - ApplicationsAdapter drawerAdapter) { + ArrayList appWidgets) { mLauncher = new WeakReference(launcher); mShortcuts = shortcuts; - mDrawerAdapter = drawerAdapter; // Sort widgets so active workspace is bound first final int currentScreen = launcher.mWorkspace.getCurrentScreen(); @@ -2006,10 +2002,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On public void startBindingItems() { obtainMessage(MESSAGE_BIND_ITEMS, 0, mShortcuts.size()).sendToTarget(); } - - public void startBindingDrawer() { - obtainMessage(MESSAGE_BIND_DRAWER).sendToTarget(); - } public void startBindingAppWidgetsWhenIdle() { // Ask for notification when message queue becomes idle @@ -2039,10 +2031,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On launcher.bindItems(this, mShortcuts, msg.arg1, msg.arg2); break; } - case MESSAGE_BIND_DRAWER: { - launcher.bindDrawer(this, mDrawerAdapter); - break; - } case MESSAGE_BIND_APPWIDGETS: { launcher.bindAppWidgets(this, mAppWidgets); break; diff --git a/src/com/android/launcher/LauncherModel.java b/src/com/android/launcher/LauncherModel.java index de84560be8..e3020818b6 100644 --- a/src/com/android/launcher/LauncherModel.java +++ b/src/com/android/launcher/LauncherModel.java @@ -47,7 +47,7 @@ import java.net.URISyntaxException; * for the Launcher. */ public class LauncherModel { - static final boolean DEBUG_LOADERS = false; + static final boolean DEBUG_LOADERS = true; static final String LOG_TAG = "HomeLoaders"; private static final int UI_NOTIFICATION_RATE = 4;