废话不多说,直接上代码
package com.zdsoft.littleapple.utils.timer;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import com.zdsoft.littleapple.utils.log.LogUtils;
public abstract class CountDownTimer {
/**
* Millis since epoch when alarm should stop.
*/
private final long mMillisInFuture;
/**
* The interval in millis that the user receives callbacks
*/
private final long mCountdownInterval;
private long mMillisFinished = 0;
private long mElapsedRealtime;
/**
* boolean representing if the timer was cancelled
*/
private boolean mCancelled = false;
/**
* @param millisInFuture The number of millis in the future from the call
* to {@link #start()} until the countdown is done and {@link #onFinish(long millisUntilFinished)}
* is called.
* @param countDownI