mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
fix sync-with-relay menu items to work even if timed syncing is
disabled.
This commit is contained in:
parent
6b773460ec
commit
d76ca5938b
2 changed files with 17 additions and 5 deletions
|
@ -148,7 +148,7 @@ public class DlgDelegate {
|
||||||
if ( null == DBUtils.getRelayIDs( m_activity, false ) ) {
|
if ( null == DBUtils.getRelayIDs( m_activity, false ) ) {
|
||||||
showOKOnlyDialog( R.string.no_games_to_refresh );
|
showOKOnlyDialog( R.string.no_games_to_refresh );
|
||||||
} else {
|
} else {
|
||||||
RelayReceiver.RestartTimer( m_activity );
|
RelayReceiver.RestartTimer( m_activity, true );
|
||||||
Toast.makeText( m_activity,
|
Toast.makeText( m_activity,
|
||||||
m_activity.getString( R.string.msgs_progress ),
|
m_activity.getString( R.string.msgs_progress ),
|
||||||
Toast.LENGTH_LONG ).show();
|
Toast.LENGTH_LONG ).show();
|
||||||
|
|
|
@ -62,13 +62,19 @@ public class RelayReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RestartTimer( Context context )
|
public static void RestartTimer( Context context, boolean force )
|
||||||
{
|
{
|
||||||
RestartTimer( context,
|
RestartTimer( context,
|
||||||
1000 * CommonPrefs.getProxyInterval( context ) );
|
1000 * CommonPrefs.getProxyInterval( context ), force );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RestartTimer( Context context, long interval_millis )
|
public static void RestartTimer( Context context )
|
||||||
|
{
|
||||||
|
RestartTimer( context, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RestartTimer( Context context, long interval_millis,
|
||||||
|
boolean force )
|
||||||
{
|
{
|
||||||
AlarmManager am =
|
AlarmManager am =
|
||||||
(AlarmManager)context.getSystemService( Context.ALARM_SERVICE );
|
(AlarmManager)context.getSystemService( Context.ALARM_SERVICE );
|
||||||
|
@ -76,7 +82,7 @@ public class RelayReceiver extends BroadcastReceiver {
|
||||||
Intent intent = new Intent( context, RelayReceiver.class );
|
Intent intent = new Intent( context, RelayReceiver.class );
|
||||||
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
|
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
|
||||||
|
|
||||||
if ( interval_millis > 0 ) {
|
if ( interval_millis > 0 || force ) {
|
||||||
// Utils.logf( "setting alarm for %d millis", interval_millis );
|
// Utils.logf( "setting alarm for %d millis", interval_millis );
|
||||||
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
||||||
0, // first firing
|
0, // first firing
|
||||||
|
@ -85,4 +91,10 @@ public class RelayReceiver extends BroadcastReceiver {
|
||||||
am.cancel( pi );
|
am.cancel( pi );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RestartTimer( Context context, long interval_millis )
|
||||||
|
{
|
||||||
|
RestartTimer( context, interval_millis, false );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue