summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/BrowserPreferencesPage.java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:52 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:52 -0800
commited217d91fb3f1a8f4e75ab36ef81d72ef9f4e6d6 (patch)
treef4f3c7225a6ed8d870f32cedbbc8f6e41b5633e7 /src/com/android/browser/BrowserPreferencesPage.java
parentba6d7b853c32ad6c3be26c443daa61f322bcfdc2 (diff)
downloadandroid_packages_apps_Gello-ed217d91fb3f1a8f4e75ab36ef81d72ef9f4e6d6.tar.gz
android_packages_apps_Gello-ed217d91fb3f1a8f4e75ab36ef81d72ef9f4e6d6.tar.bz2
android_packages_apps_Gello-ed217d91fb3f1a8f4e75ab36ef81d72ef9f4e6d6.zip
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'src/com/android/browser/BrowserPreferencesPage.java')
-rw-r--r--src/com/android/browser/BrowserPreferencesPage.java47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index b8bc495c..b23f750b 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -51,6 +51,9 @@ public class BrowserPreferencesPage extends PreferenceActivity
getPreferenceScreen().getSharedPreferences()
.getString(BrowserSettings.PREF_TEXT_SIZE, null)) );
+ e = findPreference(BrowserSettings.PREF_DEFAULT_TEXT_ENCODING);
+ e.setOnPreferenceChangeListener(this);
+
if (BrowserSettings.getInstance().showDebugSettings()) {
addPreferencesFromResource(R.xml.debug_preferences);
}
@@ -76,30 +79,36 @@ public class BrowserPreferencesPage extends PreferenceActivity
}
} else if (pref.getKey().equals(BrowserSettings.PREF_HOMEPAGE)) {
String value = (String) objValue;
-
- if (value.length() > 0) {
- Uri path = Uri.parse(value);
- if (path.getScheme() == null) {
- value = "http://"+value;
-
- pref.setSummary(value);
-
- // Update through the EditText control as it has a cached copy
- // of the string and it will handle persisting the value
- ((EditTextPreference)(pref)).setText(value);
-
- // as we update the value above, we need to return false
- // here so that setText() is not called by EditTextPref
- // with the old value.
- return false;
- }
+ boolean needUpdate = value.indexOf(' ') != -1;
+ if (needUpdate) {
+ value = value.trim().replace(" ", "%20");
}
-
+ Uri path = Uri.parse(value);
+ if (path.getScheme() == null) {
+ value = "http://" + value;
+ needUpdate = true;
+ }
+ // Set the summary value.
pref.setSummary(value);
- return true;
+ if (needUpdate) {
+ // Update through the EditText control as it has a cached copy
+ // of the string and it will handle persisting the value
+ ((EditTextPreference) pref).setText(value);
+
+ // as we update the value above, we need to return false
+ // here so that setText() is not called by EditTextPref
+ // with the old value.
+ return false;
+ } else {
+ return true;
+ }
} else if (pref.getKey().equals(BrowserSettings.PREF_TEXT_SIZE)) {
pref.setSummary(getVisualTextSizeName((String) objValue));
return true;
+ } else if (pref.getKey().equals(
+ BrowserSettings.PREF_DEFAULT_TEXT_ENCODING)) {
+ pref.setSummary((String) objValue);
+ return true;
}
return false;