summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-17 15:38:55 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-17 15:38:55 -0700
commit75dfb12af34db69ccd75afa91d619621f7d77fa4 (patch)
tree61866d890dbd4a9e3851511ccf6ba780a12568be
parent7ce42aeb72bf1d17f17f72bb401926735f3a827a (diff)
parentf11d7458ea2f52b3c4afad495274167b862e7a4c (diff)
downloadpackages_apps_settings-75dfb12af34db69ccd75afa91d619621f7d77fa4.zip
packages_apps_settings-75dfb12af34db69ccd75afa91d619621f7d77fa4.tar.gz
packages_apps_settings-75dfb12af34db69ccd75afa91d619621f7d77fa4.tar.bz2
am f11d7458: Merge change 4378 into donut
Merge commit 'f11d7458ea2f52b3c4afad495274167b862e7a4c' * commit 'f11d7458ea2f52b3c4afad495274167b862e7a4c': Make the Quick Launch settings show localized application names.
-rw-r--r--src/com/android/settings/quicklaunch/QuickLaunchSettings.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/com/android/settings/quicklaunch/QuickLaunchSettings.java b/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
index 2cbe9f7..fb9fbcd 100644
--- a/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
+++ b/src/com/android/settings/quicklaunch/QuickLaunchSettings.java
@@ -20,6 +20,8 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Bundle;
@@ -39,6 +41,8 @@ import android.widget.AdapterView;
import com.android.settings.R;
+import java.net.URISyntaxException;
+
/**
* Settings activity for quick launch.
* <p>
@@ -299,7 +303,27 @@ public class QuickLaunchSettings extends PreferenceActivity implements
if (shortcut == 0) continue;
ShortcutPreference pref = getOrCreatePreference(shortcut);
- pref.setTitle(Bookmarks.getTitle(this, c));
+ CharSequence title = Bookmarks.getTitle(this, c);
+
+ /*
+ * The title retrieved from Bookmarks.getTitle() will be in
+ * the original boot locale, not the current locale.
+ * Try to look up a localized title from the PackageManager.
+ */
+ int intentColumn = c.getColumnIndex(Bookmarks.INTENT);
+ String intentUri = c.getString(intentColumn);
+ PackageManager packageManager = getPackageManager();
+ try {
+ Intent intent = Intent.getIntent(intentUri);
+ ResolveInfo info = packageManager.resolveActivity(intent, 0);
+ if (info != null) {
+ title = info.loadLabel(packageManager);
+ }
+ } catch (URISyntaxException e) {
+ // Just use the non-localized title, then.
+ }
+
+ pref.setTitle(title);
pref.setSummary(getString(R.string.quick_launch_shortcut,
String.valueOf(shortcut)));
pref.setHasBookmark(true);