mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-02 20:46:15 +01:00
respect game dict and language in rematch! NOTE: this doesn't handle
the case where players have different dicts.
This commit is contained in:
parent
f8acd68e09
commit
1d5249f139
3 changed files with 23 additions and 9 deletions
|
@ -2564,7 +2564,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
if ( doIt ) {
|
if ( doIt ) {
|
||||||
Intent intent = GamesListDelegate
|
Intent intent = GamesListDelegate
|
||||||
.makeRematchIntent( m_activity, m_rowid, m_connTypes, btAddr,
|
.makeRematchIntent( m_activity, m_rowid, m_gi.dictName,
|
||||||
|
m_gi.dictLang, m_connTypes, btAddr,
|
||||||
phone, relayID );
|
phone, relayID );
|
||||||
if ( null != intent ) {
|
if ( null != intent ) {
|
||||||
startActivity( intent );
|
startActivity( intent );
|
||||||
|
|
|
@ -483,23 +483,27 @@ public class GameUtils {
|
||||||
public static long makeNewMultiGame( Context context, long groupID,
|
public static long makeNewMultiGame( Context context, long groupID,
|
||||||
String gameName )
|
String gameName )
|
||||||
{
|
{
|
||||||
return makeNewMultiGame( context, groupID, (CommsConnTypeSet)null,
|
return makeNewMultiGame( context, groupID, null, 0,
|
||||||
gameName );
|
(CommsConnTypeSet)null, gameName );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long makeNewMultiGame( Context context, long groupID,
|
public static long makeNewMultiGame( Context context, long groupID,
|
||||||
CommsConnTypeSet addrSet, String gameName )
|
String dict, int lang,
|
||||||
|
CommsConnTypeSet addrSet,
|
||||||
|
String gameName )
|
||||||
{
|
{
|
||||||
String inviteID = makeRandomID();
|
String inviteID = makeRandomID();
|
||||||
return makeNewMultiGame( context, groupID, inviteID, addrSet, gameName );
|
return makeNewMultiGame( context, groupID, inviteID, dict, lang,
|
||||||
|
addrSet, gameName );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long makeNewMultiGame( Context context, long groupID,
|
private static long makeNewMultiGame( Context context, long groupID,
|
||||||
String inviteID, CommsConnTypeSet addrSet,
|
String inviteID, String dict,
|
||||||
|
int lang, CommsConnTypeSet addrSet,
|
||||||
String gameName )
|
String gameName )
|
||||||
{
|
{
|
||||||
int[] lang = {0};
|
int[] langArray = {lang};
|
||||||
String[] dict = {null};
|
String[] dictArray = {dict};
|
||||||
if ( null == addrSet ) {
|
if ( null == addrSet ) {
|
||||||
addrSet = XWPrefs.getAddrTypes( context );
|
addrSet = XWPrefs.getAddrTypes( context );
|
||||||
}
|
}
|
||||||
|
@ -507,7 +511,7 @@ public class GameUtils {
|
||||||
addr.populate( context );
|
addr.populate( context );
|
||||||
int forceChannel = 0;
|
int forceChannel = 0;
|
||||||
return makeNewMultiGame( context, (MultiMsgSink)null, (UtilCtxt)null,
|
return makeNewMultiGame( context, (MultiMsgSink)null, (UtilCtxt)null,
|
||||||
groupID, addr, lang, dict, 2, 1,
|
groupID, addr, langArray, dictArray, 2, 1,
|
||||||
forceChannel, inviteID, 0, gameName, true );
|
forceChannel, inviteID, 0, gameName, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,14 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
private static final String ROWID_EXTRA = "rowid";
|
private static final String ROWID_EXTRA = "rowid";
|
||||||
private static final String GAMEID_EXTRA = "gameid";
|
private static final String GAMEID_EXTRA = "gameid";
|
||||||
private static final String REMATCH_ROWID_EXTRA = "rm_rowid";
|
private static final String REMATCH_ROWID_EXTRA = "rm_rowid";
|
||||||
|
private static final String REMATCH_DICT_EXTRA = "rm_dict";
|
||||||
|
private static final String REMATCH_LANG_EXTRA = "rm_lang";
|
||||||
private static final String REMATCH_ADDRS_EXTRA = "rm_addrs";
|
private static final String REMATCH_ADDRS_EXTRA = "rm_addrs";
|
||||||
private static final String REMATCH_BTADDR_EXTRA = "rm_btaddr";
|
private static final String REMATCH_BTADDR_EXTRA = "rm_btaddr";
|
||||||
private static final String REMATCH_PHONE_EXTRA = "rm_phone";
|
private static final String REMATCH_PHONE_EXTRA = "rm_phone";
|
||||||
private static final String REMATCH_RELAYID_EXTRA = "rm_relayid";
|
private static final String REMATCH_RELAYID_EXTRA = "rm_relayid";
|
||||||
|
|
||||||
|
|
||||||
private static final String ALERT_MSG = "alert_msg";
|
private static final String ALERT_MSG = "alert_msg";
|
||||||
|
|
||||||
private class GameListAdapter extends XWExpListAdapter {
|
private class GameListAdapter extends XWExpListAdapter {
|
||||||
|
@ -1858,12 +1861,15 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
// this will juggle if the preference is set
|
// this will juggle if the preference is set
|
||||||
newid = GameUtils.dupeGame( m_activity, rowid );
|
newid = GameUtils.dupeGame( m_activity, rowid );
|
||||||
} else {
|
} else {
|
||||||
|
String dict = intent.getStringExtra( REMATCH_DICT_EXTRA );
|
||||||
|
int lang = intent.getIntExtra( REMATCH_LANG_EXTRA, -1 );
|
||||||
int bits = intent.getIntExtra( REMATCH_ADDRS_EXTRA, -1 );
|
int bits = intent.getIntExtra( REMATCH_ADDRS_EXTRA, -1 );
|
||||||
CommsConnTypeSet addrs = new CommsConnTypeSet( bits );
|
CommsConnTypeSet addrs = new CommsConnTypeSet( bits );
|
||||||
|
|
||||||
long groupID = DBUtils.getGroupForGame( m_activity, rowid );
|
long groupID = DBUtils.getGroupForGame( m_activity, rowid );
|
||||||
String gameName = "rematch"; // FIX ME :-)
|
String gameName = "rematch"; // FIX ME :-)
|
||||||
newid = GameUtils.makeNewMultiGame( m_activity, groupID,
|
newid = GameUtils.makeNewMultiGame( m_activity, groupID,
|
||||||
|
dict, lang,
|
||||||
addrs, gameName );
|
addrs, gameName );
|
||||||
|
|
||||||
DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,
|
DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,
|
||||||
|
@ -2254,6 +2260,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Intent makeRematchIntent( Context context, long rowid,
|
public static Intent makeRematchIntent( Context context, long rowid,
|
||||||
|
String dict, int lang,
|
||||||
CommsConnTypeSet addrTypes,
|
CommsConnTypeSet addrTypes,
|
||||||
String btAddr, String phone,
|
String btAddr, String phone,
|
||||||
String relayID )
|
String relayID )
|
||||||
|
@ -2262,6 +2269,8 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
if ( XWApp.REMATCH_SUPPORTED ) {
|
if ( XWApp.REMATCH_SUPPORTED ) {
|
||||||
intent = makeSelfIntent( context );
|
intent = makeSelfIntent( context );
|
||||||
intent.putExtra( REMATCH_ROWID_EXTRA, rowid );
|
intent.putExtra( REMATCH_ROWID_EXTRA, rowid );
|
||||||
|
intent.putExtra( REMATCH_DICT_EXTRA, dict );
|
||||||
|
intent.putExtra( REMATCH_LANG_EXTRA, lang );
|
||||||
if ( null != addrTypes ) {
|
if ( null != addrTypes ) {
|
||||||
intent.putExtra( REMATCH_ADDRS_EXTRA, addrTypes.toInt() ); // here
|
intent.putExtra( REMATCH_ADDRS_EXTRA, addrTypes.toInt() ); // here
|
||||||
if ( null != btAddr ) {
|
if ( null != btAddr ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue