Personality UI without layouts?

Has anyone tried (or know how) to utilize the Personality UI functionality without layouts? My widget supports dark or light backgrounds but I do not want to replicate all the layouts twice (once for each background, since each button hint has a light or dark option). Instead, what I would like to do is access the Personality UI elements directly and then render them directly after calling View.onUpdate(dc).

The only workaround I've found so far it to include both the light and dark hints in the layout and then remove the one that is not applicable from the Array<Drawable> before calling setLayout(). The problem with this however is not all of the layouts need the icons all of the time. And in some cases, the hint icon is displayed based on certain conditions that may arise while viewing the widget and I would rather add the hint after the fact during the onUpdate() method rather than calling setLayout() again or switching to the same view with different parameters.

  • This is solution I came up with, but I only implemented one of the hints ("hint_bottom_right").

    function getPersonalityUI(personalityUiType as Symbol, bgColor as Number) as Array? {
        switch (personalityUiType) {
            case :hint_bottom_right:
                var backButtonHint = null;
                if (bgColor != Graphics.COLOR_BLACK) {
                    backButtonHint = (WatchUi.loadResource(Rez.Drawables.PersonalityHintBottomRightLight) as BitmapResource);
                } else {
                    backButtonHint = (WatchUi.loadResource(Rez.Drawables.PersonalityHintBottomRightDark) as BitmapResource);
                }
                return ([Rez.Styles.system_loc__hint_button_right_bottom.x, Rez.Styles.system_loc__hint_button_right_bottom.y, backButtonHint] as Array<Number or BitmapResource>);
            }
            return (null);
        }

    }

    That function returns the x, y position (from the stylesheet) and the bitmap resource and then I call dc.drawBitmap() with that info.

  • I kind of made this work on devices that have personality, but I can't find any way (either to generate jungle or runtime) to check whether a device has personality, and thus Rez.Styles. Rez has :Styles doesn't work on devices that don't have it