Hello this is Martez are Corti.
And in this story you are going to specify they collapsed state of our vidiot.
So let's say that we have a final.
This is going to be a constant so it cannot be changed later.
It is going to be of type review.
OK.
And its name is going to be a collapsed view assignment operator.
So now we need to refer to an instance variable named as floating widget.
So this floating widget actually holds this float underlying view that underline lay out that exemplified
right.
And here I can say that find view by ID or that Id dot collapse view semicolon.
So in this way we can access the collapsed view of this floating.
Let me switch to the floor underlying view Underland layoffs that exemplified here you can see that
this is the route view and here we have to collapse it and this linearly out is the root container of
the collapsed state.
Right.
So that's why you can see the idea is collapsed view.
So if I switch back to the routine View service that of a fight here we created a variable.
Its name is collapsed.
View is a floating widget that find view by id r that ID that collapsed view in this way we can access
the collapsed view.
So now let me show you the emulator here you can see that this is our widget right the collapsed state.
And here we have this closing button.
The app should be notified of when the user taps on these closing button so that the service is going
to be stopped completely.
So let me click on it and now you can see this service is stopped completely.
So Nalut let me go back to Andrex studio.
So here we need to create an image for you first.
So lets say image view and the name is going to be close collapsed.
Close but in collapse close button assignment operator you need to actually say we have an image so
we need to cast this to an image the object and then we need to refer to our widget.
So we have fluting which is that find view by ID or that Id dot What is its name is a collapsed close
button cynical.
Now we can create an unclick listener for this collapse because button but because this uncreate if
it is already too much clout with it we need to we can actually create an interface here we can say
that are collapsed up close but we can say collapsed the close button that sits on a click listener.
And then we just need to pass the context here.
The context is going to be the floating view service that this has the context.
So here is showing us an error and thats because this faluting view service is not actually implementing
the uncle or cousin or interface.
So after this service here typing here implements view dot unclick listener interface.
OK.
Now we need to override the uncle Meffert here.
So after the end in curly brace of this on create Mefford override the Accademia effect of the view
that Archilochus and or interface.
So inside this method you can see that we have this argument.
Let me change it to view.
Now we can create a switch statement.
So each view that we open and close the switch that it does.
So this statement by using an ID so view that get ID.
So we are going to switch between the IDs of this view that is actually clicked or tapped.
So inside the switch statement I can see a case are that ID that collapsed close button call in.
And here we can actually say it's top.
So when I say stop self this stuff sells comes from the service class.
And when this is called the service is going to be stopped completely.
And if you are floating it is going to be removed from the window manager.
So let's say we can also create a toast message here so toast that make text are floating the fruits
of your service that this as the context comma and the message so we can say the service is stopped
completely.
And then finally we need to specify duration so the duration is going to be in short or long let's say
short.
And finally we need to call the show my friend on this toast object.
So you already know how this toast object works.
Let me create a new line so that you can see what's going on here.
So that's it that's enough for this story all.
And in this story or a trot you out how you can access the collapsed view inside our floating widget
and how you can create a listener for a specific component the imagery or the close button and how you
can actually stop the service by calling the stop self method.
Thank you very much for watching.
The next story or we are going to specify the expanded view and how other of how components of our expanded
view are going to work.
So thank you very much for watching.
And I look forward to seeing you in the next hour.