diff options
author | Narayan Kamath <narayan@google.com> | 2011-06-28 13:46:59 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2011-07-18 11:43:34 +0100 |
commit | cb1a4778686a46c46d8dc88b6c83674f6fac6592 (patch) | |
tree | 37ef3095d7c21d9820e935c436b223109fba2b6f /src | |
parent | 234c4cd54406e363a2ebc213f6ae5be284414988 (diff) | |
download | packages_apps_trebuchet-cb1a4778686a46c46d8dc88b6c83674f6fac6592.zip packages_apps_trebuchet-cb1a4778686a46c46d8dc88b6c83674f6fac6592.tar.gz packages_apps_trebuchet-cb1a4778686a46c46d8dc88b6c83674f6fac6592.tar.bz2 |
Update the search widget icon if the global search provider changes.
Note that this change is necessary because the launcher might
receive the PM broadcast before the SearchManagerService does.
Change-Id: I5a03e2fb16dee232a83d24b834ef6bd0eaabe774
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherApplication.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 489f3fb..a2e4bd0 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -317,6 +317,7 @@ public final class Launcher extends Activity // If we have a saved version of these external icons, we load them up immediately if (sGlobalSearchIcon == null || sVoiceSearchIcon == null || sAppMarketIcon == null) { updateIconsAffectedByPackageManagerChanges(); + updateGlobalSearchIcon(); } if (sGlobalSearchIcon != null) { updateGlobalSearchIcon(sGlobalSearchIcon); @@ -3133,10 +3134,14 @@ public final class Launcher extends Activity */ private void updateIconsAffectedByPackageManagerChanges() { updateAppMarketIcon(); - updateGlobalSearchIcon(); updateVoiceSearchIcon(); } + @Override + public void bindSearchablesChanged() { + updateGlobalSearchIcon(); + } + /** * Add the icons for all apps. * @@ -3147,6 +3152,7 @@ public final class Launcher extends Activity mAppsCustomizeContent.setApps(apps); } updateIconsAffectedByPackageManagerChanges(); + updateGlobalSearchIcon(); } /** diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java index db3a4cb..94163ac 100644 --- a/src/com/android/launcher2/LauncherApplication.java +++ b/src/com/android/launcher2/LauncherApplication.java @@ -17,6 +17,7 @@ package com.android.launcher2; import android.app.Application; +import android.app.SearchManager; import android.content.ContentResolver; import android.content.Intent; import android.content.IntentFilter; @@ -57,6 +58,9 @@ public class LauncherApplication extends Application { filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); filter.addAction(Intent.ACTION_LOCALE_CHANGED); registerReceiver(mModel, filter); + filter = new IntentFilter(); + filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED); + registerReceiver(mModel, filter); // Register for changes to the favorites ContentResolver resolver = getContentResolver(); diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 331f124..b4e632a 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -16,6 +16,7 @@ package com.android.launcher2; +import android.app.SearchManager; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; import android.content.BroadcastReceiver; @@ -129,6 +130,7 @@ public class LauncherModel extends BroadcastReceiver { public void bindAppsRemoved(ArrayList<ApplicationInfo> apps, boolean permanent); public void bindPackagesUpdated(); public boolean isAllAppsVisible(); + public void bindSearchablesChanged(); } LauncherModel(LauncherApplication app, IconCache iconCache) { @@ -513,6 +515,7 @@ public class LauncherModel extends BroadcastReceiver { * Call from the handler for ACTION_PACKAGE_ADDED, ACTION_PACKAGE_REMOVED and * ACTION_PACKAGE_CHANGED. */ + @Override public void onReceive(Context context, Intent intent) { if (DEBUG_LOADERS) Log.d(TAG, "onReceive intent=" + intent); @@ -570,6 +573,9 @@ public class LauncherModel extends BroadcastReceiver { mAllAppsLoaded = false; mWorkspaceLoaded = false; startLoaderFromBackground(); + } else if (SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED.equals(action)) { + Callbacks callbacks = mCallbacks.get(); + callbacks.bindSearchablesChanged(); } } |