now that getDefaultNewGameGroup works, allow/pass undefined group

further down where appropriate
This commit is contained in:
Eric House 2013-11-15 07:53:57 -08:00
parent cd922ba8e2
commit d8ea672f6c
3 changed files with 9 additions and 16 deletions

View file

@ -375,6 +375,11 @@ public class GameUtils {
return DBUtils.saveGame( context, lock, bytes, setCreate );
}
public static GameLock saveNewGame( Context context, byte[] bytes )
{
return saveNewGame( context, bytes, DBUtils.GROUPID_UNSPEC );
}
public static GameLock saveNewGame( Context context, byte[] bytes,
long groupID )
{
@ -383,7 +388,9 @@ public class GameUtils {
public static long saveNew( Context context, CurGameInfo gi, long groupID )
{
Assert.assertTrue( DBUtils.GROUPID_UNSPEC != groupID );
if ( DBUtils.GROUPID_UNSPEC == groupID ) {
groupID = XWPrefs.getDefaultNewGameGroup( context );
}
long rowid = DBUtils.ROWID_NOTFOUND;
byte[] bytes = XwJNI.gi_to_stream( gi );

View file

@ -821,8 +821,7 @@ public class GamesList extends XWExpandableListActivity
byte[] stream = GameUtils.savedGame( GamesList.this,
selRowIDs[0] );
GameLock lock =
GameUtils.saveNewGame( GamesList.this, stream,
getSaveGroup() );
GameUtils.saveNewGame( GamesList.this, stream );
DBUtils.saveSummary( GamesList.this, lock, smry );
m_selGames.add( lock.getRowid() );
lock.unlock();
@ -1055,9 +1054,6 @@ public class GamesList extends XWExpandableListActivity
private void startNewGameActivity( long groupID )
{
if ( DBUtils.GROUPID_UNSPEC == groupID ) {
groupID = getSaveGroup();
}
NewGameActivity.startActivity( this, groupID );
}
@ -1337,15 +1333,6 @@ public class GamesList extends XWExpandableListActivity
}
}
private long getSaveGroup()
{
long groupID = XWPrefs.getDefaultNewGameGroup( this );
if ( DBUtils.GROUPID_UNSPEC == groupID ) {
groupID = m_adapter.getGroupIDFor( 0 );
}
return groupID;
}
public static void onGameDictDownload( Context context, Intent intent )
{
intent.setClass( context, GamesList.class );

View file

@ -79,7 +79,6 @@ public class NewGameActivity extends XWActivity {
getBundledData( savedInstanceState );
m_groupID = getIntent().getLongExtra( GROUPID_EXTRA, -1 );
Assert.assertTrue( -1 != m_groupID );
setContentView( R.layout.new_game );