1
00:00:00,490 --> 00:00:01,670
All righty, welcome back.

2
00:00:01,690 --> 00:00:06,700
And this video, we are going to start implementing the due date functionality, so let's get started

3
00:00:06,700 --> 00:00:08,070
with what you can see here.

4
00:00:08,080 --> 00:00:14,080
So when we click on it, we can select the date and then we can see that the date is there.

5
00:00:14,290 --> 00:00:18,520
And once we update, the date will also be put into the database.

6
00:00:18,910 --> 00:00:19,360
All right.

7
00:00:19,360 --> 00:00:21,500
So let's get started.

8
00:00:22,530 --> 00:00:30,510
Therefore, first of all, we should go to our cart model because now we also want to store the data

9
00:00:30,520 --> 00:00:32,850
out or the due date here as well.

10
00:00:32,860 --> 00:00:40,950
So let's add a new entry, which will be vital due date, which will be a long that I'm going to assign

11
00:00:40,950 --> 00:00:41,520
zero to.

12
00:00:41,800 --> 00:00:46,680
OK, so I'm going to store the date as a long Pellew because it's easier that way.

13
00:00:46,680 --> 00:00:52,110
You just get a loan value and then you can transfer that back into a readable date, so to speak.

14
00:00:52,740 --> 00:00:53,100
All right.

15
00:00:53,100 --> 00:00:59,490
If you do that, we, of course, need to add a line here as well where we say source thawed, read

16
00:00:59,490 --> 00:01:01,260
long and.

17
00:01:02,260 --> 00:01:10,880
That will allow us to read the due date and then also we need to write it so here right along with the

18
00:01:10,890 --> 00:01:12,010
due date.

19
00:01:13,590 --> 00:01:21,330
OK, then we can go to the details activity, and here I will create a new global variable which will

20
00:01:21,330 --> 00:01:28,950
store the date so private var m selected due date merely.

21
00:01:30,520 --> 00:01:31,450
Seconds.

22
00:01:32,980 --> 00:01:33,710
We'll be along.

23
00:01:33,730 --> 00:01:39,910
So I'm going to store it in milliseconds, so this will be huge value, but that's why we use long here,

24
00:01:40,150 --> 00:01:42,420
but we don't really need to take care of that too much.

25
00:01:42,430 --> 00:01:47,160
We all just transferred or converted accordingly.

26
00:01:48,390 --> 00:01:55,290
Next, we will need a data picker, and I'm not going to create a new function down here to display

27
00:01:55,320 --> 00:02:01,230
or show to date Picker and by the way, you can just simply use the date picker functionality that we

28
00:02:01,230 --> 00:02:04,050
have used an earlier project.

29
00:02:05,490 --> 00:02:10,680
All right, let me show you what the day picture will look like, so we need a calendar instance first.

30
00:02:10,680 --> 00:02:15,360
So I'm going to call this one, see, then I get the year from the calendar.

31
00:02:15,360 --> 00:02:22,500
So calendar year, the month with calendar that month and today with day of month.

32
00:02:22,950 --> 00:02:30,030
And then we can create a date, bigger dialogue, which will have an on date set listener.

33
00:02:30,040 --> 00:02:32,460
So that will wait for us to set the date.

34
00:02:32,820 --> 00:02:37,440
And when you set the date, you will get a view the year, month of year and day of month.

35
00:02:37,950 --> 00:02:42,810
And we then used to the information to store the day of month.

36
00:02:43,230 --> 00:02:46,590
If day of month is less than 10, we say zero day of month.

37
00:02:46,830 --> 00:02:52,230
And otherwise we just used the day of month because we don't want to display one, two, three, four

38
00:02:52,440 --> 00:02:57,690
or something that that we want to display to date with zero one zero two zero three and so forth.

39
00:02:58,230 --> 00:02:58,560
All right.

40
00:02:58,560 --> 00:03:02,910
Then we get the month of the year and they will do the same thing.

41
00:03:03,660 --> 00:03:04,020
Right.

42
00:03:04,440 --> 00:03:08,130
And then we get the select date and put away.

43
00:03:08,130 --> 00:03:10,380
If you were wondering what the code looks like here.

44
00:03:12,030 --> 00:03:17,670
Then we get the select date, which is day of month, day of year and year, so basically those things

45
00:03:17,670 --> 00:03:25,590
that we prepared here, which were just another way of preparing the or displaying the data, and then

46
00:03:25,590 --> 00:03:27,870
we just used that as the selected date.

47
00:03:28,260 --> 00:03:29,940
And that will be a string, of course.

48
00:03:30,330 --> 00:03:35,010
Then we select that to be the TV select due date text.

49
00:03:35,010 --> 00:03:42,870
So and the activity card details, we have this text you called TV Select Due Date, and that's the

50
00:03:42,870 --> 00:03:43,470
one here.

51
00:03:43,800 --> 00:03:46,380
This one will then be populated with the.

52
00:03:47,430 --> 00:03:51,750
Select data date that happens when the date that listener is called, right?

53
00:03:51,780 --> 00:03:57,900
So once we set the date and then we need a simple date formatter in order to formatted, we used to

54
00:03:57,900 --> 00:04:02,640
asdf then we create a date based on the idea of the past.

55
00:04:02,640 --> 00:04:12,930
So we parse our string into a date and then we can set that date to be the one for our selected to date

56
00:04:13,080 --> 00:04:21,209
in milliseconds because time will return a long value, which is the number of milliseconds since the

57
00:04:21,209 --> 00:04:22,050
1st of January.

58
00:04:22,050 --> 00:04:24,690
Nineteen seventy had zero clock.

59
00:04:25,110 --> 00:04:26,100
Zero minutes.

60
00:04:26,100 --> 00:04:27,000
Zero seconds.

61
00:04:28,070 --> 00:04:28,640
All right.

62
00:04:31,730 --> 00:04:32,390
And then.

63
00:04:33,960 --> 00:04:40,020
We pass in the year to month and today day, all right, so this is what the day picture dialogue will

64
00:04:40,020 --> 00:04:46,460
do all of the code up to here and then we say, OK, let's show the date picture dialog.

65
00:04:46,800 --> 00:04:49,110
OK, so that's what this show date picture function does.

66
00:04:49,140 --> 00:04:49,850
It's nothing new.

67
00:04:49,860 --> 00:04:51,030
We have seen that before.

68
00:04:51,250 --> 00:04:52,430
We have used it before.

69
00:04:52,650 --> 00:04:54,060
This was just a quick refresher.

70
00:04:55,950 --> 00:05:01,200
All right, and when do we want to display this take picture or when do we want to call this function

71
00:05:01,200 --> 00:05:01,420
here?

72
00:05:01,830 --> 00:05:05,880
Well, once we click on the text, you OK?

73
00:05:05,880 --> 00:05:10,890
So let's go all the way up to our own creative function here and in there.

74
00:05:10,890 --> 00:05:16,410
I'm going to add an all click listener for our text view on the scores select.

75
00:05:17,470 --> 00:05:19,150
To date, this one here.

76
00:05:20,840 --> 00:05:23,720
And let's set in on a listener here.

77
00:05:25,120 --> 00:05:27,310
Which will then call the show date, pick her function.

78
00:05:27,820 --> 00:05:30,850
OK, so it's this element right here, select to date.

79
00:05:30,850 --> 00:05:32,440
Once we click on it, we want this.

80
00:05:32,470 --> 00:05:33,880
They pick her to appear.

81
00:05:35,580 --> 00:05:40,860
And, of course, in our card details activity, we have this function called update.

82
00:05:43,430 --> 00:05:51,770
Card details, this one here and there currently we are creating a card, but we are not passing the

83
00:05:51,980 --> 00:05:52,790
date as well.

84
00:05:52,790 --> 00:05:54,850
So that's what we need to add here as well.

85
00:05:54,860 --> 00:05:58,940
And that will be our team selected due date milliseconds.

86
00:05:59,660 --> 00:06:05,360
OK, so now our card will get this additional information, because if you look at the card, that's

87
00:06:05,360 --> 00:06:08,390
what we added this due date for.

88
00:06:10,900 --> 00:06:15,940
And then, of course, we want to display the due date if it was already set before.

89
00:06:15,970 --> 00:06:23,250
So if it is in the database, we want to set a due date, OK, and that should be done in our own create

90
00:06:23,260 --> 00:06:23,710
method.

91
00:06:23,720 --> 00:06:29,710
So I'm just going to put that up here where I'm just going to say I'm selected.

92
00:06:30,340 --> 00:06:40,630
Due date milliseconds should be M board details DOT task list at the M task this position.

93
00:06:41,730 --> 00:06:42,720
Add to cart.

94
00:06:44,660 --> 00:06:46,490
At the guard position.

95
00:06:48,960 --> 00:06:51,420
And Dot Tudorza.

96
00:06:53,170 --> 00:06:57,040
OK, so pretty long statement here, you see they don't get shorter.

97
00:06:57,460 --> 00:07:03,250
Luckily, we don't have any objects underneath carts that would make it even longer, but that's the

98
00:07:03,520 --> 00:07:04,960
due date in milliseconds.

99
00:07:05,350 --> 00:07:11,290
And then what we can check is if the value is not null or zero, better said.

100
00:07:11,590 --> 00:07:14,050
So this case, it's actually the zero.

101
00:07:14,050 --> 00:07:17,320
So I'm selected due date in milliseconds.

102
00:07:17,620 --> 00:07:19,050
If it's greater than zero.

103
00:07:19,060 --> 00:07:22,000
We know that there was a value in the database.

104
00:07:22,300 --> 00:07:25,070
OK, if it's zero, then it's the default value for the card.

105
00:07:25,090 --> 00:07:26,930
So there was no due date set ever.

106
00:07:27,340 --> 00:07:28,840
OK, it's just going to be zero here.

107
00:07:29,500 --> 00:07:29,830
All right.

108
00:07:29,830 --> 00:07:35,470
But if it was created in zero, we know that there was a value set and then we want to display this

109
00:07:35,470 --> 00:07:36,930
value as the text.

110
00:07:37,450 --> 00:07:45,130
So here we want to, first of all, get a simple date format object, which will be.

111
00:07:46,000 --> 00:07:54,370
Simple date format with a specific pattern that we want to use, and I'm just going to use this pattern

112
00:07:54,370 --> 00:07:57,370
here and day, day, month, month, year, year.

113
00:07:58,660 --> 00:08:01,780
Of course, you have different patterns that you can use if you want.

114
00:08:02,230 --> 00:08:04,300
I'm going to use the local.

115
00:08:05,800 --> 00:08:06,430
English.

116
00:08:08,670 --> 00:08:13,140
So here it's with a capital L. Lacayo thought English.

117
00:08:14,780 --> 00:08:22,070
And then I can use this simple date format in order to format my unselected due date in milliseconds

118
00:08:22,070 --> 00:08:25,880
to a readable format, so to a format that fits this pattern.

119
00:08:26,210 --> 00:08:35,150
OK, so selected date will be our simple date format, that format.

120
00:08:35,150 --> 00:08:42,530
So we use that simple date format object that we just created to format our variable and selected due

121
00:08:42,530 --> 00:08:44,440
date in many seconds.

122
00:08:44,810 --> 00:08:47,030
But of course we need to make a data out of it.

123
00:08:47,030 --> 00:08:52,090
So let's create a date object from it just like that.

124
00:08:52,950 --> 00:09:03,270
And then that will now give us the date in a readable format that we can then use to use it for our

125
00:09:03,270 --> 00:09:09,270
selected to date dot text is equal to selected date.

126
00:09:10,170 --> 00:09:18,690
OK, so this code here will take care of assigning the date to this text field if it was in the database

127
00:09:18,690 --> 00:09:19,120
before.

128
00:09:19,350 --> 00:09:22,740
So if we had stored the due date beforehand.

129
00:09:23,720 --> 00:09:29,570
All right, and at that point, we should be able to test this and see if it actually works.

130
00:09:30,830 --> 00:09:32,160
OK, so there we are.

131
00:09:32,630 --> 00:09:34,410
Let's check out our board with image.

132
00:09:35,150 --> 00:09:36,590
Let's go to our card one.

133
00:09:37,310 --> 00:09:38,600
Let's select due date.

134
00:09:38,690 --> 00:09:40,550
OK, so the dialogue opens up.

135
00:09:40,550 --> 00:09:41,950
This is very good.

136
00:09:42,110 --> 00:09:42,780
That's great.

137
00:09:42,800 --> 00:09:44,090
So let's select a date.

138
00:09:45,190 --> 00:09:45,670
Here.

139
00:09:47,030 --> 00:09:49,130
Due date is the 11th of March.

140
00:09:49,220 --> 00:09:50,150
It's updated.

141
00:09:51,530 --> 00:09:52,220
All right, great.

142
00:09:52,250 --> 00:09:58,310
We are back in our cart here or the cart lists, and here you can see when we get back to the cart to

143
00:09:58,310 --> 00:10:00,620
date is in fact, collared here.

144
00:10:00,740 --> 00:10:03,170
So we can, in fact, see the date here.

145
00:10:04,890 --> 00:10:07,740
Now, let's check out our boards here to see.

146
00:10:08,640 --> 00:10:12,870
If the date is in fact there, so we have the cart.

147
00:10:15,060 --> 00:10:19,530
And we can see the due date is there, so it's this value here.

148
00:10:20,940 --> 00:10:26,610
And you can use a long to date online converter Époque converter in order to.

149
00:10:27,940 --> 00:10:34,600
Calculated, sometimes timed to human date, and we can see it's Wednesday 11th.

150
00:10:35,680 --> 00:10:37,720
All right, so that seems to work.

151
00:10:37,990 --> 00:10:38,590
That's awesome.

152
00:10:40,050 --> 00:10:44,970
So let's go over to the next video where we can then drag and drop Cartes.

153
00:10:45,920 --> 00:10:47,080
So see you in the next one.

