mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
use gameID as inviteID for non-NFC invites too
This commit is contained in:
parent
0cef5fce50
commit
63ba7d45d3
2 changed files with 15 additions and 7 deletions
|
@ -940,9 +940,11 @@ public class BoardActivity extends XWActivity
|
||||||
&& !NFCUtils.nfcAvail( this )[1] ) {
|
&& !NFCUtils.nfcAvail( this )[1] ) {
|
||||||
showDialog( ENABLE_NFC );
|
showDialog( ENABLE_NFC );
|
||||||
} else {
|
} else {
|
||||||
GameUtils.launchInviteActivity( this, which,
|
String inviteID = GameUtils.formatGameID( m_gi.gameID );
|
||||||
m_room, null, m_gi.dictLang,
|
GameUtils.launchInviteActivity( this, which, m_room,
|
||||||
m_gi.dictName, m_gi.nPlayers );
|
inviteID, m_gi.dictLang,
|
||||||
|
m_gi.dictName,
|
||||||
|
m_gi.nPlayers );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ( AlertDialog.BUTTON_POSITIVE == which ) {
|
} else if ( AlertDialog.BUTTON_POSITIVE == which ) {
|
||||||
|
|
|
@ -522,9 +522,8 @@ public class GameUtils {
|
||||||
int lang, String dict,
|
int lang, String dict,
|
||||||
int nPlayers )
|
int nPlayers )
|
||||||
{
|
{
|
||||||
if ( null == inviteID ) {
|
Assert.assertNotNull( inviteID );
|
||||||
inviteID = makeRandomID();
|
|
||||||
}
|
|
||||||
String msgString;
|
String msgString;
|
||||||
if ( DlgDelegate.NFC_BTN == chosen ) {
|
if ( DlgDelegate.NFC_BTN == chosen ) {
|
||||||
msgString = NetLaunchInfo.makeLaunchJSON( activity, room, inviteID,
|
msgString = NetLaunchInfo.makeLaunchJSON( activity, room, inviteID,
|
||||||
|
@ -870,10 +869,17 @@ public class GameUtils {
|
||||||
activity.startActivity( intent );
|
activity.startActivity( intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatGameID( int gameID )
|
||||||
|
{
|
||||||
|
Assert.assertTrue( 0 != gameID );
|
||||||
|
// substring: Keep it short so fits in SMS better
|
||||||
|
return String.format( "%X", gameID ).substring( 0, 4 );
|
||||||
|
}
|
||||||
|
|
||||||
public static String makeRandomID()
|
public static String makeRandomID()
|
||||||
{
|
{
|
||||||
int rint = newGameID();
|
int rint = newGameID();
|
||||||
return String.format( "%X", rint ).substring( 0, 4 );
|
return formatGameID( rint );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int newGameID()
|
public static int newGameID()
|
||||||
|
|
Loading…
Reference in a new issue