PlaceHolderRecyclerView

A RecyclerView that can switch between items and placeholders

This libs doesn't force a placehoder type, the developer is responsible for creating one, checkout the sample module and see how simple it is.

You can use the best beloved Shimmer-Android, a Lottie animation or even Property Animation. Use your imagination, it's your placeholder.

A RecyclerView that can switch between items and placeholders

A RecyclerView that can switch between items and placeholders

A RecyclerView that can switch between items and placeholders

Installation

PlaceHolderRecyclerView is distributed through Maven Central, Jcenter and Jitpack.

implementation 'com.github.guilhe:placeholder-recyclerview:${LATEST_VERSION}'

A RecyclerView that can switch between items and placeholders A RecyclerView that can switch between items and placeholders A RecyclerView that can switch between items and placeholders

Usage

<com.github.guilhe.views.PlaceHolderRecyclerView
        android:id="@+id/my_RecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
class MyItemsPlaceHolderAdapter : ..., PlaceHolderAdapter { ... }

private val itemsAdapter = MyItemsAdapter()
...
with(binding.myRecyclerView) {
    adapter = itemsAdapter
    holdersAdapter = MyItemsPlaceHolderAdapter()
    holdersItemDecoration = MyItemsDecoration() //if needed
}
...
viewModel.items.observe(this, { itemsAdapter.update(it) })
viewModel.isLoading.observe(this, { isLoading -> binding.myRecyclerView.toggleHoldersAdapter(isLoading) })

A RecyclerView that can switch between items and placeholders

GitHub