Skip to content

Commit d778a73

Browse files
committed
fix crash in pre-Lollipop
1 parent b61816d commit d778a73

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,32 @@ public class AVLoadingIndicatorView extends View {
2929
private boolean mShouldStartAnimationDrawable;
3030

3131
public AVLoadingIndicatorView(Context context) {
32-
this(context, null);
32+
super(context);
33+
init(context, null,0,0);
3334
}
3435

3536
public AVLoadingIndicatorView(Context context, AttributeSet attrs) {
36-
this(context, attrs, 0);
37+
super(context, attrs);
38+
init(context, attrs,0,0);
3739
}
3840

3941
public AVLoadingIndicatorView(Context context, AttributeSet attrs, int defStyleAttr) {
40-
this(context, attrs, defStyleAttr, R.style.AVLoadingIndicatorView);
42+
super(context, attrs, defStyleAttr);
43+
init(context, attrs,defStyleAttr,R.style.AVLoadingIndicatorView);
4144
}
4245

4346
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
4447
public AVLoadingIndicatorView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
4548
super(context, attrs, defStyleAttr, defStyleRes);
46-
init();
49+
init(context,attrs,defStyleAttr,R.style.AVLoadingIndicatorView);
50+
}
51+
52+
private void init(Context context,AttributeSet attrs,int defStyleAttr, int defStyleRes) {
53+
mMinWidth = 24;
54+
mMaxWidth = 48;
55+
mMinHeight = 24;
56+
mMaxHeight = 48;
57+
4758
final TypedArray a = context.obtainStyledAttributes(
4859
attrs, R.styleable.AVLoadingIndicatorView, defStyleAttr, defStyleRes);
4960

@@ -58,13 +69,6 @@ public AVLoadingIndicatorView(Context context, AttributeSet attrs, int defStyleA
5869
a.recycle();
5970
}
6071

61-
private void init() {
62-
mMinWidth = 24;
63-
mMaxWidth = 48;
64-
mMinHeight = 24;
65-
mMaxHeight = 48;
66-
}
67-
6872
public Indicator getIndicator() {
6973
return mIndicator;
7074
}

0 commit comments

Comments
 (0)