Code drop from //branches/cupcake/...@124589
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index b8bc495..b23f750 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -51,6 +51,9 @@
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 @@
}
} 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;