Skip to content

Commit ee2d517

Browse files
committed
Add smooth to display
1 parent 5f08250 commit ee2d517

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ It's very simple use just like .
5858
```java
5959
void startAnim(){
6060
avi.show();
61+
// or avi.smoothToShow();
6162
}
6263

6364
void stopAnim(){
6465
avi.hide();
66+
// or avi.smoothToHide();
6567
}
6668

6769
```

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2727

2828
public void hideClick(View view) {
2929
avi.hide();
30+
// or avi.smoothToHide();
3031
}
3132

3233
public void showClick(View view) {
3334
avi.show();
35+
// or avi.smoothToShow();
3436
}
3537
}

library/src/main/java/com/wang/avi/AVLoadingIndicatorView.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import android.util.AttributeSet;
1414
import android.util.Log;
1515
import android.view.View;
16+
import android.view.animation.AnimationUtils;
1617

1718
public class AVLoadingIndicatorView extends View {
1819

@@ -159,6 +160,16 @@ public void setIndicator(String indicatorName){
159160
}
160161
}
161162

163+
public void smoothToShow(){
164+
startAnimation(AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_in));
165+
setVisibility(VISIBLE);
166+
}
167+
168+
public void smoothToHide(){
169+
startAnimation(AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_out));
170+
setVisibility(GONE);
171+
}
172+
162173
public void hide() {
163174
mDismissed = true;
164175
removeCallbacks(mDelayedShow);

0 commit comments

Comments
 (0)