‫Hello, my friends, and welcome back.
‫In this video, we will continue with the note and chapter and we will create the on bind viewholder.
‫So I will type on bind viewholder.
‫I will override it.
‫I will start with val current.
‫Note equal to defer dot current list and get the position from it.
‫Okay.
‫Holder dot item binding.tv.
‫Note title equal to current node dot Node title.
‫I'm getting the node title.
‫If the user select one of them, I need to get holder dot item binding.tv.
‫Note body dot text equal to current note dot note body.
‫Here I need to add text.
‫I'm getting the title and the body.
‫Now I will create Val random.
‫I will use the random class in order to generate random number for me and display a random color for
‫the create the newly created nodes.
‫Okay, so this is the random alt+.
‫Enter here.
‫I need to add val color equal to colors the or color dot a r gb.
‫I'm adding here the colors.
‫First is the integer 255, which is the alpha random dot next integer.
‫256.
‫And here random dot next integer.
‫Two five, six and random dot.
‫Next integer 256.
‫What I've done here and why I'm using this.
‫I'm creating an object color and the first parameter of the color.
‫As two, five five, which is the alpha, and here the red.
‫The green and the blue, and I'm generating random numbers from zero and 2 to 5, six.
‫Two, five, six and two, five six, which is which correspond to, for example, the hex code for
‫the color, for example.
‫Four, four, five, five, six, seven, seven.
‫Okay.
‫I'm generating like this color variable.
‫Okay.
‫Now.
‫I will add here the holder.
‫Dot item binding dot ip color dot set background to color.
‫I am assigning and generating a random color for newly created.
‫Notes.
‫Holder dot item view binding or item view dot set on click listener when the user click on the the items.
‫The notes I need to create Val.
‫Direction equal to home fragment.
‫Direction.
‫Thought.
‫Action.
‫So I need to go to the nav fragment.
‫Here.
‫In the navigation nav graph and add the actions.
‫Okay.
‫So I will keep this.
‫Later on I will edit.
‫It.
‫Okay.
‫And I need to overwrite get item count and return defer dot current list dot size.
‫It's very simple.
‫I need later on when we talk about the handling click events and add the click the actions between the
‫fragments here and destinations, we will come back and edit the note adapter.
‫Set and click.