From: Nathaniel Wesley Filardo Date: Sat, 21 Oct 2017 05:51:48 +0000 (-0400) Subject: Factor out timer providers X-Git-Tag: release-1.2~29 X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=c1d2c708b83110bb97a2515157d45c3dec71eb12;p=acmetensortoys-ctfws-android Factor out timer providers --- diff --git a/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/CtFwSGameState.java b/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/CtFwSGameState.java index f7d53fa..0cb30a5 100644 --- a/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/CtFwSGameState.java +++ b/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/CtFwSGameState.java @@ -10,11 +10,6 @@ import java.util.Set; public class CtFwSGameState { - public interface TimerProvider { - long wallMS(); - void postDelay(Runnable r, long delayMS); - void cancelPost(Runnable r); - } private final TimerProvider mT; public CtFwSGameState (TimerProvider t) { diff --git a/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/TimerProvider.java b/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/TimerProvider.java new file mode 100644 index 0000000..34fb4a4 --- /dev/null +++ b/lib/src/main/java/com/acmetensortoys/ctfwstimer/lib/TimerProvider.java @@ -0,0 +1,7 @@ +package com.acmetensortoys.ctfwstimer.lib; + +public interface TimerProvider { + long wallMS(); + void postDelay(Runnable r, long delayMS); + void cancelPost(Runnable r); +} diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java index 6252a24..6501af2 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java @@ -11,6 +11,7 @@ import android.support.annotation.Nullable; import android.util.Log; import com.acmetensortoys.ctfwstimer.lib.CtFwSGameState; +import com.acmetensortoys.ctfwstimer.lib.TimerProvider; import org.eclipse.paho.android.service.MqttAndroidClient; import org.eclipse.paho.android.service.MqttTraceHandler; @@ -34,7 +35,7 @@ public class MainService extends Service { // The reason we're here! private final CtFwSGameState mCgs - = new CtFwSGameState(new CtFwSGameState.TimerProvider() { + = new CtFwSGameState(new TimerProvider() { @Override public long wallMS() { return System.currentTimeMillis();