Skip to content

A simple android news app showing pagination(offline support with network call), MVVM, retrofit, room, picasso, multiple rows in recyclerview, footer/loader etc

License

Notifications You must be signed in to change notification settings

fahimfarhan/NewsApp

Repository files navigation

NewsApp

Acknowledgement

The data is collected from NewsApi.org

Preview

with-stories.gif final1.png final2.png

Description

Hello there!

So I was struggling with this android pagination stuffs for quite some time now. You see, most of the tutorials are either really old(you don't want to see them), some only show you the paging library with networking support only, some only show database support, some don't show a loader at the ena of recyclerView and so on.Finally, last night I was able to code a sample pagination app successfully with networking, database support, a little loader at the bottom and an extra row at top(you know, for displaying stories/my day/ whatever you call it). So finally after understanding all these things properly, I wish to keep all of it in this project. I hope you'll like it.

We'll be using android paging library 2.1.2 as it is production ready. Though the paging library 3.0 alpha is released, it's still in alpha. So it might not be a good idea to use it in production. Hence the version 2.1.2.

Please go through the followings:

1. Add Api Key

2. Use Retrofit

3. Use Room

4. Init RecyclerViewAdapter

5. Connect Database with RecyclerView

6. Use BoundaryCallBack to Trigger Network Call

7. Add a Footer/Loader

8. Add Stories at the Top

9. Add MVVM support

10. Force Refresh on Swipe

11. Factory Pattern For Online and Offline Support

If you have any questions, feel free to ask me and I'll try my utmost to answer you.

Thank you for reading.

References

  1. https://www.raywenderlich.com/6948-paging-library-for-android-with-kotlin-creating-infinite-lists
  2. https://blog.mindorks.com/implementing-paging-library-in-android
  3. https://proandroiddev.com/8-steps-to-implement-paging-library-in-android-d02500f7fffe
  4. https://medium.com/@sharmadhiraj.np/android-paging-library-step-by-step-implementation-guide-75417753d9b9