I started using Retrofit and RxJava recently. and I love it. I am working on an Android project. and I am following MVP Repository pattern as specified in Android Architecture Components,. I'm still learning though.
fruitsRepository
is a Repository that can get data from local or remote source..getFeaturedFruits()
calls retrofit internally if remote source is selectedcompositeDisposable
isCompositeDisposable
UniversalResponse
is a class havinghttpStatusCode
,isSuccess
andList<T>
view
is an implementation of UI fromFeaturedFruitsContract.View
I am looking for some improvements to this. Can I reduce this somehow? If I have to make 5 different API calls, my presenter gets really bigger and repetitive.
So, how can I improve this code? I was thinking about making an adapter for Observer I am using to subscribe.
p.s.
fruitsRepository
is a Repository that can get data from local or remote source..getFeaturedFruits()
calls retrofit internally if remote source is selectedcompositeDisposable
is CompositeDisposableUniversalResponse
is a class having httpStatusCode, isSuccess and Listview
is an implementation of UI fromFeaturedFruitsContract.View
If more information is required, please comment.