amilcar-sr / paging

Usage example of Paging Library with simple network requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paging Library - Usage example

This repo is just an usage example of the Paging Library released by Android with simple network requests. I wanted to make this small repo to practice/understand the way this library works and to provide a simpler sample because Android's Sample is kind of complex πŸ˜….

⚠️ API KEY (VERY IMPORTANT)

In order to make this example, I used a super cool sample api called "The Movie Database API" πŸ˜ƒ so I created an account with them and got a SECRET API KEY to use their endpoints, and you'll have to do the same if you want to give this example a try yourself πŸ™‚.

You just need to get an API KEY following these instructions and paste it in the NetworkManager class (it should be the only thing giving you compiling errors in the project, let me know if it isn't πŸ™πŸ») replacing PrivateConstants.API_KEY and you'll be ready to go!

Paging's Purpose

This library simplifies greatly the code needed to implement paging into our app, it takes care of triggering callbacks in order to fetch the appropriate pages from our endpoint/database and also provides a way to integrate its DataSources with LiveData wich saves us A LOT of boilerplate code when appending new results into the Adapter's list πŸ‘ŒπŸ»πŸ§.

App Behaviour

I didn't add any actions to the sample app because I wanted to focus on the paging scrolling part and take the time to comment without adding unnecesary code that might just get in the way of the guys trying to get a hold on this new library.

Maybe I'll add a new repo with Database loading and different kinds of DataSource later. In the meantime please feel free to clone this repo and/or add comments to my code, I'll appreciate the feedback πŸ˜„.

Resources

In case you want to read the documentation I read in order to make this sample (it's basically Android's), I'll leave the urls in here. Good Luck ✌🏻and Happy Coding πŸ‘¨πŸ»β€πŸ’».

About

Usage example of Paging Library with simple network requests

License:Apache License 2.0


Languages

Language:Kotlin 98.5%Language:Java 1.5%