restart method

void restart(
  1. int totalTime
)

Restart the countdown with a new totalTime.

取消当前计时(如有)并以 totalTime 为新总数重新启动倒计时。等价于旧的 updateTotalTime 组合行为(cancel + set + start)。

Implementation

void restart(int totalTime) {
  cancel();
  if (totalTime <= 0) return;
  mTotalTime = totalTime;
  startCountDown();
}