post actual notifications (with text yet to be improved)

This commit is contained in:
Eric House 2014-08-09 21:00:53 -07:00
parent 5230593276
commit 9e763b4049
5 changed files with 16 additions and 3 deletions

View file

@ -1605,6 +1605,9 @@ public final class R {
/** Text of progress indicator shown while check is being conducted /** Text of progress indicator shown while check is being conducted
*/ */
public static final int msgs_progress=0x7f06009d; public static final int msgs_progress=0x7f06009d;
/** Nagging
*/
public static final int nag_title=0x7f0602c5;
public static final int name_dict_fmt=0x7f060086; public static final int name_dict_fmt=0x7f060086;
/** text of checkbox. If this checkbox is checked, games created /** text of checkbox. If this checkbox is checked, games created
for network play will by default have the hint feature for network play will by default have the hint feature

View file

@ -2265,4 +2265,7 @@
<string name="force_tablet_title">Force tablet layout</string> <string name="force_tablet_title">Force tablet layout</string>
<string name="force_tablet_summary">Even if my screen is too small</string> <string name="force_tablet_summary">Even if my screen is too small</string>
<!-- Nagging -->
<string name="nag_title">Make your move already</string>
</resources> </resources>

View file

@ -1937,4 +1937,6 @@
tahw\'s elbaliava.</string> tahw\'s elbaliava.</string>
<string name="force_tablet_title">Ecrof telbat tuoyal</string> <string name="force_tablet_title">Ecrof telbat tuoyal</string>
<string name="force_tablet_summary">Neve fi ym neercs si oot llams</string> <string name="force_tablet_summary">Neve fi ym neercs si oot llams</string>
<!-- Nagging -->
<string name="nag_title">Ekam ruoy evom ydaerla</string>
</resources> </resources>

View file

@ -1937,4 +1937,6 @@
WHAT\'S AVAILABLE.</string> WHAT\'S AVAILABLE.</string>
<string name="force_tablet_title">FORCE TABLET LAYOUT</string> <string name="force_tablet_title">FORCE TABLET LAYOUT</string>
<string name="force_tablet_summary">EVEN IF MY SCREEN IS TOO SMALL</string> <string name="force_tablet_summary">EVEN IF MY SCREEN IS TOO SMALL</string>
<!-- Nagging -->
<string name="nag_title">MAKE YOUR MOVE ALREADY</string>
</resources> </resources>

View file

@ -35,7 +35,7 @@ import org.eehouse.android.xw4.DBUtils.NeedsNagInfo;
public class NagTurnReceiver extends BroadcastReceiver { public class NagTurnReceiver extends BroadcastReceiver {
private static final long INTERVAL_MILLIS = 1000 * 30; // every half minute for now private static final long INTERVAL_MILLIS = 1000 * 30; // every half minute for now
private static final long NAG_INTERVAL = 1000 * 30; // 90 seconds for now private static final long NAG_INTERVAL = 1000 * 60 * 30; // 90 seconds for now
@Override @Override
public void onReceive( Context context, Intent intent ) public void onReceive( Context context, Intent intent )
@ -47,8 +47,11 @@ public class NagTurnReceiver extends BroadcastReceiver {
long now = new Date().getTime(); // in milliseconds long now = new Date().getTime(); // in milliseconds
for ( NeedsNagInfo info : needNagging ) { for ( NeedsNagInfo info : needNagging ) {
Assert.assertTrue( info.m_nextNag < now ); Assert.assertTrue( info.m_nextNag < now );
DbgUtils.logf( "%d hasn't moved in %d seconds", info.m_rowid, long rowid = info.m_rowid;
(now - info.m_lastMoveMillis )/ 1000 ); 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 );
info.m_nextNag = figureNextNag( info.m_lastMoveMillis ); info.m_nextNag = figureNextNag( info.m_lastMoveMillis );
} }