subclass ListPreference in order to provide a list of dicts at runtime

for setting the default.  Remove the hint that says "do it on dicts
screen."
This commit is contained in:
eehouse 2010-05-26 02:26:24 +00:00
parent c92d919934
commit da7c59a869
3 changed files with 43 additions and 6 deletions

View file

@ -232,8 +232,6 @@
<string name="prefs_defaults_summary">Default settings for new
games</string>
<string name="default_dict">Game dictionary</string>
<string name="default_dict_summary">(Use the Dictionaries screen
to set me -- for now)</string>
<string name="board_size">Initial board size</string>
<string name="manage_dicts">Choose</string>

View file

@ -12,10 +12,10 @@
android:numeric="decimal"
/>
<Preference android:key="@string/key_default_dict"
android:title="@string/default_dict"
android:summary="@string/default_dict_summary"
/>
<org.eehouse.android.xw4.DictListPreference
android:key="@string/key_default_dict"
android:title="@string/default_dict"
/>
<ListPreference android:key="@string/key_board_size"
android:title="@string/board_size"

View file

@ -0,0 +1,39 @@
/* -*- 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.ListPreference;
import android.content.Context;
import android.util.AttributeSet;
import junit.framework.Assert;
public class DictListPreference extends ListPreference {
public DictListPreference( Context context, AttributeSet attrs )
{
super( context, attrs );
String[] dicts = GameUtils.dictList( context );
setEntries( dicts );
setEntryValues( dicts );
}
}