1
00:00:00,390 --> 00:00:06,180
Hello this is mortiser called the and in this story you are going to create the window manager inside

2
00:00:06,180 --> 00:00:08,500
is floating in the service class.

3
00:00:08,520 --> 00:00:14,730
So now let's add another instance variable to this class and its name is going to be private and it

4
00:00:14,730 --> 00:00:21,000
is going to be of type of window manager and its name is going to be Window Manager semicolon.

5
00:00:21,180 --> 00:00:23,420
Let's go inside this on create it.

6
00:00:23,430 --> 00:00:29,550
And after inflating this floating visit here we are going to initialize our window manager with a window

7
00:00:29,550 --> 00:00:31,520
manager assignment operator.

8
00:00:31,530 --> 00:00:37,770
So first we're going to cast this to our window manager because you are actually creating a service

9
00:00:38,070 --> 00:00:40,850
Vinita which has this service through our window manager.

10
00:00:40,860 --> 00:00:49,420
So just open here get system service and open here Windows service your ass into service.

11
00:00:49,520 --> 00:00:49,990
OK.

12
00:00:50,100 --> 00:00:53,860
So not in this way be initialized ATA window manager.

13
00:00:53,940 --> 00:00:58,480
So now it's time to specify the parameters of our window manager.

14
00:00:58,680 --> 00:01:00,570
So let me paste these lines of code here.

15
00:01:00,600 --> 00:01:03,270
As you can see these are the lines of code that I paste that here.

16
00:01:03,390 --> 00:01:06,740
This is going to be a constant so it cannot be changed later.

17
00:01:06,810 --> 00:01:10,570
It is going to be of type window manager that lay out palms.

18
00:01:10,740 --> 00:01:14,030
So if you are specifying diplomate Here is our window manager here.

19
00:01:14,160 --> 00:01:15,670
Its name is going to be parameters.

20
00:01:15,690 --> 00:01:19,810
Assignment operator new window manager that layout prompts.

21
00:01:20,010 --> 00:01:24,090
And here we have a pair of Prentice's inside these practices.

22
00:01:24,090 --> 00:01:27,420
We have these arguments.

23
00:01:27,480 --> 00:01:30,280
The first argument is going to specify the beat.

24
00:01:30,360 --> 00:01:35,550
So we say window manager that lay out problems that wrapped content or that content is going to be the

25
00:01:35,570 --> 00:01:37,140
width of our window manager.

26
00:01:37,140 --> 00:01:41,790
The second argument is going to be specified the height window manager that lay out upon them that the

27
00:01:42,000 --> 00:01:48,850
content is going to be the height of our window manager and we have our window manager that layout problems

28
00:01:48,900 --> 00:01:51,740
that type application overlay.

29
00:01:52,080 --> 00:01:54,220
So let me show you what are these.

30
00:01:54,360 --> 00:01:56,140
The priority is the name of them.

31
00:01:56,310 --> 00:01:59,540
So let's say New You don't have to type is here.

32
00:01:59,550 --> 00:02:08,840
I just want to show you the parameters so new Our window manager that lay out perhaps and that I put

33
00:02:08,840 --> 00:02:13,730
a pair of practice this year as you can see I put a pair of parenthesis here so we don't have to do

34
00:02:13,730 --> 00:02:16,590
that.

35
00:02:16,630 --> 00:02:18,750
So now it's going to show us the parameters.

36
00:02:18,760 --> 00:02:24,580
As you can see the first one is going to be to beat the second one is going to be the height here.

37
00:02:25,180 --> 00:02:34,690
And we have the type the type of our window manager as of Android or you or eight we must use type application

38
00:02:34,720 --> 00:02:35,340
overlay.

39
00:02:35,350 --> 00:02:36,250
This is very important.

40
00:02:36,250 --> 00:02:42,340
And if you are targeting versions before the versions of operate and the operating system before the

41
00:02:42,340 --> 00:02:45,290
Android or you you should use type underline phone.

42
00:02:45,400 --> 00:02:53,500
But here because we are targeting Android 8 or Odeo we must use type application overlay and we have

43
00:02:53,500 --> 00:02:54,340
the flags.

44
00:02:54,490 --> 00:02:57,610
So the flight is going to specify some features of our widget.

45
00:02:57,700 --> 00:03:01,320
So we said we don't want our widgets to be focused.

46
00:03:01,370 --> 00:03:06,240
So if we said window manager that Leanne's perhaps that flag not focus.

47
00:03:06,700 --> 00:03:12,520
And finally even if you specify a format or window manager which we actually use the pixel format that

48
00:03:12,580 --> 00:03:13,680
translucent.

49
00:03:13,720 --> 00:03:20,770
So that's why you can see that here are used type application overlay and we have the flag flag not

50
00:03:20,940 --> 00:03:21,780
fixable.

51
00:03:21,910 --> 00:03:29,170
And finally the format pixel format that translucent they use this actually primatologists as your at

52
00:03:29,170 --> 00:03:33,320
the parameters of your widget or window manager.

53
00:03:33,370 --> 00:03:36,160
DAVID It is going to be added to the window manager.

54
00:03:36,160 --> 00:03:43,570
So now let me delete this line of code here but it's time to specify the position of our window manager

55
00:03:43,660 --> 00:03:44,660
on the screen.

56
00:03:44,950 --> 00:03:54,310
So here I'm going to say parameters that gravity or key assignment operator.

57
00:03:54,330 --> 00:04:02,440
So for example I want my widget to be positioned from the top left corner of the screen.

58
00:04:02,610 --> 00:04:14,780
Yeah I'm going to say gravity that top and gravity lift gravity that lift.

59
00:04:14,780 --> 00:04:22,250
So in this way our window manager that holds our vision is going to be positioned at the top left hand

60
00:04:22,280 --> 00:04:31,280
corner of the screen and then from there we can specify the exact position of our view of our widget

61
00:04:31,550 --> 00:04:34,750
or for example I can say gravity that center.

62
00:04:34,750 --> 00:04:41,270
So it's going to position our widget at the center of the screen and from there I can specify the exact

63
00:04:41,270 --> 00:04:43,250
position of my widget.

64
00:04:43,430 --> 00:04:45,190
So I'll talk more about this later for now.

65
00:04:45,200 --> 00:04:46,170
Just don't worry.

66
00:04:46,250 --> 00:04:51,710
Let's use gravity that up and gravity that lift here in order to create this operator here you need

67
00:04:51,710 --> 00:04:58,020
to hold down the shift key on your keyboard and then press on the back of worthless key on your keyboard.

68
00:04:58,070 --> 00:04:59,210
So that's it.

69
00:04:59,220 --> 00:05:01,980
Now let's specify the exact position.

70
00:05:02,000 --> 00:05:11,450
So prime it here is that X assignment operator is going to be X is going to be 200 semicolon and parameters

71
00:05:11,450 --> 00:05:15,140
that y is going to be again 200 semi-hollow.

72
00:05:15,320 --> 00:05:19,980
So you already know that the X here.

73
00:05:20,000 --> 00:05:22,790
When I say top left hand corner I mean this here.

74
00:05:22,820 --> 00:05:23,280
Right.

75
00:05:23,450 --> 00:05:32,120
And then I say primes if that X I mean the horizontal axis here the horizontal axis that when it moves

76
00:05:32,120 --> 00:05:35,100
to the right the value is going to be positive.

77
00:05:35,150 --> 00:05:39,740
And when it moves to the left the value of the X is going to be negative.

78
00:05:40,250 --> 00:05:47,360
And for the boy here it starts from the top left hand corner of the screen because we specified that

79
00:05:47,360 --> 00:05:47,900
here right.

80
00:05:47,900 --> 00:05:50,880
Grab it at the top and gravity that.

81
00:05:51,110 --> 00:05:54,800
So the Y starts here and then it moves to the top.

82
00:05:54,800 --> 00:05:58,890
The value is going to be negative when it moves to the bottom.

83
00:05:59,030 --> 00:06:01,700
The value is going to be positive.

84
00:06:01,910 --> 00:06:09,800
So where is the parameters that x 200 is going to actually move 200 to the right and 200 to the bottom

85
00:06:11,420 --> 00:06:12,650
so that's it.

86
00:06:12,890 --> 00:06:14,540
Let's go back to our studio.

87
00:06:14,570 --> 00:06:15,700
I'll talk more about this later.

88
00:06:15,700 --> 00:06:19,390
Don't worry.

89
00:06:19,400 --> 00:06:28,550
And finally we need to add the view that we want to actually inflate on the screen to this window manager.

90
00:06:28,730 --> 00:06:29,280
Right.

91
00:06:29,300 --> 00:06:37,390
So we created a beautiful floating widget window manager service a window manager that at VU faluting

92
00:06:37,400 --> 00:06:38,400
widget.

93
00:06:38,510 --> 00:06:39,320
That's it.

94
00:06:39,320 --> 00:06:41,810
So here it's showing us an error.

95
00:06:41,810 --> 00:06:46,910
Finally here you can see that we need to add two arguments the first one is going to be the floating

96
00:06:46,910 --> 00:06:47,330
widget.

97
00:06:47,450 --> 00:06:51,300
So we also created the parameters of all that window manager.

98
00:06:51,320 --> 00:06:58,830
We also need to pass the parameters so we set parameters that are going to be that are going to affect

99
00:06:59,040 --> 00:07:03,430
how this floating widget actually behaves on the screen.

100
00:07:04,110 --> 00:07:13,100
So I think that's enough for this story in the next two Oriol we are going to specify what happens when

101
00:07:13,100 --> 00:07:20,300
the widget is actually in the collapsed state and how to transition to that expanded state by just clicking

102
00:07:20,360 --> 00:07:28,370
on that collapsed widget and we're going to specify the behaviors of all the components inside that

103
00:07:28,400 --> 00:07:34,090
we did for example the image view when the user clicks on that image view what was going to happen.

104
00:07:34,100 --> 00:07:38,800
So thank you very much for watching and I look forward to seeing you in the next two or three years.

