Welcome back.
And this video, we are going to implement the feature that you can see here where you can see the images
of the people who are assigned to a specific project cart.
All right.
So here within the task force, we have those different cards.
And then if we have another person assigned to the project, except for the creator itself, then we
will see the different people who are assigned to it.
So the different users.
All right.
So let's implement this feature.
In order to do that, we need to go to your task list activity, because that's where the magic happens.
That's where we are on that screen.
So let's go over your task list activity.
And that is to, first of all, make this variable here so our assigned member details a list.
To make it public so that we can access it from multiple spots and then we need to cut something out
of the code, which means we need to go to our board detail function.
So what details where is it?
It's further down here, right, and there we need to cut a specific part of the code out.
So here this one.
All the way down to the point where we start to show the progress dialogue.
All right.
So from the set up action by virtue of the show progress dialogue, let's cut this piece out and paste
it to our board members.
Details list.
Functio, so to this one here, just underneath hyd progress dialogue.
Now, the board, of course, will be the global board details variable.
All right, so what details task first, then the layout manager all stays the same.
And of course, here, when it comes to the task list, we also need to use and board details here instead,
because port was a variable that was past the function and this case, we get the board directly from
the global variable that we created earlier on.
So if you look at it, it's this one here, which is a board.
All right, now we will be able to use that in that card list items adapter, so we have this adapter
here, card list items adapter, and now we can use that global variable that we just prepared or the
global variable that we made public.
Now we can use it in here inside of our unbind view Holder.
Just underneath this code here.
We can go ahead and provide some additional code so we can check here if the context as a task list
activity.
Thought am a silent member details list.
So now we used this global variable that we made public.
That size.
Is greater than zero.
So let me put that into two lines.
It's a real bomb.
Then we want to have an instance of the selected members, so Paul selected members, a list should
be an array list of selected members.
Which is an array list.
For now.
And now just underneath it, we want to run a Falu.
Where we check the eye in context that I'm assigned member details list thought indices.
With another Falu where Jay in model thought assigned to.
With the check where context Todd and assigned members details list at the position, I thought.
Heidi equals Jay.
So double equals sign, Jake.
And then what do we want to do for these cases?
Well, we want to add them to our selected members list.
All right.
So far, the elected member is a selected members object.
Which contains the context that assigned details.
No list I.
I thought ID and context thought am assigned members details, I dot image.
OK, because that's the information that a selected members object needs.
And then we can go ahead and add that you are selected members list.
All right.
So here, add the selected members.
All right, now that we have added that we can check if the list is empty or not.
So if.
The selected members list is greater than zero, so its size is greater than zero.
We know that we have selected members and then we can check if the selected.
Remember this list, that size is equal one and.
The selected members list creator is the person who is currently locked in, then we don't want to display
it.
OK, so that's the idea.
That's exactly what I told you as I tested the application.
So here the I.D. at the first entry is modeled, not created by.
Then.
I want to make that recital of you gone, so Holder, that item you thought Arvi Carter selected members
list, thought visibility view dot com.
OK, so what is the point behind this?
Well, the idea is, if you're the creator of this card here or of this whole board, then you don't
need to see your image here all the time.
It would be useless.
You only want to see that if there are multiple people who are assigned to the project or if it's a
person who is not you, OK?
So at least that's the design, that philosophy that I have behind it.
If you want to change that, you can of course, change it and make it the way you want it.
But for example, here, if I get rid of this additional field and I am the only creator of this card,
you can see it's not there.
So the images are only there if it's not the creator itself who is a site.
OK, so this check that and you can see the other person would then be visible, but the creator itself
will not be visible.
So you could see, OK, if you're not visible there or in a card is in a way that you're not visible
there, then.
It's someone else who is responsible.
The idea really is that, for example, if you create those cards for yourself, you don't want to display
all of these images because they would just add no value at all.
They would just make the whole thing a lot bigger, like the whole list would be a lot more clumsy and
not as easy to use, so to speak.
And in all other cases, we want to display this.
OK, so let's make it visible in those cases.
So you got.
Visible.
OK, on top of that, what we want to do is we want to give this holder item view Davíð card selected
members, list a layout manager.
All right.
So the layout manager that I want to use is a grid layout manager, which I need to pass in the context
and the span count, which I'm going to settle for.
So I just say, OK, due to the size of this image, I only want to be able to put four in here, not
more than four.
OK, so that's what I do with this spend count.
At least in one line, only four can be added.
OK, that's the idea here.
Then we need an adapter.
And which adapter should we use?
Well, the card members list items adapter, which needs the context and then the selected members list.
And then also, let's look at it, we have no further information here.
And what I would like to add here.
As a private VUL sign members said.
Or it should be a boolean, right?
And while we're here, let's also check that when we are inside of our own bond holder, so here I'm
going to use it at the point where I check the position and fantasize.
And here also each person assigned members.
All right, so then we can go back to our card list items adapter here and now we need to pass in the
information here as well.
So but we want to assign members or not.
And I'm going to say false here.
All right, so this is how the editor is going to look like and how we can assign that adapter to the
recital of you.
All right.
So here to discuss.
Recyclable you.
We can assign to adopt her, which will be the adapter that we just prepared.
And now I'm going to add another listener here as well, so adapter dot set unclick Lessner.
Which will be an object of card members, list item, adapter, unclick listeners, all of this.
Interface there.
All right, and now we need to, of course, implement it, so we need to have the unclick event here.
So on Klick.
And not a lesson there about the unclick event, so.
Here on Kallick operated.
And we may not forget who lost this year at the bottom.
So this is our adaptive set on Click Listener.
This is how is looking.
And then we can now go ahead and implement their own click event.
So what do you want to hear?
Well, if there is an unclick listener.
So if it's not Marle then used on Craigslist in the dot on click event.
With the position.
And as the unclick listen, there is a nullable we need to add the two exclamation marks here.
All right, so all of that should happen if the selected members list size is greater than zero, what
should happen if it's not greater than zero?
So here towards the bottom, well, then I want to have an A-list blog here which uses our website reviews
list here.
And makes it invisible, so visibility said to view dot gone.
All right.
So at this point, we can test our application and see if it's actually visible in our app as well.
And now, of course, as we have changed our cast member list items adductor and our card details activity,
we get this every year because I didn't pass the.
Pavilion here that we have added.
Which is inside of our set up selected members, a list function.
And here in this case, we assigned true.
Because if we are in the car, details, activity, what we want to have us to guard members list items,
adapters, assign members value is true.
Because if you look at it, you only want to see I've had no, uh, this image, if there are any members
to add, because if there is no one in the list, right.
Except for you, the creator, then there's no reason to add someone to the list at that point.
So you need to have multiple people assigned to the board for this to make sense, OK, or for this
to make sense to make this appear.
This I've at member, which is just a little plus icon there.
All right.
Now let's test our application.
So let's go over to our board with image.
OK, so here you could see nothing.
That's because only we are assigned to the cart.
Let's assign someone else to the cart.
That we are now, we can see both now let's get rid of ourselves from the cart.
And we could see the other person is still visible, which is part in this case and now the final case
where.
Well, we see all three cases already, right, so let's get rid of part and just have us there and
we will see that the image disappears as well.
All right.
So this works as intended.
Great.
So I think this is a great moment to have another pause and let's go ahead with more features and the
next video.