How to define a number of properties at once on a flavor level

67 Views Asked by At

So I have a three-option menu, which can show (on a flavor level) either one of the options (no matter which), two of the options, three of them or none. What is the best way to set a property in which I can define the visible options for each flavor? I already put boolean flags for each option, but later on more options might be needed and I'll end up having a lot of flags. This made me think that there might be a better approach here. Something like

options.setOptionOne(true);
options.setOptionTwo(false);
options.setOptionThree(true);

But if I do it this way in any custom Class, how am I supposed to get options for each flavor?

Edit:

Thanks to @deHaar, who found out that there is a way to programmatically check which flavor is running and by this to set the proper properties at once.

if (BuildConfig.FLAVOR.equals("flavorOne")) {
    ...
}
else if (BuildConfig.FLAVOR.equals("flavorTwo")) {
    ...
}

This is the most clean solution as of now. If someone else knows a better, more clean approach I'd love to have a look at it!

0

There are 0 best solutions below