1
00:00:00,600 --> 00:00:01,400
Welcome back.

2
00:00:01,650 --> 00:00:06,810
At this point, we want to display the members, of course, and as you can see, we have members here

3
00:00:06,810 --> 00:00:14,010
at the top with a back button and then we have the member itself here, which is Dennis and this little

4
00:00:14,010 --> 00:00:16,550
icon, which is the image of the user in this case.

5
00:00:16,560 --> 00:00:18,990
I don't have a user image for that user.

6
00:00:19,230 --> 00:00:21,570
But overall, you can see that one member is displayed.

7
00:00:21,570 --> 00:00:23,280
Of course, only one member is assigned.

8
00:00:23,280 --> 00:00:27,810
And we will need to add more members or we can add more members later on, of course.

9
00:00:28,020 --> 00:00:30,480
But for now, that is what we want to implement.

10
00:00:30,750 --> 00:00:31,130
All right.

11
00:00:31,140 --> 00:00:33,020
So you can try to build it yourself.

12
00:00:33,270 --> 00:00:36,570
You know, everything that you need to know to do that.

13
00:00:37,080 --> 00:00:39,060
But of course, you can also follow along.

14
00:00:39,270 --> 00:00:44,220
I will do some copy and pasting, of course, because it doesn't make sense for me to show you for the

15
00:00:44,220 --> 00:00:46,600
15th time how an adapter is created.

16
00:00:46,860 --> 00:00:49,600
So I think let's just start with that, OK?

17
00:00:49,800 --> 00:00:50,220
So.

18
00:00:51,120 --> 00:00:56,610
This is something, as I said, you can try to build it yourself, but at one point, once you got the

19
00:00:56,610 --> 00:01:00,750
hang of it, it really just makes sense to just go ahead and.

20
00:01:01,500 --> 00:01:03,870
Yeah, just reuse your code.

21
00:01:03,870 --> 00:01:04,140
Right.

22
00:01:04,349 --> 00:01:08,700
It doesn't make sense to write everything from scratch all over again each time.

23
00:01:09,210 --> 00:01:11,820
And here just makes sense to make changes.

24
00:01:12,710 --> 00:01:16,880
All right, so I'm just going to paste in the adapter, it's the list item adapter.

25
00:01:18,800 --> 00:01:25,460
If you have a just copy and paste a class and you, of course need to make some adjustments, it needs

26
00:01:25,460 --> 00:01:26,870
to have the right imports.

27
00:01:26,900 --> 00:01:27,590
That's one thing.

28
00:01:27,620 --> 00:01:31,270
So, for example, we need to import our user class.

29
00:01:31,970 --> 00:01:36,380
We also need to import our our so our resources.

30
00:01:36,890 --> 00:01:39,810
So, of course, the package name will be different.

31
00:01:40,070 --> 00:01:42,480
That's why it's important to make these adjustments.

32
00:01:42,710 --> 00:01:43,100
All right.

33
00:01:43,100 --> 00:01:47,450
So overall, what does this members list adapter look like?

34
00:01:47,480 --> 00:01:53,030
Well, we have uncreate view holder and which we just have a default layout inflator, which where we

35
00:01:53,030 --> 00:01:59,080
inflate our item number, which is this item here that we prepared in the last video.

36
00:01:59,660 --> 00:02:03,880
Then in Unbind view, Holder, that's where a little bit more happens.

37
00:02:04,130 --> 00:02:07,480
So first of all, we create a model out of the list position.

38
00:02:07,970 --> 00:02:14,180
So the list that is given to the adapter here at the top and the position that the new holder itself

39
00:02:14,180 --> 00:02:18,960
has so positioned, zero would be the first entry one, the second and so forth.

40
00:02:19,400 --> 00:02:25,430
Then if the holder is my view Holder and my view Holder is, by the way, our own class here, which

41
00:02:25,430 --> 00:02:27,920
inherits from side view view Holder.

42
00:02:28,220 --> 00:02:32,930
If that's the case, then we use Glide in order to display the right image.

43
00:02:33,080 --> 00:02:33,500
So.

44
00:02:34,660 --> 00:02:40,600
We need to pass in the context, we need to load the image, so this is the image you URL, which is

45
00:02:40,600 --> 00:02:41,300
model image.

46
00:02:41,440 --> 00:02:47,140
So from the user, that image that we want to display, then the next step is to.

47
00:02:49,640 --> 00:02:52,600
Define a placeholder and then where we want to put it.

48
00:02:52,640 --> 00:02:57,800
So we want to put it into a five member image, which is this image here, of course.

49
00:02:58,930 --> 00:03:03,810
All right, and then we assign the text for the member name and the email as well.

50
00:03:05,640 --> 00:03:11,180
OK, now in the members activity, we need to let this activity know that it should use this member's

51
00:03:11,190 --> 00:03:18,930
list adapter or members list items adapter, and I'm going to create a function for this set up member

52
00:03:20,190 --> 00:03:22,920
list where I pass on the list of.

53
00:03:23,870 --> 00:03:24,240
Users.

54
00:03:24,890 --> 00:03:33,260
All right, so on the list of user objects, and then we need to import user in our members activity

55
00:03:33,290 --> 00:03:38,500
so that we can use it and it's the user that we created ourselves or our own model that we created.

56
00:03:38,780 --> 00:03:44,060
And here, first of all, I want to hide my progress dialogue, so.

57
00:03:45,760 --> 00:03:51,350
This is something that you will find out once you test the application and you will see that potentially

58
00:03:51,650 --> 00:03:54,710
a displaced dialogue and it never disappears.

59
00:03:54,890 --> 00:03:56,270
So high progress, dialogue.

60
00:03:56,270 --> 00:04:01,440
And in order to be able to use this function, we need to inherit from base activity instead of a combat

61
00:04:01,520 --> 00:04:04,020
activity, as we've done multiple times already.

62
00:04:04,040 --> 00:04:08,550
So, you know, now in base activity, we have defined functions that we reuse.

63
00:04:09,020 --> 00:04:09,370
All right.

64
00:04:09,380 --> 00:04:13,130
So hi, progress dialogue, for example, and display progress, dialogue and so forth.

65
00:04:13,790 --> 00:04:16,180
OK, so that is the first step.

66
00:04:16,399 --> 00:04:21,290
And then we need to assign to our members.

67
00:04:22,510 --> 00:04:29,380
XML, RV sold to this recycler, view the right adapter, so first of all, we need to give the layout

68
00:04:29,380 --> 00:04:35,140
member manager, then we need to fix the size and then we can assign them adapter.

69
00:04:35,650 --> 00:04:37,370
OK, so let's get real quick.

70
00:04:37,750 --> 00:04:45,280
So RV member list, the layout manager should be a linear layout manager.

71
00:04:46,990 --> 00:04:52,510
And when you create an object from that, you can or you have to pass in the context, then I'm going

72
00:04:52,510 --> 00:04:55,140
to assign the has fixed size true.

73
00:04:55,150 --> 00:05:02,130
So are members list has or set has fixed size to true.

74
00:05:02,590 --> 00:05:04,260
And now we can assign the adapter.

75
00:05:04,270 --> 00:05:10,090
So first of all, we create an object of the adapter, which is our member list items adapter that we

76
00:05:10,090 --> 00:05:15,660
needed to pass in the context and of course the list.

77
00:05:15,880 --> 00:05:17,790
So the object that we want to pass.

78
00:05:18,220 --> 00:05:19,960
So I'm just going to pass in the list.

79
00:05:22,490 --> 00:05:26,930
And that is the list that is given to the function when it's loaded, so set up members list needs to

80
00:05:26,930 --> 00:05:34,910
have a list and now I pass on this list of numbers and then we can assign that adapter to our RV members

81
00:05:34,910 --> 00:05:35,270
list.

82
00:05:35,570 --> 00:05:39,950
So our members list adaptor should be the adapter that we prepared.

83
00:05:41,770 --> 00:05:48,460
OK, now that point, let's go ahead and create another entry in our constants, so the thing is we

84
00:05:48,460 --> 00:05:50,890
will need to use the user ID.

85
00:05:51,400 --> 00:05:58,240
So I'm just going to create a constant ID here, which will be the idea of the user.

86
00:05:59,340 --> 00:06:02,600
OK, so we are going to reuse that multiple times and so forth.

87
00:06:02,980 --> 00:06:09,150
So now we want to get the members list, so we want to get it from the collections.

88
00:06:09,580 --> 00:06:12,120
So we want to get the assigned members, so to speak.

89
00:06:13,130 --> 00:06:17,240
So if we look at that, you can see assigned to it has this idea.

90
00:06:17,660 --> 00:06:22,160
So this is the member that is assigned to it currently, just one member, but it could be multiple

91
00:06:22,160 --> 00:06:22,430
ones.

92
00:06:22,430 --> 00:06:22,680
Right.

93
00:06:23,060 --> 00:06:29,840
So it's, of course, the user here that we created, which is then is a Gmail dot com, which is the

94
00:06:29,840 --> 00:06:35,690
one with this unique user I.D. So that's the one that is assigned to that port.

95
00:06:35,720 --> 00:06:41,050
And yeah, that's basically the one that is assigned to the card as well and so forth.

96
00:06:41,330 --> 00:06:47,360
So let's go ahead and get that value and make it available in our application.

97
00:06:48,770 --> 00:06:55,610
Now, what would be a good function or better said class to do that would of course, do that in our

98
00:06:55,610 --> 00:06:56,900
members activity directly.

99
00:06:57,230 --> 00:07:05,690
But as we have done before, we want to do all of the firebase stuff in the firebase or Firestar class,

100
00:07:06,380 --> 00:07:09,680
because here is where all of the firestorm stuff happens, right.

101
00:07:09,920 --> 00:07:15,250
Will be low data, where we update data in the database and so forth.

102
00:07:15,260 --> 00:07:17,420
So that's exactly what we want to do here as well.

103
00:07:17,750 --> 00:07:20,000
So let's go ahead and create a new function here.

104
00:07:21,770 --> 00:07:28,670
Which I'm going to call fun, get assigned members, list details.

105
00:07:30,110 --> 00:07:34,850
And we need to pass an activity and this one will be the members activity.

106
00:07:36,710 --> 00:07:40,880
And then you need a person assigned to so assigned.

107
00:07:43,460 --> 00:07:47,420
Two, which will be an array, lists of strengths.

108
00:07:50,650 --> 00:07:52,630
So let's look at it again.

109
00:07:55,100 --> 00:07:59,720
This is basically the head of the function and now we can implement it.

110
00:08:00,230 --> 00:08:04,220
So I want to load it from the fire store, right.

111
00:08:04,460 --> 00:08:08,120
So we need to get faster collections users.

112
00:08:08,720 --> 00:08:10,280
And which one do we want?

113
00:08:10,370 --> 00:08:15,830
Well, we want all of those where the ID is the one that we have assigned to.

114
00:08:16,130 --> 00:08:23,900
OK, so here we want to check all the uses that we have where the ID is equal to the one that is assigned

115
00:08:23,900 --> 00:08:24,110
to.

116
00:08:24,970 --> 00:08:27,260
OK, so that is exactly what we're going to do.

117
00:08:27,260 --> 00:08:33,409
And that's the power of the store once again, right where we can use where clauses and where in clauses

118
00:08:33,409 --> 00:08:34,250
and stuff like that.

119
00:08:36,120 --> 00:08:44,340
So let's just do that here, so firestorm collection and the collection name is Constance Thought Users,

120
00:08:45,150 --> 00:08:47,610
of course, internally, it's just.

121
00:08:48,620 --> 00:08:50,310
Users, OK?

122
00:08:51,260 --> 00:09:03,170
And then we can use where in so here I'm just going to say we are in constant thought it is equal to

123
00:09:03,170 --> 00:09:09,050
assigned to OK, because in society we use this ID of the user.

124
00:09:09,380 --> 00:09:11,580
That's the ID that we have as Constancia.

125
00:09:11,840 --> 00:09:14,350
So here we are checking is it equal.

126
00:09:14,410 --> 00:09:16,910
So is there one that is equal or multiple ones?

127
00:09:17,420 --> 00:09:21,450
And we want to get those and then we add in on success listener.

128
00:09:21,470 --> 00:09:24,620
So if that was successful, then we will get a document.

129
00:09:25,970 --> 00:09:35,000
But you want to use so we're just going to log it here with the aggressive log e so an error logging

130
00:09:35,810 --> 00:09:45,110
where we just get the document to string and then we can go ahead and use VUL user list, which will

131
00:09:45,110 --> 00:09:46,190
be an array list.

132
00:09:47,340 --> 00:09:48,150
Of users.

133
00:09:51,070 --> 00:09:54,970
And I'm going to start with an empty array list first.

134
00:09:56,660 --> 00:10:02,360
And then I can go through the document that was given to us, that was passed to us and it was successful.

135
00:10:03,740 --> 00:10:11,030
To add all of those users to the users list, so I in document the documents.

136
00:10:14,970 --> 00:10:26,730
And here I can just say, OK, vol user is going to be I to object, and here it will be end user Java

137
00:10:27,570 --> 00:10:28,920
or Cluster Chilo here.

138
00:10:31,290 --> 00:10:33,620
And that users should then be added to the users list.

139
00:10:35,930 --> 00:10:36,440
Ed.

140
00:10:38,390 --> 00:10:39,290
The user.

141
00:10:40,280 --> 00:10:43,400
OK, so what we are doing here is.

142
00:10:46,190 --> 00:10:46,710
We are.

143
00:10:47,960 --> 00:10:54,470
Checking the database, we get the users, then we get the list of all the users that fit this criteria

144
00:10:54,860 --> 00:11:00,530
and we go through all of them with this volume and we put them into this users list that we have here

145
00:11:00,740 --> 00:11:06,910
so that we can then call this set up members list function that we prepared.

146
00:11:06,920 --> 00:11:07,250
Right.

147
00:11:08,180 --> 00:11:11,630
So here it's complaining because this could.

148
00:11:12,750 --> 00:11:17,760
Return nothing, right, that could return now, but as I'm sure that it will return something, I'm

149
00:11:17,760 --> 00:11:18,700
just going to force it.

150
00:11:19,080 --> 00:11:24,930
Of course, you can check if this is empty or not beforehand, but that's what we're going to do as

151
00:11:24,960 --> 00:11:34,280
of now and then we can call activity that set up members list and here we can pass on the user's list.

152
00:11:34,680 --> 00:11:39,360
So if we look at this function here to set up members list, there's dysfunction we just created in

153
00:11:39,360 --> 00:11:42,830
our members activity, which requires in the list of users.

154
00:11:43,380 --> 00:11:45,930
And that's exactly what we prepared here.

155
00:11:46,320 --> 00:11:49,590
We prepared a list and array list of users.

156
00:11:50,340 --> 00:11:53,300
We filled it up and then we called this function.

157
00:11:53,820 --> 00:11:54,150
All right.

158
00:11:54,150 --> 00:11:56,950
Now we can also add a failure listener.

159
00:11:56,970 --> 00:11:59,880
So what should happen if something goes wrong?

160
00:12:00,210 --> 00:12:05,100
And I'm just going to say, OK, add on for your listener.

161
00:12:06,540 --> 00:12:12,150
The exception should be logged, so look the exception and then also highlight the progress dialogue

162
00:12:12,160 --> 00:12:13,140
if something went wrong.

163
00:12:13,800 --> 00:12:20,100
Now, we could, of course, let the user know as well as voting members went wrong or something like

164
00:12:20,100 --> 00:12:20,280
that.

165
00:12:20,280 --> 00:12:23,790
So you can add a little task.

166
00:12:27,220 --> 00:12:28,960
Snack bar here, for example.

167
00:12:30,440 --> 00:12:32,210
But I think for now, it's going to be fine.

168
00:12:32,930 --> 00:12:41,510
OK, and now we can go into the member's activity once again and here in the uncreate, that is where

169
00:12:41,870 --> 00:12:45,080
we can now, first of all, show the progress dialogue.

170
00:12:45,110 --> 00:12:47,980
So the user comes to this activity.

171
00:12:47,990 --> 00:12:54,740
First, we show the progress dialogue, then we call the function of the forest or class Soulfire store.

172
00:12:57,130 --> 00:13:03,430
Class, get assigned and come on, give me something.

173
00:13:05,120 --> 00:13:06,770
Import Firestone Glacier.

174
00:13:09,190 --> 00:13:10,510
Get a signed.

175
00:13:12,630 --> 00:13:22,530
Members list details, then we need to pass and the activity so this and we need to give it and more

176
00:13:22,530 --> 00:13:23,040
details.

177
00:13:23,580 --> 00:13:24,030
All right.

178
00:13:24,420 --> 00:13:30,630
So here and board details that assigned to.

179
00:13:33,280 --> 00:13:40,480
Because if we look at our get assigned numbers list, it needs to get an array list of assigned to values,

180
00:13:40,480 --> 00:13:40,780
right.

181
00:13:41,530 --> 00:13:42,700
So a bunch of strengths.

182
00:13:44,110 --> 00:13:49,990
And that is exactly what we are passing here with more details assigned to, because if you look at

183
00:13:49,990 --> 00:13:52,120
it, assigned to is an array list of strengths.

184
00:13:53,500 --> 00:13:57,700
And now everything comes together and we can basically use it now.

185
00:13:59,370 --> 00:14:06,320
Now, you could, of course, put this code into the if statement, so only if there are more details

186
00:14:06,330 --> 00:14:07,540
we want to do anything.

187
00:14:07,800 --> 00:14:11,760
So if you want to really make sure that this only runs, then you could put it here.

188
00:14:12,000 --> 00:14:14,010
But usually nothing should go wrong.

189
00:14:14,010 --> 00:14:14,310
Right?

190
00:14:15,120 --> 00:14:18,360
So we should have at least one assigned member.

191
00:14:18,690 --> 00:14:24,130
If that goes wrong and this creates an error, then we have an error somewhere else, actually.

192
00:14:24,360 --> 00:14:30,240
So this is just going to then be one symptom of the error.

193
00:14:31,140 --> 00:14:33,660
OK, so I'm just going to leave it where it was.

194
00:14:34,140 --> 00:14:38,040
So these kind of things they are always expecting or.

195
00:14:38,100 --> 00:14:42,660
Yeah, when you write code like that, you're always expecting that everything that you wrote before

196
00:14:43,020 --> 00:14:43,820
is correct.

197
00:14:44,010 --> 00:14:45,960
So the code works correctly.

198
00:14:46,470 --> 00:14:51,360
So if you want to really make sure that everything goes right, then you would put it into the if then

199
00:14:51,360 --> 00:14:56,310
you would have an L statement where you then notify or when you write another log entry.

200
00:14:56,460 --> 00:14:59,940
But the thing is, those functions themselves, they also give us log entries.

201
00:14:59,940 --> 00:15:00,150
Right.

202
00:15:00,160 --> 00:15:02,490
So we will see the error even before.

203
00:15:03,090 --> 00:15:05,130
OK, so now let's test that.

204
00:15:05,310 --> 00:15:12,540
Let's see if we actually can see the members in this case, just one member, which will be Homer assigned

205
00:15:12,540 --> 00:15:15,420
to our different part boards.

206
00:15:17,100 --> 00:15:19,380
OK, so there we are, bored with image.

207
00:15:20,250 --> 00:15:22,710
Let's go over let's go to the members.

208
00:15:24,070 --> 00:15:29,230
And we will see much there, the images populated, the email addresses there as well.

209
00:15:29,260 --> 00:15:29,770
Perfect.

210
00:15:30,550 --> 00:15:31,020
All right.

211
00:15:31,450 --> 00:15:32,890
So that is it for this video.

212
00:15:33,220 --> 00:15:38,920
Of course, we want to be able to add members later on and do a bunch of other stuff, but that's for

213
00:15:38,920 --> 00:15:40,000
the next few videos.

214
00:15:40,000 --> 00:15:41,230
So we'll see you in the next one.

