mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
summarize role based on relay if in use, bt or sms otherwise
This commit is contained in:
parent
73851b285e
commit
a1b967033f
1 changed files with 22 additions and 26 deletions
|
@ -177,30 +177,32 @@ public class GameSummary {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: should report based on whatever conType is giving us a
|
||||||
|
// successful connection.
|
||||||
public String summarizeRole()
|
public String summarizeRole()
|
||||||
{
|
{
|
||||||
String result = null;
|
String result = null;
|
||||||
if ( isMultiGame() ) {
|
if ( isMultiGame() ) {
|
||||||
int fmtID = 0;
|
int fmtID = 0;
|
||||||
for ( Iterator<CommsConnType> iter = conTypes.iterator();
|
|
||||||
null == result && iter.hasNext(); ) {
|
// If we're using relay to connect, get status from that
|
||||||
CommsConnType conType = iter.next();
|
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
||||||
DbgUtils.logf( "summarizeRole: got type %s", conType.toString() );
|
if ( null == relayID || 0 == relayID.length() ) {
|
||||||
switch ( conType ) {
|
fmtID = R.string.summary_relay_conf_fmt;
|
||||||
case COMMS_CONN_RELAY:
|
} else if ( anyMissing() ) {
|
||||||
if ( null == relayID || 0 == relayID.length() ) {
|
fmtID = R.string.summary_relay_wait_fmt;
|
||||||
fmtID = R.string.summary_relay_conf_fmt;
|
} else if ( gameOver ) {
|
||||||
} else if ( anyMissing() ) {
|
fmtID = R.string.summary_relay_gameover_fmt;
|
||||||
fmtID = R.string.summary_relay_wait_fmt;
|
} else {
|
||||||
} else if ( gameOver ) {
|
fmtID = R.string.summary_relay_conn_fmt;
|
||||||
fmtID = R.string.summary_relay_gameover_fmt;
|
}
|
||||||
} else {
|
result = LocUtils.getString( m_context, fmtID, roomName );
|
||||||
fmtID = R.string.summary_relay_conn_fmt;
|
}
|
||||||
}
|
|
||||||
result = LocUtils.getString( m_context, fmtID, roomName );
|
// Otherwise, use BT or SMS
|
||||||
break;
|
if ( null == result ) {
|
||||||
case COMMS_CONN_BT:
|
if ( conTypes.contains( CommsConnType.COMMS_CONN_BT )
|
||||||
case COMMS_CONN_SMS:
|
|| ( conTypes.contains( CommsConnType.COMMS_CONN_SMS))){
|
||||||
if ( anyMissing() ) {
|
if ( anyMissing() ) {
|
||||||
if ( DeviceRole.SERVER_ISSERVER == serverRole ) {
|
if ( DeviceRole.SERVER_ISSERVER == serverRole ) {
|
||||||
fmtID = R.string.summary_wait_host;
|
fmtID = R.string.summary_wait_host;
|
||||||
|
@ -210,7 +212,7 @@ public class GameSummary {
|
||||||
} else if ( gameOver ) {
|
} else if ( gameOver ) {
|
||||||
fmtID = R.string.summary_gameover;
|
fmtID = R.string.summary_gameover;
|
||||||
} else if ( null != remoteDevs
|
} else if ( null != remoteDevs
|
||||||
&& CommsConnType.COMMS_CONN_SMS == conType ) {
|
&& conTypes.contains( CommsConnType.COMMS_CONN_SMS)){
|
||||||
result =
|
result =
|
||||||
LocUtils.getString( m_context, R.string.summary_conn_sms_fmt,
|
LocUtils.getString( m_context, R.string.summary_conn_sms_fmt,
|
||||||
TextUtils.join(", ", m_remotePhones) );
|
TextUtils.join(", ", m_remotePhones) );
|
||||||
|
@ -220,11 +222,6 @@ public class GameSummary {
|
||||||
if ( null == result ) {
|
if ( null == result ) {
|
||||||
result = LocUtils.getString( m_context, fmtID );
|
result = LocUtils.getString( m_context, fmtID );
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// result = conType.toString();
|
|
||||||
DbgUtils.logf( "unexpected type: %s", conType.toString() );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +230,6 @@ public class GameSummary {
|
||||||
|
|
||||||
public boolean isMultiGame()
|
public boolean isMultiGame()
|
||||||
{
|
{
|
||||||
// This definition will expand as other transports are added
|
|
||||||
return ( null != conTypes && 0 < conTypes.size()
|
return ( null != conTypes && 0 < conTypes.size()
|
||||||
&& serverRole != DeviceRole.SERVER_STANDALONE );
|
&& serverRole != DeviceRole.SERVER_STANDALONE );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue