Automation

The Configuration File

The great File of Configuration is truly a mighty hurdle to overcome when implementing this library. It contains many confusing and difficult concepts such as “tags” and “attributes”. However, when it comes down to it, it is really just a weird form of layout file that specifies the information to display instead of how to display it.

For no specific reason, each configuration file must have an <about> tag as its root element. Inside of that tag, any amount of children can be defined in any order. When the about screen is opened, these tags will be parsed and their corresponding objects will be created, much like inflating a layout file. The objects are then added to a list to be displayed in a RecyclerView. In order to simplify things, these tags, their corresponding objects, and the views created for them in the RecyclerView will be referred to as “wedges”.

Because wedge classes are instantiated from the configruation file, the wedge’s tag in the file must be the class name of the wedge that should be instantiated, including the package name. This is the same as adding a custom view to a layout file.

With this information, we can now create a simple configuration file using the App, Contributors, and Licenses wedges as follows.

This will create a screen that displays information about your app, followed by its contributors and finally the open source licenses that you have used. However, the only information that is currently displayed is what Attribouter knows how to find by itself; the AppWedge displays your app’s icon, name, and a link to rate your app on the Play Store, the ContributorsWedge displays the people that have contributed to Attribouter, and the LicensesWedge displays the licenses that Attribouter uses. In order to add information to these wedges, you can use one of the following options:

Option 2: Attributes and Children

If your project does not have a GitHub repository or you want some information to be available without an internet connection, you should define that information in the configuration file. Using the documentation pages for AppWedge and ContributorsWedge, the equivalent of Option 1 (without the GitHub link in the AppWedge) would be as follows:

Option 3: Both

“This should be fairly easy. All that you need to do is combine the two previous options, right?”

Actually, there is one extra step - if you do not define the login attribute on all of the ContributorWedges, you will end up with two sets of contributors - one from the configuration file and one from the GitHub API. Similar attributes are used to merge duplicate wedges like LinkWedges and LicenseWedges, so you should check out “Overriding Resources and Providing Translations” if the results of this option confuse you. When you are done, the end result should look something like this: