Look Counter app is now in Kotlin and stores data in Room DB

In 2016 (which seems like a whole eternity from now :), I wrote an Android app called Look Counter for counting how many times you have switched the screen on, as well as unlocked it. Up until recently I haven’t updated it. The app used such libs as greenDAO , ButterKnife , GoogleAnalytics, and RecyclerView. After the update, only the last one remained 🙂

I’ve decided to completely re-write Look Counter, using the modern tools. The first step was to update all of the dependencies and set project’s target API to 27. It’s a good idea to set yours to 26 as a min, because of Google Play’s new requirements — “Google Play will require that new apps target at least Android 8.0 (API level 26) from August 1, 2018, and that app updates target Android 8.0 from November 1, 2018.”

As the second step I chose to refactor layouts and use ConstraintLayout in order to flatten the hierarchy. It allowed me to make both Calendar and About screens completely flat, which I think is awesome 🙂

Next I wanted to convert Java to Kotlin. I used Android Studio’s Convert Java file to Kotlin file option, and then cleaned up the code. I got rid of !! and used vals instead of vars whenever possible. Also, objects instead of classes, extension methods, etc. In general, simply converting Java to Kotlin is easy, but to make Kotlin code look good and not like some Java-adaption, requires an extra effort.

Continue reading Look Counter app is now in Kotlin and stores data in Room DB

Like and share:

Best resources to learn RxJava

Hi,

Some time ago I got interested in reactive programming and RxJava in particular. It’s gaining more popular in Android world and I often see RxJava as an obligatory skill for a Senior or Mid Android Developer position, that’s why learning it can be of a great benefit if you’re seeking a job 😉 But even if not, it can simplify your app development, especially if you have lots of UI fields which you fill in with some changing data or if you want to have an interactive search, or while using Retrofit for you HTTP requests. There are even smaller libs for a particular task, like RxWear, RxNotifications or RxAndroidBle (find a full list of such libs here). Choosing the right one will depend on your needs 😉

And so today I just want to share a few resources which I found very useful while learning how RxJava and RxAndroid libraries work (and what are they at all :). I have basically reviewed what’s available on ReactiveX Tutorials list (which is huge!) and listed the most intuitive and easy to get below, as well as a few articles and tutorials I found on the Internet myself.

A separate and an absolutely must position is a RxJava for Android App Development free e-book. It’s very short (only 41 pages!), and it’s a piece of cake to read, believe me, because I read it before any other docs or tutorials, and it explained the most important principles just fine 🙂

Continue reading Best resources to learn RxJava

Like and share: