mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-25 07:58:33 +01:00
make it possible to open a second game
This commit is contained in:
parent
6d3f56fa45
commit
f4f486403e
2 changed files with 29 additions and 12 deletions
|
@ -567,6 +567,13 @@ public class BoardDelegate extends DelegateBase
|
||||||
ConnStatusHandler.setHandler( this );
|
ConnStatusHandler.setHandler( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy()
|
||||||
|
{
|
||||||
|
GamesListDelegate.boardDestroyed( m_rowid );
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
protected void onSaveInstanceState( Bundle outState )
|
protected void onSaveInstanceState( Bundle outState )
|
||||||
{
|
{
|
||||||
outState.putInt( DLG_TITLE, m_dlgTitle );
|
outState.putInt( DLG_TITLE, m_dlgTitle );
|
||||||
|
|
|
@ -501,6 +501,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
private int m_fieldID;
|
private int m_fieldID;
|
||||||
|
|
||||||
private Activity m_activity;
|
private Activity m_activity;
|
||||||
|
private static GamesListDelegate s_self;
|
||||||
private GamesListDelegator m_delegator;
|
private GamesListDelegator m_delegator;
|
||||||
private GameListAdapter m_adapter;
|
private GameListAdapter m_adapter;
|
||||||
private Handler m_handler;
|
private Handler m_handler;
|
||||||
|
@ -516,7 +517,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
private String m_nameField;
|
private String m_nameField;
|
||||||
private NetLaunchInfo m_netLaunchInfo;
|
private NetLaunchInfo m_netLaunchInfo;
|
||||||
private GameNamer m_namer;
|
private GameNamer m_namer;
|
||||||
private long m_launchedGame = DBUtils.ROWID_NOTFOUND;
|
private Set<Long> m_launchedGames;
|
||||||
private boolean m_menuPrepared;
|
private boolean m_menuPrepared;
|
||||||
private Set<Long> m_selGames;
|
private Set<Long> m_selGames;
|
||||||
private Set<Long> m_selGroupIDs;
|
private Set<Long> m_selGroupIDs;
|
||||||
|
@ -527,6 +528,8 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
super( delegator, sis, R.menu.games_list_menu );
|
super( delegator, sis, R.menu.games_list_menu );
|
||||||
m_delegator = delegator;
|
m_delegator = delegator;
|
||||||
m_activity = delegator.getActivity();
|
m_activity = delegator.getActivity();
|
||||||
|
m_launchedGames = new HashSet<Long>();
|
||||||
|
s_self = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Dialog onCreateDialog( int id )
|
protected Dialog onCreateDialog( int id )
|
||||||
|
@ -792,7 +795,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
protected void onNewIntent( Intent intent )
|
protected void onNewIntent( Intent intent )
|
||||||
{
|
{
|
||||||
// super.onNewIntent( intent );
|
// super.onNewIntent( intent );
|
||||||
m_launchedGame = DBUtils.ROWID_NOTFOUND;
|
m_launchedGames.clear();
|
||||||
Assert.assertNotNull( intent );
|
Assert.assertNotNull( intent );
|
||||||
invalRelayIDs( intent.getStringArrayExtra( RELAYIDS_EXTRA ) );
|
invalRelayIDs( intent.getStringArrayExtra( RELAYIDS_EXTRA ) );
|
||||||
m_adapter.reloadGame( intent.getLongExtra( ROWID_EXTRA, -1 ) );
|
m_adapter.reloadGame( intent.getLongExtra( ROWID_EXTRA, -1 ) );
|
||||||
|
@ -813,7 +816,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
protected void onDestroy()
|
protected void onDestroy()
|
||||||
{
|
{
|
||||||
DBUtils.clearDBChangeListener( this );
|
DBUtils.clearDBChangeListener( this );
|
||||||
// super.onDestroy();
|
s_self = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onSaveInstanceState( Bundle outState )
|
protected void onSaveInstanceState( Bundle outState )
|
||||||
|
@ -855,10 +858,10 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
if ( hasFocus ) {
|
if ( hasFocus ) {
|
||||||
updateField();
|
updateField();
|
||||||
|
|
||||||
if ( DBUtils.ROWID_NOTFOUND != m_launchedGame ) {
|
// if ( DBUtils.ROWID_NOTFOUND != m_launchedGame ) {
|
||||||
setSelGame( m_launchedGame );
|
// setSelGame( m_launchedGame );
|
||||||
m_launchedGame = DBUtils.ROWID_NOTFOUND;
|
// m_launchedGame = DBUtils.ROWID_NOTFOUND;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,9 +916,9 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
// dialog in case it was dismissed. That way it to check for
|
// dialog in case it was dismissed. That way it to check for
|
||||||
// an empty room name.
|
// an empty room name.
|
||||||
if ( clicked instanceof GameListItem ) {
|
if ( clicked instanceof GameListItem ) {
|
||||||
if ( DBUtils.ROWID_NOTFOUND == m_launchedGame ) {
|
long rowid = ((GameListItem)clicked).getRowID();
|
||||||
long rowid = ((GameListItem)clicked).getRowID();
|
DbgUtils.logf( "GamesListDelegate.itemClicked(%d)", rowid );
|
||||||
DbgUtils.logf( "GamesListDelegate.itemClicked(%d)", rowid );
|
if ( ! m_launchedGames.contains( rowid ) ) {
|
||||||
showNotAgainDlgThen( R.string.not_again_newselect,
|
showNotAgainDlgThen( R.string.not_again_newselect,
|
||||||
R.string.key_notagain_newselect,
|
R.string.key_notagain_newselect,
|
||||||
Action.OPEN_GAME, rowid,
|
Action.OPEN_GAME, rowid,
|
||||||
|
@ -1710,8 +1713,8 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
private void launchGame( long rowid, boolean invited )
|
private void launchGame( long rowid, boolean invited )
|
||||||
{
|
{
|
||||||
DbgUtils.logf( "launchGame(%d)", rowid );
|
DbgUtils.logf( "launchGame(%d)", rowid );
|
||||||
if ( DBUtils.ROWID_NOTFOUND == m_launchedGame ) {
|
if ( ! m_launchedGames.contains( rowid ) ) {
|
||||||
m_launchedGame = rowid;
|
m_launchedGames.add( rowid );
|
||||||
m_delegator.launchGame( rowid, invited );
|
m_delegator.launchGame( rowid, invited );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1826,6 +1829,13 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
// return adapter;
|
// return adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void boardDestroyed( long rowid )
|
||||||
|
{
|
||||||
|
if ( null != s_self ) {
|
||||||
|
s_self.m_launchedGames.remove( rowid );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void onGameDictDownload( Context context, Intent intent )
|
public static void onGameDictDownload( Context context, Intent intent )
|
||||||
{
|
{
|
||||||
intent.setClass( context, GamesListActivity.class );
|
intent.setClass( context, GamesListActivity.class );
|
||||||
|
|
Loading…
Add table
Reference in a new issue