All right, so now let's take care of all of that coming together to finally be available in the card
details activity so that we can then actually select a color and see it here on the label color view.
All right.
So in order to do so, we will need to have a function which will return a color list.
So I'm going to create a new function inside of card details activity.
So here, fun.
And actually we can make it private as well.
So Private Fun Colors list, which will return an array list of.
Strength's.
All right, so first of all, I'm going to create a new list of colors so colors list, which will be
an array list of strings.
And I'm going to say why I'm going to create an object of a realist here.
Now I can go ahead and add to the list and I'm just going to show you the different colors that I want
to use here.
So it's those colors that you can see here.
So I just add a bunch of colors here.
You can.
Like different colors, if you want to, it's free for you to decide and then I can return the colors
list.
By the way, you can also return a different amount of colors.
You are completely free to choose whatever you want here.
All right, then we will need a function which will set the color so private fund set color and that
one will basically set the TV selected color.
This one here on TV, selected label color text to be empty, because in our case currently, if we
look at it, it says Select Color.
So this is the text that we currently have and we want this to be an empty string.
So no text at all.
And instead we want to change the background of it.
So here.
Said background color, which will be.
Color thought DPAs.
And colors, but color pass color.
With selected color now, by the way, we, of course, need to create this and select color variable,
so this global variable and also let's import color here from Google Graphics and here let's create
this global variable at the very top.
So here.
Private var m selected color.
Which will for now be an empty string.
All right, and now we need a function to actually trigger our dialogue.
All right, so let's create one private fun label colors list dialogue.
All right, so what are the details that we need from labor colored dialogue?
Well, we need to context the list, the title and deselected color.
So let's prepare all of those Sobell colors.
A list should be an array list of strings.
Which will be a colors list, or we'll just use the colors list function to get all of the colors.
All right.
And then now that we have those colors, we can go ahead and prepare the.
This dialogue, so vollies, the dialogue will be subject, label, color.
This dialogue, which now needs, of course.
The context, then the list, then the text that we want to display and here I want to use the resources
that we prepared, which means it will be the string, string, select label color, which is going
to be this string here, OK?
So that's the one that I want to use here.
And now.
We can define the code of it, so we can now go ahead and say, for example, by the way, I miss a
bracket here.
So here we need to implement the on item selected because if we look at it.
We have this abstract function on it and select it, so if you use a label color dialogue, you need
to implement its members.
So to see that, implement the member on item selected.
Now, we have a little to do here.
So what do you want to do once we selected an item?
Well, then we.
Get the color right and we want to set that color to be the selected color.
And also, we want to then call select color or said color, which is dysfunction, which will then
set the current color as the new background of their set label.
So if this select color label here.
Now, of course, we need to trigger all of that, and in order to trigger it, we will add an unclick
listener for this text you.
OK, so in our uncreate function.
Here we can give our TV selected label, Color and Outlook listener.
On Click, listen, there will be.
Calling labor colors, this dialogue, which is dysfunctional, we just created.
So it should go ahead and use that.
Now, of course, once we created this little dialogue here, we need to show at some point as well.
Otherwise it will be not worth it created.
Right.
So that's the whole idea behind this label.
Collarless dialogue.
You could even call this one show liberalist color dialogue.
So this function, you could call it differently, but I think it does what it should do.
So it should now display the list dialogue.
OK, that by itself is already pretty cool, but what I want to do is, of course, I want to not only
display the color, but I also want to pass it to my card.
So the card later on, when we reload the page or discard it, should know that we actually want to.
Display a certain color because otherwise it won't know.
So our card currently doesn't know anything about colors.
That's what we need to change.
So let's go over to discard and we can see now it works.
So now we can select a color and you can also see that it even goes into the.
Fields right here, but of course, the cart, as I said, doesn't know anything about that.
So let's go to our cart.
Model and it's adjusted a little bit because if we look at it here, the card, what it knows is the
name who created it and who is assigned to it, but it knows nothing about its color.
So I'm just going to add a field here, which will be evol label color, which will be a string that
is empty by default.
And now we can, of course, update the card details.
All right, so we have this function here, update card details here.
We, of course, also now need to pass on the color.
And luckily enough, we have the color here.
As we can just go ahead and add a new entry called Selected Color.
OK, so for all it's going to look like this.
So we create a cart now, and this cart also has a color.
So now we will store that color in the database as well.
Of course, we're not loading it yet.
Or do we let's look at the uncreate.
We're not actually loading it yet, but at least we're passing it to the database, so let's see if
that's actually the case.
Because once we click update.
And they create function.
We update the card details.
All right, so let's see.
Let's go to court one and listen to the selective color, for example, the screen, let's click on
update.
All right, now let's go to the back end.
Let's check our list to here.
So it's as card one.
And that's actually the wrong list, so here, listen to.
Has the card here, which has discolor, so let's see if that is actually the right color.
And you can see the screen here.
And that looks a lot like the green that I have selected here.
All right, so that seems to work OK, and that's it for this video and the next one, we will, of
course, also want to read to color to display it and so forth.
So see you in the next one.