mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-02 20:46:15 +01:00
show in game list item if invitations pending
This commit is contained in:
parent
e60945733f
commit
73a7a8836f
6 changed files with 704 additions and 683 deletions
File diff suppressed because it is too large
Load diff
|
@ -59,6 +59,8 @@
|
||||||
<!-- Final state: game is over. -->
|
<!-- Final state: game is over. -->
|
||||||
<string name="summary_relay_gameover_fmt">Game over in room \"%1$s\"</string>
|
<string name="summary_relay_gameover_fmt">Game over in room \"%1$s\"</string>
|
||||||
|
|
||||||
|
<string name="summary_invites_out">Players invited</string>
|
||||||
|
|
||||||
<!-- Games that have ended are listed with this string -->
|
<!-- Games that have ended are listed with this string -->
|
||||||
<string name="gameOver">Game over</string>
|
<string name="gameOver">Game over</string>
|
||||||
<!-- Otherwise they're listed with this to give some indication of
|
<!-- Otherwise they're listed with this to give some indication of
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<string name="summary_relay_conn_fmt">Emag ni yalp ni moor \"%1$s\"</string>
|
<string name="summary_relay_conn_fmt">Emag ni yalp ni moor \"%1$s\"</string>
|
||||||
<!-- Final state: game is over. -->
|
<!-- Final state: game is over. -->
|
||||||
<string name="summary_relay_gameover_fmt">Emag revo ni moor \"%1$s\"</string>
|
<string name="summary_relay_gameover_fmt">Emag revo ni moor \"%1$s\"</string>
|
||||||
|
<string name="summary_invites_out">Sreyalp detivni</string>
|
||||||
<!-- Games that have ended are listed with this string -->
|
<!-- Games that have ended are listed with this string -->
|
||||||
<string name="gameOver">Emag revo</string>
|
<string name="gameOver">Emag revo</string>
|
||||||
<!-- Otherwise they're listed with this to give some indication of
|
<!-- Otherwise they're listed with this to give some indication of
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<string name="summary_relay_conn_fmt">GAME IN PLAY IN ROOM \"%1$s\"</string>
|
<string name="summary_relay_conn_fmt">GAME IN PLAY IN ROOM \"%1$s\"</string>
|
||||||
<!-- Final state: game is over. -->
|
<!-- Final state: game is over. -->
|
||||||
<string name="summary_relay_gameover_fmt">GAME OVER IN ROOM \"%1$s\"</string>
|
<string name="summary_relay_gameover_fmt">GAME OVER IN ROOM \"%1$s\"</string>
|
||||||
|
<string name="summary_invites_out">PLAYERS INVITED</string>
|
||||||
<!-- Games that have ended are listed with this string -->
|
<!-- Games that have ended are listed with this string -->
|
||||||
<string name="gameOver">GAME OVER</string>
|
<string name="gameOver">GAME OVER</string>
|
||||||
<!-- Otherwise they're listed with this to give some indication of
|
<!-- Otherwise they're listed with this to give some indication of
|
||||||
|
|
|
@ -320,7 +320,7 @@ public class GameListItem extends LinearLayout
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
String roleSummary = summary.summarizeRole();
|
String roleSummary = summary.summarizeRole( m_rowid );
|
||||||
if ( null != roleSummary ) {
|
if ( null != roleSummary ) {
|
||||||
m_role.setText( roleSummary );
|
m_role.setText( roleSummary );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Iterator;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import org.eehouse.android.xw4.DBUtils;
|
||||||
import org.eehouse.android.xw4.DbgUtils;
|
import org.eehouse.android.xw4.DbgUtils;
|
||||||
import org.eehouse.android.xw4.R;
|
import org.eehouse.android.xw4.R;
|
||||||
import org.eehouse.android.xw4.Utils;
|
import org.eehouse.android.xw4.Utils;
|
||||||
|
@ -196,15 +197,26 @@ public class GameSummary {
|
||||||
|
|
||||||
// FIXME: should report based on whatever conType is giving us a
|
// FIXME: should report based on whatever conType is giving us a
|
||||||
// successful connection.
|
// successful connection.
|
||||||
public String summarizeRole()
|
public String summarizeRole( long rowid )
|
||||||
{
|
{
|
||||||
String result = null;
|
String result = null;
|
||||||
if ( isMultiGame() ) {
|
if ( isMultiGame() ) {
|
||||||
int fmtID = 0;
|
int fmtID = 0;
|
||||||
|
|
||||||
|
int missing = countMissing();
|
||||||
|
if ( 0 < missing ) {
|
||||||
|
DBUtils.SentInvitesInfo si = DBUtils.getInvitesFor( m_context,
|
||||||
|
rowid );
|
||||||
|
if ( si.getPlayerCount() >= missing ) {
|
||||||
|
result = LocUtils.getString( m_context,
|
||||||
|
R.string.summary_invites_out );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we're using relay to connect, get status from that
|
// If we're using relay to connect, get status from that
|
||||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
if ( null == result
|
||||||
if ( anyMissing() ) {
|
&& conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
||||||
|
if ( 0 < missing ) {
|
||||||
if ( null == relayID || 0 == relayID.length() ) {
|
if ( null == relayID || 0 == relayID.length() ) {
|
||||||
fmtID = R.string.summary_relay_conf_fmt;
|
fmtID = R.string.summary_relay_conf_fmt;
|
||||||
} else {
|
} else {
|
||||||
|
@ -222,7 +234,7 @@ public class GameSummary {
|
||||||
if ( null == result ) {
|
if ( null == result ) {
|
||||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_BT )
|
if ( conTypes.contains( CommsConnType.COMMS_CONN_BT )
|
||||||
|| ( conTypes.contains( CommsConnType.COMMS_CONN_SMS))){
|
|| ( conTypes.contains( CommsConnType.COMMS_CONN_SMS))){
|
||||||
if ( anyMissing() ) {
|
if ( 0 < missing ) {
|
||||||
if ( DeviceRole.SERVER_ISSERVER == serverRole ) {
|
if ( DeviceRole.SERVER_ISSERVER == serverRole ) {
|
||||||
fmtID = R.string.summary_wait_host;
|
fmtID = R.string.summary_wait_host;
|
||||||
} else {
|
} else {
|
||||||
|
@ -277,16 +289,20 @@ public class GameSummary {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean anyMissing()
|
private int countMissing()
|
||||||
{
|
{
|
||||||
boolean missing = false;
|
int result = 0;
|
||||||
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
if ( !isLocal(ii) && (0 != ((1 << ii) & missingPlayers) ) ) {
|
if ( !isLocal(ii) && (0 != ((1 << ii) & missingPlayers) ) ) {
|
||||||
missing = true;
|
++result;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return missing;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean anyMissing()
|
||||||
|
{
|
||||||
|
return 0 < countMissing();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int giflags() {
|
public int giflags() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue