Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2021 11:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
class FooterAdapter : LoadStateAdapter<FooterAdapter.ViewHolder>() {
private lateinit var binding: FooterProgressBarBinding
class ViewHolder(binding: FooterProgressBarBinding) : RecyclerView.ViewHolder(binding.root)
override fun onCreateViewHolder(parent: ViewGroup, loadState: LoadState): ViewHolder {
binding = FooterProgressBarBinding.inflate(
LayoutInflater.from(parent.context), parent, false
return ViewHolder(binding)
override fun onBindViewHolder(holder: ViewHolder, loadState: LoadState) {
if (loadState is LoadState.Loading) {
binding.progressBar.visibility = View.VISIBLE
} else {
binding.progressBar.visibility = View.GONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment