Skip to content

Commit c7199bb

Browse files
authored
Merge pull request #75 from frogobox/release/2.3.4
Release/2.3.4
2 parents 8b28611 + ee18ccc commit c7199bb

File tree

7 files changed

+54
-33
lines changed

7 files changed

+54
-33
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
This Is Latest Release
1515

16-
$version_release = 2.3.3
16+
$version_release = 2.3.4
1717

1818
What's New??
1919

@@ -54,7 +54,7 @@ allprojects {
5454
```groovy
5555
dependencies {
5656
// library frogo-sdk
57-
implementation 'com.github.frogobox:frogo-sdk:2.3.3'
57+
implementation 'com.github.frogobox:frogo-sdk:2.3.4'
5858
}
5959
```
6060

@@ -63,14 +63,14 @@ dependencies {
6363
```groovy
6464
dependencies {
6565
// library frogo-sdk
66-
implementation("com.github.frogobox:frogo-sdk:2.3.3")
66+
implementation("com.github.frogobox:frogo-sdk:2.3.4")
6767
}
6868
```
6969

7070
#### <Option 3> libs.versions.toml
7171
```yml
7272
[versions]
73-
frogoAndroid = "2.3.3"
73+
frogoAndroid = "2.3.4"
7474

7575
[libraries]
7676
frogo-android = { group = "com.github.frogobox", name = "frogo-sdk", version.ref = "frogoAndroid" }

buildSrc/src/main/kotlin/ProjectSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object ProjectSetting {
3636

3737
const val VERSION_MAJOR = 2
3838
const val VERSION_MINOR = 3
39-
const val VERSION_PATCH = 3
39+
const val VERSION_PATCH = 4
4040

4141
// ---------------------------------------------------------------------------------------------
4242

frogorecyclerview/src/main/java/com/frogobox/recycler/core/FrogoRecyclerBindingAdapter.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ abstract class FrogoRecyclerBindingAdapter<T, VB : ViewBinding> :
4545
)
4646
}
4747

48-
open fun setupData(data: List<T>?) {
49-
this.asyncListDiffer.currentList.clear()
48+
open fun getItem(): MutableList<T> = asyncListDiffer.currentList.toMutableList()
5049

51-
if (data != null) {
52-
listData.addAll(data)
53-
this.asyncListDiffer.submitList(listData)
50+
open fun setItem(data: List<T>) {
51+
if (data.isEmpty()) {
52+
asyncListDiffer.submitList(listOf())
53+
} else {
54+
asyncListDiffer.submitList(data.map { it })
5455
}
5556
}
5657

@@ -61,11 +62,11 @@ abstract class FrogoRecyclerBindingAdapter<T, VB : ViewBinding> :
6162
}
6263

6364
open fun setupRequirement(
64-
data: List<T>?,
65+
data: List<T>,
6566
bindingListener: FrogoRecyclerBindingListener<T, VB>?
6667
) {
6768
setupListener(bindingListener)
68-
setupData(data)
69+
setItem(data)
6970
}
7071

7172
}

frogorecyclerview/src/main/java/com/frogobox/recycler/core/FrogoRecyclerViewAdapter.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ abstract class FrogoRecyclerViewAdapter<T> :
6262
} else {
6363
if (hasMultiHolder) {
6464
if (hasEmptyView) {
65-
listCount = if (frogoHolder.size == 0) {
65+
listCount = if (frogoHolder.isEmpty()) {
6666
1
6767
} else {
6868
frogoHolder.size
@@ -73,7 +73,7 @@ abstract class FrogoRecyclerViewAdapter<T> :
7373
}
7474
} else {
7575
if (hasEmptyView) {
76-
listCount = if (asyncListDiffer.currentList.size == 0) {
76+
listCount = if (asyncListDiffer.currentList.isEmpty()) {
7777
1
7878
} else {
7979
asyncListDiffer.currentList.size
@@ -92,7 +92,7 @@ abstract class FrogoRecyclerViewAdapter<T> :
9292
} else {
9393
if (hasMultiHolder) {
9494
if (hasEmptyView) {
95-
if (frogoHolder.size != 0) {
95+
if (frogoHolder.isNotEmpty()) {
9696
holder.bindItem(
9797
data = frogoHolder[position].data,
9898
position = position,
@@ -110,7 +110,7 @@ abstract class FrogoRecyclerViewAdapter<T> :
110110
}
111111
} else {
112112
if (hasEmptyView) {
113-
if (asyncListDiffer.currentList.size != 0) {
113+
if (asyncListDiffer.currentList.isNotEmpty()) {
114114
holder.bindItem(
115115
data = asyncListDiffer.currentList[position],
116116
position = position,
@@ -206,12 +206,13 @@ abstract class FrogoRecyclerViewAdapter<T> :
206206
}
207207
}
208208

209-
open fun setupData(data: List<T>?) {
210-
this.asyncListDiffer.currentList.clear()
209+
open fun getItem(): MutableList<T> = asyncListDiffer.currentList.toMutableList()
211210

212-
if (data != null) {
213-
listData.addAll(data)
214-
this.asyncListDiffer.submitList(listData)
211+
open fun setItem(data: List<T>) {
212+
if (data.isEmpty()) {
213+
asyncListDiffer.submitList(listOf())
214+
} else {
215+
asyncListDiffer.submitList(data.map { it })
215216
}
216217
}
217218

@@ -227,11 +228,11 @@ abstract class FrogoRecyclerViewAdapter<T> :
227228

228229
open fun setupRequirement(
229230
customViewId: Int,
230-
data: List<T>?,
231+
data: List<T>,
231232
listener: FrogoRecyclerViewListener<T>?
232233
) {
233234
setupListener(listener)
234-
setupData(data)
235+
setItem(data)
235236
setupCustomLayout(customViewId)
236237
layoutHandling()
237238
}

frogorecyclerview/src/main/java/com/frogobox/recycler/ext/FrogoRecyclerViewExt.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,24 @@ fun <T> RecyclerView.getAdapterExt(): FrogoViewAdapter<T> {
4747
return this.adapter as FrogoViewAdapter<T>
4848
}
4949

50-
fun <T> RecyclerView.setupData(data: List<T>) {
51-
this.getAdapterExt<T>().setupData(data)
50+
fun <T> RecyclerView.setItem(data: List<T>) {
51+
this.getAdapterExt<T>().setItem(data)
52+
}
53+
54+
fun <T> RecyclerView.getItem(): List<T> {
55+
return this.getAdapterExt<T>().getItem()
5256
}
5357

5458
fun <T, VB : ViewBinding> RecyclerView.getAdapterBindingExt(): FrogoBindingAdapter<T, VB> {
5559
return this.adapter as FrogoBindingAdapter<T, VB>
5660
}
5761

58-
fun <T, VB : ViewBinding> RecyclerView.setupDataBinding(data: List<T>) {
59-
this.getAdapterBindingExt<T, VB>().setupData(data)
62+
fun <T, VB : ViewBinding> RecyclerView.setItemBinding(data: List<T>) {
63+
this.getAdapterBindingExt<T, VB>().setItem(data)
64+
}
65+
66+
fun <T, VB : ViewBinding> RecyclerView.getItemBinding(): List<T> {
67+
return this.getAdapterBindingExt<T, VB>().getItem()
6068
}
6169

6270
fun RecyclerView.addOnBottomScrollListener(onBottomReached: () -> Unit = {}) {

frogorecyclerview/src/main/java/com/frogobox/recycler/widget/FrogoRecyclerView.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,24 @@ class FrogoRecyclerView : RecyclerView,
9696
return this.adapter as FrogoViewAdapter<T>
9797
}
9898

99-
override fun <T> setupData(data: List<T>) {
100-
this.getAdapterExt<T>().setupData(data)
99+
override fun <T> setItem(data: List<T>) {
100+
this.getAdapterExt<T>().setItem(data)
101+
}
102+
103+
override fun <T> getItem(): List<T> {
104+
return this.getAdapterExt<T>().getItem()
101105
}
102106

103107
override fun <T, VB : ViewBinding> getAdapterBindingExt(): FrogoBindingAdapter<T, VB> {
104108
return this.adapter as FrogoBindingAdapter<T, VB>
105109
}
106110

107-
override fun <T, VB : ViewBinding> setupDataBinding(data: List<T>) {
108-
this.getAdapterBindingExt<T, VB>().setupData(data)
111+
override fun <T, VB : ViewBinding> setItemBinding(data: List<T>) {
112+
this.getAdapterBindingExt<T, VB>().setItem(data)
109113
}
110114

115+
override fun <T, VB : ViewBinding> getItemBinding(): List<T> {
116+
return this.getAdapterBindingExt<T, VB>().getItem()
117+
}
111118

112119
}

frogorecyclerview/src/main/java/com/frogobox/recycler/widget/IFrogoRecyclerView.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ interface IFrogoRecyclerView {
5454

5555
fun <T> getAdapterExt(): FrogoViewAdapter<T>
5656

57-
fun <T> setupData(data: List<T>)
57+
fun <T> setItem(data: List<T>)
58+
59+
fun <T> getItem(): List<T>
5860

5961
fun <T, VB : ViewBinding> getAdapterBindingExt(): FrogoBindingAdapter<T, VB>
6062

61-
fun <T, VB : ViewBinding> setupDataBinding(data: List<T>)
63+
fun <T, VB : ViewBinding> setItemBinding(data: List<T>)
64+
65+
fun <T, VB : ViewBinding> getItemBinding(): List<T>
6266

6367
}

0 commit comments

Comments
 (0)