dinuscxj / RecyclerRefreshLayout

A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc. really a practical RefreshLayout!
1.67k stars 253 forks source link

Refreshing animation is frozen #6

Closed mauriciogior closed 7 years ago

mauriciogior commented 7 years ago

The refreshing animation is always static. Here is an example:

screen shot 2016-08-25 at 6 35 57 pm

Ps: only happens on emulator.

dinuscxj commented 7 years ago

Maybe your emulator not support AnimationDrawable well, the default animation just defined in the xml spinner

dinuscxj commented 7 years ago

@mauriciogior the compileSdkVersion that you are using is lower 23 ?

mauriciogior commented 7 years ago

@dinuscxj I'm using 24.

dinuscxj commented 7 years ago

@mauriciogior 👌!

dinuscxj commented 7 years ago

@mauriciogior I get it. the line 65 ~ 66 of the RefreshView need to reverse the order. The refreshing animation is always static, because the AnimationDrawable is not yet fully attached to the window. if you want to learn more, you can click the link

change the following code

    @Override
    public void refreshing() {
        clearAnimation();

        AnimationDrawable drawable = (AnimationDrawable) getResources().getDrawable(R.drawable.spinner);
        drawable.start();
        this.setImageDrawable(drawable);
    }

to

    @Override
    public void refreshing() {
        clearAnimation();

        AnimationDrawable drawable = (AnimationDrawable) getResources().getDrawable(R.drawable.spinner);
        this.setImageDrawable(drawable);
        drawable.start();
    }