Glance Background/Gradient

On some devices, like the vivoactive 5 and Forerunner 965, the background of Glances is a gradient but when creating a CIQ app the drawable area is just a black square.

Even when just setting a default WatchUi.GlanceView() as the Glance View its still a black square so its not caused by something I'm drawing.

Do you need to manually draw the background based on device type in Glances? Because even so i don't see anything in the SDK that lets you draw gradients.

  • Alright, turns out calling super.onUpdate() from onUpdate is what causes it, even though you need to call that on every normal view and even the default GlanceView calls it, you need to explicitly NOT call it.

    Garmin please fix (bad documentation)

  • Alright, turns out calling super.onUpdate() from onUpdate is what causes it, even though you need to call that on every normal view and even the default GlanceView calls it, you need to explicitly NOT call it.

    To be fair you only need to call super.onUpdate() on regular views if you have a layout associated with the view (this part isn’t well documented either), as the super class’s onUpdate() method will actually render the layout contents.

    This would seemingly imply that you can’t use a layout with a glance view if you want to preserve the gradient, which could be considered a bug.

  • The solution I found is to simply not use a layout and draw the text and stuff manually in the onUpdate method.

     // Load your resources here
     function onLayout(dc as Dc) as Void {
     }

     // Called when this View is brought to the foreground. Restore
     // the state of this View and prepare it to be shown. This includes
     // loading resources into memory.
     function onShow() as Void {
     }

     // Update the view
     function onUpdate(dc as Dc) as Void {
     dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
     dc.drawText(0, 0, Graphics.FONT_MEDIUM, "Test", Graphics.TEXT_JUSTIFY_LEFT);
     }

    This way you can set a transparent color and it looks good when drawn.