Class: $.BackgroundTimerView
- Inherits:
-
WatchUi.View
-
WatchUi.View
-
Overview
The main view for the timer application. This displays the remaining time on the countdown timer
Constant Summary
-
TimerKeys
Constant Variables
| Type | Name | Value | Since | Description |
|---|---|---|---|---|
| Type | TIMER_DURATION_DEFAULT | (5*60) |
| Name | Value | Since | Description |
|---|---|---|---|
| TIMER_KEY_DURATION | 0 | ||
| TIMER_KEY_START_TIME | 1 | ||
| TIMER_KEY_PAUSE_TIME | 2 |
Instance Member Summary collapse
- _timerDuration as Lang.Number
- _timerPauseTime as Lang.Number or Null
- _timerStartTime as Lang.Number or Null
- _updateTimer as Timer.Timer
Instance Method Summary collapse
-
backgroundEvent() as Void
If we do receive a background event while the application is open, go ahead and reset to the default timer.
-
deleteBackgroundEvent() as Void
Delete the background event.
-
initialize(backgroundRan as Application.PersistableType)
Initialize variables for this view.
-
onUpdate(dc as Graphics.Dc) as Void
Draw the time remaining on the timer to the display.
-
requestUpdate() as Void
This is the callback method we use for our timer.
-
resetTimer() as Lang.Boolean
If the timer is paused, then go ahead and reset it back to the default time.
-
saveProperties() as Void
Save all the persisted values into the object store.
-
setBackgroundEvent() as Void
Set up a background event to occur when the timer expires.
-
startStopTimer() as Void
If the timer is running, pause it.
Instance Attribute Details
var _timerDuration as Lang.Number
var _timerPauseTime as Lang.Number or Null
var _timerStartTime as Lang.Number or Null
var _updateTimer as Timer.Timer
Instance Method Details
backgroundEvent() as Void
If we do receive a background event while the application is open, go ahead and reset to the default timer.
deleteBackgroundEvent() as Void
Delete the background event. We can get rid of this event when the application opens because now we can see exactly when the timer is going to expire. We will set it again when the application closes.
initialize(backgroundRan as Application.PersistableType)
Initialize variables for this view
onUpdate(dc as Graphics.Dc) as Void
Draw the time remaining on the timer to the display
requestUpdate() as Void
This is the callback method we use for our timer. It is only needed to request display updates as the timer counts down so we see the updated time on the display.
resetTimer() as Lang.Boolean
If the timer is paused, then go ahead and reset it back to the default time.
saveProperties() as Void
Save all the persisted values into the object store. This gets called by the Application base before the application shuts down.
setBackgroundEvent() as Void
Set up a background event to occur when the timer expires. This will alert the user that the timer has expired even if the application does not remain open.
startStopTimer() as Void
If the timer is running, pause it. Otherwise, start it up.