From c80967a455f1aa12b44159f48b0bcf7f8535ebbe Mon Sep 17 00:00:00 2001 From: beiger <1441512921@qq.com> Date: Sun, 16 Dec 2018 19:40:00 +0800 Subject: [PATCH] fix bug --- .../bing/mvvmbase/base/recycleview/BaseRecycleViewAdapter.kt | 3 ++- .../bing/mvvmbase/base/recycleview/BaseRecycleViewFragment.kt | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewAdapter.kt b/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewAdapter.kt index 669ef29..96af78a 100644 --- a/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewAdapter.kt +++ b/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewAdapter.kt @@ -13,7 +13,8 @@ import androidx.recyclerview.widget.RecyclerView abstract class BaseRecycleViewAdapter> : RecyclerView.Adapter() { var data: List? = ArrayList() - set(data_temp) { + + fun updateData(data_temp: List?) { if (data_temp == null) { return } diff --git a/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewFragment.kt b/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewFragment.kt index dfc24cb..8042b02 100644 --- a/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewFragment.kt +++ b/mvvmbase/src/main/java/com/bing/mvvmbase/base/recycleview/BaseRecycleViewFragment.kt @@ -22,7 +22,6 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.RecyclerView import io.reactivex.disposables.CompositeDisposable @@ -132,7 +131,7 @@ abstract class BaseRecycleViewFragment mAdapter.data = list }) + data.observe(this, Observer { list -> mAdapter.updateData(list) }) refreshState.observe(this, Observer { status -> if (status != Status.LOADING) { mRefreshLayout.finishRefresh(status == Status.SUCCESS)