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.