private void init(long length) { /* TODO: mTimerId must avoid StopwatchService.NOTIFICATION_ID, * TimerReceiver.IN_USE_NOTIFICATION_ID, and alarm ID's (which seem to be 1, 2, ..) */ mTimerId = (int) Utils.getTimeNow(); mStartTime = Utils.getTimeNow(); mTimeLeft = mOriginalLength = mSetupLength = length; mLabel = ""; }
public long updateTimeLeft(boolean forceUpdate) { if (isTicking() || forceUpdate) { long millis = Utils.getTimeNow(); mTimeLeft = mOriginalLength - (millis - mStartTime); } return mTimeLeft; }
public void addTime(long time) { mTimeLeft = mOriginalLength - (Utils.getTimeNow() - mStartTime); if (mTimeLeft < MAX_TIMER_LENGTH - time) { mOriginalLength += time; } }