Home

Awesome

<a href="https://www.simform.com/"><img src="https://github.com/SimformSolutionsPvtLtd/SSToastMessage/blob/master/simformBanner.png"></a>

SSPullToRefresh

Pull to Refresh with custom animations

Kotlin Version Platform API

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.

Features

🎬 Preview

Default refreshViewGif animationWave animation (Custom class)
<a href="sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt#L227"></a><a href="app/src/main/java/com/simform/demo/WaveAnimation.kt"></a>
Lottie animation 1Lottie animation 2Lottie animation 3
<a href="sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt#L218"></a><a href="sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt#L218"></a><a href="sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt#L218"></a>
Custom view with user interactions
<a href="app/src/main/java/com/simform/demo/CustomView.kt"></a>

How it works:

  1. Gradle Dependency
allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencyResolutionManagement {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.5.2'
}
  1. Wrap your refreshing view (RecyclerView, listView etc..) with SSPullToRefreshLayout
<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>
  1. Set OnRefreshListener on SSPullToRefreshLayout and you are good to go 👍
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()
   }
}

To customize SSPullToRefreshLayout:

ssPullRefresh.setLottieAnimation("lottie_isometric-plane.json")
ssPullRefresh.setRepeatMode(SSPullToRefreshLayout.RepeatMode.REPEAT)
ssPullRefresh.setRepeatCount(SSPullToRefreshLayout.RepeatCount.INFINITE)
ssPullRefresh.setRefreshStyle(SSPullToRefreshLayout.RefreshStyle.NORMAL)
ssPullRefresh.setRefreshView(WaveAnimation(this))
ssPullRefresh.setRefreshViewParams(
   ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT,
      300
   )
)
ssPullRefresh.setGifAnimation(R.raw.bird)

Other Library used:

Credits:

Find this library useful? ❤️

Support it by joining stargazers for this repository.⭐

🤝 How to Contribute

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.

iOS Library:

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

Awesome Mobile Libraries

License

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.