Hello this is mortiser called the and in this story you are going to create the window manager inside
is floating in the service class.
So now let's add another instance variable to this class and its name is going to be private and it
is going to be of type of window manager and its name is going to be Window Manager semicolon.
Let's go inside this on create it.
And after inflating this floating visit here we are going to initialize our window manager with a window
manager assignment operator.
So first we're going to cast this to our window manager because you are actually creating a service
Vinita which has this service through our window manager.
So just open here get system service and open here Windows service your ass into service.
OK.
So not in this way be initialized ATA window manager.
So now it's time to specify the parameters of our window manager.
So let me paste these lines of code here.
As you can see these are the lines of code that I paste that here.
This is going to be a constant so it cannot be changed later.
It is going to be of type window manager that lay out palms.
So if you are specifying diplomate Here is our window manager here.
Its name is going to be parameters.
Assignment operator new window manager that layout prompts.
And here we have a pair of Prentice's inside these practices.
We have these arguments.
The first argument is going to specify the beat.
So we say window manager that lay out problems that wrapped content or that content is going to be the
width of our window manager.
The second argument is going to be specified the height window manager that lay out upon them that the
content is going to be the height of our window manager and we have our window manager that layout problems
that type application overlay.
So let me show you what are these.
The priority is the name of them.
So let's say New You don't have to type is here.
I just want to show you the parameters so new Our window manager that lay out perhaps and that I put
a pair of practice this year as you can see I put a pair of parenthesis here so we don't have to do
that.
So now it's going to show us the parameters.
As you can see the first one is going to be to beat the second one is going to be the height here.
And we have the type the type of our window manager as of Android or you or eight we must use type application
overlay.
This is very important.
And if you are targeting versions before the versions of operate and the operating system before the
Android or you you should use type underline phone.
But here because we are targeting Android 8 or Odeo we must use type application overlay and we have
the flags.
So the flight is going to specify some features of our widget.
So we said we don't want our widgets to be focused.
So if we said window manager that Leanne's perhaps that flag not focus.
And finally even if you specify a format or window manager which we actually use the pixel format that
translucent.
So that's why you can see that here are used type application overlay and we have the flag flag not
fixable.
And finally the format pixel format that translucent they use this actually primatologists as your at
the parameters of your widget or window manager.
DAVID It is going to be added to the window manager.
So now let me delete this line of code here but it's time to specify the position of our window manager
on the screen.
So here I'm going to say parameters that gravity or key assignment operator.
So for example I want my widget to be positioned from the top left corner of the screen.
Yeah I'm going to say gravity that top and gravity lift gravity that lift.
So in this way our window manager that holds our vision is going to be positioned at the top left hand
corner of the screen and then from there we can specify the exact position of our view of our widget
or for example I can say gravity that center.
So it's going to position our widget at the center of the screen and from there I can specify the exact
position of my widget.
So I'll talk more about this later for now.
Just don't worry.
Let's use gravity that up and gravity that lift here in order to create this operator here you need
to hold down the shift key on your keyboard and then press on the back of worthless key on your keyboard.
So that's it.
Now let's specify the exact position.
So prime it here is that X assignment operator is going to be X is going to be 200 semicolon and parameters
that y is going to be again 200 semi-hollow.
So you already know that the X here.
When I say top left hand corner I mean this here.
Right.
And then I say primes if that X I mean the horizontal axis here the horizontal axis that when it moves
to the right the value is going to be positive.
And when it moves to the left the value of the X is going to be negative.
And for the boy here it starts from the top left hand corner of the screen because we specified that
here right.
Grab it at the top and gravity that.
So the Y starts here and then it moves to the top.
The value is going to be negative when it moves to the bottom.
The value is going to be positive.
So where is the parameters that x 200 is going to actually move 200 to the right and 200 to the bottom
so that's it.
Let's go back to our studio.
I'll talk more about this later.
Don't worry.
And finally we need to add the view that we want to actually inflate on the screen to this window manager.
Right.
So we created a beautiful floating widget window manager service a window manager that at VU faluting
widget.
That's it.
So here it's showing us an error.
Finally here you can see that we need to add two arguments the first one is going to be the floating
widget.
So we also created the parameters of all that window manager.
We also need to pass the parameters so we set parameters that are going to be that are going to affect
how this floating widget actually behaves on the screen.
So I think that's enough for this story in the next two Oriol we are going to specify what happens when
the widget is actually in the collapsed state and how to transition to that expanded state by just clicking
on that collapsed widget and we're going to specify the behaviors of all the components inside that
we did for example the image view when the user clicks on that image view what was going to happen.
So thank you very much for watching and I look forward to seeing you in the next two or three years.