Hi,
I've recently started to adapt a stopwatch widget of mine for glance mode. Currently I don't own a glance-enabled watch, so I can only test this in the sim (CIQ SDK 3.2.3, Windows/Eclipse).
Non-Glance Widget
The non-glance structure of the widget is as follows:
Top-level Initial view (minimal UI):
Displays the stopwatch (minimal UI) and has very limited user-input (as it's the front page of a widget). The user can tap or press enter to transition to "full user interaction mode", at which point another view is pushed (let's call it "full view")
e.g.
Full view (full UI):
Displays the stopwatch (full UI) and has full user input (via onKey() handler). The user can start the timer, stop the timer, take laps, change settings, etc. When the user presses Back (or another key sequence under certain circumstances *), this view is popped and the user is back to the initial view (which can be "exited" by either scrolling to another widget or by pressing Back)
(* I actually have two ways of exiting the full widget UI other than Back: by pressing Up twice, or by using a settings menu item. The use case here is that while the stopwatch is running, Back is reserved for taking laps or resetting the stopwatch.)
e.g.
All of this works perfectly without any crashes.
Glance-Mode Widget
But in glance mode, the glance view is supposed to replace the initial view (minimal UI), and the new initial view is the full UI. So the new architecture of the widget in glance mode is:
Glance View: shows an "extremely minimal UI" (like the minimal UI, but smaller and with slightly less information)
e.g.
Top-level Widget View: shows the "full UI", with full user interaction. (User can start and stop the stopwatch, as well as take laps, access settings, etc.)
e.g.
The problem here is that I can't seem to exit the top-level widget view cleanly.
- If I call popView(), then I get a system error (probably because popView() is not allowed for the top-level view of a widget) and the widget exits
- But if I just return false from onKey(), then nothing happens. Whether I return true or false from onKey() (without calling popView), nothing happens
It seems that the only way to cleanly exit the top-level view of the widget in glance mode is to omit the onKey() handler from the delegate.
(EDIT: As Jim pointed out, the problem here is due to having both an onKey and an onBack handler, but not returning false form both).
Am I doing something wrong or missing something here? I need to have full user interaction in the "full view" (which is top-level view of the glance-mode widget), but I also want to be able to exit that top level view:
- When Back is pressed (under some circumstances - i.e. when the stopwatch is not running)
- When some other key sequence is pressed (under other circumstances - i.e. when the stopwatch is running, as the Back key is now reserved for taking laps)
It seems I could just continue to call popView(), but I don't want the widget to crash every time it exits.
If it's actually the case the top-level view of widget in glance mode cannot be popped, maybe this design decision should be revisited? At the very least, maybe the behavior of onKey() could be changed?
As it stands, it seems that it isn't possible to have the same kind of UX in both the glance and non-glance versions of a widget, where the glance view takes the place of the non-glance widget landing/summary page, and the glance-mode widget initial view takes the place of the non-glance widget "full view" (with an onKey() handler and with the ability to exit this view with ways other than the Back key.). Unless I'm missing something.
It seems that the only way to accomplish what I want to do is to keep the extra widget landing page (minimal UI) in glance mode. But the landing page is redundant when the glance mode view exists....
Thanks!