pwittchen / InfiniteScroll

Infinite Scroll (Endless Scrolling) for RecyclerView in Android
Apache License 2.0
190 stars 26 forks source link

Best approach for using this library when using Retrofit and network is slow. #9

Open amitsri20 opened 7 years ago

amitsri20 commented 7 years ago

Can you suggest what will be the best approach for using this library when data is being fetched using Retrofit and network may be slow? Thank you

pwittchen commented 7 years ago

Hi,

Thank you for creating this issue! This library is designed to be universal and it should be able to load any kind of data from any source. Right now, I don't have any samples with Retrofit. When I find some time, I'll prepare something. For now, you can take a look at my another app: SearchTwitter. I'm using this library there. Specifically here: https://github.com/pwittchen/SearchTwitter/blob/master/app/src/main/java/com/pwittchen/search/twitter/ui/MainActivity.java#L114. I'm using it to load more tweets, which have been searched. I'm not using Retrofit there, but I used Twitter4J library and wrapped API calls with RxJava Observables. In Retrofit, you can also use RxJava Observables and process of loading more data with Retrofit should look in a similar way like in this app excluding details related to your domain. The main difference will be replacing Observables wrapping Twitter4J API with Retrofit Observables.

Regards, Piotr