Skip to content

wff-validator: Variant as a child element of TimeText #100

@pacjo

Description

@pacjo

Hi,
I'm trying to change TimeText color in ambient mode, but I'm running into some issues with validator.

With the following xml everything passes:

<?xml version="1.0"?>
<WatchFace width="450" height="450">
    <Metadata key="CLOCK_TYPE" value="DIGITAL" />

    <Scene>
        <Group x="0" y="0" width="450" height="450" name="background">
            <Variant mode="AMBIENT" target="alpha" value="0" />
            <PartAnimatedImage x="0" y="0" width="450" height="450">
                <AnimationController play="ON_VISIBLE" repeat="TRUE" resumePlayBack="TRUE" />
                <AnimatedImage resource="jimball" format="AGIF" />
            </PartAnimatedImage>
        </Group>

        <DigitalClock x="150" y="125" width="150" height="200">
            <!-- two TimeText elements, since a format like `hh\nmm` isn't supported` -->
            <TimeText x="0" y="0" width="150" height="100" format="hh" align="CENTER">
                <Font family="balatro" size="100" color="#FF9800" />
            </TimeText>
            <TimeText x="0" y="100" width="150" height="100" format="mm" align="CENTER" tintColor="#FF9800">
                <Font family="balatro" size="100" />
            </TimeText>
        </DigitalClock>
    </Scene>
</WatchFace>

adding Variant as a child of any TimeText in the following way gives an error:

<TimeText x="0" y="100" width="150" height="100" format="mm" align="CENTER" tintColor="#FF9800">
    <Font family="balatro" size="100" />
    <Variant mode="AMBIENT" target="tintColor" value="#FF000000" />
</TimeText>
INFO: WFF Validation Application Version unspecified. Maximum Supported Format Version #4
SEVERE: [Line 22:Column 80]: cvc-complex-type.2.4.d: Invalid content was found starting with element 'Variant'. No child element is expected at this point.
INFO: ❌  FAILED : /home/kamil/AndroidStudioProjects/WearWatchfaces/wff/jimball/src/main/res/raw/watchface.xml is NOT valid against watch face format version #1

It's worth mentioning that this specific watchface fails to change the color, but a Variant like:

 <Variant mode="AMBIENT" target="alpha" value="0" />

placed in the same TimeText works just fine.

TimeText's Docs specify following allowed inner elements:

Variant
Allows for changing attributes of this element when the Wear OS device is in ambient mode. More information is available in the Variant reference.
BitmapFont
A BitmapFont to use for rendering the time.
Font
A Font to use for rendering the time.

So either I'm misunderstanding something or validator or docs are incorrect. It's quite possible I missed some details so if there's a reason for this behavior I'd be happy to learn it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions