No need to use CurGameInfo for any game summary fields since it's all

in the summary db now.  Saves opening the game itself just to show it
in a list.
This commit is contained in:
Andy2 2010-11-20 20:37:01 -08:00
parent 985c3d586c
commit d23dc4aee5

View file

@ -67,36 +67,30 @@ public class GameListAdapter extends XWListAdapter {
if ( null == layout ) { if ( null == layout ) {
Utils.logf( "creating new list elem for %s", path ); Utils.logf( "creating new list elem for %s", path );
layout = m_factory.inflate( m_layoutId, null ); layout = m_factory.inflate( m_layoutId, null );
byte[] stream = GameUtils.savedGame( m_context, path );
if ( null != stream ) {
CurGameInfo gi = new CurGameInfo( m_context );
XwJNI.gi_from_stream( gi, stream );
GameSummary summary = DBUtils.getSummary( m_context, path ); GameSummary summary = DBUtils.getSummary( m_context, path );
TextView view = (TextView)layout.findViewById( R.id.players ); TextView view = (TextView)layout.findViewById( R.id.players );
String gameName = GameUtils.gameName( m_context, path ); String gameName = GameUtils.gameName( m_context, path );
view.setText( String.format( "%s: %s", gameName, view.setText( String.format( "%s: %s", gameName,
gi.summarizePlayers( m_context, summary.players ) );
summary ) ) );
view = (TextView)layout.findViewById( R.id.state ); view = (TextView)layout.findViewById( R.id.state );
view.setText( gi.summarizeState( m_context, summary ) ); view.setText( summary.summarizeState( m_context ) );
view = (TextView)layout.findViewById( R.id.dict ); view = (TextView)layout.findViewById( R.id.dict );
view.setText( gi.summarizeDict( m_context ) ); view.setText( summary.dictName );
view = (TextView)layout.findViewById( R.id.role ); view = (TextView)layout.findViewById( R.id.role );
String roleSummary = gi.summarizeRole( m_context, summary ); String roleSummary = summary.summarizeRole( m_context );
if ( null != roleSummary ) { if ( null != roleSummary ) {
view.setText( roleSummary ); view.setText( roleSummary );
} else { } else {
view.setVisibility( View.GONE ); view.setVisibility( View.GONE );
}
View marker = layout.findViewById( R.id.msg_marker );
marker.setVisibility( summary.msgsPending?
View.VISIBLE : View.GONE );
} }
View marker = layout.findViewById( R.id.msg_marker );
marker.setVisibility( summary.msgsPending?
View.VISIBLE : View.GONE );
m_viewsCache.put( path, layout ); m_viewsCache.put( path, layout );
} }
return layout; return layout;