[CIQBUG] menu and progress bar don't render correctly after createSession

The following testcase illustrates a problem with the built-in menu (progress bar and other classes may be affected) when run on a 920XT w/ 3.20 firmware. I expect the separators between menu items and progress bars to be rendered in blue. Before creating a session, everything is normal. After, things that would be blue are rendered in black.

using Toybox.Application as App;
using Toybox.ActivityRecording as Arc;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
using Toybox.WatchUi as Ui;

class TestMenuDelegate extends Ui.MenuInputDelegate
{
function onMenuItem(item) {
return true;
}
}

class TestDelegate extends Ui.InputDelegate
{
hidden var view;
hidden var activity;
hidden var state;

function initialize(view) {
self.view = view;
activity = null;
state = 1;
}

function onKey(evt) {
var key = evt.getKey();
if (key == Ui.KEY_ENTER) {
Sys.println("state="+state);

if (state & 1) {

// could push a self-removing progress bar here instead...

var menu = new Ui.Menu();
menu.setTitle("Menu");
menu.addItem("Test 1", :test1);
menu.addItem("Test 2", :test2);
menu.addItem("Test 3", :test3);

Ui.pushView(menu, new TestMenuDelegate(), Ui.SLIDE_IMMEDIATE);

view.setText("Press Enter");
}
else if (state == 2) {
activity = Arc.createSession({
:sport => Arc.SPORT_GENERIC,
:subSport => Arc.SUB_SPORT_GENERIC,
:name => "testing"
});

view.setText("Created\nPress Enter");
}
else if (state == 4) {
activity.start();

view.setText("Recording\nPress Enter");
}
else if (state == 6) {
activity.stop();

view.setText("Paused\nPress Enter");
}
else if (state == 8) {
activity.discard();
view.setText("Discarded\nPress Enter");
}
else if (state == 10) {
activity = null;
view.setText("Deallocated\nPress Enter");
}
else {
Ui.popView(Ui.SLIDE_IMMEDIATE);
}

++state;
}

return true;
}
}

class TestView extends Ui.View
{
var text;

function initialize() {
text = "Press Enter\nTo Start";
}

function setText(text) {
self.text = text;
Ui.requestUpdate();
}

function onUpdate(dc) {
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_WHITE);
dc.clear();

var cx = dc.getWidth() / 2;
var cy = dc.getHeight() / 2;

dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_TRANSPARENT);
dc.drawText(cx, cy, Gfx.FONT_LARGE,
text,
Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER);
}
}

class TestApp extends App.AppBase
{
function getInitialView() {
var view = new TestView();
var delegate = new TestDelegate(view);
return [ view, delegate ];
}
}
  • Additionally, I think it is really weird that the progress bar and menu separators render in a color that is based on the last call to setColor(). This could lead to difficult to find problems.

    Travis
  • Former Member
    Former Member over 10 years ago
    I just filed a ticket for this issue last week. On the 920 I think the native views should all render with the blue color that is in the menu when you are selecting apps. We would want to add something to the API if we allow the color to be controlled.
  • Just to be clear, you filed a bug on the progress bar and menu colors being controlled by the most recent call to setColor() or you filed a bug about createSession causing the progress bar and menu to draw as black/gray (because it isn't restoring colors)?
  • Former Member
    Former Member over 10 years ago
    The report is about the accent color changing to black. I don't think it should be controllable by setColor() either, so that may be adjusted as a part of fixing the issue.