summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2010-10-29 17:35:36 -0700
committerJoe Onorato <joeo@google.com>2010-10-29 17:35:36 -0700
commite9ad59eba6d8ffd2cbf28520c237ccefd291a33c (patch)
tree08411d461685982b790d3cda03189d5c08159045 /src/com
parenta997ac26664befbd0d5b172e36ef9e8b2c63b435 (diff)
downloadandroid_packages_apps_Trebuchet-e9ad59eba6d8ffd2cbf28520c237ccefd291a33c.tar.gz
android_packages_apps_Trebuchet-e9ad59eba6d8ffd2cbf28520c237ccefd291a33c.tar.bz2
android_packages_apps_Trebuchet-e9ad59eba6d8ffd2cbf28520c237ccefd291a33c.zip
When the locale changes, flush the all apps list.
Bug: 3032131 Change-Id: I47659a459044fdace0a3480d216b168c18f2de37
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/LauncherApplication.java1
-rw-r--r--src/com/android/launcher2/LauncherModel.java45
2 files changed, 32 insertions, 14 deletions
diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java
index 8a18317bc..dab2b588a 100644
--- a/src/com/android/launcher2/LauncherApplication.java
+++ b/src/com/android/launcher2/LauncherApplication.java
@@ -52,6 +52,7 @@ public class LauncherApplication extends Application {
filter = new IntentFilter();
filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
+ filter.addAction(Intent.ACTION_LOCALE_CHANGED);
registerReceiver(mModel, filter);
// Register for changes to the favorites
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index aa259aa86..67aa31126 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -424,24 +424,41 @@ public class LauncherModel extends BroadcastReceiver {
String[] packages = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
enqueuePackageUpdated(new PackageUpdatedTask(PackageUpdatedTask.OP_ADD, packages));
// Then, rebind everything.
- boolean runLoader = true;
- if (mCallbacks != null) {
- Callbacks callbacks = mCallbacks.get();
- if (callbacks != null) {
- // If they're paused, we can skip loading, because they'll do it again anyway
- if (callbacks.setLoadOnResume()) {
- runLoader = false;
- }
- }
- }
- if (runLoader) {
- startLoader(mApp, false);
- }
-
+ startLoaderFromBackground();
} else if (Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
String[] packages = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
enqueuePackageUpdated(new PackageUpdatedTask(
PackageUpdatedTask.OP_UNAVAILABLE, packages));
+ } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
+ // If we have changed locale we need to clear out the labels in all apps.
+ // Do this here because if the launcher activity is running it will be restarted.
+ // If it's not running startLoaderFromBackground will merely tell it that it needs
+ // to reload. Either way, mAllAppsLoaded will be cleared so it re-reads everything
+ // next time.
+ mAllAppsLoaded = false;
+ startLoaderFromBackground();
+ }
+ }
+
+ /**
+ * When the launcher is in the background, it's possible for it to miss paired
+ * configuration changes. So whenever we trigger the loader from the background
+ * tell the launcher that it needs to re-run the loader when it comes back instead
+ * of doing it now.
+ */
+ public void startLoaderFromBackground() {
+ boolean runLoader = false;
+ if (mCallbacks != null) {
+ Callbacks callbacks = mCallbacks.get();
+ if (callbacks != null) {
+ // Only actually run the loader if they're not paused.
+ if (!callbacks.setLoadOnResume()) {
+ runLoader = true;
+ }
+ }
+ }
+ if (runLoader) {
+ startLoader(mApp, false);
}
}