1
00:00:00,560 --> 00:00:06,110
All right, so let's get to the final dialogue that I wanted to look at in this section, and that's

2
00:00:06,110 --> 00:00:08,250
the custom progress dialogue function.

3
00:00:08,540 --> 00:00:14,240
And that is the function that I'm using in order to create this custom progress dialogue, which is

4
00:00:14,240 --> 00:00:16,730
this progress here and it's a custom one.

5
00:00:16,730 --> 00:00:23,300
So there was one back in the day that you could automatically use an android, but now there's, well,

6
00:00:23,300 --> 00:00:26,690
it's deprecated, so you need to have a little workaround here, and that's what we're doing.

7
00:00:26,690 --> 00:00:31,850
So I'm going to show you how to create this thing because we are going to need it for our application

8
00:00:32,119 --> 00:00:38,780
when we have a background process which needs to run and we don't want to use it to do anything while

9
00:00:38,780 --> 00:00:39,350
that happens.

10
00:00:39,710 --> 00:00:44,390
So in this case, it's a very short one because we can anytime cancel it.

11
00:00:45,050 --> 00:00:48,590
But let's get a look at how we can build this thing.

12
00:00:49,040 --> 00:00:53,750
So first of all, I have this little function and it's called once I click on this button here, which

13
00:00:53,750 --> 00:00:55,860
is this button custom progress dialog.

14
00:00:55,910 --> 00:01:01,070
So once we click on it, I call this function custom progress dialogue function, and you could of course,

15
00:01:01,070 --> 00:01:06,760
call this one custom progress dialog view or appearance or something at that.

16
00:01:06,770 --> 00:01:09,890
But basically what it does is it creates a dialog.

17
00:01:10,160 --> 00:01:10,490
All right.

18
00:01:10,760 --> 00:01:12,620
And I call this one custom progress dialog.

19
00:01:12,920 --> 00:01:18,880
But here I set the content view to be Are layout dialog custom progress?

20
00:01:18,920 --> 00:01:20,870
So what is this dialogue custom progress?

21
00:01:21,290 --> 00:01:25,970
Well, it's another layout file, and it's another one that I created myself.

22
00:01:25,970 --> 00:01:28,430
So you can create this as you like.

23
00:01:28,430 --> 00:01:33,830
It has to, of course, fit in the screen, but other than that, you can create whatever you want.

24
00:01:34,100 --> 00:01:36,470
What, of course, makes sense is to have a progress bar.

25
00:01:36,710 --> 00:01:44,190
So maybe you want to have a progress bar, which the user needs to see in order to see how far the progress

26
00:01:44,190 --> 00:01:44,380
is.

27
00:01:44,390 --> 00:01:49,610
I mean, how far to download, for example, has done or how far the upload is and how far the user

28
00:01:49,940 --> 00:01:52,760
is with whatever process he wants to finish.

29
00:01:53,030 --> 00:01:57,080
And then you can use a progress bar and the progress bars are pretty cool feature.

30
00:01:57,080 --> 00:02:03,020
They have a bunch of cool properties here that you can assign and use.

31
00:02:03,020 --> 00:02:08,300
But if I want to know more about progress bars, then I would really recommend to check out their progress

32
00:02:08,300 --> 00:02:09,380
bar documentation.

33
00:02:11,009 --> 00:02:17,640
For example, if you're wants to set the progress director, you can set it here to 25 percent, for

34
00:02:17,640 --> 00:02:22,680
example, and so forth, so you have a bunch of options that you can play around with.

35
00:02:22,680 --> 00:02:28,290
As you can see, it's a very long class once again, so a bunch of different attributes that you can

36
00:02:28,290 --> 00:02:29,820
look at and so forth.

37
00:02:30,180 --> 00:02:30,510
All right.

38
00:02:31,150 --> 00:02:37,680
OK, so let's get back to the code that we have the progress bar, which is this little icon here.

39
00:02:37,830 --> 00:02:39,900
Let me make it a little bigger so you can see it.

40
00:02:40,110 --> 00:02:46,650
This I can that will constantly move around because we're not controlling it otherwise, and we just

41
00:02:46,650 --> 00:02:47,610
wanted to move like that.

42
00:02:48,030 --> 00:02:53,610
And then we have this text view which just says, Please wait, OK, and this text you is in black.

43
00:02:53,610 --> 00:02:54,920
It's six p.m..

44
00:02:55,230 --> 00:03:00,660
But what's interesting here is that it's within a linear layout where I have the gravity set to center,

45
00:03:00,870 --> 00:03:05,970
so the two are next to each other because the orientation is set to horizontal.

46
00:03:06,240 --> 00:03:12,150
So that's why the two are just perfectly next to each other, and the progress bar has a margin end,

47
00:03:12,150 --> 00:03:18,980
which means and margin to towards the right, which gives it some space to this place.

48
00:03:18,990 --> 00:03:19,890
White text.

49
00:03:20,640 --> 00:03:26,160
OK, so that's basically the XML file, and as I said, you can customize it as you like.

50
00:03:26,820 --> 00:03:30,660
And then the only thing we do is we say custom progress dialogue, dot show.

51
00:03:31,020 --> 00:03:35,280
So we're just showing that dialogue and dialogues.

52
00:03:35,790 --> 00:03:36,210
They.

53
00:03:37,410 --> 00:03:40,650
I have, of course, some other options, as we saw before.

54
00:03:40,740 --> 00:03:42,390
So you can adjust it as you please.

55
00:03:42,690 --> 00:03:44,850
But in our case, when we click on it.

56
00:03:46,580 --> 00:03:52,130
It just appears in the middle, and then I can click it away, but you can, of course, force it not

57
00:03:52,130 --> 00:03:54,740
to get away or go away once you click on it.

58
00:03:55,130 --> 00:04:00,080
But most of the times you will use that for something super short because you don't want to freeze the

59
00:04:00,080 --> 00:04:02,180
UI for a long period of time.

60
00:04:02,450 --> 00:04:06,050
That should be something that can happen within half a second or second.

61
00:04:06,050 --> 00:04:09,230
So it's it's best if the user can't even read whatever text here.

62
00:04:09,860 --> 00:04:12,980
So that's how short these dialogues should be.

63
00:04:13,130 --> 00:04:16,910
This progress dialogues in the context of dialogues.

64
00:04:16,910 --> 00:04:22,250
I can highly recommend to check out the documentation here and especially guides, because you can see

65
00:04:22,250 --> 00:04:23,480
there are a bunch of guides here.

66
00:04:23,750 --> 00:04:25,540
And one of them is for dialogue.

67
00:04:25,550 --> 00:04:29,810
So if you want to know more about how to create a custom dialogue, this is the place to go.

68
00:04:30,050 --> 00:04:35,180
Because here you have a bunch of code examples of layout examples, which I really like.

69
00:04:35,180 --> 00:04:37,310
And yeah, you have the Scotland code.

70
00:04:37,310 --> 00:04:43,100
You directly so you can copy it and use it for yourself can see how you can positive, negative and

71
00:04:43,100 --> 00:04:46,190
neutral buttons and kind of lists and so forth.

72
00:04:46,190 --> 00:04:48,190
So a bunch of options, pretty cool stuff.

73
00:04:48,200 --> 00:04:52,820
You can design it as you like and here is the documentation that can really help you out.

74
00:04:53,150 --> 00:04:58,820
And of course, it's not the only thing that you can find here not only dialogues, but you can find

75
00:04:59,450 --> 00:05:02,430
guides here on a lot of different topics.

76
00:05:02,450 --> 00:05:03,710
Some are better than others.

77
00:05:04,010 --> 00:05:09,710
And yeah, I would definitely recommend to check out the documentation every now and then in order to

78
00:05:09,710 --> 00:05:12,380
get a better understanding of what is going on.

79
00:05:12,740 --> 00:05:14,570
Something that I really like is, for example.

80
00:05:14,630 --> 00:05:20,280
Drag and drop because drag and drop is a cool feature and apps, and it feels good.

81
00:05:20,300 --> 00:05:22,740
So you could, of course, check out the documentation on that.

82
00:05:22,970 --> 00:05:28,160
Even though we're not using drag and drop in our applications yet, but that's not to hold you back

83
00:05:28,160 --> 00:05:31,700
because it's really your own experience.

84
00:05:31,940 --> 00:05:37,760
You should make this course your very own experience, and part of it is to learn stuff around the course

85
00:05:37,760 --> 00:05:39,650
and not just the core stuff itself.

86
00:05:39,650 --> 00:05:45,380
Because of course, content itself is great, and I really put a lot of effort into creating a great

87
00:05:45,380 --> 00:05:45,770
course.

88
00:05:45,950 --> 00:05:51,050
But of course, I cannot cover everything, and that's not even necessary because there are a bunch

89
00:05:51,050 --> 00:05:55,160
of guides which are amazing here in the documentation.

90
00:05:55,580 --> 00:05:57,560
All right, so I'd say that's enough for now.

91
00:05:58,280 --> 00:06:00,540
Good luck with the guides that you find here.

92
00:06:00,620 --> 00:06:04,430
If you find something super duper useful and you want to share it, of course, please share it with

93
00:06:04,430 --> 00:06:05,330
the other students.

94
00:06:05,630 --> 00:06:07,700
And yes, you in the next video.

