Skip to content

samlss/IntertwineLoadingView

Repository files navigation

IntertwineLoadingView

A two intertwined balls loading view.


Api reqeust MIT Licence Blog

The default effect

gif1

The effect of custom animation duration & color

gif2

Use

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        //...
        maven { url 'https://jitpack.io' }
    }
}

Add it in your app build.gradle at the end of repositories:

dependencies {
    implementation 'com.github.samlss:IntertwineLoadingView:1.0'
}

in layout.xml:

  <com.iigo.library.IntertwineLoadingView
            app:animDuration="1000"
            app:firstBallColor="@android:color/holo_red_dark"
            app:secondBallColor="@android:color/holo_orange_dark"
            android:layout_width="70dp"
            android:layout_height="70dp"/>

in java code:

  intertwineLoadingView.setDuration(1000); //Set animation duration
  intertwineLoadingView.setFirstBallColor(Color.RED); //Set the color of the first ball
  intertwineLoadingView.setSecondBallColor(Color.YELLOW); //Set the color of the second ball

  intertwineLoadingView.start(); //start animation
  intertwineLoadingView.stop(); //stop animation
  
  intertwineLoadingView.pause(); //pause animation
  intertwineLoadingView.resume(); //resume animation
  intertwineLoadingView.release(); //Can 'released' when you don't need to use the loading view, for example in the activity's onDestroy()

Attributes description:

attr description
firstBallColor the color of the first ball
secondBallColor the color of the second ball
animDuration the animation duration