Collect: an approach to whitelabelling

Here's a git repo demonstrating an approach to whitelabelling Collect which could be used to reduce the need to fork the project:

This allows overriding images, strings and the applicationId of ODK Collect. Collect itself is included in the project as a git submodule, which allows for easy referencing and updating of a specific branch or tag of the main repository.

To allow for this, a significant change would be required to the main Collect repo - converting the core code from being an Android app to an Android library, and adding an Android app which incorporates the library to create the main Collect build.

Converting to an Android library does not affect much of the codebase, but because Android libraries do not have resource IDs hardcoded, it does require:

  • changing butterknife annotations from referencing R.* to R2.*
  • removing switch statements based on resource IDs from R.*

This is demonstrated at https://github.com/opendatakit/collect/compare/master...alxndrsn:multi-brand

I'd be interested in hearing others' thoughts on this approach, and if anyone knows of an alternative, or a way to extend a gradle project without the requirement for changing Collect itself to an Android library.

1 Like