Hi, I'm venturing in developing my first CIQ App WatchFace and I ran into questions if I choose the right solution for different issues. I hope you can give some advice.
I try to create some Display featuring Glyphs resembling those of the Predator selfdestruct device countdown from the movie.
1. layout and partial update
I tried to adapt the Analog Sample for my purposes to employ the partial update and offscreen rendering. But I also incorporated resurce based layout to avoid explicit positioning in code which turned out to be quite tricky with partial updates where I just need to redraw a part of the layouted components. I implemented a strategy to switch layouts on the fly to satisfy my rendering needs that worked but would instantiate new drawables every time when setLayout is called. I guess that's not the best way regarding memory and performance?
I refrained form that approach and now use layout for regular update components only. Additionally I have a separate drawable-list for some static graphics that must be omitted in low power mode w/o partial updates. Second data is drawn by custom drawables part of the main layout which can hide on demand. Works fine so far, but the hidden drawables still get draw calls in the regular cycle.
I guess there is no way to hide (temporarily remove) symbols (bitmaps, drawable-lists) from the drawing queue of the layout? Or is there a way to cache a separate layout not bound to the View? That may do the trick to render seconds separately while still using the layout technique.
2. Custom Drawable handling
The Custom Drawable class is actually some kind of segment-display featuring 12 segments which can be triggered individually to draw the required Glyphs. I choose this approach over custom font because I want to render random configurations for hour and minute digit values displaying the corresponting amount of segments istead of a fixed glyph and I want to scale freely.
One thing I'm pretty uncertain about is the way I use to draw the segments. I choose to supply the polygon cooordinates (16 Points) of each segment as jsonData and load them during draw if needed depending on the current configuration. These have to be translated to the position of the Drawable each time. I can't tell if that's a good idea regarding power budget for partial updates. I tried to compute all possible coordinates at instantiation time but that led to an out of memory exeption because each Drawable had to hold an array of 12*16*2 32bit vals.
I got several optimization ideas but don't know which are recommended.
- Reduce polygon coordinates. 6 or 8 per segment should suffice. Less would possibly effort a lot of fine tuning, maybe depending on display size.
- The segments have actually identic shapes only translated to different locations and angles. So it would be possible to calculate them from one initial set. Despite my lack of expertise in such cartesian transformations I doubt an advantage beyond little less memory required by the resources.
- Use only one glyph display instance to render all values. Requires dynamic positioning without layout and major code refactoring.
- Pre-render segments as bitmaps and draw them on demand. Doesn't seem to be any better than loading the coordinates each time.
- Move coordinates array(s) from json resource to constant or instance variable in code. Bloats the code and will persumably block more memory permanently.
3. Json Resources
Besides those coordinate arrays I set up 60 fixed configurations as jasonData arrays for 4 of those display instance to render uniform second represantations. Each 2 dimensiononal array stores up to 4*12 Number values representing the active segment indices. Actually none of the configurations reaches this worst case. But looking at the recommendation not to load resources during partial updates I like to know if I should rather move that stuff to the code (i.e. as static const).
Instead of storing indices in the array a single Long bitmask per second configuration would also suffice. Thoug it would obfuscate what is to be rendered.
4. Device
I actually own a FR 735xt. I noticed it doesn't seem to support partial updates despite beeing SDK 2.4.x compatible. Is there any way to activate that feature or is the display hardware incapable? The documentation seem to be very vague about which devices actually feature this mode.