Ejemplo n.º 1
0
 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 = "";
 }
Ejemplo n.º 2
0
 public long updateTimeLeft(boolean forceUpdate) {
   if (isTicking() || forceUpdate) {
     long millis = Utils.getTimeNow();
     mTimeLeft = mOriginalLength - (millis - mStartTime);
   }
   return mTimeLeft;
 }
Ejemplo n.º 3
0
 public void addTime(long time) {
   mTimeLeft = mOriginalLength - (Utils.getTimeNow() - mStartTime);
   if (mTimeLeft < MAX_TIMER_LENGTH - time) {
     mOriginalLength += time;
   }
 }