add feature controlled by "debug features" preference, to add rowids

to the list of game properties that can be part of the game's summary
display.
This commit is contained in:
Eric House 2013-10-23 20:26:19 -07:00
parent 0a5e891d5e
commit 8f8911c7d1
4 changed files with 21 additions and 0 deletions

View file

@ -113,6 +113,7 @@
<string name="invite_host">eehouse.org</string> <string name="invite_host">eehouse.org</string>
<string name="invite_prefix">/and/</string> <string name="invite_prefix">/and/</string>
<string name="invite_mime">application/x-xwordsinvite</string> <string name="invite_mime">application/x-xwordsinvite</string>
<string name="game_summary_field_rowid">rowid</string>
<!--string name="invite_mime">text/plain</string--> <!--string name="invite_mime">text/plain</string-->
<string name="dict_url">http://eehouse.org/and_wordlists</string> <string name="dict_url">http://eehouse.org/and_wordlists</string>

View file

@ -462,6 +462,7 @@ public class GameListAdapter implements ExpandableListAdapter {
,R.string.game_summary_field_language ,R.string.game_summary_field_language
,R.string.game_summary_field_opponents ,R.string.game_summary_field_opponents
,R.string.game_summary_field_state ,R.string.game_summary_field_state
,R.string.game_summary_field_rowid
}; };
int result = -1; int result = -1;
for ( int id : ids ) { for ( int id : ids ) {

View file

@ -201,6 +201,9 @@ public class GameListItem extends LinearLayout
switch ( m_fieldID ) { switch ( m_fieldID ) {
case R.string.game_summary_field_empty: case R.string.game_summary_field_empty:
break; break;
case R.string.game_summary_field_rowid:
value = String.format( "%d", m_rowid );
break;
case R.string.game_summary_field_language: case R.string.game_summary_field_language:
value = value =
DictLangCache.getLangName( m_context, DictLangCache.getLangName( m_context,

View file

@ -27,16 +27,32 @@ import android.util.AttributeSet;
import junit.framework.Assert; import junit.framework.Assert;
public class XWListPreference extends ListPreference { public class XWListPreference extends ListPreference {
private Context m_context;
public XWListPreference( Context context, AttributeSet attrs ) public XWListPreference( Context context, AttributeSet attrs )
{ {
super( context, attrs ); super( context, attrs );
m_context = context;
} }
protected void onAttachedToActivity() protected void onAttachedToActivity()
{ {
super.onAttachedToActivity(); super.onAttachedToActivity();
setSummary( getPersistedString( "" ) ); setSummary( getPersistedString( "" ) );
if ( XWPrefs.getDebugEnabled( m_context ) ) {
CharSequence[] entries = getEntries();
String lastRow
= m_context.getString( R.string.game_summary_field_rowid );
if ( !entries[entries.length - 1].equals( lastRow ) ) {
CharSequence[] newEntries = new CharSequence[1 + entries.length];
System.arraycopy( entries, 0, newEntries, 0, entries.length );
newEntries[entries.length] = lastRow;
setEntries( newEntries );
setEntryValues( newEntries );
}
}
} }
protected boolean persistString( String value ) protected boolean persistString( String value )