Hello all,
This problem may be a result of me misunderstanding the functionality of CountdownTimer.addTime(), but it seems that the method is actually subtracting time from the timer. CountdownTimer.add() works as expected, but that is evidently the deprecated method:
Working as intended but deeply counterintuitive, I’m afraid.
CountdownTimer is still based on the Clock object. What it’s really doing is creating a clock that counts up normally, but it is subtracting the current value of the clock from a constant that is the maximum value of the timer (five seconds, in your case).
So, “addTime” is adding to the Clock ‘inside’ the CountdownTimer therefore jumping the timer ‘forward’ one second and decreasing the displayed time. The other problem is that “add” is kind of counterintuitive and deprecated (meaning it’s no longer intended to be used). If you were using a normal Clock, ‘add’ would decrease the displayed time by that amount because it adds not to the clock itself but to the start time of the clock. That weirdness is why it’s not supposed to be used. However, because you’re using a CountdownTimer, that increases the displayed time by that amount instead.
It’s a confluence of two counterintuitive things, the way “add” and “addTime” work and the way that CountdownTimer is just a flipped Clock, but everything is doing what it’s supposed to do. It’s just that CountdownTimer doesn’t have it’s own separate “addTime” function.