import static ro.ieval.fonbot.Utils.toNonNull;
import java.util.Collections;
-import java.util.HashSet;
+import java.util.EnumSet;
import java.util.Set;
import org.eclipse.jdt.annotation.Nullable;
* Broadcast action: remove an ongoing event
*/
public static final String ACTION_DELETE_ONGOING="ro.ieval.fonbot.FonBotMainService.ACTION_DELETE_ONGOING";
+ /** Broadcast action: trigger a server poll */
+ public static final String ACTION_TRIGGER_POLL="ro.ieval.fonbot.FonBotMainService.ACTION_TRIGGER_POLL";
/**
* Extra: ongoing event id
*
/**
* Set of ongoing events.
*/
- private final Set<OngoingEvent> ongoing=new HashSet<OngoingEvent>(10);
+ private final Set<OngoingEvent> ongoing=EnumSet.noneOf(OngoingEvent.class);
/**
* Get the set of ongoing events.
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_ONGOING_UPDATE));
}
+ if(intent!=null && intent.getAction()==ACTION_TRIGGER_POLL)
+ Utils.pollServer(this);
+
final boolean runForeground=PreferenceManager.getDefaultSharedPreferences(this).getBoolean("foreground", false);
if(!runForeground)
stopForeground(true);