How to Create Reddit like Android Kotlin app Step by Step

0
622
How to make Reddit like Android Kotlin app
How to make Reddit like Android Kotlin app

Recently Google introduce Kotlin as a official language for Android and I really love Kotlin! and for me is the future of Java (today) but this is just my opinion 🙂

Welcome to this series of articles where we are going to learn Kotlin, a new JVM language, while developing an Android App. I hope it will help you to learn this incredible language in the context of Android. This stories will be separated in different Parts. In the Content section you will have the different Parts and the main topics that are going to be discussing there, each Part will include different Kotlin features.

My intention is not to create the best App in the world (I can’t do that hahah) but I’ll try to explain Kotlin and it’s main features while developing this app.

The App: Keddit

The App that we are going to develop is a small Reddit Client. It’ll present the latest news from Reddit with an infinite scroll to continuously load more news while you scroll down, showing the title, image, number of comments, time published and the author of the news.

Libraries that we are going to use:

  • Retrofit 2.0: To consume public Reddit API.
  • RxJava: We will use Observables to decouple the UI thread with our background tasks. In this case to call the API and return this values to the UI.
  • Picasso: Load images from Reddit.
  • RecyclerView: We will use the RecyclerView to present the information and also to provide the infinite scroll behaviour.
  • Kotlin Android Extensions: to bind the UI (Views) with code.
  • Dagger 2: Dependency Injection

Here is step by step tutorial to make Reddit like Android app using Kotlin named as Keddit.

Content

In this article we discuss about Kotlin and why it is better than Java for Android development.

In this Part we are going to configure an Android Studio project to use Kotlin and leave everything prepared for the next story to start developing the Keddit App from the beginning and learning some Kotlin concepts.

In this Part we are going to focus on understanding some basic syntax of the language and also adding all the code that we need for the MainActivity.kt in order to open our fragment.

In this Part we are going to see different Kotlin concepts that will help us to create our NewsFragment fragment.

In this 4th Part we are going to cover these topics about Kotlin:

  1. Init Constructor
  2. Object Expressions
  3. Single Expressions
  4. Data Classes
  5. Ranges
  6. List & Lambdas (introduction)

In this article we are discussing about RxJava in Kotlin.

Now it’s time to make a real API call and demonstrate that our abstraction with RxJava really works! and of course to show some real news in the App 🙂

We need now is to allow the user to see not only the first 10 news but the next news that also belongs to this Top Reddit news.

In this story we are going to review how to properly manage the orientation change in the device, in fact, we are going to see how to handle runtime changes so we don’t lose the already requested news and continue at the same point.

Let’s talk about Unit Test in Keddit App.

In this article we discuss about dependency injection in Kotlin.

It would be great if a new build is run every time we push new code to the repository, the unit tests are run automatically for us and also to receive an alert if the build has failed. Let’s do it with our Keddit App.

Apart from this you can run your demo kotlin program in online compiler. Hope you like my articles. So please comment us and if any issues and problem occurs then commit me.

Share your thoughts

Loading Facebook Comments ...
Loading Disqus Comments ...