‫Hello, my friends.
‫And welcome to The Last Steps.
‫So we need to create a new package here called Activity, and I will move the main activity to it.
‫Click on Refractor.
‫And and it becomes inside this activity package.
‫And in this class, the main activity, I will make the notation Android entry point and it is an annotation
‫from the health Android entry Android entry point.
‫Okay.
‫So we annotate this main activity as Android entry point.
‫Now that we start by creating the variables and the instances of the previous adapters, glasses, models
‫and others.
‫So we start by movie model
‫main, main activity view model.
‫Activity.
‫Main binding code binding movies adapter.
‫Cold movies adapter.
‫And we start by injecting the request manager.
‫And here we have used also annotation from Java to inject inject a request manager, request manager
‫out plus enter.
‫Okay.
‫Now we need to start by on create method, on create or create.
‫We remove set content of view because we need or before it.
‫I need to make that binding.
‫So this is how we create the view binding object.
‫Before that the set content of view.
‫So binding equal activity activity.
‫Main binding.
‫Because we are going to use the activity main.
‫So we start by activity main and we put the binding keyword after rent inflate, get out, inflate,
‫set content to view.
‫We remove this, we put binding dot get root set support action bar.
‫Let me see if I have supported the action board.
‫We have removed that toolbar so I will not add this.
‫No.
‫If utils the API key equal or equal to none or we are going to check or utils, the API key is empty
‫or.
‫Utils.
‫This is if we go to the utils and we have specified it correctly.
‫So it is not empty.
‫And if there is not none, then.
‫We are going to proceed with that.
‫If it is null or empty.
‫What we are going to make, we will display those message telling that there is an error inside the
‫API or concerning the API error in API key.
‫Okay.
‫Now create the movie movies adapter object and provide that provide the request manager.
‫So movies adapter equal to use movies adapter.
‫Equal to new movies and after new movie comparator.
‫And a request manager
‫create the view model.
‫So main activity view model equal to new view model provider.
‫This and we specified get movie model or get movie review model thought class.
‫Now we need to set the recycler view and adapt.
‫Or so initiate, initiate, recycle or refute.
‫This is the method that we are going to create recycler of you and adapter.
‫This is the method and plus enter to create the method and subscribe to Beijing.
‫This is very important because we are going to use the paging subscribe to Paging Data main activity.
‫This is how we subscribe to the view model to this paging movie, Paging Dataflow, the subscribe and
‫what we are going to subscribe to the movie Paging Data.
‫And here we are going to specify submitting in you data to recycler view adapter.
‫So movies adapter don't submit the data, get the life cycle and the movie paging data.
‫Okay.
‫No.
‫Initiate a recycler review and adapter.
‫Here we start by creating the grid layout manager with a span of count two.
‫So create layout manager.
‫Grid Layout Manager equal to new grid layout manager.
‫This and this.
‫Specify the spend count to two.
‫Finally set the layout manager to recycler view by using the binding recycler you move is the set layout
‫manager grid layout manager add item decoration so binding the recycler view movies that add item decoration
‫new grid the space to 20 true.
‫Now setting that after so many people missed this very important step, binding the three secular view
‫movies, the set adapter to what this will show the end user a progress bar while pages are being requested
‫from the server.
‫So movies adapter dot with load the state had their or footer, so we will use the footer when we will
‫scroll down and next page request will be sent and while we get the response from the server progress
‫bar will shown to the end user.
‫This is why we are using the.
‫Notes.
‫State Food New Movies, Notes De Adapter three.
‫What we are going to make this is the movies adapter, the retro.
‫Okay.
‫So.
‫The movie's adapter, the ad load states the center method set agreed to spend to set progress at the
‫center.
‫How to do that?
‫We use that correctly out manager.
‫Don't set the span size.
‫Look up new grid layout manager.
‫Dot span size.
‫Look up.
‫And what we are going to make.
‫Implement the methods this will implement that gets band size.
‫It will return movies adapted to get item review type position.
‫Equal equal to is equal to movies adapter dot loading item.
‫Then make it one.
‫Otherwise make it to OC.
‫This is that logic and algorithm behind making this grid the view and grid layout manager and how to
‫get their span.
‫One last thing I need to make is to create a new class here in the upper one upper level.
‫New Java class, I will name it movie app and this movie app will make an annotation with Health Android
‫app and extends application.
‫Helpless.
‫Enter.
‫And here we go.
‫And don't miss to add manifest user permission and Internet.