I have gone through the samples for creating a custom Android 2.0 watchface with support for complications. the document for ComplicationDrawable states that we can provide custom progressbars and use setRangedValueProgressHidden() to suppress the default UI.
Optional fields are not guaranteed to be displayed. If you want to draw your own progress bar, you can use the setRangedValueProgressHidden() method to hide the progress bar provided by the ComplicationDrawable class.
But I have been unable to find guides on how to draw the custom UI after setting the default progress bar to hidden. Any pointers will be highly appreciated.
There is no guide because there isn't a single/preferred way to do this. Here are a few steps to help you get started:
1) Create a
Canvas
and aBitmap
that are large enough to contain your custom progress bar:2) Make sure that the complication has data to show, and that it is a ranged value complication. (You can access the complication data from the
onComplicationDataUpdate(int complicationId, ComplicationData complicationData)
method.):3) Get the progress values from your ComplicationData object (all these fields are required):
4) Draw the progress in whatever way you want on your
Canvas
. Below is a simplified example from one of our watch faces.And here is the end result: