mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-06 20:45:54 +01:00
tweak nag message to include the name of the player who last moved
This commit is contained in:
parent
50cb87901e
commit
67c18f4653
6 changed files with 24 additions and 8 deletions
|
@ -2084,6 +2084,7 @@ public final class R {
|
|||
/** clarification of the above
|
||||
*/
|
||||
public static final int prefs_names_summary=0x7f060132;
|
||||
public static final int prev_player=0x7f0602c8;
|
||||
public static final int progress_title=0x7f0602bc;
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -2268,6 +2268,7 @@
|
|||
|
||||
<!-- Nagging -->
|
||||
<string name="nag_title">Reminder: It\'s your turn</string>
|
||||
<string name="nag_body_fmt">It\'s been your turn for more than %1$d hours.</string>
|
||||
<string name="nag_body_fmt">%1$s has been waiting more than %2$d hours.</string>
|
||||
<string name="nag_warn_last_fmt">Last warning: %1$s</string>
|
||||
<string name="prev_player">Your opponent</string>
|
||||
</resources>
|
||||
|
|
|
@ -1939,6 +1939,7 @@
|
|||
<string name="force_tablet_summary">Neve fi ym neercs si oot llams</string>
|
||||
<!-- Nagging -->
|
||||
<string name="nag_title">Rednimer: Ti\'s ruoy nrut</string>
|
||||
<string name="nag_body_fmt">Ti\'s neeb ruoy nrut rof erom naht %1$d sruoh.</string>
|
||||
<string name="nag_body_fmt">%1$s sah neeb gnitiaw erom naht %2$d sruoh.</string>
|
||||
<string name="nag_warn_last_fmt">Tsal gninraw: %1$s</string>
|
||||
<string name="prev_player">Ruoy tnenoppo</string>
|
||||
</resources>
|
||||
|
|
|
@ -1939,6 +1939,7 @@
|
|||
<string name="force_tablet_summary">EVEN IF MY SCREEN IS TOO SMALL</string>
|
||||
<!-- Nagging -->
|
||||
<string name="nag_title">REMINDER: IT\'S YOUR TURN</string>
|
||||
<string name="nag_body_fmt">IT\'S BEEN YOUR TURN FOR MORE THAN %1$d HOURS.</string>
|
||||
<string name="nag_body_fmt">%1$s HAS BEEN WAITING MORE THAN %2$d HOURS.</string>
|
||||
<string name="nag_warn_last_fmt">LAST WARNING: %1$s</string>
|
||||
<string name="prev_player">YOUR OPPONENT</string>
|
||||
</resources>
|
||||
|
|
|
@ -32,6 +32,7 @@ import junit.framework.Assert;
|
|||
|
||||
import org.eehouse.android.xw4.DBUtils.NeedsNagInfo;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
import org.eehouse.android.xw4.jni.GameSummary;
|
||||
|
||||
public class NagTurnReceiver extends BroadcastReceiver {
|
||||
|
||||
|
@ -58,11 +59,16 @@ public class NagTurnReceiver extends BroadcastReceiver {
|
|||
boolean lastWarning = 0 == info.m_nextNag;
|
||||
|
||||
long rowid = info.m_rowid;
|
||||
GameSummary summary = DBUtils.getSummary( context, rowid, 10 );
|
||||
String prevPlayer = null == summary
|
||||
? LocUtils.getString(context, R.string.prev_player)
|
||||
: summary.getPrevPlayer();
|
||||
|
||||
Intent msgIntent = GamesListDelegate.makeRowidIntent( context, rowid );
|
||||
// Change this to hours or days before ship
|
||||
int nHours = (int)(now - info.m_lastMoveMillis) / (1000 * 60 * 60);
|
||||
String body = String.format( LocUtils.getString(context, R.string.nag_body_fmt),
|
||||
nHours );
|
||||
prevPlayer, nHours );
|
||||
if ( lastWarning ) {
|
||||
body = LocUtils
|
||||
.getString( context, R.string.nag_warn_last_fmt, body );
|
||||
|
|
|
@ -50,7 +50,7 @@ public class GameSummary {
|
|||
public int missingPlayers;
|
||||
public int[] scores;
|
||||
public boolean gameOver;
|
||||
public String[] players;
|
||||
private String[] m_players;
|
||||
public CommsConnType conType;
|
||||
// relay-related fields
|
||||
public String roomName;
|
||||
|
@ -135,7 +135,7 @@ public class GameSummary {
|
|||
public void readPlayers( String playersStr )
|
||||
{
|
||||
if ( null != playersStr ) {
|
||||
players = new String[nPlayers];
|
||||
m_players = new String[nPlayers];
|
||||
String sep;
|
||||
if ( playersStr.contains("\n") ) {
|
||||
sep = "\n";
|
||||
|
@ -150,7 +150,7 @@ public class GameSummary {
|
|||
String name = -1 == nxt ?
|
||||
playersStr.substring( prev ) :
|
||||
playersStr.substring( prev, nxt );
|
||||
players[ii] = name;
|
||||
m_players[ii] = name;
|
||||
if ( -1 == nxt ) {
|
||||
break;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public class GameSummary {
|
|||
|
||||
public String summarizePlayer( int indx )
|
||||
{
|
||||
String player = players[indx];
|
||||
String player = m_players[indx];
|
||||
int formatID = 0;
|
||||
if ( !isLocal(indx) ) {
|
||||
boolean isMissing = 0 != ((1 << indx) & missingPlayers);
|
||||
|
@ -332,6 +332,12 @@ public class GameSummary {
|
|||
return result;
|
||||
}
|
||||
|
||||
public String getPrevPlayer()
|
||||
{
|
||||
int prevTurn = (turn + nPlayers - 1) % nPlayers;
|
||||
return m_players[prevTurn];
|
||||
}
|
||||
|
||||
public String dictNames( String separator )
|
||||
{
|
||||
String list = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue