1
00:00:00,510 --> 00:00:01,260
Hello there.

2
00:00:01,440 --> 00:00:02,240
I'm coming on.

3
00:00:02,250 --> 00:00:03,090
And welcome back.

4
00:00:03,100 --> 00:00:07,470
Demand what you don't use in today's video when we're talking about recycling.

5
00:00:07,740 --> 00:00:09,550
So what does all this I love you.

6
00:00:09,570 --> 00:00:11,070
It is just like the last view.

7
00:00:11,070 --> 00:00:12,630
But then why do we need it.

8
00:00:13,170 --> 00:00:19,470
Well sometimes we need to leave huge amounts of data on loading all that useless in the memory results

9
00:00:19,500 --> 00:00:24,290
in about application performance and might even make your application flash blown.

10
00:00:24,300 --> 00:00:26,040
Here comes the recycling even the picture.

11
00:00:26,070 --> 00:00:31,550
So what it does is it creates value items which are scored in the screen and destroys the items just

12
00:00:31,550 --> 00:00:32,880
go out of the screen.

13
00:00:33,180 --> 00:00:38,910
So what's happening here is the only limited small amount of new items which are visible on your screen

14
00:00:39,280 --> 00:00:40,630
are only present in the memory.

15
00:00:40,980 --> 00:00:46,140
That's why giving us more scroll on a better application performance.

16
00:00:46,140 --> 00:00:47,740
So let's get started.

17
00:00:48,090 --> 00:00:49,470
Let's create a new project

18
00:00:53,020 --> 00:00:55,090
let's call a recycling tutorial

19
00:01:00,540 --> 00:01:03,910
let's the next button guy.

20
00:01:04,140 --> 00:01:08,520
We're going to keep on going on as the guest of theme y so that we can run our application on almost

21
00:01:08,520 --> 00:01:11,100
100 percent of the devices running ongoing in the world.

22
00:01:11,640 --> 00:01:12,840
Let's add the next button.

23
00:01:13,560 --> 00:01:16,460
Let's start with an empty activity.

24
00:01:16,530 --> 00:01:17,430
Let's go home.

25
00:01:17,460 --> 00:01:18,790
First off building is made up.

26
00:01:19,290 --> 00:01:20,460
So let's send the finished button

27
00:01:23,120 --> 00:01:25,230
well understood who's was building a project.

28
00:01:25,280 --> 00:01:26,110
So let's wait.

29
00:01:26,900 --> 00:01:29,290
Well the projects built on it's ready to go.

30
00:01:29,630 --> 00:01:34,880
So let's get started long before we get started to use it as I give you two other defendants in the

31
00:01:34,880 --> 00:01:35,390
green.

32
00:01:35,480 --> 00:01:36,320
So let's do that.

33
00:01:36,980 --> 00:01:47,190
So great credits application Garrido and other dependency here so implementation com Android support

34
00:01:48,180 --> 00:01:57,760
I love you re seven Golden and those emotions which is yet to win 6 1 2 1 1 0.

35
00:01:58,260 --> 00:01:59,690
So let's sing the grid allow

36
00:02:02,590 --> 00:02:10,300
Well the grid as well and we were good to go so let's close this coming to the left file so let's get

37
00:02:10,300 --> 00:02:18,590
rid of this constraint out get let's use the little allows you let's fill the orientation say where

38
00:02:18,680 --> 00:02:19,120
go.

39
00:02:20,180 --> 00:02:26,950
Let's get rid of this text you when you've been cyclone move you sewer recycler you were much better

40
00:02:26,950 --> 00:02:33,020
and I'd much Behrendt get it I did it with an I.D. So let's say so.

41
00:02:33,130 --> 00:02:38,740
Coming to the functionality right now we need an instance of the cycle view so let's create one.

42
00:02:40,020 --> 00:02:40,980
So private.

43
00:02:41,500 --> 00:02:42,510
Here's a clue.

44
00:02:42,550 --> 00:02:46,060
Let's call and say you let's initialize it.

45
00:02:46,090 --> 00:02:48,790
So as I music will do fine.

46
00:02:48,810 --> 00:02:53,340
But idea that I.T. on recycling.

47
00:02:54,250 --> 00:02:54,900
OK.

48
00:02:55,120 --> 00:02:57,090
So we've got an instance of others idea of you.

49
00:02:57,500 --> 00:03:02,010
So recycling requires another item which is allowed amount.

50
00:03:02,290 --> 00:03:03,900
So we've got several managers.

51
00:03:03,910 --> 00:03:09,730
So for instance you've got a leaner out manager using again defined less to be in a linear fashion which

52
00:03:09,730 --> 00:03:12,920
could either be horizontal schooling or vertical schooling.

53
00:03:13,280 --> 00:03:17,960
And we've got a great loud manager so let's use a leaner manager view.

54
00:03:18,640 --> 00:03:24,410
So Mineola manager Let's call it level managers will do you know a manager.

55
00:03:24,580 --> 00:03:25,900
That's more like the context.

56
00:03:25,900 --> 00:03:29,980
So this again lets us send a loud manager not recyclable.

57
00:03:30,550 --> 00:03:33,640
So it's like you said loud manager and let's.

58
00:03:33,640 --> 00:03:35,020
That's our object to.

59
00:03:35,860 --> 00:03:37,100
So there you go.

60
00:03:37,120 --> 00:03:38,820
Now all we need is an adapter.

61
00:03:38,920 --> 00:03:40,030
So let's create one.

62
00:03:40,240 --> 00:03:48,150
So project application Java or directory right click new Java class.

63
00:03:48,180 --> 00:03:49,890
So let's call it customer uptime

64
00:03:53,310 --> 00:03:54,120
that's a little bit about

65
00:03:58,330 --> 00:03:59,220
let's close this.

66
00:04:00,640 --> 00:04:04,270
So there is clearly a base on the bottom.

67
00:04:04,330 --> 00:04:05,910
So what's the beholder.

68
00:04:05,920 --> 00:04:10,870
Miller describes an item you unlimited data about its position in the recycling.

69
00:04:11,140 --> 00:04:12,940
So let's create a we will last year.

70
00:04:13,870 --> 00:04:16,690
So public we will do.

71
00:04:17,200 --> 00:04:19,520
And this needs to be a subclass of cycling.

72
00:04:19,600 --> 00:04:20,170
We will do.

73
00:04:20,290 --> 00:04:24,230
So let's extend that extends the cyclone to dot.

74
00:04:24,400 --> 00:04:27,850
We will do okay.

75
00:04:27,850 --> 00:04:29,380
And this requires a construct.

76
00:04:29,390 --> 00:04:30,700
So let's avoid that.

77
00:04:30,970 --> 00:04:36,210
So public we will do it needs view as a barometer.

78
00:04:36,210 --> 00:04:37,750
So that's that.

79
00:04:37,810 --> 00:04:42,260
Let's then put the glass on simple view.

80
00:04:42,970 --> 00:04:44,500
Well constructor is ready.

81
00:04:44,790 --> 00:04:47,900
So let's underscore some adopted glass.

82
00:04:47,940 --> 00:04:51,610
Even this needs to be a subclass all recyclable adapters.

83
00:04:51,630 --> 00:04:52,740
So let's do that.

84
00:04:53,040 --> 00:04:56,700
So extends recycling that adapter.

85
00:04:57,150 --> 00:05:01,200
Let's pass the new order so a custom adapter dot we hold.

86
00:05:02,100 --> 00:05:05,130
Well it requires some implementation of some functions.

87
00:05:05,190 --> 00:05:06,480
So let's implement those.

88
00:05:06,990 --> 00:05:16,630
So on create we Holder on mine hold and get a dot com okay.

89
00:05:17,230 --> 00:05:18,610
So create we hold it here.

90
00:05:18,610 --> 00:05:21,100
We include all out the loop.

91
00:05:21,430 --> 00:05:22,870
So let's do that.

92
00:05:24,130 --> 00:05:31,210
So view music will do now inflator from

93
00:05:35,390 --> 00:05:35,820
okay.

94
00:05:35,890 --> 00:05:42,930
So let's define a constructor because we need the data to be populated here along with the context so

95
00:05:42,930 --> 00:05:49,750
public custom adapter context on an average list.

96
00:05:49,980 --> 00:05:57,640
So let's define this out of this of strings let's call it either list let's define some member variables

97
00:05:57,650 --> 00:05:59,580
or private context

98
00:06:03,540 --> 00:06:13,740
and again try with our other list which is of type String let's call it I witnessed let's send the values

99
00:06:13,740 --> 00:06:14,010
here.

100
00:06:14,010 --> 00:06:18,500
So this dot context is a go do context.

101
00:06:18,660 --> 00:06:23,710
Similarly for our list based on our list as a go do list.

102
00:06:24,570 --> 00:06:27,700
Well our constructors ready so we can use context here.

103
00:06:27,960 --> 00:06:30,450
So context inflate.

104
00:06:30,630 --> 00:06:33,230
So we need now to.

105
00:06:33,270 --> 00:06:36,570
So let's define allow for the view items.

106
00:06:36,570 --> 00:06:37,740
So resources.

107
00:06:37,770 --> 00:06:47,310
Now let's create another allows you let's call it list item now.

108
00:06:48,570 --> 00:06:49,760
Also they'll get done.

109
00:06:50,320 --> 00:06:54,050
Let's close this systematic small again.

110
00:06:54,050 --> 00:06:56,240
Let's get rid of this constraint low.

111
00:06:56,720 --> 00:07:04,320
Let's use a linear Little Chip let's do the orientation a vertical let's change the height to rub content

112
00:07:04,350 --> 00:07:06,200
that we're talking about a list item.

113
00:07:06,630 --> 00:07:10,100
OK so let's define it X with you so much parent.

114
00:07:10,110 --> 00:07:15,410
I drop content that's for an idea so let's call it Android version.

115
00:07:15,810 --> 00:07:16,620
OK.

116
00:07:16,770 --> 00:07:18,410
Let's check the preview.

117
00:07:19,020 --> 00:07:19,950
Let's bring it to.

118
00:07:20,510 --> 00:07:20,980
OK.

119
00:07:21,060 --> 00:07:22,160
So we got to go.

120
00:07:23,040 --> 00:07:24,050
Let's just copy this.

121
00:07:24,150 --> 00:07:28,330
So going back to an upper class so let's use a loud cheers So order.

122
00:07:28,440 --> 00:07:31,700
Note dot list item left.

123
00:07:31,920 --> 00:07:35,160
Let's pass the group so which is parent.

124
00:07:35,220 --> 00:07:37,810
We don't want to attach or new in the group.

125
00:07:37,800 --> 00:07:42,360
So false let's create a v Holder instance now.

126
00:07:42,720 --> 00:07:47,280
So we hold the let's call it v Holder is go do we holder.

127
00:07:47,610 --> 00:07:54,170
And this was about a meter which is use looks bus or you and this entire function on create.

128
00:07:54,380 --> 00:07:55,670
There are of your will.

129
00:07:55,740 --> 00:07:59,810
So let's return our newly created to hold of you.

130
00:08:00,120 --> 00:08:01,100
A function is ready.

131
00:08:01,350 --> 00:08:07,020
So this another function on buying you older you'll be buying a data and allow items.

132
00:08:07,380 --> 00:08:08,790
So we do that shortly.

133
00:08:09,130 --> 00:08:09,800
So.

134
00:08:09,990 --> 00:08:14,310
So this function get item count it returns the number of list items.

135
00:08:14,310 --> 00:08:15,660
So let's implement that.

136
00:08:16,260 --> 00:08:24,240
So if our list is not equal to no analyst Don size is greater than zero.

137
00:08:24,360 --> 00:08:27,810
So we're just saying if our analyst is not null or if it's not empty.

138
00:08:28,260 --> 00:08:34,560
If that's the case then we'll return the size of the list because that would be the number of list items.

139
00:08:34,560 --> 00:08:37,170
Else we'll just return zero.

140
00:08:37,860 --> 00:08:38,330
OK.

141
00:08:38,370 --> 00:08:47,860
So coming to our we will we know so does class say holds an instance to a view or two out loud.

142
00:08:48,560 --> 00:08:51,010
So here we get to friends or views.

143
00:08:51,140 --> 00:08:52,870
So let's do that.

144
00:08:53,900 --> 00:08:59,480
Well now we've got an stands of our view items and we've got a list to be populated.

145
00:08:59,480 --> 00:09:01,780
So moving on to the on my new world.

146
00:09:02,420 --> 00:09:05,950
So we're just going to bind our values to the items.

147
00:09:06,200 --> 00:09:07,150
So let's do that.

148
00:09:07,400 --> 00:09:10,520
So Holder don't want your name said text.

149
00:09:10,800 --> 00:09:17,270
I'm a realist but get dimmer position that's all.

150
00:09:17,300 --> 00:09:21,500
So this will take the strain from the analyst to only.

151
00:09:21,880 --> 00:09:22,330
OK.

152
00:09:22,580 --> 00:09:25,550
So adapters it is so moving back to a mean activity.

153
00:09:26,030 --> 00:09:28,370
OK let's create an instance of this adapter here.

154
00:09:28,640 --> 00:09:32,960
So a custom adapter let's call it custom adopter new custom adapter.

155
00:09:32,960 --> 00:09:38,270
It requires two parameters a context and a list of strings.

156
00:09:38,300 --> 00:09:49,370
So let's create one two private barrels of string get released.

157
00:09:49,710 --> 00:09:52,010
Okay let's create an order list inside

158
00:09:55,300 --> 00:09:58,560
our list is equal to new our list.

159
00:09:59,500 --> 00:10:01,150
Let's create a string

160
00:10:05,960 --> 00:10:07,500
s let's call it

161
00:10:10,480 --> 00:10:11,320
cupcake.

162
00:10:12,520 --> 00:10:13,320
Let's do that.

163
00:10:13,370 --> 00:10:21,590
Let's dot an s Let's do this a couple of times to create a list and let's just do this.

164
00:10:21,590 --> 00:10:27,440
EARNEST Well our list is ready so let's just pass the tube so we get our list.

165
00:10:28,380 --> 00:10:35,280
And let's just say this adapter to our recyclable suicide Globe you set it up to custom adapter.

166
00:10:35,750 --> 00:10:37,100
Well everything's ready.

167
00:10:37,100 --> 00:10:39,530
Let's build our application and have a look

168
00:10:45,130 --> 00:10:46,950
well obligations built.

169
00:10:47,130 --> 00:10:48,760
So let's have a look.

170
00:10:48,870 --> 00:10:55,560
Get it's open wiser as you can see our applications running and we can see a list of cupcake but it's

171
00:10:55,560 --> 00:10:59,030
not scrolling because the list items aren't enough.

172
00:10:59,160 --> 00:11:04,300
Let's provide some padding and margins just to make things a little more clean.

173
00:11:04,560 --> 00:11:07,850
So let's provide a batting here.

174
00:11:07,900 --> 00:11:11,760
Say five DP and let's provide a margin.

175
00:11:11,760 --> 00:11:16,370
You say five DP So that would give us a total of 10 DP.

176
00:11:16,470 --> 00:11:18,130
So let's run our application again.

177
00:11:18,580 --> 00:11:21,080
Well applications running so let's have a look.

178
00:11:21,330 --> 00:11:24,750
Well now as you can see it's scrolling on.

179
00:11:24,990 --> 00:11:26,780
That's all for cyclone folks.

180
00:11:26,820 --> 00:11:31,320
If you have any doubts any queries feel free to comment on we'll go through it.

181
00:11:31,320 --> 00:11:36,670
And if you need to code the link to github is already in your description.

182
00:11:36,720 --> 00:11:38,640
Check it out by.
