diff --git a/app/src/main/java/io/github/krtkush/lineartimeproject/MainActivity.java b/app/src/main/java/io/github/krtkush/lineartimeproject/MainActivity.java index 617908e..0ff5f10 100644 --- a/app/src/main/java/io/github/krtkush/lineartimeproject/MainActivity.java +++ b/app/src/main/java/io/github/krtkush/lineartimeproject/MainActivity.java @@ -42,6 +42,8 @@ protected void onCreate(Bundle savedInstanceState) { linearTimer = new LinearTimer.Builder() .linearTimerView(linearTimerView) .duration(duration) + .timerListener(this) + .getCountUpdate(LinearTimer.COUNT_DOWN_TIMER, 1000) .build(); // Start the timer. diff --git a/lineartimer/src/main/java/io/github/krtkush/lineartimer/CountUpTimer.java b/lineartimer/src/main/java/io/github/krtkush/lineartimer/CountUpTimer.java index 5aa23ef..0dd69ad 100644 --- a/lineartimer/src/main/java/io/github/krtkush/lineartimer/CountUpTimer.java +++ b/lineartimer/src/main/java/io/github/krtkush/lineartimer/CountUpTimer.java @@ -39,9 +39,7 @@ public abstract class CountUpTimer { private long base; public CountUpTimer(long duration, long interval) { - // Reduce the time duration by 1000 millis so as to make sure that tha animation and - // counter finish at the same time. - this.duration = duration - 1000; + this.duration = duration; this.interval = interval; } diff --git a/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimer.java b/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimer.java index 1948768..7e999e9 100644 --- a/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimer.java +++ b/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimer.java @@ -174,11 +174,8 @@ else if (countType == COUNT_UP_TIMER) } else if (countType == COUNT_UP_TIMER) countUpTimer.resume(); - // The LinearTimerView's prefill is reset to as it was when it was paused. - linearTimerView.setAnimation(arcProgressAnimation); - // Start animation again. - arcProgressAnimation.start(); + linearTimerView.startAnimation(arcProgressAnimation); // Store the current status code in intStatusCode integer intStatusCode = LinearTimerStates.ACTIVE.getStaus(); diff --git a/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountDownTimer.java b/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountDownTimer.java index 91b141a..8d428d9 100644 --- a/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountDownTimer.java +++ b/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountDownTimer.java @@ -9,16 +9,12 @@ public class LinearTimerCountDownTimer extends CountDownTimer { private LinearTimer.TimerListener timerListener; /** - * @param millisInFuture The number of millis in the future from the call + * @param millisLeftUntilFinished The number of millis in the future from the call * to {@link #start()} until the countdown is done and {@link #onFinish()} * is called. * @param countDownInterval The interval along the way to receive * {@link #onTick(long)} callbacks. */ - public LinearTimerCountDownTimer(long millisInFuture, long countDownInterval) { - super(millisInFuture, countDownInterval); - } - public LinearTimerCountDownTimer(long millisLeftUntilFinished, long countDownInterval, LinearTimer.TimerListener timerListener) { super(millisLeftUntilFinished, countDownInterval); diff --git a/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountUpTimer.java b/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountUpTimer.java index ff959a8..3552d1e 100644 --- a/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountUpTimer.java +++ b/lineartimer/src/main/java/io/github/krtkush/lineartimer/LinearTimerCountUpTimer.java @@ -7,14 +7,12 @@ public class LinearTimerCountUpTimer extends CountUpTimer { private LinearTimer.TimerListener timerListener; - public LinearTimerCountUpTimer(long duration, long interval) { - super(duration, interval); - } - public LinearTimerCountUpTimer(long timerDuration, long countUpInterval, LinearTimer.TimerListener timerListener) { super(timerDuration, countUpInterval); this.timerListener = timerListener; + // Reduce the time duration by 1000 millis so as to make sure that tha animation and + // counter finish at the same time. this.timerDuration = timerDuration; }