Use Kotlin Anko DSL and Say No to Android Layouts Written in XML

We would like to introduce an application that serves as our lunch menu.

Every day at 13:37 we eat lunch together at our cool office, catered by the lovely couple Hanna and Tadeo. The only problem we have with lunch right now is ordering. The menus for the upcoming week are provided in a Google Sheet which we have to fill out before each Friday. It’s inconvenient and requires a lot of time on everyone’s part. We already have an iOS app that gives us access to the lunch menus, so we decided to write a similar one for our Android users.

ss1 (1)ss2

Our Minimal Viable Product (MVP) is dead simple. It contains five tabs with lunch menus for each given day, a list with the number of meals ordered by the logged in user, and the total number of orders for every given meal. We’re using the Google Sheet API as our backend.

We decided to choose Kotlin as our programming language. There is some good stuff out there about learning Kotlin, so we decided to share with you a less documented but still very interesting topic — creating Android layouts in code with the help of the Kotlin Anko library. Our post assumes that you have at least a basic working knowledge of developing Android applications and have at least skimmed through the Kotlin documentation. Reading through this this piece will give you a basic knowledge of creating Android Layouts directly in code using Kotlin Anko.

Continue Reading

Using SonarQube with Jenkins Continuous Integration and GitHub to Improve Code Review

title

Every app that we develop at Macoscope is built on CI, while Code Review is an inherent part of our creative process. This allows every member of the team to quickly figure out how some new portion of code was implemented and point out what’s wrong with the code and how it can be improved. Another thing that helps produce high quality code is static code analysis. It looks for patterns in code (using a pre-defined set of rules) that can cause bugs and result in security vulnerabilities.

For developers, static code analysis is most helpful when it is an essential part of the code review process. Under such an approach, every pull request is automatically analyzed and potentially incorrect parts of the code are commented. In this short blogpost, we describe how you can implement that approach by integrating SonarQube with Jenkins CI and GitHub for an Android project.

Continue Reading

Model-View-Presenter Architecture in Android Applications

MVP_model_blogpost_illustration@2x

Recently, clean architecture has been a hot subject in the Android development world. As developers, our responsibility is not only limited to delivering apps with a bunch of features, we also need easily maintainable code with clear separation between presentation and business logic.

In this post, we’d like to illustrate the usage of the Model-View-Presenter architectural pattern as a method for developing Android apps with a clean architecture approach.

Continue Reading

Cross-Platform Libraries

Programmers are lazy. They really are, but in a good way. According to Larry Wall (you know, the Perl guy), laziness is one of the virtues of great programmers. Programmers do not like to repeat themselves, implement the same stuff over and over again, or waste time solving the same problems. But above all, they hate fixing the same bugs.

In theory, all that can be avoided by creating reusable code, and programmers do that a lot.

Continue Reading