And I think it makes sense to be prepared in the Tunstall's activity, so let's add it here fun create
a task list which needs a task list name, which will be a string, and then we can go ahead and create
the task.
Which will be task task list.
Name and Firestar class dot.
Get current user ID.
So what we will do is we will create a new task and as you can see, it needs a title and it needs to
know who created it.
So I'm just going to say, OK.
The task will, when we create a new task, just give me the task name, I can get the current user
ID from the Firestar class directly.
OK, so here we are creating a new task.
And then, of course, we need to update our board so we have this more details, which is a board,
and we need to let it know that something has been added to its task list so we can just say a more
detailed task list and had the index zero task.
OK, so when we create a task list, we can add that info at the index zero and we can pass the task.
So that will be our new task list element.
And then we also need to make sure that we remove a more detailed task list, remove, add and board
details that size.
Minus one.
And essentially task list size task lists that size minus one.
So maybe you remember where we used this task, this size minus one.
I was here and the adapter and the armband view holder, where we check the list, whether it was.
Minus one, the position was minus one.
So we only wanted to display.
This had me cancel this ad list.
Only display it if the list is minus one.
Otherwise, we don't want to display it.
Or the list size minus one.
So this part here.
So basically, we are removing the last entry with this very last entry of our task list.
OK, at that point, we can go ahead and show the progress dialogue.
With our police wait text, so just so the user needs to know that he has to wait.
OK, and then we can use Firestar class.
Add up to a task list with the activity and our border, which has created so bored details.
OK, now let's check this out, add up the task list we can see will create a collection here.
We update the task list with the latest board that we have now.
This board has a task list that has something in their.
And we can now go to our to do which was in our adapters here.
Well, we need to create an entry in the DB and display the task list.
So let's get the last name here, last name.
So while list name is going to be Holder, that item view.
That added to text added task, a list name, I added his last name, the text to string.
OK, so whatever the user has entered in here, once we clicked that button, so this is this holder
I've done list name set on Click Listener.
So this is the EBE Done list.
Name this one here.
This image button.
Once we click that, this will be triggered.
So what we will get is the text that is entered here.
So let's say season five is entered.
We click on this button, then the listing will be gotten from the edit text.
Then we will check if the listening wasn't empty, so maybe the user didn't enter anything.
So if it was not empty, it's not empty.
Then we want to run some code, so we want to check if the context that we currently are in is our task
list, activity, context, and if that's the case, then we can use the create task list.
Function from the context, which means from the task list activity, and there we can pass the last
name.
So this means that the create list, this dysfunction here, will then be called we will create a task
where we update the board, where we show the progress dialogue, where we had to update the task list.
OK, so then at this point, we should go back to the task, this item adapter, because we're not fully
done yet.
What if it's empty?
Well, then let's just write a little toast and let the user know that he can't create empty boards
or and empty lists, so to speak.
Please enter list name and then those things.
Sure.
OK, so this is what we're going to display to the user if he didn't enter anything into the list name
when trying to save it.
OK, so then there's one last thing that I haven't done and that I would like to show you, because
potentially well, we can test it, but then we will probably get this weird behavior, which I need
to fix.
And that is does add up to a task list success.
So what we get here is the board details.
But the thing is, we have a well, we have a progress dialogue open.
Right.
So this show, Progress Dialogue is currently open.
And we, first of all, need to hide one, because when dysfunction is called or just before dysfunction
is called, we create a progress dialogue.
And this function is called when we were successful getting data.
Right.
So it's here.
Ad update, task list.
Success in the first class.
When we call this function, we open a progress dialogue just before calling this function.
OK, so we will need to close it at one point.
And doing that here is a good idea.
But then we need to open another one because here we are closing once again.
So here we are hiding the progress dialogue in case of a failure or in board details.
We are also hiding it.
So what we will need to do is we need to open up another one.
So the thing is now you might wonder why the heck would you close one and then just create another one?
What's the idea behind that?
Well, the idea and I'm jumping around to find the right activity where we were.
It's this one here.
I want to show another progress dialogue, OK, so I'm just hiding one and then the next moment I want
to display another one.
So why is that?
Well, the thing is, I'm hiding the one that was successful to load the activity, but with no activity.
But I want to create another one or shorten show another one when I'm trying to get something from the
fire store again.
Of course, you could just say, OK, just keep the one open that is currently open.
But then it might be a very long one.
And it's two different processes, so to speak.
Right.
So now the question is, do you want to have just one which is constantly showing or do you want to
show one, then quit it or quit it quickly to then open it up again.
So that's basically what I do here with this show, Progress Dialogue.
And here I'm just going to say, please wait again.
Which is inside our resources, get string, string, please wait.
OK, so at this point, let's test the application and it was another long video, but I promised that
would be a bunch of short videos coming.
So it's just that some topics are just so complex that it doesn't make sense to display stuff in five
minutes and then make a break and then just keep on going because it's just one flow here.
Right?
That's why it's such a long video.
OK, so now we can actually test it in our own application.
So not the one that I prepared before, but the one that we have built together.
So let's wait for the balls to appear here.
We see more with image.
Let's go there.
Let's add a new list.
OK, that worked.
It's called this list one.
List one is edit.
Let's see in the database if it was created, even though in my case, it just disappeared.
So it seems like we still need to fix something.
But overall, let's look for a new task force created.
So, Nicole.
And that was in this board and you can see here created a new task list or it created a task list with
the title list, one created by the user who also created the board.
OK, so the creation actually works, but the loading doesn't work yet, or at least I'm not displaying
the right stuff.
So let's see where I have the bug.
So if we look at it, it could either be when we load the data or it could be when we actually just
hide or display stuff.
So as it seems, we're just not hiding this at least, and we're not displaying the one that we want
to see or the data that we want to see.
So let's look into that.
And I think it was actually another mistake, so here I entered or used as a task list.
The wrong term, so I use tankless with a small L word should be a capital L here, and if we look at
our board, we can see the task list is with the Capital Hill.
So it was expecting something else.
So let's test it again with this minor change so we can see these minor changes, they can really make
a huge difference when it comes to testing your application.
That's why I highly recommend to use these constants, because now you can see why it's important to
use these constants, because if I once read this with a capital L another time without another time,
I'm making a typo or whatever, then I'm going to get so much joy into so much trouble.
But here everything is in one place.
So all the constants, all of the names are in one place.
So if I make this change once here, it's going to be working for all of the situations where we use
this constant task list.
So let's go to our board with image, because that's where I created the list element.
Let's create a task list and I'm going to call this one a list, too, just for testing purposes.
And we can see list to steer.
OK, so that is a very tricky one.
I'm very happy that I found it in no time.
And here, let's create this list and create it not or just cancel the creation.
You can see it works fine.
OK, but now, of course, in our database we have a task list which doesn't work.
So let's look at that.
So we can see now we have a task list and we have a task list, so one with a capital and one without,
so I can get rid of this array with one without.
So this this one because it's not going to work.
Because it was just an incorrect one.
OK, and now our app should work fine.
And we can even see that it works fine, so let's create a list one this time.
That we are list one is their list, who is there, all of them are they're perfect.
So I hope you manage to get this done as well with me.
And it works for you as well.
And see you in the next video.