Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import java.lang.reflect.Field;
import java.util.ArrayList;
import androidx.swiperefreshlayout.widget.CircularProgressDrawable;

/**
* Created by tangyinsheng on 2017/6/20.
Expand Down Expand Up @@ -250,6 +251,7 @@ private static void recycleView(View view) {
// Ignored.
}


if (view.getBackground() != null) {
view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
Expand All @@ -259,9 +261,16 @@ public void onViewAttachedToWindow(View v) {

@Override
public void onViewDetachedFromWindow(View v) {
Drawable drawable = v.getDrawable();
if (drawable instanceof CircularProgressDrawable) {
v.removeOnAttachStateChangeListener(this);
return;
}
try {
v.getBackground().setCallback(null);
v.setBackgroundDrawable(null);
if (drawable != null) {
v.getBackground().setCallback(null);
v.setBackgroundDrawable(null);
}
} catch (Throwable ignored) {
// Ignored.
}
Expand Down Expand Up @@ -421,4 +430,5 @@ private static void recycleViewGroup(ViewGroup vg) {
unbindDrawablesAndRecycle(vg.getChildAt(i));
}
}

}