Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
beiger authored and 刘冰冰 committed Dec 17, 2018
1 parent c43f399 commit c80967a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import androidx.recyclerview.widget.RecyclerView

abstract class BaseRecycleViewAdapter<T : IsSame, VH: BaseViewHolder<*>> : RecyclerView.Adapter<VH>() {
var data: List<T>? = ArrayList()
set(data_temp) {

fun updateData(data_temp: List<T>?) {
if (data_temp == null) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -132,7 +131,7 @@ abstract class BaseRecycleViewFragment<DB : ViewDataBinding, VM : BaseViewModel,
}
}
})
data.observe(this, Observer { list -> 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)
Expand Down

0 comments on commit c80967a

Please sign in to comment.