In ODK Collect, we've recently made changes to the app to try and improve its usability, aesthetics and also the UI code itself. This has included introducing new ways to define "question widgets" (see WIDGETS.md).
We now need to revise each of the existing widgets - this means updating their layout, code and tests. Steps that should be completed for each widget (there are 30+) are:
- Re-write (and potentially expand) the tests for the widget following the style in
WIDGETS.md. As in the examples, the tests shouldn't end up extending from other test classes but we should definitely be using (and expanding on) the shared test helpers. If there are Espresso tests for the widget then these should be replaced by Robolectric tests. This is an opportunity to try and apply TDD/BDD style testing.
- The widget should add an implementation of
onCreateAnswerViewthat replaces any calls to
addAnswerView. As much as possible, the UI should be defined in XML rather than in Java.
- The actual design of the layout should be reviewed and improved if there are opportunities. Using this style guide and the Material Design docs can be helpful for this.
TextViewobjects should be made to use our standard typography styles (found in
typography.xml). If we don't have a custom style for something on the Material Typographic Scale then one should be added.
- Any components that can be converted to Material Components should be.
Of course if there are other things you feel like can be improved on or changed then we don't want to just stick to these steps! It'd also be good to look for opportunities where widgets/tests could be combined or inheritance could be replaced by composition/configuration. The goal here is to improve the widget code and improve their test coverage but in doing so it should be easier to both add and change widgets in the future.