├── .gitignore ├── README.md ├── apk └── app-debug.apk ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wang │ │ └── avi │ │ └── sample │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── wang │ │ └── avi │ │ └── sample │ │ ├── IndicatorActivity.java │ │ ├── MyCustomIndicator.java │ │ └── SampleActivity.java │ └── res │ ├── layout │ ├── activity_indicator.xml │ ├── activity_sample.xml │ └── item_indicator.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wang │ │ └── avi │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── wang │ │ └── avi │ │ ├── AVLoadingIndicatorView.java │ │ ├── Indicator.java │ │ └── indicators │ │ ├── BallBeatIndicator.java │ │ ├── BallClipRotateIndicator.java │ │ ├── BallClipRotateMultipleIndicator.java │ │ ├── BallClipRotatePulseIndicator.java │ │ ├── BallGridBeatIndicator.java │ │ ├── BallGridPulseIndicator.java │ │ ├── BallPulseIndicator.java │ │ ├── BallPulseRiseIndicator.java │ │ ├── BallPulseSyncIndicator.java │ │ ├── BallRotateIndicator.java │ │ ├── BallScaleIndicator.java │ │ ├── BallScaleMultipleIndicator.java │ │ ├── BallScaleRippleIndicator.java │ │ ├── BallScaleRippleMultipleIndicator.java │ │ ├── BallSpinFadeLoaderIndicator.java │ │ ├── BallTrianglePathIndicator.java │ │ ├── BallZigZagDeflectIndicator.java │ │ ├── BallZigZagIndicator.java │ │ ├── CubeTransitionIndicator.java │ │ ├── LineScaleIndicator.java │ │ ├── LineScalePartyIndicator.java │ │ ├── LineScalePulseOutIndicator.java │ │ ├── LineScalePulseOutRapidIndicator.java │ │ ├── LineSpinFadeLoaderIndicator.java │ │ ├── PacmanIndicator.java │ │ ├── SemiCircleSpinIndicator.java │ │ ├── SquareSpinIndicator.java │ │ └── TriangleSkewSpinIndicator.java │ └── res │ └── values │ ├── attrs.xml │ ├── strings.xml │ └── style.xml ├── screenshots └── avi.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.ap_ 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated files 11 | bin/ 12 | gen/ 13 | 14 | # Local configuration file (sdk path, etc) 15 | local.properties 16 | 17 | # Proguard folder generated by Eclipse 18 | proguard/ 19 | 20 | # Ignore gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Eclipse project files 25 | .classpath 26 | .project 27 | .settings/ 28 | 29 | # Intellij project files 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | 35 | # Mac system files 36 | .DS_Store 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED 2 | 3 | * * * 4 | 5 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AVLoadingIndicatorView-green.svg?style=flat)](https://android-arsenal.com/details/1/2686) 6 | 7 | AVLoadingIndicatorView 8 | =================== 9 | 10 | > **Now AVLoadingIndicatorView was updated version to 2.X , If you have any question or suggestion with this library , welcome to tell me !** 11 | 12 | ## Introduction 13 | AVLoadingIndicatorView is a collection of nice loading animations for Android. 14 | 15 | You can also find iOS version of this [here](https://github.com/ninjaprox/NVActivityIndicatorView). 16 | 17 | ## Demo 18 | ![avi](screenshots/avi.gif) 19 | 20 | ## Usage 21 | 22 | ### Step 1 23 | 24 | Add dependencies in build.gradle. 25 | ```groovy 26 | dependencies { 27 | compile 'com.wang.avi:library:2.1.3' 28 | } 29 | ``` 30 | 31 | ### Step 2 32 | 33 | Add the AVLoadingIndicatorView to your layout: 34 | 35 | Simple 36 | 37 | ```java 38 | 43 | ``` 44 | 45 | Advance 46 | 47 | ```java 48 | 57 | ``` 58 | 59 | ### Step 3 60 | 61 | It's very simple use just like . 62 | ```java 63 | void startAnim(){ 64 | avi.show(); 65 | // or avi.smoothToShow(); 66 | } 67 | 68 | void stopAnim(){ 69 | avi.hide(); 70 | // or avi.smoothToHide(); 71 | } 72 | 73 | ``` 74 | 75 | ## Custom Indicator 76 | 77 | See [MyCustomIndicator](https://github.com/81813780/AVLoadingIndicatorView/blob/master/app/src/main/java/com/wang/avi/sample/MyCustomIndicator.java) in Sample . 78 | 79 | ## Proguard 80 | 81 | When using proguard need add rules: 82 | 83 | ``` 84 | -keep class com.wang.avi.** { *; } 85 | -keep class com.wang.avi.indicators.** { *; } 86 | ``` 87 | 88 | Indicators is load from class names, proguard may change it (rename). 89 | 90 | ## Indicators 91 | 92 | As seen above in the **Demo**, the indicators are as follows: 93 | 94 | **Row 1** 95 | * `BallPulseIndicator` 96 | * `BallGridPulseIndicator` 97 | * `BallClipRotateIndicator` 98 | * `BallClipRotatePulseIndicator` 99 | 100 | **Row 2** 101 | * `SquareSpinIndicator` 102 | * `BallClipRotateMultipleIndicator` 103 | * `BallPulseRiseIndicator` 104 | * `BallRotateIndicator` 105 | 106 | **Row 3** 107 | * `CubeTransitionIndicator` 108 | * `BallZigZagIndicator` 109 | * `BallZigZagDeflectIndicator` 110 | * `BallTrianglePathIndicator` 111 | 112 | **Row 4** 113 | * `BallScaleIndicator` 114 | * `LineScaleIndicator` 115 | * `LineScalePartyIndicator` 116 | * `BallScaleMultipleIndicator` 117 | 118 | **Row 5** 119 | * `BallPulseSyncIndicator` 120 | * `BallBeatIndicator` 121 | * `LineScalePulseOutIndicator` 122 | * `LineScalePulseOutRapidIndicator` 123 | 124 | **Row 6** 125 | * `BallScaleRippleIndicator` 126 | * `BallScaleRippleMultipleIndicator` 127 | * `BallSpinFadeLoaderIndicator` 128 | * `LineSpinFadeLoaderIndicator` 129 | 130 | **Row 7** 131 | * `TriangleSkewSpinIndicator` 132 | * `PacmanIndicator` 133 | * `BallGridBeatIndicator` 134 | * `SemiCircleSpinIndicator` 135 | 136 | **Row 8** 137 | * `com.wang.avi.sample.MyCustomIndicator` 138 | 139 | ## Thanks 140 | - [NVActivityIndicatorView](https://github.com/ninjaprox/NVActivityIndicatorView) 141 | - [Connor Atherton](https://github.com/ConnorAtherton) 142 | 143 | ## Contact me 144 | 145 | If you have a better idea or way on this project, please let me know, thanks :) 146 | 147 | [Email](mailto:81813780@qq.com) 148 | 149 | [Weibo](http://weibo.com/601265161) 150 | 151 | [My Blog](http://hlong.xyz) 152 | 153 | ### License 154 | ``` 155 | Copyright 2015 jack wang 156 | 157 | Licensed under the Apache License, Version 2.0 (the "License"); 158 | you may not use this file except in compliance with the License. 159 | You may obtain a copy of the License at 160 | 161 | http://www.apache.org/licenses/LICENSE-2.0 162 | 163 | Unless required by applicable law or agreed to in writing, software 164 | distributed under the License is distributed on an "AS IS" BASIS, 165 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 166 | See the License for the specific language governing permissions and 167 | limitations under the License. 168 | ``` 169 | 170 | -------------------------------------------------------------------------------- /apk/app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarlonWang/AVLoadingIndicatorView/841f98d230b14f0617e541a8b421f8dd96acd030/apk/app-debug.apk -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.ap_ 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated files 11 | bin/ 12 | gen/ 13 | 14 | # Local configuration file (sdk path, etc) 15 | local.properties 16 | 17 | # Proguard folder generated by Eclipse 18 | proguard/ 19 | 20 | # Ignore gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Eclipse project files 25 | .classpath 26 | .project 27 | .settings/ 28 | 29 | # Intellij project files 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | 35 | # Mac system files 36 | .DS_Store 37 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.wang.avi.sample" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 33 12 | versionName "2.1.3" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | compile 'com.android.support:appcompat-v7:23.2.0' 25 | compile 'com.android.support:recyclerview-v7:23.2.0' 26 | compile project(':library') 27 | } 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\Jack\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/wang/avi/sample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.wang.avi.sample; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/wang/avi/sample/IndicatorActivity.java: -------------------------------------------------------------------------------- 1 | package com.wang.avi.sample; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | import com.wang.avi.AVLoadingIndicatorView; 9 | 10 | /** 11 | * Created by Jack Wang on 2016/8/5. 12 | */ 13 | 14 | public class IndicatorActivity extends AppCompatActivity{ 15 | 16 | private AVLoadingIndicatorView avi; 17 | 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_indicator); 22 | 23 | String indicator=getIntent().getStringExtra("indicator"); 24 | avi= (AVLoadingIndicatorView) findViewById(R.id.avi); 25 | avi.setIndicator(indicator); 26 | } 27 | 28 | public void hideClick(View view) { 29 | avi.hide(); 30 | // or avi.smoothToHide(); 31 | } 32 | 33 | public void showClick(View view) { 34 | avi.show(); 35 | // or avi.smoothToShow(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/wang/avi/sample/MyCustomIndicator.java: -------------------------------------------------------------------------------- 1 | package com.wang.avi.sample; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | 6 | import android.animation.ValueAnimator; 7 | import com.wang.avi.Indicator; 8 | 9 | import java.util.ArrayList; 10 | 11 | /** 12 | * Created by Jack Wang on 2016/8/5. 13 | */ 14 | 15 | public class MyCustomIndicator extends Indicator{ 16 | 17 | 18 | public static final float SCALE=1.0f; 19 | 20 | //scale x ,y 21 | private float[] scaleFloats=new float[]{SCALE, 22 | SCALE, 23 | SCALE, 24 | SCALE, 25 | SCALE}; 26 | 27 | 28 | 29 | @Override 30 | public void draw(Canvas canvas, Paint paint) { 31 | float circleSpacing=4; 32 | float radius=(Math.min(getWidth(),getHeight())-circleSpacing*2)/12; 33 | float x = getWidth()/ 2-(radius*2+circleSpacing); 34 | float y=getHeight() / 2; 35 | for (int i = 0; i < 4; i++) { 36 | canvas.save(); 37 | float translateX=x+(radius*2)*i+circleSpacing*i; 38 | canvas.translate(translateX, y); 39 | canvas.scale(scaleFloats[i], scaleFloats[i]); 40 | canvas.drawCircle(0, 0, radius, paint); 41 | canvas.restore(); 42 | } 43 | } 44 | 45 | @Override 46 | public ArrayList onCreateAnimators() { 47 | ArrayList animators=new ArrayList<>(); 48 | int[] delays=new int[]{120,240,360,480}; 49 | for (int i = 0; i < 4; i++) { 50 | final int index=i; 51 | 52 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1); 53 | 54 | scaleAnim.setDuration(750); 55 | scaleAnim.setRepeatCount(-1); 56 | scaleAnim.setStartDelay(delays[i]); 57 | 58 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() { 59 | @Override 60 | public void onAnimationUpdate(ValueAnimator animation) { 61 | scaleFloats[index] = (float) animation.getAnimatedValue(); 62 | postInvalidate(); 63 | 64 | } 65 | }); 66 | animators.add(scaleAnim); 67 | } 68 | return animators; 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/wang/avi/sample/SampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.wang.avi.sample; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.GridLayoutManager; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.wang.avi.AVLoadingIndicatorView; 13 | 14 | /** 15 | * Created by Jack Wang on 2016/8/5. 16 | */ 17 | 18 | public class SampleActivity extends AppCompatActivity{ 19 | 20 | private RecyclerView mRecycler; 21 | 22 | @Override 23 | protected void onCreate(@Nullable Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_sample); 26 | 27 | mRecycler= (RecyclerView) findViewById(R.id.recycler); 28 | 29 | GridLayoutManager layoutManager=new GridLayoutManager(this,4); 30 | mRecycler.setLayoutManager(layoutManager); 31 | mRecycler.setAdapter(new RecyclerView.Adapter() { 32 | @Override 33 | public IndicatorHolder onCreateViewHolder(ViewGroup parent, int viewType) { 34 | View itemView=getLayoutInflater().inflate(R.layout.item_indicator,parent,false); 35 | return new IndicatorHolder(itemView); 36 | } 37 | 38 | @Override 39 | public void onBindViewHolder(IndicatorHolder holder, final int position) { 40 | holder.indicatorView.setIndicator(INDICATORS[position]); 41 | holder.itemLayout.setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View v) { 44 | Intent intent=new Intent(SampleActivity.this,IndicatorActivity.class); 45 | intent.putExtra("indicator",INDICATORS[position]); 46 | startActivity(intent); 47 | } 48 | }); 49 | } 50 | 51 | @Override 52 | public int getItemCount() { 53 | return INDICATORS.length; 54 | } 55 | }); 56 | } 57 | 58 | final static class IndicatorHolder extends RecyclerView.ViewHolder{ 59 | 60 | public AVLoadingIndicatorView indicatorView; 61 | public View itemLayout; 62 | 63 | public IndicatorHolder(View itemView) { 64 | super(itemView); 65 | itemLayout= itemView.findViewById(R.id.itemLayout); 66 | indicatorView= (AVLoadingIndicatorView) itemView.findViewById(R.id.indicator); 67 | } 68 | } 69 | 70 | 71 | 72 | private static final String[] INDICATORS=new String[]{ 73 | "BallPulseIndicator", 74 | "BallGridPulseIndicator", 75 | "BallClipRotateIndicator", 76 | "BallClipRotatePulseIndicator", 77 | "SquareSpinIndicator", 78 | "BallClipRotateMultipleIndicator", 79 | "BallPulseRiseIndicator", 80 | "BallRotateIndicator", 81 | "CubeTransitionIndicator", 82 | "BallZigZagIndicator", 83 | "BallZigZagDeflectIndicator", 84 | "BallTrianglePathIndicator", 85 | "BallScaleIndicator", 86 | "LineScaleIndicator", 87 | "LineScalePartyIndicator", 88 | "BallScaleMultipleIndicator", 89 | "BallPulseSyncIndicator", 90 | "BallBeatIndicator", 91 | "LineScalePulseOutIndicator", 92 | "LineScalePulseOutRapidIndicator", 93 | "BallScaleRippleIndicator", 94 | "BallScaleRippleMultipleIndicator", 95 | "BallSpinFadeLoaderIndicator", 96 | "LineSpinFadeLoaderIndicator", 97 | "TriangleSkewSpinIndicator", 98 | "PacmanIndicator", 99 | "BallGridBeatIndicator", 100 | "SemiCircleSpinIndicator", 101 | "com.wang.avi.sample.MyCustomIndicator" 102 | }; 103 | 104 | } 105 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_indicator.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 28 | 29 |