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)