mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +01:00
now that getDefaultNewGameGroup works, allow/pass undefined group
further down where appropriate
This commit is contained in:
parent
cd922ba8e2
commit
d8ea672f6c
3 changed files with 9 additions and 16 deletions
|
@ -375,6 +375,11 @@ public class GameUtils {
|
||||||
return DBUtils.saveGame( context, lock, bytes, setCreate );
|
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,
|
public static GameLock saveNewGame( Context context, byte[] bytes,
|
||||||
long groupID )
|
long groupID )
|
||||||
{
|
{
|
||||||
|
@ -383,7 +388,9 @@ public class GameUtils {
|
||||||
|
|
||||||
public static long saveNew( Context context, CurGameInfo gi, long groupID )
|
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;
|
long rowid = DBUtils.ROWID_NOTFOUND;
|
||||||
byte[] bytes = XwJNI.gi_to_stream( gi );
|
byte[] bytes = XwJNI.gi_to_stream( gi );
|
||||||
|
|
|
@ -821,8 +821,7 @@ public class GamesList extends XWExpandableListActivity
|
||||||
byte[] stream = GameUtils.savedGame( GamesList.this,
|
byte[] stream = GameUtils.savedGame( GamesList.this,
|
||||||
selRowIDs[0] );
|
selRowIDs[0] );
|
||||||
GameLock lock =
|
GameLock lock =
|
||||||
GameUtils.saveNewGame( GamesList.this, stream,
|
GameUtils.saveNewGame( GamesList.this, stream );
|
||||||
getSaveGroup() );
|
|
||||||
DBUtils.saveSummary( GamesList.this, lock, smry );
|
DBUtils.saveSummary( GamesList.this, lock, smry );
|
||||||
m_selGames.add( lock.getRowid() );
|
m_selGames.add( lock.getRowid() );
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -1055,9 +1054,6 @@ public class GamesList extends XWExpandableListActivity
|
||||||
|
|
||||||
private void startNewGameActivity( long groupID )
|
private void startNewGameActivity( long groupID )
|
||||||
{
|
{
|
||||||
if ( DBUtils.GROUPID_UNSPEC == groupID ) {
|
|
||||||
groupID = getSaveGroup();
|
|
||||||
}
|
|
||||||
NewGameActivity.startActivity( this, groupID );
|
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 )
|
public static void onGameDictDownload( Context context, Intent intent )
|
||||||
{
|
{
|
||||||
intent.setClass( context, GamesList.class );
|
intent.setClass( context, GamesList.class );
|
||||||
|
|
|
@ -79,7 +79,6 @@ public class NewGameActivity extends XWActivity {
|
||||||
getBundledData( savedInstanceState );
|
getBundledData( savedInstanceState );
|
||||||
|
|
||||||
m_groupID = getIntent().getLongExtra( GROUPID_EXTRA, -1 );
|
m_groupID = getIntent().getLongExtra( GROUPID_EXTRA, -1 );
|
||||||
Assert.assertTrue( -1 != m_groupID );
|
|
||||||
|
|
||||||
setContentView( R.layout.new_game );
|
setContentView( R.layout.new_game );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue