SSPullToRefresh makes PullRefresh easy to use, you can provide your own custom animations or set simple gifs on refresh view. The best feature is Lottie animations in refresh view, it uses lottie animations to render high quality animations on pull refresh. 🎉💥
SSPullToRefresh makes PullRefresh easy to use, you can provide your own custom animations or set simple gifs on refresh view. The best feature is Lottie animations in refresh view, it uses lottie animations to render high quality animations on pull refresh.
Default refreshView | Gif animation | Wave animation (Custom class) |
---|---|---|
Lottie animation 1 | Lottie animation 2 | Lottie animation 3 |
---|---|---|
Custom view with user interactions |
---|
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencyResolutionManagement {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.5.2'
}
<com.simform.refresh.SSPullToRefreshLayout
android:id="@+id/ssPullRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.simform.refresh.SSPullToRefreshLayout>
ssPullRefresh.setOnRefreshListener {
CoroutineScope(Dispatchers.Main).launch {
delay(2000)
ssPullRefresh.setRefreshing(false) // This stops refreshing
mAdapter.randomizeData()
Toast.makeText(
this@MainActivity,
"Refresh Complete",
Toast.LENGTH_SHORT
).show()
}
}
ssPullRefresh.setLottieAnimation("lottie_isometric-plane.json")
ssPullRefresh.setRepeatMode(SSPullToRefreshLayout.RepeatMode.REPEAT)
ssPullRefresh.setRepeatCount(SSPullToRefreshLayout.RepeatCount.INFINITE)
ssPullRefresh.setRefreshStyle(SSPullToRefreshLayout.RefreshStyle.NORMAL)
To customize the whole refresh view you need to inherit SSAnimationView for your custom class and override the methods needed
Here is an example class WaveAnimation.
Provide your CustomView by setRefreshView() method
ssPullRefresh.setRefreshView(WaveAnimation(this))
ssPullRefresh.setRefreshViewParams(
ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
300
)
)
ssPullRefresh.setGifAnimation(R.raw.bird)
Support it by joining stargazers for this repository.⭐
Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 Check out our Contributing Guide for ideas on contributing.
For bugs, feature requests, and discussion please use GitHub Issues.
MIT License
Copyright (c) 2022 Simform Solutions
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.