‫Hello, my friends.
‫In the previous video we have created that view model and we have created an instance of movie paging
‫source.
‫So what is the source?
‫We have say that the data source is a very important part from the paging library.
‫So if we go to the structure of the Paging Library page list adapter which replaces the recycler view,
‫that adapter class, the page list which loading the data automatically and the data source which is
‫an interface for data providing.
‫And we have worked with the this data.
‫Now we need to make sure that it's one of these important like times.
‫One of these that we are going to work with is the page, the key data source, which pass that page
‫number as a keyword parameter in the request.
‫And this is the case that we are going to use inside our our approach and as a migrate in migration
‫notice and remembering for you if you are using Beijing three and you wire or you see source codes that
‫has a page list at chapter, now it becomes paging data and apt if you were using data so data source,
‫now you are using the Beijing source live based list builder becomes boat pager, which is the case
‫that we have used in the previous video.
‫We have created the pager and the page list config, which is a paging config.
‫So here we have used the pager and now let's create the paging source.
‫So I will create new package.
‫I will name it as.
‫Beijing.
‫And inside this Beijing package, I will create more for you.
‫Beijing source.
‫And this class will be behaving as paging source by extending it from our ex paging source and we passed
‫the integer and more v helpless enter.
‫These are the type parameters.
‫Implement the methods.
‫And here we go now.
‫For the single.
‫Single here, single load.
‫I will remove this return and start by withdrawing three.
‫If the page number is already there, then initiate page variable with it.
‫Otherwise we are going to get the first page.
‫Okay.
‫So end page equal to load.
‫But don't get key because not equal to null then load firearms.
‫The get key equals to point.
‫Send the request to the server with page number by making return API key client dot get API interface
‫dot get movies by page, which is the page and subscribe the result subscribe on which is the scheduler
‫scheduler dot io method
‫schedulers.
‫Al plus enter to report that class map the results top list of the movies so map.
‫More the response
‫and get the results.
‫I will import the movie response class.
‫And here get results.
‫Dot map map results to load the results object.
‫So movies
‫movies to load result.
‫And we passed the movies here and a page.
‫Okay, don't worry.
‫We are going to solve all the errors on time or error, return load result
‫and the error and we pass new.
‫Okay.
‫This is how we make it now.
‫Plus enter to add the catch closed and return single dot just new load result and we pass hashCode.
‫New load the resultant error we don't need to load now.
‫We know the result here.
‫The error.
‫And we pass.
‫Okay.
‫So this is how we create that single load.
‫Single.
‫These are the methods, or this is the load result.
‫Load result.
‫Drive that load.
‫Result to which is that it's that parameter is an integer and having more V here to load result.
‫This is the method that we have used above.
‫Or we can create the method directly like this.
‫Okay.
‫To load a result, I would pass a list.
‫Of what?
‫Of movies.
‫Our movie.
‫It's called Movies, and it's into your page called Pitch Alpha Plus entertaining.
‫Part of the class.
‫The Framework.
‫Return.
‫New load.
‫Result.
‫I removed this note, this old
‫dot page.
‫The movies and what I pressed the page equal equal to one then equal to not bathroom them now otherwise
‫page minus one and then page plus one.
‫This is how we load the next key.
‫Okay.
‫Get the refresh key.
‫It will be still no cat movies.
‫Yeah.
‫Okay.
‫Here we have created that paging source.
‫Which class that we are going to make.
‫You add inside that other classes later on and we will see how it behaves.
‫So we have limited it to 20 and we have started by page number one and we are preparing the next key,
‫which is the page plus one.
‫This is how to load the results accordingly and in sequence.
‫Of plus enter to import the package that we have in the class inside that package, Beijing, that we
‫have created just now.