Skip to content

10clouds/ParticlesRefreshLayout-android

Repository files navigation

Particles Refresh Layout Build StatusDownload library

Sample

Sample Particles Refresh Layout

Installation

Just use the Maven repository. Library is on jCenter and mavenCentral.

Gradle:

implementation 'com.tenclouds.particlesrefreshlayout:particles-refresh-layout:{last_release_version}'

SBT:

libraryDependencies += "com.tenclouds.particlesrefreshlayout" % "particles-refresh-layout" % "{last_release_version}"

Maven:

<dependency>
  <groupId>com.tenclouds.particlesrefreshlayout</groupId>
  <artifactId>particles-refresh-layout</artifactId>
  <version>{last_release_version}</version>
  <type>aar</type>
</dependency>

Usage

Wrap your View in ParticlesRefreshLayout in your layout:

<com.tenclouds.particlesrefreshlayout.ParticlesRefreshLayout
            android:id="@+id/particlesRefreshLayout"
            android:layout_height="wrap_content"
            android:layout_width="0dp">
            
        <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>
                
</com.tenclouds.particlesrefreshlayout.ParticlesRefreshLayout>

then listen to start refresh actions:

particlesSwipeRefresh.onParticleRefreshListener = object : OnParticleRefreshListener {
            override fun onRefresh() {
                // do an action and stop refreshing after  
                particlesSwipeRefresh.stopRefreshing()
            }
        }

Application with example is in app folder

Customization

You can customize component from XML layout file, using attributes:

app:accentColor="@color/accentColor"
app:isSmallSize="true"

or from Java/Kotlin code:

particlesSwipeRefresh.accentColor = ContextCompat.getColor(this, R.color.accentColor)
particlesSwipeRefresh.isSmallSize = true

Library made by Jakub Jodełka