Skip to content

Commit 1eeea9f

Browse files
committed
Update sample
1 parent a109223 commit 1eeea9f

File tree

6 files changed

+119
-485
lines changed

6 files changed

+119
-485
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
AVLoadingIndicatorView
44
===================
55

6+
**Now AVLoadingIndicatorView was updated version to 2.0 , If you have any question or suggestion with this library , welcome to tell me !**
7+
8+
如果你对实现各种酷炫的动画效果感兴趣 , 欢迎一起交流 :)
9+
10+
**Android动画开源交流QQ群 : 199750106**
11+
612
## Introduction
713
AVLoadingIndicatorView is a collection of nice loading animations for Android.
814

@@ -20,7 +26,7 @@ You can also find iOS version of this [here](https://github.com/ninjaprox/NVActi
2026
Add dependencies in build.gradle.
2127
```groovy
2228
dependencies {
23-
compile 'com.wang.avi:library:1.0.5'
29+
compile 'com.wang.avi:library:2.0.0'
2430
compile 'com.nineoldandroids:library:2.4.0'
2531
}
2632
```
@@ -33,9 +39,10 @@ Add the AVLoadingIndicatorView to your layout:
3339
android:id="@+id/avi"
3440
android:layout_width="wrap_content" //or your custom size
3541
android:layout_height="wrap_content" //or your custom size
42+
style="@style/AVLoadingIndicatorView"// or AVLoadingIndicatorView.Large or AVLoadingIndicatorView.Small
3643
android:visibility="visible" //visible or gone
37-
app:indicator="BallPulse"
38-
app:indicator_color="your color"
44+
app:indicatorName="BallPulseIndicator"//Indicator Name
45+
app:indicatorColor="your color"
3946
/>
4047
```
4148

@@ -53,8 +60,6 @@ It's very simple use just like Progressbar.
5360

5461
```
5562

56-
If you want use this with Dialog , Here are mine [com.wang.avi.sample.MainActivity](https://github.com/81813780/AVLoadingIndicatorView/blob/master/app/src/main/java/com/wang/avi/sample/MainActivity.java).
57-
5863
## Indicators
5964

6065
As seen above in the **Demo**, the indicators are as follows:
@@ -114,6 +119,7 @@ As seen above in the **Demo**, the indicators are as follows:
114119

115120
[Weibo](http://weibo.com/601265161)
116121

122+
[My Blog](http://hlong.xyz)
117123

118124

119125

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ android {
2222
dependencies {
2323
compile fileTree(include: ['*.jar'], dir: 'libs')
2424
compile 'com.android.support:appcompat-v7:23.2.0'
25+
compile 'com.android.support:recyclerview-v7:23.2.0'
2526
compile project(':library')
2627
}

app/src/main/java/com/wang/avi/sample/SampleActivity.java

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,90 @@
33
import android.os.Bundle;
44
import android.support.annotation.Nullable;
55
import android.support.v7.app.AppCompatActivity;
6+
import android.support.v7.widget.GridLayoutManager;
7+
import android.support.v7.widget.RecyclerView;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
11+
import com.wang.avi.AVLoadingIndicatorView;
612

713
/**
814
* Created by Jack Wang on 2016/8/5.
915
*/
1016

1117
public class SampleActivity extends AppCompatActivity{
1218

19+
private RecyclerView mRecycler;
20+
1321
@Override
1422
protected void onCreate(@Nullable Bundle savedInstanceState) {
1523
super.onCreate(savedInstanceState);
16-
setContentView(R.layout.activity_loading);
24+
setContentView(R.layout.activity_sample);
25+
26+
mRecycler= (RecyclerView) findViewById(R.id.recycler);
27+
28+
GridLayoutManager layoutManager=new GridLayoutManager(this,4);
29+
mRecycler.setLayoutManager(layoutManager);
30+
mRecycler.setAdapter(new RecyclerView.Adapter<IndicatorHolder>() {
31+
@Override
32+
public IndicatorHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33+
View itemView=getLayoutInflater().inflate(R.layout.item_indicator,parent,false);
34+
return new IndicatorHolder(itemView);
35+
}
36+
37+
@Override
38+
public void onBindViewHolder(IndicatorHolder holder, int position) {
39+
holder.indicatorView.setIndicator(INDICATORS[position]);
40+
}
41+
42+
@Override
43+
public int getItemCount() {
44+
return INDICATORS.length;
45+
}
46+
});
47+
}
48+
49+
final static class IndicatorHolder extends RecyclerView.ViewHolder{
50+
51+
public AVLoadingIndicatorView indicatorView;
1752

53+
public IndicatorHolder(View itemView) {
54+
super(itemView);
55+
indicatorView= (AVLoadingIndicatorView) itemView.findViewById(R.id.indicator);
56+
}
1857
}
1958

59+
60+
61+
private static final String[] INDICATORS=new String[]{
62+
"BallPulseIndicator",
63+
"BallGridPulseIndicator",
64+
"BallClipRotateIndicator",
65+
"BallClipRotatePulseIndicator",
66+
"SquareSpinIndicator",
67+
"BallClipRotateMultipleIndicator",
68+
"BallPulseRiseIndicator",
69+
"BallRotateIndicator",
70+
"CubeTransitionIndicator",
71+
"BallZigZagIndicator",
72+
"BallZigZagDeflectIndicator",
73+
"BallTrianglePathIndicator",
74+
"BallScaleIndicator",
75+
"LineScaleIndicator",
76+
"LineScalePartyIndicator",
77+
"BallScaleMultipleIndicator",
78+
"BallPulseSyncIndicator",
79+
"BallBeatIndicator",
80+
"LineScalePulseOutIndicator",
81+
"LineScalePulseOutRapidIndicator",
82+
"BallScaleRippleIndicator",
83+
"BallScaleRippleMultipleIndicator",
84+
"BallSpinFadeLoaderIndicator",
85+
"LineSpinFadeLoaderIndicator",
86+
"TriangleSkewSpinIndicator",
87+
"PacmanIndicator",
88+
"BallGridBeatIndicator",
89+
"SemiCircleSpinIndicator"
90+
};
91+
2092
}

0 commit comments

Comments
 (0)