All right, so let's finish this off as we prepared the function, set up select members list and we
want to call that.
And I think it makes sense to call that Indian create method because it should be visible directly at
the start.
Right.
So instead of our uncreate method, we can add up or add this little call for dysfunction.
So in uncreate, I add this set up selected members list function now.
All right, now we still have this one thing where we had this little to do right, where we said,
OK, we still need to implement a selected members function, Nabatieh.
So let's do that real quick.
So here.
What we need to do is we need to check for the action because we getting an action here, right?
So is it the action to select or is it the action to select?
So here we say if the action is constants that select.
So if the user should be selecting something, what we want to do is we want to.
Check the board details the task list at the AM task, this position.
Thought cards at the.
And card position.
Thought assigned to.
Thought contains pretty long statement, but basically we want to see if the.
User ID that is passed to us, so the user here.
If that is inside of this, assigned to so user data ID so it doesn't contain it.
Then we want to add to user.
So we want to basically.
The same thing here.
Assigned to.
Thought I had.
And that user.
Dot, Heidi.
OK, so we check, is the user in there or is it not, if it's not in there, we want to add it to the
assigned to list.
All right, and otherwise.
We want to get rid of it from the list, so ALS.
We do the same thing as here, only that we don't add, but we remove, OK, so we remove a specific
element from the list.
On top of that, we need to go through all of the members and then select the one that we just checked
out to be said to false.
So we need to have this for loop where we check if the member details or for the member.
Details list that indices.
If the.
And remember, details list.
At the position, I thought ID is the same as the user ID I wouldn't want to do is we want to set selected
to.
False, because then the user will not be selected anymore, right?
If we deleted him from the list, then he's not selected anymore.
And by the way, deselected, if you look at it, it's this user we gave it to selected setting for
this property, which is a boolean.
Because we need to make sure that if the user is selected, that it's also reflected in the users object
so that if we store the user, that it will contain this information as well.
And then after this house block, we can call the set up selected members list function again, which
will then refresh everything.
So this is the part where we did all of the magic, where we added some people to the selected members
list or we got rid of them and where we loaded the respect of you with all of the different settings
and so forth.
So whenever we make changes to the members list, we also need to, of course, call this set up selected
members list.
All right, and then there is one last thing to do, and that is to go to our layout.
Which is our item.
Cart that one here and we look at it, this is how an item cart looks, right, currently, right?
We have the cart name and that's pretty much it.
So we have some taxpayers here, member's name, which is gone.
So we have a bunch of stuff that is not visible.
But what is important is that we add a recycler of you in here.
So just underneath the cart name here, I would like to have a recycler of you.
So recycler view.
And I'm going to set the width to match parent.
And had to content.
The visibility can be gone, so.
We make it invisible because we are going to make it visible via code, but in the tools, I want to
see it.
So tools start or kolon visibility should be set visible, OK.
So, yeah, I want it to be visible.
And I need to give you an idea so that I can talk to it, OK, and this one should get rid of our V
card.
Underscore selected.
Members list.
I'm also giving it a little margin, so here, margin top.
What will be our default value for cards or actually here?
I think it's easier to search for margin top.
So card, margined, top.
Actually, it's not easier.
It's this one here card details value margined top.
All righty.
And at that point, if we test the application and we go to our board with image, then we go to a car
that we have and we could see we have two members or one member here at the plus button.
So this plus button is there because we added this one line here.
Where we checked, if the size is greater than zero and we added the selected number, which is an empty
one, so that's why this plus icon is actually visible.
OK, so here we have one member that is assigned to it and that is our homework.
And now we add Bart, you can see Bart is there as well.
So now let's click on part again.
Well, as it seems, the unselected feature doesn't work yet.
And well, yeah, it seems like the issue is that I have set this El's case here into the wrong part
of this statement.
So here this ls inside of the card details activity inside of our on items selected function.
It should not be the El's for the if for details is at user, but.
It should be for the ends of the action constants select.
All right, so let's cut this whole part out.
And put that underneath the halls or inside of the walls for the if statement of the constant action.
OK, so here we want to have it instead.
OK, so it's not inside of this if statement for the board details, but it's the else block here for
the action equals constant select.
All right.
That's sort of one of the issues.
But then there is one more thing that I missed when recording, and that is when we go to our ETA member,
this linear layout underneath our image.
So here in item number, we have this circle image, you know, with this linear layout.
But the problem is that this linear layout doesn't have any weight and I need to give it some weight
so that it will be displayed.
So it means that I need to give it a layout weight.
Of one, because otherwise it will not display anything and it's not going to add this tick box.
OK, so now let's check it again, because then I can show you what exactly I mean with this.
All right.
So back in our application board with image, then we check out the card.
Now, let's see, OK, we have the members here, so we have Holmer.
Now, let's click on the plus side.
Could see we only have Homer was check him and you can see this checkbox now.
Is working fine.
All right.
Now, you might wonder why Bart is not there anymore.
Well, that's because I've gotten rid of Bart, so let's head back our whole me Bart here to the members
of the board itself.
So Bart had Gmail dot com.
Let's add him.
All right, now let's go back to the card and see how the future will work once we want to add another
person to it, you can see now Bart is selectable as well.
Let's select him.
You can see now both of them are here.
All right.
Now, let's see if it's persistent.
So let's update the cart and let's go back to the card once again to see if it is there all.
Yes, it is there.
Now, let me answer.
Let Holmer and update the cart and go back to the board and to the cart.
And we can see only Bartosz there.
All right.
So this feature works now.
And it was quite some work, as you can see, but at least we have that sorted out now.
And by the way, inside of the update card, details function in our cart details activity.
There's one a little bit of code that we also still need to add, and that is to update our task lists
or task list.
Which is an array list.
Of tasks.
Should be defined here.
Has our report details, DOD task list, and then we need to make sure that we remove.
The last entry, so remove at task list that size minus one, which basically is just this add button.
So as we have it, when we add a task here, this add cart, this part here is part of our add pattern,
so to speak.
And it's part of our task list because we added earlier on right in our code.
I guess I just wanted to make sure that you also have that because we don't want this part to be added
to our database.
All right.
So see you in the next video.