summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/quicklaunch
diff options
context:
space:
mode:
authorEric Fischer <enf@google.com>2009-06-16 13:31:22 -0700
committerEric Fischer <enf@google.com>2009-06-16 13:31:22 -0700
commitec598cb91c02c035d19ccd8a9f17e2bf8da9da5a (patch)
treec885df7759ad503b14c4f6962e92e6bc230915b5 /src/com/android/settings/quicklaunch
parenta78edb54182da5881f2f1e6bc76ae027a9a6f3e3 (diff)
downloadpackages_apps_settings-ec598cb91c02c035d19ccd8a9f17e2bf8da9da5a.zip
packages_apps_settings-ec598cb91c02c035d19ccd8a9f17e2bf8da9da5a.tar.gz
packages_apps_settings-ec598cb91c02c035d19ccd8a9f17e2bf8da9da5a.tar.bz2
Make the Quick Launch settings show localized application names.
It looks like when you look up the name of an application bookmark, you get the name in whatever locale the device was in when it first booted. Check the PackageManager to get a name in the current locale, if possible, to display instead.
Diffstat (limited to 'src/com/android/settings/quicklaunch')
-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 4d44524..40316b5 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>
@@ -300,7 +304,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);