Convert project structure to Gradle.

This also splits the actual `ViewServer` class into its own module independent
of the sample application.