diff --git a/xwords4/android/XWords4/archive/R.java b/xwords4/android/XWords4/archive/R.java index 1e9e7fd08..e278efeca 100644 --- a/xwords4/android/XWords4/archive/R.java +++ b/xwords4/android/XWords4/archive/R.java @@ -1605,9 +1605,11 @@ public final class R { /** Text of progress indicator shown while check is being conducted */ public static final int msgs_progress=0x7f06009d; + public static final int nag_body_fmt=0x7f0602c6; /** Nagging */ public static final int nag_title=0x7f0602c5; + public static final int nag_warn_last=0x7f0602c7; public static final int name_dict_fmt=0x7f060086; /** text of checkbox. If this checkbox is checked, games created for network play will by default have the hint feature diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 82d92f7e7..855d474c5 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -2267,5 +2267,7 @@ Even if my screen is too small - Make your move already + Reminder: It\'s your turn + And it\'s been your turn for more than %1$d minutes. + (This is your last warning.) diff --git a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml index 7010ce2a7..7f5d3c1f2 100644 --- a/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ba_CK/strings.xml @@ -1938,5 +1938,7 @@ Ecrof telbat tuoyal Neve fi ym neercs si oot llams - Ekam ruoy evom ydaerla + Rednimer: Ti\'s ruoy nrut + Dna ti\'s neeb ruoy nrut rof erom naht %1$d setunim + sIht( si ruoy tsal gninraw.) diff --git a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml index d3d00f52d..8f53d69aa 100644 --- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml +++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml @@ -1938,5 +1938,7 @@ FORCE TABLET LAYOUT EVEN IF MY SCREEN IS TOO SMALL - MAKE YOUR MOVE ALREADY + REMINDER: IT\'S YOUR TURN + AND IT\'S BEEN YOUR TURN FOR MORE THAN %1$d MINUTES + (THIS IS YOUR LAST WARNING.) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java index 18751d0af..89757ad1c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java @@ -31,11 +31,17 @@ import java.util.Date; import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.NeedsNagInfo; +import org.eehouse.android.xw4.loc.LocUtils; public class NagTurnReceiver extends BroadcastReceiver { private static final long INTERVAL_MILLIS = 1000 * 30; // every half minute for now - private static final long NAG_INTERVAL = 1000 * 60 * 30; // 90 seconds for now + private static final long[] NAG_INTERVAL_SECONDS = {2*60, // five minutes (for testing) + 5*60, + // 60*1*24, // one day + // 60*2*24, // two days + // 60*3*24, // three days + }; @Override public void onReceive( Context context, Intent intent ) @@ -47,13 +53,21 @@ public class NagTurnReceiver extends BroadcastReceiver { long now = new Date().getTime(); // in milliseconds for ( NeedsNagInfo info : needNagging ) { Assert.assertTrue( info.m_nextNag < now ); + info.m_nextNag = figureNextNag( info.m_lastMoveMillis ); + boolean lastWarning = 0 == info.m_nextNag; + long rowid = info.m_rowid; Intent msgIntent = GamesListDelegate.makeRowidIntent( context, rowid ); - String body = String.format( "It's been your turn in game %d for %d seconds", - rowid, (now - info.m_lastMoveMillis)/ 1000 ); - Utils.postNotification( context, msgIntent, R.string.nag_title, body, (int)rowid ); + // Change this to hours or days before ship + int nMinutes = (int)(now - info.m_lastMoveMillis) / (1000 * 60); + String body = String.format( LocUtils.getString(context, R.string.nag_body_fmt), + nMinutes ); + if ( lastWarning ) { + body += " " + LocUtils.getString( context, R.string.nag_warn_last ); + } + Utils.postNotification( context, msgIntent, R.string.nag_title, + body, (int)rowid ); - info.m_nextNag = figureNextNag( info.m_lastMoveMillis ); } DBUtils.updateNeedNagging( context, needNagging ); @@ -91,12 +105,19 @@ public class NagTurnReceiver extends BroadcastReceiver { public static long figureNextNag( long moveTimeMillis ) { + long result = 0; long now = new Date().getTime(); // in milliseconds - while ( moveTimeMillis < now ) { - moveTimeMillis += NAG_INTERVAL; + Assert.assertTrue( now >= moveTimeMillis ); + for ( long nSecs : NAG_INTERVAL_SECONDS ) { + long asMillis = moveTimeMillis + (nSecs * 1000); + if ( asMillis >= now ) { + result = asMillis; + break; + } } - DbgUtils.logf( "figureNextNag => %d (%d seconds in future)", moveTimeMillis, - (moveTimeMillis - now) / 1000 ); - return moveTimeMillis; + + DbgUtils.logf( "figureNextNag => %d (%s)", result, + DbgUtils.millisToDateStr(result) ); + return result; } }