This seems to indicate that when letting the three seconds expire, the progress bar got popped before it was ever drawn and the Ui.popView() call in onComplete() is popping the main view.
On the vivoactive and the simulator, the behavior is different. If the confirmation is accepted, the progress bar appears. If the timer expires the main window is shown and the text displayed reads Completed. If the operation is cancelled by pressing back, the main window is shown and the text reads Cancelled. In both cases, pressing enter again will restart the entire operation.
If you change the code at line ~77 to use the derived Ui.View instead of the derived Ui.ProgressBar, the simulator behaves like the 630. If you start trying to fix it, things get weirder. I'm tired and don't want to spend more time figuring out what is going on.
using Toybox.WatchUi as Ui;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
class Zebra_ProgressViewDelegate extends Ui.BehaviorDelegate
{
hidden var _parent;
hidden var _timer;
function initialize(parent) {
BehaviorDelegate.initialize();
_parent = parent;
_timer = new Timer.Timer();
_timer.start(self.method(:onComplete), 3000, false);
}
function onComplete() {
if (_timer != null) {
_timer.stop();
_timer = null;
}
Ui.popView(Ui.SLIDE_DOWN);
Ui.requestUpdate();
return _parent.onComplete();
}
function onBack() {
if (_timer != null) {
_timer.stop();
_timer = null;
}
// apparently we should not pop the progress bar in this case.
// doing so causes the last view to be popped, which implies
// that it is being automagically popped by the system. if we
// use a view, however, we need to pop.
//Ui.popView(Ui.SLIDE_DOWN);
//Ui.requestUpdate();
return _parent.onCancel();
}
}
class Zebra_ProgressView extends Ui.ProgressBar
{
function initialize() {
ProgressBar.initialize("Processing...", null);
}
}
class Zebra_ConfirmationViewDelegate extends Ui.ConfirmationDelegate
{
hidden var _parent;
function initialize(parent) {
ConfirmationDelegate.initialize();
_parent = parent;
}
function onResponse(response) {
// we should not need to pop the confirmation view
// (apparently the rule is to never do that).
if (response == Ui.CONFIRM_YES) {
var delegate = new Zebra_ProgressViewDelegate(_parent);
// if we use a progress bar here, we will see it on the vivoactive
// and the simulator, but it will not appear on the 630. if we use
// a view, we will not see it in the simulator.
var view = new Zebra_ProgressView();
//var view = new Zebra_View("Progressing...");
Ui.pushView(view, delegate, Ui.SLIDE_IMMEDIATE);
Ui.requestUpdate();
}
return true;
}
}
class Zebra_ConfirmationView extends Ui.Confirmation
{
function initialize() {
Confirmation.initialize("Confirm?");
}
}
class Zebra_Delegate extends Ui.InputDelegate
{
hidden var _view;
function initialize(view) {
InputDelegate.initialize();
_view = view;
}
function onKey(evt) {
var key = evt.getKey();
if (key == Ui.KEY_ENTER) {
var delegate = new Zebra_ConfirmationViewDelegate(self);
var view = new Zebra_ConfirmationView();
Ui.pushView(view, delegate, Ui.SLIDE_UP);
Ui.requestUpdate();
}
else {
return false;
}
return true;
}
function onComplete() {
_view.setText("Complete");
return true;
}
function onCancel() {
_view.setText("Cancelled");
return true;
}
}
class Zebra_View extends Ui.View {
hidden var _text;
function initialize(text) {
View.initialize();
_text = text;
}
function setText(text) {
_text = text;
Ui.requestUpdate();
}
function onUpdate(dc) {
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
dc.clear();
var cx = dc.getWidth() / 2;
var cy = dc.getHeight() / 2;
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
dc.drawText(cx, cy, Gfx.FONT_LARGE, _text, Gfx.TEXT_JUSTIFY_CENTER);
// for the progress bar color
dc.setColor(Gfx.COLOR_GREEN, Gfx.COLOR_WHITE);
}
}
using Toybox.Application as App;
class Zebra_WidgetApp extends App.AppBase {
function initialize() {
AppBase.initialize();
}
function getInitialView() {
var view = new Zebra_View("Press <Enter>");
var delegate = new Zebra_Delegate(view);
return [ view, delegate ];
}
}