‫Welcome back.
‫In the previous video, we created the View Modal Layer.
‫Now let's move to create the view layer.
‫The purpose of this layer is to inform the view modal about the user's action.
‫This layer observes the view model and doesn't contain any kind of application logic.
‫I'll create a new package and I name it as view.
‫Remember, the name of the package should be in small letters.
‫I'll move down to the activity underscore main dot XML layout, go to split mode, remove this text
‫view and I'll create a recycler view Matchparent Matchparent id recycler view and click on infer constraints.
‫And here we go.
‫This is our main activity XML.
‫And in this application I'll introduce a new layout which is the swipe refresh layout which detects
‫a vertical swipe display Distinctive progress bar and triggers callback methods in your app.
‫So go to developer.android.com and search for Swipe to refresh, scroll down and select Kotlin and I'll
‫copy this dependency.
‫Go back to Android studio and here to build the products here in the dependencies, I'll add the swipe
‫to refresh sync.
‫Now then let's go back to the main activity dot XML file and here I need to remove this constraint layout
‫and I'll replace it with swipe android x dot swipe refresh layout dot widget dot swipe refresh layout
‫and the layout width is matchparent and the height is match score per.
‫I need to add the namespaces and I'm going to use the data binding.
‫So here of course I go back to the Android tag and scoop in the build products and I'll add build features.
‫And here I need to specify data binding equal to true sync now and data binding is added to our project.
‫And here I'll start with the layout tag, cut it, paste it here and I need to add these namespaces.
‫Alt+ Enter.
‫You can add this namespace for Android and alt+ enter to create the namespace declaration for Android.
‫And of course I need to add Android here in order to solve the errors.
‫Okay.
‫You can see the errors are gone and the swipe layout fill the entire screen.
‫I'll give it an ID swipe layout and tools and I'm specifying the context of the dot main activity alt
‫plus enter to import this namespace.
‫You can see here the tools.
‫This is our layout here.
‫I'm specifying the swipe refresh layout and the ending tag and the closing tag of this swipe to refresh.
‫I'll specify it here.
‫Of course, I include them into the layout tag to use the data bind and since I'm going to use an adapter
‫and recycler view, I need to create a new custom layout for displaying items in the recycler view.
‫So for that I'll create movie underscore list underscore item.
‫This layout will act as a template for every item for every movie in my recycler view.
‫I'll add the layout tag and inside the layout I'll copy these namespaces, cut them, add them here.
‫Then I remove this constraint layout and inside the layout tag I'll start adding a linear layout because
‫I'm going to use it to organize the items and the widgets in a linear manner.
‫Matchparent.
‫Wrapcontent.
‫Android orientation to vertical.
‫Then inside this linear layout I'll create a card view layout Matchparent for the width and the height
‫would be Matchparent.
‫Also the ID would be CVV movie card, view, movie and layout margin would be five, DP elevation would
‫be three, DP and gravity would be center card, corner radius one DP, which is good.
‫And we finished our card view.
‫Inside this card view, we need to add two text views and one image view inside a relative layout.
‫So I'll create a relative layout Matchparent Matchparent.
‫And I'll specify inside this relative layout the image view.
‫And the other two text views.
‫So this is our movie list item layout.
‫It's a layout containing a linear layout.
‫And inside this linear layout we have a card view.
‫And inside this card view we have a relative layout that contains two text views and one image view.