From d7a515ca97a3fd8a597e4c39c6ad6afced28fd85 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Mon, 22 Aug 2011 07:03:46 -0700 Subject: [PATCH] display three states of relay connectedness in games list items: configured, connected but waiting for players, and game-in-play. --- .../android/XWords4/res/values/strings.xml | 6 ++++- .../eehouse/android/xw4/jni/GameSummary.java | 24 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index c5650e22f..521660c42 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -365,7 +365,11 @@ check off-device players. Modified first player. - Connecting via Relay, room \"%s\" + Configured for room + \"%s\" + Waiting for players in room + \"%s\" + Game in play in room \"%s\" Game over %d moves played diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java index 6a2dee187..d6953d405 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java @@ -118,10 +118,18 @@ public class GameSummary { { String result = null; if ( isRelayGame() ) { + Assert.assertTrue( CommsAddrRec.CommsConnType.COMMS_CONN_RELAY == conType ); - String fmt = m_context.getString( R.string.summary_fmt_relay ); - result = String.format( fmt, roomName ); + int fmtID; + if ( null == relayID || 0 == relayID.length() ) { + fmtID = R.string.summary_relay_conff; + } else if ( anyMissing() ) { + fmtID = R.string.summary_relay_waitf; + } else { + fmtID = R.string.summary_relay_connf; + } + result = String.format( m_context.getString(fmtID), roomName ); } return result; } @@ -144,6 +152,18 @@ public class GameSummary { return result; } + private boolean anyMissing() + { + boolean missing = false; + for ( int ii = 0; ii < nPlayers; ++ii ) { + if ( !isLocal(ii) && (0 != ((1 << ii) & missingPlayers) ) ) { + missing = true; + break; + } + } + return missing; + } + public int giflags() { int result; if ( null == m_gi ) {