发表1 分钟读完 (大约164个字)
Android专栏-BaseQuickAdapterHelper
Android专栏-BaseQuickAdapterHelper
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| import android.view.View import android.view.ViewGroup import com.chad.library.adapter.base.loadmore.BaseLoadMoreView import com.chad.library.adapter.base.loadmore.LoadMoreStatus import com.chad.library.adapter.base.util.getItemView import com.chad.library.adapter.base.viewholder.BaseViewHolder
class LoadingFooterView : BaseLoadMoreView() { private var loadingView: LoadingPagView? = null override fun getRootView(parent: ViewGroup): View { val rootView = parent.getItemView(R.layout.ui_footer_adapter_load_more) loadingView = rootView.findViewById(R.id.loadingView) return rootView }
override fun getLoadingView(holder: BaseViewHolder): View { return holder.getView(R.id.loadingView) }
override fun getLoadComplete(holder: BaseViewHolder): View { return holder.getView(R.id.fakeView) }
override fun getLoadEndView(holder: BaseViewHolder): View { return holder.getView(R.id.endView) }
override fun getLoadFailView(holder: BaseViewHolder): View { return holder.getView(R.id.fakeView) }
override fun convert(holder: BaseViewHolder, position: Int, loadMoreStatus: LoadMoreStatus) { super.convert(holder, position, loadMoreStatus) when (loadMoreStatus) { LoadMoreStatus.Complete -> { loadingView?.stopPlay() } LoadMoreStatus.Loading -> { loadingView?.startPlay() } LoadMoreStatus.Fail -> {
} LoadMoreStatus.End -> { loadingView?.stopPlay() } } } }
|