Nov 2016
7 Mon
8 Tue
9 Wed
10 Thu 08:45 AM – 06:00 PM IST
11 Fri 08:45 AM – 06:00 PM IST
12 Sat
13 Sun
Nov 2016
7 Mon
8 Tue
9 Wed
10 Thu 08:45 AM – 06:00 PM IST
11 Fri 08:45 AM – 06:00 PM IST
12 Sat
13 Sun
Manas Chaudhari
It is important to write reusable code to increase development speed and for easier maintenance. Although it is quite easy to share model logic across various components of the app, sharing presentation logic isn’t trivial. Some questions that need to be answered:
It is very common to present one model in multiple ways.
For example, one layout shows a mini view, while other shows a detailed view. If both views show same information, we should be able to build the second view without writing any extra code
Consider three pages which use different combinations of “basic details”, “reviews”, “customization” functionalities.
I will demonstrate how MVVM architecture allows you to tackle these scenarios. Binding is essential for connecting ViewModels to Views. However, binding values from RxJava’s Observables to Views is difficult to get right and often leads to boilerplate code. We will explore how this problem can be solved using Google’s Data Binding library.
Binding values from RxJava’s Observables to Views requires subscriptions. Cleaning up RxJava subscriptions is necessary to prevent leaks. By writing ViewModels in a functional style, we’ll move all subscriptions to the Data Binding layer and thus, remove the need to cleanup subscriptions.
By extending ObservableField, we’ll be able to bind RxJava’s Observables using the minimal Data Binding syntax android:text="@{vm.title}"
, where title
is built from Observable. By making use of Data Binding’s BindingAdapter
API, we’ll eliminate boilerplate required to setup complex views such as RecyclerView.
<android.support.v7.widget.RecyclerView
bind:items="@{vm.itemVms}"
bind:layout_vertical="@{true}"
bind:view_provider="@{@layout/row_item}" />
<include>
tagFamiliarity with RxJava and Data Binding
Graduating from IIT Bombay in 2014, Manas Chaudhari joined TinyOwl and built the consumer Android and iOS apps. He had been driving the consumer product at TinyOwl, leading a team of Android, iOS and backend (ROR) devs. Currently, he builds end-to-end solutions as a freelance software architect/developer. His core focus has always been to make development faster and bug-free.
As a Microsoft Student Partner, he developed Windows Phone apps and conducted workshops in nearby colleges.
https://speakerdeck.com/manaschaudhari/functional-mvvm-using-rxjava-and-data-binding
Nov 2016
7 Mon
8 Tue
9 Wed
10 Thu 08:45 AM – 06:00 PM IST
11 Fri 08:45 AM – 06:00 PM IST
12 Sat
13 Sun
Hosted by
{{ gettext('Login to leave a comment') }}
{{ gettext('Post a comment…') }}{{ errorMsg }}
{{ gettext('No comments posted yet') }}