Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guilhe/placeholderrecyclerview
A RecyclerView that can switch between items and placeholders
https://github.com/guilhe/placeholderrecyclerview
android androidx kotlin lottie-animation placeholder placeholder-recyclerview recyclerview recyclerview-adapter shimmer-recyclerview
Last synced: about 2 months ago
JSON representation
A RecyclerView that can switch between items and placeholders
- Host: GitHub
- URL: https://github.com/guilhe/placeholderrecyclerview
- Owner: GuilhE
- License: apache-2.0
- Created: 2020-04-26T17:36:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-29T17:20:46.000Z (over 2 years ago)
- Last Synced: 2023-07-26T21:57:42.697Z (over 1 year ago)
- Topics: android, androidx, kotlin, lottie-animation, placeholder, placeholder-recyclerview, recyclerview, recyclerview-adapter, shimmer-recyclerview
- Language: Kotlin
- Homepage: https://guilhe.github.io/PlaceHolderRecyclerView/
- Size: 5.87 MB
- Stars: 34
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PlaceHolderRecyclerView
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PlaceHolderRecyclerView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8193)
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](http://facebook.github.io/shimmer-android/), a [Lottie](https://airbnb.design/lottie/) animation or even [Property Animation](https://developer.android.com/guide/topics/resources/animation-resource). Use your imagination, it's your placeholder 😊
# Installation
PlaceHolderRecyclerView is distributed through [Maven Central](https://search.maven.org/artifact/com.github.guilhe/placeholder-recyclerview) and [Jitpack](https://jitpack.io/#GuilhE/PlaceHolderRecyclerView).
```groovy
implementation 'com.github.guilhe:placeholder-recyclerview:${LATEST_VERSION}'
```
[![Maven Central](https://img.shields.io/maven-central/v/com.github.guilhe/placeholder-recyclerview.svg)](https://search.maven.org/search?q=g:com.github.guilhe%20AND%20placeholder-recyclerview)## Usage
```xml
```
```kotlin
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) })
```
Don't recognise those chinese characters? They're from an awesome game called [Mahjong](https://en.wikipedia.org/wiki/Mahjong)
Lottie animation by [puput Santoso](https://lottiefiles.com/puput_santoso)
## Dependencies
- [androidx.recyclerview:recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview)## Bugs and Feedback
For bugs, questions and discussions please use the [Github Issues](https://github.com/GuilhE/PlaceHolderRecyclerView/issues).
## LICENSE
Copyright (c) 2020-present GuilhE
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License atUnless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.