Log.v(“ThreeTips”, “#1”)
1- Long Polling Operation with RxJava
If you have to create long polling operation to your api from mobile client and you use RxJava here is your tip how to create it. Let say your api has loadHotels method and takes SearchRequest model as parameter. And you want to check returned boolean value which is isCompleted. Also you let say you want to do this api call every 3 seconds till isCompleted value turns true.
api.loadHotels(searchRequest)
.repeatWhen(obs -> observable.delay(3, TimeUnit.SECONDS))
.takeUntil(searchResponse -> searchResponse.isCompleted)
.subscribe(listener::hotelListLoaded);
2- Password Toggle
To active this, I didn’t add any drawable or didn’t check if user click eye icon and change input type of Edittext field. Or I didn’t add Lisa’s library. It comes with new Support Library revision 24.2.0.
TextInputLayout adds support for the password visibility toggle from the material design specification. -From Doc
You can also change toggle drawable. Check other attributes from here.
3- DiffUtil for RecyclerView
DiffUtil is a brand new class which comes with Support Library 24.2.0. It basically calculate the difference between two lists and output a list of update operations that converts the first list into the second one. Cmon guys we are android developers. Of course we are going to use it for RecyclerView Adapter. Here is my blogpost about implementation.