https://coroutinedispatcher.github.io/coroutinedispatcher/images/stavro.jpeg

The Android guy

Generate Kotlin Docs using Dokka

Have you ever generated Kotlin docs (Kdocs) for your library/project? I have. There is a tool for this called Dokka and you can find it here. It’s not too hard to set up. I personally used Dokka for a small API i wrote for SharedPreferences. Anyways, the steps are pretty basic. One thing you must be careful though, is to know the syntax of the Kdocs pretty well (usually, if you know how to generate Javadoc, Kotlin docs don’t have much difference).

What I learned from Kotlin Flow API

I used to check the docs and just read a lot about flows but didn’t implement anything until yesterday. However, the API tasted really cool (even though some operations are still in Experimental state). Prerequisites: If you don’t know RxJava it’s fine. But a RxJava recognizer would read this faster. Cold vs Hot streams Well, I really struggled with this concept because it is a little bit tricky. The main difference between cold and hot happened to be pretty simple: Hot streams produce when you don’t care while in cold streams, if you don’t collect() (or RxJava-s equivalent subscribe()) the stream won’t be activated at all.

Searchable Fragments with the Paging Library

This post is inspired by @EpicPandaForce¬†answer in StackOverflow. I faced the same problem which I didn’t know how to solve: How to perform search when you are using a Paging Library (or how the hell to refresh after I reperform Rooms query)? Let’s suppose we have this scenario: I have a list of data, which are shown in the Fragment by LiveData observation, which are retrieved by the ViewModel through LiveDataPagedListBuilder().

Prepopulate Room with data.

There are times, when we just need the data when the app starts, and all the functionality is just a matter of work. Or we just need the app to be independent from the network and we have the data. A simple dog-race database or cat-race database doesn’t actually need online interaction at all (if there are not too many data of course). So, Room comes with a nice solution about this.

Fragments ‚̧ ViewPager2

The ViewPager2 is a pretty nice rework of the ViewPager API. Some new features you may find with the ViewPager2 are: 1- Vertical scrolling. You can simply enable it by adding: android:orientation=“vertical” in the tag in your xml file. 2- Right to left support: you can set the android:layoutDirection=“rtl” to enable this. 3- Support for DiffUtil, because it is based on RecyclerView. 4 - Fragments improved support, which we will talk about below.

Setting up Gradle with Kotlin DSL, a simple guide

Kotlin is a very a pretty nice adoptive language and user friendly. It really replaced Java from my everyday programming. However, it was not enough. We all know that groovy runs on JVM. So, why do I even need a new language just for my builds? Can’t it be Java? So Java is the basic language for the JVM, Kotlin runs on JVM, Groovy runs on JVM and my build system has a separated language from my business logic system.