mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
fix nag timers firing when display disabled
Logic to set the fire time in the future wasn't firing when display of the nag was diabled, so timers fired every few ms because they always existed in the past.
This commit is contained in:
parent
2f6680b9a3
commit
b0d0fa8da7
2 changed files with 31 additions and 32 deletions
|
@ -79,18 +79,17 @@ public class NagTurnReceiver {
|
|||
for ( NeedsNagInfo info : needNagging ) {
|
||||
Assert.assertTrueNR( info.m_nextNag < now );
|
||||
|
||||
// Skip processing if notifications disabled for this type
|
||||
// of game
|
||||
if ( s_nagsDisabledSolo && info.isSolo() ) {
|
||||
continue;
|
||||
} else if ( s_nagsDisabledNet && !info.isSolo() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
info.m_nextNag = figureNextNag( context,
|
||||
info.m_lastMoveMillis );
|
||||
boolean lastWarning = 0 == info.m_nextNag;
|
||||
|
||||
// Skip display of notifications disabled for this type
|
||||
// of game
|
||||
if ( s_nagsDisabledSolo && info.isSolo() ) {
|
||||
// do nothing
|
||||
} else if ( s_nagsDisabledNet && !info.isSolo() ) {
|
||||
// do nothing
|
||||
} else {
|
||||
boolean lastWarning = 0 == info.m_nextNag;
|
||||
long rowid = info.m_rowid;
|
||||
GameSummary summary = GameUtils.getSummary( context, rowid,
|
||||
10 );
|
||||
|
@ -113,7 +112,7 @@ public class NagTurnReceiver {
|
|||
Utils.postNotification( context, msgIntent,
|
||||
R.string.nag_title, body,
|
||||
rowid );
|
||||
|
||||
}
|
||||
}
|
||||
DBUtils.updateNeedNagging( context, needNagging );
|
||||
|
||||
|
|
|
@ -373,8 +373,8 @@ public class TimerReceiver extends BroadcastReceiver {
|
|||
final long curNextFire = data.getFor( CLIENT_STATS, KEY_NEXT_FIRE, 0 );
|
||||
if ( 1000L < Math.abs( firstFireTime - curNextFire ) ) {
|
||||
if ( firstFireTime - now < MIN_FUTURE ) { // Less than a 2 seconds in the future?
|
||||
Log.d( TAG, "moving firstFireTime to the future: %s -> %s",
|
||||
fmtLong(firstFireTime), fmtLong(now + MIN_FUTURE) );
|
||||
Log.d( TAG, "setNextTimer(): moving firstFireTime (for %s) to the future: %s -> %s",
|
||||
firstClient, fmtLong(firstFireTime), fmtLong(now + MIN_FUTURE) );
|
||||
firstFireTime = now + MIN_FUTURE;
|
||||
data.setFor( firstClient, KEY_FIREWHEN, firstFireTime );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue