Skip to content

Commit 1dd5454

Browse files
authored
Update README.md
1 parent ee29a4a commit 1dd5454

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

README.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ private fun exampleEzRecycleSingleLayout() {
6666
// if you want use view binding you should to cast the object like the example below
6767
rvSample = binding.rvSample as EzRecyclerView<SampleData>
6868

69-
// set empty object like example "SampleData" when you use for shimmer effect, to avoid exception
70-
rvSample.setData(SampleData())
69+
// set class data
70+
rvSample.setData(SampleData::class.java)
7171

7272
// example function for pagination on Ez-RecyclerView
7373
// init the pagination after bind the view and declare it into field
@@ -110,8 +110,8 @@ private fun exampleEzRecycleMultipleLayout() {
110110
// if you want use view binding you should to cast the object like the example below
111111
rvSample = binding.rvSample as EzRecyclerView<SampleData>
112112

113-
// set empty object like example "SampleData" when you use for shimmer effect, to avoid exception
114-
rvSample.setData(SampleData())
113+
// set class data
114+
rvSample.setData(SampleData::class.java)
115115

116116
// example function for pagination on Ez-RecyclerView
117117
// init the pagination after bind the view and declare it into field
@@ -120,13 +120,9 @@ private fun exampleEzRecycleMultipleLayout() {
120120
// set your view holder layout
121121
rvSample.setLayout1(R.layout.sample_view_holder_layout_one)
122122
rvSample.setLayout2(R.layout.sample_view_holder_layout_two)
123-
124-
// set custom shimmer effect after that, bind the shimmer view id by R.id.<shimmer_view_id> from R.layout.<your_shimmer_layout>
125-
// and set into layout with method "setCustomShimmerLayout()"
126-
rvSample.setCustomShimmerLayout(
127-
R.layout.sample_custom_shimmer_effect,
128-
R.id.sample_shimmer_view_id
129-
)
123+
124+
// set you custom shimmer layout
125+
rvSample.setCustomShimmerLayout(R.layout.sample_custom_shimmer_effect)
130126

131127
// you can use "setViewHolderLayout" directly without "EzMultipleLayout" object
132128
rvSample.setViewHolderLayout { view: View, data: SampleData ->
@@ -188,12 +184,8 @@ val ezMultipleLayout = EzMultipleLayout()
188184
ezMultipleLayout.layout1 = R.layout.sample_view_holder_layout_one
189185
ezMultipleLayout.layout2 = R.layout.sample_view_holder_layout_two
190186

191-
// custom shimmer effect after that, bind the shimmer view id by R.id.<shimmer_view_id> from R.layout.<your_shimmer_layout>
192-
// and set into "ezMultipleLayout" with method "setCustomShimmerLayout()"
193-
ezMultipleLayout.setCustomShimmerLayout(
194-
R.layout.sample_custom_shimmer_effect,
195-
R.id.sample_shimmer_view_id
196-
)
187+
// set your custom shimmer layout
188+
ezMultipleLayout.setCustomShimmerLayout(R.layout.sample_custom_shimmer_effect)
197189

198190
// store "ezMultipleLayout" into param of "setViewHolderLayout()" and implement callback/listener in bindViewHolder
199191
rvSample.setViewHolderLayout(ezMultipleLayout) { view: View, data: SampleData -> {} }
@@ -281,10 +273,8 @@ rvSample.setViewHolderLayout(ezMultipleLayout) { view: View, data: SampleData ->
281273
Another Example Implementation Custom Shimmer to binding the view id
282274
```kotlin
283275

284-
rvSample.setCustomShimmerLayout(
285-
R.layout.sample_custom_shimmer_effect,
286-
R.id.sample_shimmer_view_id
287-
)
276+
// your shimmer effect layout
277+
rvSample.setCustomShimmerLayout(R.layout.sample_custom_shimmer_effect)
288278

289279
// you can use "setViewHolderLayout" directly without "EzMultipleLayout" object
290280
rvSample.setViewHolderLayout { view: View, data: SampleData -> {} }
@@ -294,7 +284,7 @@ Start Shimmer on loading the data
294284
```kotlin
295285
// 10 is the size view on shimmer effect, and "SampleData" for empty object from EzRecyclerView<SampleData>
296286
// please do take a note for "Sample Data" is extend/inheritance from "Ez BaseData"
297-
rvSample.startShimmer(size, SampleData()) // Alternative
287+
rvSample.startShimmer(size, SampleData()) // Deprecated
298288
rvSample.startShimmer(size) // Recommended
299289
```
300290
>Note: before you start the shimmer, set empty object like example "SampleData" when you use for shimmer effect, to avoid exception rvSample.setData(SampleData())
@@ -311,7 +301,7 @@ rvSample.startShimmer()
311301
```
312302

313303
`Important!` Always call function destroy to avoid memory leak or error state
314-
```
304+
```kotlin
315305
override fun onDestroy() {
316306
super.onDestroy()
317307
rvSample.destroy()

0 commit comments

Comments
 (0)