diff --git a/xwords4/android/XWords4/res/xml/xwprefs.xml b/xwords4/android/XWords4/res/xml/xwprefs.xml
index 1ce6c99ff..5c5ae44ed 100644
--- a/xwords4/android/XWords4/res/xml/xwprefs.xml
+++ b/xwords4/android/XWords4/res/xml/xwprefs.xml
@@ -11,28 +11,32 @@
android:summary="@string/prefs_names_summary"
>
-
-
-
-
+
+
+
+
-
+
-
+
-
+
@@ -94,97 +101,97 @@
android:summary="@string/prefs_appearance_summary"
>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
@@ -244,42 +251,42 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
-
-
+
+
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java
index a74de55eb..072268dae 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java
@@ -26,7 +26,7 @@ import android.util.AttributeSet;
import junit.framework.Assert;
-public class DictListPreference extends ListPreference {
+public class DictListPreference extends XWListPreference {
public DictListPreference( Context context, AttributeSet attrs )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java
index 318b6e22d..97f57db65 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java
@@ -39,7 +39,6 @@ public class PrefsActivity extends PreferenceActivity
private static final int REVERT_COLORS = 1;
private static final int REVERT_ALL = 2;
- private HashSet m_keys;
private String m_keyEmpty;
private String m_keyLogging;
@@ -114,31 +113,6 @@ public class PrefsActivity extends PreferenceActivity
// Load the preferences from an XML resource
addPreferencesFromResource( R.xml.xwprefs );
- int[] textKeyIds = { R.string.key_relay_host,
- R.string.key_redir_host,
- R.string.key_relay_port,
- R.string.key_proxy_port,
- R.string.key_dict_host,
- R.string.key_board_size,
- R.string.key_initial_player_minutes,
- R.string.key_default_dict,
- R.string.key_default_robodict,
- R.string.key_default_phonies,
- R.string.key_player1_name,
- R.string.key_player2_name,
- R.string.key_player3_name,
- R.string.key_player4_name,
- };
-
- SharedPreferences sp
- = PreferenceManager.getDefaultSharedPreferences( this );
- m_keys = new HashSet( textKeyIds.length );
- for ( int ii = 0; ii < textKeyIds.length; ++ii ) {
- int id = textKeyIds[ii];
- String key = getString( id );
- setSummary( sp, key );
- m_keys.add( key );
- }
m_keyEmpty = getString( R.string.key_empty );
m_keyLogging = getString( R.string.key_logging_on );
}
@@ -161,9 +135,6 @@ public class PrefsActivity extends PreferenceActivity
public void onSharedPreferenceChanged( SharedPreferences sp, String key )
{
- if ( m_keys.contains( key ) ) {
- setSummary( sp, key );
- }
if ( key.equals( m_keyLogging ) ) {
Utils.logEnable( sp.getBoolean( key, false ) );
}
@@ -197,18 +168,6 @@ public class PrefsActivity extends PreferenceActivity
return handled;
}
- private void setSummary( SharedPreferences sp, String key )
- {
- Preference pref = getPreferenceScreen().findPreference( key );
- String value = sp.getString( key, "" );
- // if ( pref instanceof android.preference.ListPreference ) {
- // Utils.logf( "%s: want to do lookup of user string here",
- // key );
- // }
- pref.setSummary( value );
- }
-
-
private void relaunch()
{
PreferenceManager.setDefaultValues( this, R.xml.xwprefs,
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWEditTextPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWEditTextPreference.java
new file mode 100644
index 000000000..26639a685
--- /dev/null
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWEditTextPreference.java
@@ -0,0 +1,48 @@
+/* -*- compile-command: "cd ../../../../../; ant install"; -*- */
+/*
+ * Copyright 2010 by Eric House (xwords@eehouse.org). All
+ * rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package org.eehouse.android.xw4;
+
+import android.preference.EditTextPreference;
+import android.content.Context;
+import android.util.AttributeSet;
+
+import junit.framework.Assert;
+
+public class XWEditTextPreference extends EditTextPreference {
+
+ public XWEditTextPreference( Context context, AttributeSet attrs )
+ {
+ super( context, attrs );
+ }
+
+ protected void onAttachedToActivity()
+ {
+ super.onAttachedToActivity();
+ setSummary( getPersistedString( "" ) );
+ }
+
+ protected boolean persistString( String value )
+ {
+ setSummary( value );
+ return super.persistString( value );
+ }
+
+}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListPreference.java
new file mode 100644
index 000000000..e608ba1d1
--- /dev/null
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListPreference.java
@@ -0,0 +1,47 @@
+/* -*- compile-command: "cd ../../../../../; ant install"; -*- */
+/*
+ * Copyright 2010 - 2011 by Eric House (xwords@eehouse.org). All
+ * rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package org.eehouse.android.xw4;
+
+import android.preference.ListPreference;
+import android.content.Context;
+import android.util.AttributeSet;
+
+import junit.framework.Assert;
+
+public class XWListPreference extends ListPreference {
+
+ public XWListPreference( Context context, AttributeSet attrs )
+ {
+ super( context, attrs );
+ }
+
+ protected void onAttachedToActivity()
+ {
+ super.onAttachedToActivity();
+ setSummary( getPersistedString( "" ) );
+ }
+
+ protected boolean persistString( String value )
+ {
+ setSummary( value );
+ return super.persistString( value );
+ }
+}