Is the configuration I'm describing possible with the SDK and VSCode?

Hello,

I am developing multiple apps with the SDK, mainly for personal use but one of them is also public with 100+ downloads.

My app supports 6 product variants (fenix7x,venusq2,fenix7xpro, fenix7xpronowifi,venu2,venu3,venusq2) and is currently available in 2 language versions (German and English).

I have the following resource folders:

resources/
resources-fenix7x/
resources-fenix7xpro/
resources-fenix7xpronowifi/
resources-deu/
resources-fenix7x-deu/
resources-fenix7xpro-deu/
resources-fenix7xpronowifi-deu/

Inside each of these, there is the full structure with:

drawables (icons, drawables.xml)
layout (layout.xml)
settings (settings.xml, properties.xml)
strings (strings.xml)


For translations of the strings in the Glance and the main View, I have a custom solution so that I don't have to maintain all the strings.xml files in each resource folder for each variant and language (there is only the app name in there now), so those are not an issue.


But I would really like to simplify updating the settings (properties.xml → can be the same for every model and language, settings.xml → all German variants should have the same and all English variants should have the same) and the layout (both languages should have the same layout.xml per device ID, as the layout is updated with the correct language at runtime anyway).

Is there a way to achieve a configuration where:

  • settings.xml is shared between all resource folders with the same language (those with "-deu" and those without each have different settings names)
  • properties.xml is shared between all resource folders
  • layout.xml is shared between both resource folders with the same device ID, regardless of language


I am developing with VSCode under Linux Mint, if that matters.


Thanks in advance
Aaron


  • You can simplify it!

    First, you don't have to have all the resources in one file. Not even if the same type. For example I usually have multiple files for strings (but this works with all the other types as well). As an example I can have: strings-app.xml, strings-settings.xml.

    Second, things that don't vary should not be in some multi dimensional resource directory. For example if the translation is the same, no matter what is the screen size, then keep them only in resources, resources-<lng> directories.

    Third, similar to the second, resources that are only different because of different screen size (probably icons or any image without text on it) can go to resources-round-<width>x<height> . An additional advantage of this approach is that you'll be able to export your app for all the other devices with the same display size *.

    *) sometimes things become a bit more complex and you'll need to pick only some of the devices, because of other parameters. For example available memory size, number of colors, display technology, touch screen, and more.

    Anyway, if you notice that you had to add the same thing to more than one place, then it's probably a sign that you could optimize it even more. Later you might want to learn how to do custom directories based on your criteria, using monkey.jungle file.

  • Thank you so much for your reply!
    I didn't quite understand the resource folder system until now, but I did it like you said and the device-specific folders only contain files specific to the device now...
    I also deleted the "resources-{device}-deu" folders as the only thing that needs to be different for German is the settings.xml file for the settings UI, and that can be the same for all devices as it's displayed on the phone anyway...

  • What things are different per device?

  • The layout is very different on a Fenix 7x than on a Venu 3s...

  • Ah, so it's input related, like touch and button positions? Then probably that is in the right place per device. However if you plan to add support for other devices, then try to think how that can be possible without the need to create a layout for every device. Or maybe if and when you decide to do it, then after you add a few devices, you'll see some pattern. Or maybe you can just pick one of the existing devices that has the most similar layout and copy it and if needed then modify it. This shouldn't really be a problem if you only plan to add future devices, only a few at a time.

  • The issue is that the screen site is different, I'm not using any input at the moment, just displaying some data...

    For a Venu 3s, I can't fit as much data onto the screen (or I have ro format it differently) as on a Venu 3....

  • Then read carefully my 1st comment. If the only difference is screen size and shape then you don't need a folder for each device. Once you rearrange them to use folders like resources-round-390x390 then all of a sudden you'll be able to add all the devices (with similar display size than those you already support)  with only one click in the manifest editor.

  • I now have looked up each device's dimensions and restructured my folders accordingly.

    I have the following folders now:

    resources
    resources-390x390
    resources-deu
    resources-rectangle-320x360
    resources-round-260x260
    resources-round-280x280
    resources-round-416x416
    resources-round-454x454
    resources-venusq2
    resources-venusq2m

    Each folder except for the resources and resources-deu only contains a layout file.

    But my simulator Venu SQ2 doesn't apply the layout that it should have (Venu SQ2 has 320x360 according to the Garmin Device Reference but it still shows the layout in the resources folder...

    Am I missing something? My monkey.jungle file looks like this (didn't edit it yet):

    project.manifest = manifest.xml

    My manifest looks like this:

    <?xml version="1.0"?>
    <!-- This is a generated file. It is highly recommended that you DO NOT edit this file. -->
    <iq:manifest version="3" xmlns:iq="http://www.garmin.com/xml/connectiq">
        <!--
            Use "Monkey C: Edit Application" from the Visual Studio Code command palette
            to update the application attributes.
        -->
        <iq:application id="xxxxxxxxxxxxxxxxxxxxxxxx" type="widget" name="@Strings.AppName" entry="garmin_ecowittApp" launcherIcon="@Drawables.LauncherIcon" minApiLevel="4.2.0">
            <!--
                Use the following from the Visual Studio Code comand palette to edit
                the build targets:
                "Monkey C: Set Products by Product Category" - Lets you add all products
                                           that belong to the same product category
                "Monkey C: Edit Products" - Lets you add or remove any product
            -->
            <iq:products/>
            <!--
                Use "Monkey C: Edit Permissions" from the Visual Studio Code command
                palette to update permissions.
            -->
            <iq:permissions>
                <iq:uses-permission id="Communications"/>
            </iq:permissions>
            <!--
                Use "Monkey C: Edit Languages" from the Visual Studio Code command
                palette to edit your compatible language list.
            -->
            <iq:languages>
                <iq:language>deu</iq:language>
                <iq:language>eng</iq:language>
            </iq:languages>
            <!--
                Use "Monkey C: Configure Monkey Barrel" from the Visual Studio Code
                command palette to edit the included barrels.
            -->
            <iq:barrels/>
        </iq:application>
    </iq:manifest>

  • Strange, this should work. resources-390x390 is not used, you can delete it or rename and add round to it. You also don't need a layout in the resources folder IMHO, what would be the default?