Callbacks in Java are probably the most basic way to perform executions/send actions between classes. If you have chosen to use coroutines in a project, you want to keep the same style everywhere. But what if some of the libraries you use, are still using callbacks? No worries, Kotlin coroutines are easily integrated with callbacks. It’s just a small workaround to make. Let’s think of a very simple use case:
typealias Coroutine = Quarantine I hope you get the joke…. Well, it has been a very rough year for me, “motion-ally” and emotionally. I moved to Germany just when all these corona fear started. Luckily I got time to get introduced to the team and the project and got ready to start fresh . And then, since the situation with the epidemic wasn’t getting any better, the company decided to switch to home office.
Details matter especially when it comes to making users happy. We have all kinds of users, those who don’t care how the app is designed (just do what he/she needs), those who care, and those who are developers themselves. I have met people who don’t use a single app just because it has some strange animation, and they hate it. For me, it’s a little from both. I Like seeing a minimalist design (like Airbnb Android app, which is one of my favorites, for instance), but it is also important to fulfill your needs also.
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).
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.
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().