Welcome back.
Let's go ahead and finish this part where we are displaying the exercise with the image view and the
correct exercise, as well as then moving over to the other view once it's ready.
So let's go ahead and first of all, make changes to our activity exercise example file because we need
to add the image, you know, and the image you will be on top of our frame layout, and I'm going to
put it on top of the frame layout that we have here, which is our full exercise view.
OK, so here I'm just going to add an image for you.
Image view.
And I'm going to say that it's going to match parents in terms of with, and it's going to have a height
of zero density pixels and then I'm going to scale the image.
So the scale type should be fit x y.
So it's going to fit the image into the available size as the resource here, I'm going to set the jumping
jacks by default for now, and I need to make the visibility for now invisible.
So the image will be invisible at the beginning because this image view should only be visible once
we are in the exercise part of our view.
All right, so here this is the best view, and then we go to the exercise.
So only then this should be made visible and then we need to add constraints.
So I'm going to say that the bottom should be tied to the top of the TV x size, and this will be another
texture that we will need to create.
We're going to create in a second.
And then the top should to to be to the bottom of our toolbar exercise.
And this year at ID TV exercise, this TV exercise doesn't exist yet, so let's add that as well.
So I'm going to add a new text for you here.
By the way, this should be a closed image you like, so now we can add a text to you.
Accordingly, and just text, you will rep its content in both directions.
This will get the idea of TV exercise.
So this one here.
And then I'm going to add a couple of more settings to it, so let me go over them real quick.
So I want it to be having the name or the text of exercise name.
It should be used to colour and accent color.
We have Texas 22 and should be bold.
Visibility should be that it's gone, not invisible, but gone.
So it should even be there.
Then the constraint should be on the left and right towards the parent head should be to the bottom
of our image view and this image should need an I.D..
I'm going to call it I.V. image like so.
So now this should be fine.
And now we need to make a change to the frame layout that we had here with this l'exercice view because
we're working with constraint layout here.
So let's say that this should be top to bottom of ivy image.
Accordingly.
OK.
That should be it when it comes to the XML file.
We now have this big image view and then on the NIRF, we have the exercise name with the value and
this isn't perfect yet.
So this text you and me see?
This text, you hear, Mitch, up to that.
Should be on top of this frame lay out, so.
Top to bottom of.
It frame layout should be not too top to bottom of the image, but instead the TV exercise.
Yep, that should be better.
That looks better.
All right.
So now let's go over to the coach, because that's where the magic happens.
So we're going to need to get an image for our I.V. image, so.
Let's jump over to our set up exercise view, because that's where most of the magic happens.
So we already started with some invisibility invisibility stuff, so let's go on with it.
So first of all, so first we need to make sure that this progress bar, which I'm going to rename,
I'm not happy with this name.
I'm going to call this one l wrist view.
OK, and then accordingly, this one will be underneath the rest of you like so.
And we have another error somewhere.
Doesn't seem like it was the error.
No, it's just warnings, no error, because we're hard coding.
So now instead of using our progress bar and going to use the rest of you here because it's just more
descriptive, then we make the title invisible.
So TV title visibility should be set to view that invisible because we want the title to be invisible
when we are to exercise view.
We're going to display the exercise name, however.
So let's that binding.
I want the.
Exercise to be appearing so he has TV exercise like so maybe we want to call it exercise name.
Hmm.
TV exercised name.
I think that's more descriptive.
Maybe that would be better.
And and here to be exercise name, because the thing is, we have this TV title, which actually is
to get ready for so it could even change that to something else because it's the TV title is not really
the title.
But here the TV exercise name is the one that we're going to now edit.
So it is the visibility should be said to view that visible.
OK, so basically, when we are setting up the exercise view, we need to hide this stuff, right?
And then we want to move over to the exercise view where we display the image and what would display
the frame layout, as well as this title.
So this TV exercise name?
OK, so that's what we're doing here.
And then finally, let's make sure that the image is also going to be visible.
So I've image visibility.
It's going to be.
Viewed or visible?
So everything that we're making visible here, we need to make sure that we make it invisible or invisible
when we are displaying the rest of you.
OK, so set up a rest, you will need to be changed as well with all of this binding stuff.
But then we're displaying the image now and we're displaying the exercise name now, but we have never
set them.
So let's set them, though, by using binding dots.
I.V. image but said Image resource from an ID.
Where do we get the idea from?
Well, from our exercise list, which is a so when you turn for force and rep it here at the current
position, so current exercise position.
But get image.
OK, so this is quite a long statement here.
We could have put it into two lines as well, but basically our exercise list, which is this list of
exercises of exercise model now contains the list of exercises you write.
We got the list of exercises and every single exercise contains an image, which is an integer which
we can get via the position using get image, which is this method that we created to get the image
right.
So this gives us the image and true here for the existing or current exercise that we are looking at.
At the beginning, it will be position zero, so it will be the first entry, which will be if we look
at our constants, jumping jacks because this is the first entry that we have in our exercise.
This we added this year.
OK, so now we get the image and we assign it.
And now we need to do the same thing with the exercise name.
So TV exercise name will be set via exercise list for some wrapping it at the current position, we
get the name.
OK, get me.
I know this will work exactly once because it never is going to go back to the rest of you.
So we need to set up the rest of you as well.
So basically, we do the same thing as we've done here, so let's copy all of this stuff and do the
exact opposite.
So we're making everything that's invisible, visible.
And everything that was visible, we're making it invisible.
And invisible laser.
All right.
And that is fine.
And now we need to look at the timers, so once our progress is over, so once it's finished, it's
increasing the current position.
And what we also need to make sure of is that we make a jump.
So we are changing to the exercise view.
And now when we are in the exercise progress bar, which means we are in the exercise timer here, once
the timer is done, instead of displaying this post, we need to go to the rest view again.
OK, so here we need to check if.
The current exercise position doesn't exceed the total exercises that we have so exercised, list size
and sizes knowable at this point.
Minus one.
So we're basically saying if we still have exercises left, then let's set up a rescue because if we
don't have any more exercises left, then we want to be done with the exercise and jump to a different
screen where we can then see the results or see that we were done for this exercise.
So here, let's add a toast that says, Congratulations, you've completed the exercise.
What a seven minute workout.
Congratulations.
So from a flow perspective, you always have to think of the flow from a flow perspective when we go
into the screen.
So we go in, we start, we go to the rest view.
Once the rest is done, we go to the exercise view.
And once the exercise view is done, we go back to the rest view until we have no more exercises left.
Okay, so that's what we want to achieve.
Let's see if that's actually working for our application.
So I'm going to run it now and let's start it.
And here, for testing purposes, I would recommend to change the timer to rest timer from 10 seconds
to like one second or whatever so that we are.
It works.
We're going over to the jumping jacks.
And now actually, let's really do it for an exercise purpose or for testing purpose.
Let's reduce the exercise duration to three seconds and the recovery also to 30 seconds.
I'm not going to change anything about the appearance.
So the style will still stay the same.
But now let's take this.
It would, of course, be better to have a global variable where we store the duration for the timer
and everything and then make the one to three.
You see, it jumps over one two three.
It should now jump back to the rest view.
OK, there we are at the exercise rescue and next exercise and rest.
You OK, so that works now.
That's perfect.
So now our application and this should be 10000 for the rest.
You and hear thirty thousand Ford exercise view.
All right.
That's pretty much it for this video.
You see, we basically have a seven minute workout app already like the absolute fundamentals of it.
And next, what I would like to appear is what exercise will come next.
So once you and the rest of you get ready for and then the next exercise name, so I would like to do
that.
Now we're done with the exercise in the background.
That's great.
So see you in the next few.