1
00:00:00,150 --> 00:00:02,160
Hello this is Martez are Corti.

2
00:00:02,280 --> 00:00:08,280
And in this story you are going to specify they collapsed state of our vidiot.

3
00:00:08,610 --> 00:00:11,390
So let's say that we have a final.

4
00:00:11,520 --> 00:00:14,480
This is going to be a constant so it cannot be changed later.

5
00:00:14,580 --> 00:00:16,390
It is going to be of type review.

6
00:00:16,620 --> 00:00:17,290
OK.

7
00:00:17,340 --> 00:00:21,690
And its name is going to be a collapsed view assignment operator.

8
00:00:21,690 --> 00:00:27,400
So now we need to refer to an instance variable named as floating widget.

9
00:00:27,540 --> 00:00:33,210
So this floating widget actually holds this float underlying view that underline lay out that exemplified

10
00:00:33,290 --> 00:00:34,040
right.

11
00:00:34,500 --> 00:00:45,100
And here I can say that find view by ID or that Id dot collapse view semicolon.

12
00:00:45,600 --> 00:00:49,880
So in this way we can access the collapsed view of this floating.

13
00:00:49,890 --> 00:00:54,450
Let me switch to the floor underlying view Underland layoffs that exemplified here you can see that

14
00:00:54,450 --> 00:01:01,800
this is the route view and here we have to collapse it and this linearly out is the root container of

15
00:01:01,800 --> 00:01:02,540
the collapsed state.

16
00:01:02,550 --> 00:01:03,120
Right.

17
00:01:03,120 --> 00:01:06,850
So that's why you can see the idea is collapsed view.

18
00:01:06,870 --> 00:01:12,150
So if I switch back to the routine View service that of a fight here we created a variable.

19
00:01:12,150 --> 00:01:13,060
Its name is collapsed.

20
00:01:13,080 --> 00:01:19,710
View is a floating widget that find view by id r that ID that collapsed view in this way we can access

21
00:01:19,710 --> 00:01:21,160
the collapsed view.

22
00:01:21,540 --> 00:01:29,140
So now let me show you the emulator here you can see that this is our widget right the collapsed state.

23
00:01:29,370 --> 00:01:32,150
And here we have this closing button.

24
00:01:32,190 --> 00:01:39,840
The app should be notified of when the user taps on these closing button so that the service is going

25
00:01:39,840 --> 00:01:41,400
to be stopped completely.

26
00:01:41,400 --> 00:01:46,470
So let me click on it and now you can see this service is stopped completely.

27
00:01:46,500 --> 00:01:49,000
So Nalut let me go back to Andrex studio.

28
00:01:49,050 --> 00:01:51,930
So here we need to create an image for you first.

29
00:01:52,140 --> 00:01:57,270
So lets say image view and the name is going to be close collapsed.

30
00:01:57,420 --> 00:02:06,280
Close but in collapse close button assignment operator you need to actually say we have an image so

31
00:02:06,290 --> 00:02:11,160
we need to cast this to an image the object and then we need to refer to our widget.

32
00:02:11,250 --> 00:02:22,380
So we have fluting which is that find view by ID or that Id dot What is its name is a collapsed close

33
00:02:22,620 --> 00:02:25,310
button cynical.

34
00:02:25,470 --> 00:02:33,310
Now we can create an unclick listener for this collapse because button but because this uncreate if

35
00:02:33,370 --> 00:02:38,610
it is already too much clout with it we need to we can actually create an interface here we can say

36
00:02:38,670 --> 00:02:48,870
that are collapsed up close but we can say collapsed the close button that sits on a click listener.

37
00:02:48,920 --> 00:02:50,900
And then we just need to pass the context here.

38
00:02:50,900 --> 00:02:56,620
The context is going to be the floating view service that this has the context.

39
00:02:56,630 --> 00:03:03,230
So here is showing us an error and thats because this faluting view service is not actually implementing

40
00:03:03,470 --> 00:03:04,940
the uncle or cousin or interface.

41
00:03:04,940 --> 00:03:14,140
So after this service here typing here implements view dot unclick listener interface.

42
00:03:14,290 --> 00:03:14,750
OK.

43
00:03:14,870 --> 00:03:18,230
Now we need to override the uncle Meffert here.

44
00:03:18,230 --> 00:03:25,100
So after the end in curly brace of this on create Mefford override the Accademia effect of the view

45
00:03:25,100 --> 00:03:27,090
that Archilochus and or interface.

46
00:03:27,110 --> 00:03:29,920
So inside this method you can see that we have this argument.

47
00:03:30,580 --> 00:03:32,410
Let me change it to view.

48
00:03:32,480 --> 00:03:34,760
Now we can create a switch statement.

49
00:03:34,780 --> 00:03:39,440
So each view that we open and close the switch that it does.

50
00:03:39,440 --> 00:03:45,010
So this statement by using an ID so view that get ID.

51
00:03:45,290 --> 00:03:50,860
So we are going to switch between the IDs of this view that is actually clicked or tapped.

52
00:03:50,870 --> 00:04:00,650
So inside the switch statement I can see a case are that ID that collapsed close button call in.

53
00:04:00,920 --> 00:04:04,870
And here we can actually say it's top.

54
00:04:05,180 --> 00:04:10,740
So when I say stop self this stuff sells comes from the service class.

55
00:04:10,970 --> 00:04:15,850
And when this is called the service is going to be stopped completely.

56
00:04:16,040 --> 00:04:21,290
And if you are floating it is going to be removed from the window manager.

57
00:04:21,350 --> 00:04:30,260
So let's say we can also create a toast message here so toast that make text are floating the fruits

58
00:04:30,260 --> 00:04:37,280
of your service that this as the context comma and the message so we can say the service is stopped

59
00:04:37,280 --> 00:04:37,990
completely.

60
00:04:38,000 --> 00:04:45,830
And then finally we need to specify duration so the duration is going to be in short or long let's say

61
00:04:45,830 --> 00:04:46,390
short.

62
00:04:46,400 --> 00:04:49,990
And finally we need to call the show my friend on this toast object.

63
00:04:50,000 --> 00:04:53,590
So you already know how this toast object works.

64
00:04:53,900 --> 00:04:57,410
Let me create a new line so that you can see what's going on here.

65
00:04:57,740 --> 00:05:00,020
So that's it that's enough for this story all.

66
00:05:00,250 --> 00:05:07,100
And in this story or a trot you out how you can access the collapsed view inside our floating widget

67
00:05:07,520 --> 00:05:15,950
and how you can create a listener for a specific component the imagery or the close button and how you

68
00:05:15,950 --> 00:05:20,190
can actually stop the service by calling the stop self method.

69
00:05:20,510 --> 00:05:21,890
Thank you very much for watching.

70
00:05:21,960 --> 00:05:30,550
The next story or we are going to specify the expanded view and how other of how components of our expanded

71
00:05:30,560 --> 00:05:32,800
view are going to work.

72
00:05:33,200 --> 00:05:35,240
So thank you very much for watching.

73
00:05:35,270 --> 00:05:37,820
And I look forward to seeing you in the next hour.

