Keddit — Intro: Learn Kotlin while developing an Android App
- Introduction: A few words about this
- Part 1: Configuring Android Studio with Kotlin
- Part 2: MainActivity.kt: Syntax, Null Safety and more…
- Part 3: NewsFragment.kt: Extension Functions, Android Extensions…
- Part 4: RecyclerView — Delegate Adapters & Data Classes with Kotlin
- Part 5: Kotlin, RxJava & RxAndroid
- Part 6: API — Retrofit & Kotlin
- Part 7: Infinite Scroll: Higher-Order functions & Lambdas
- Part 8: Orientation Change (Parcelable & Data Classes)
- Part 9: Unit Test with Kotlin (Mockito, RxJava & Spek)
- Part 10: Kotlin & Dagger 2 (Dependency Injection)
- Part 11: Continuous Integration with Kotlin (BuddyBuild)
- Final Part: Conclusion and thanks!
Welcome to this series of Stories 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.
We will be learning Kotlin covering topics like Properties and Fields, Data Classes, Null Safety, Extensions Functions, Lambda expressions, Delegation, Higher-Order Functions among other excellent topics and also covering some scenarios that an Android Dev has to deal frequently like Orientation Change (Parcelables), requesting data from service to be shown in the UI, binding and manipulating Views and more. Also, I will assume that you already know Java and have some experience developing Android Apps.
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 you have all the code that we are going to be creating/reviewing in this series of Stories.
In the next story we will be configuring Android Studio to be ready for Kotlin but for now, if you are curious, you can start reviewing the code in the repository.
If you have any questions, please feel free to contact me in these social networks. I’ll try to do my best to answer if I can, otherwise we will learn together :) .