@@ -44,10 +44,11 @@ public final class TutorialPageIndicator extends View implements TutorialImpl.In
44
44
private static final float ANGLE_360 = 360f ;
45
45
46
46
static final int NO_VALUE = -1 ;
47
- static final int DEFAULT_VALUE = 0 ;
48
47
static final int NO_COLOR = 1 ;
49
48
@ ColorInt
50
- static final int DEFAULT_COLOR = Color .RED ;
49
+ static final int DEFAULT_ELEMENT_COLOR = Color .LTGRAY ;
50
+ @ ColorInt
51
+ static final int DEFAULT_SELECTED_ELEMENT_COLOR = Color .WHITE ;
51
52
52
53
private final RectF mClipBounds = new RectF ();
53
54
private final RectF mElementBounds = new RectF ();
@@ -62,20 +63,28 @@ public final class TutorialPageIndicator extends View implements TutorialImpl.In
62
63
private boolean mIsInfiniteScroll ;
63
64
64
65
public TutorialPageIndicator (Context context ) {
65
- super (context );
66
+ this (context , null );
66
67
}
67
68
68
69
public TutorialPageIndicator (Context context , AttributeSet attrs ) {
69
- super (context , attrs );
70
+ this (context , attrs , 0 );
70
71
}
71
72
72
73
public TutorialPageIndicator (Context context , AttributeSet attrs , int defStyleAttr ) {
73
74
super (context , attrs , defStyleAttr );
75
+ initDefaultSizes (context );
76
+
74
77
}
75
78
76
79
@ TargetApi (Build .VERSION_CODES .LOLLIPOP )
77
80
public TutorialPageIndicator (Context context , AttributeSet attrs , int defStyleAttr , int defStyleRes ) {
78
81
super (context , attrs , defStyleAttr , defStyleRes );
82
+ initDefaultSizes (context );
83
+ }
84
+
85
+ private void initDefaultSizes (@ NonNull Context context ) {
86
+ mIndicatorElementSize = context .getResources ().getDimension (R .dimen .st_indicator_size_default );
87
+ mIndicatorElementSpacing = context .getResources ().getDimension (R .dimen .st_indicator_spacing_default );
79
88
}
80
89
81
90
void initWith (@ NonNull IndicatorOptions indicatorOptions , int pagesCount ) {
@@ -84,7 +93,7 @@ void initWith(@NonNull IndicatorOptions indicatorOptions, int pagesCount) {
84
93
if (indicatorOptions .getElementColor () != NO_COLOR ) {
85
94
elementColor = indicatorOptions .getElementColor ();
86
95
} else {
87
- elementColor = TutorialPageIndicator .DEFAULT_COLOR ;
96
+ elementColor = TutorialPageIndicator .DEFAULT_ELEMENT_COLOR ;
88
97
}
89
98
mIndicatorPaint .setColor (elementColor );
90
99
@@ -93,20 +102,16 @@ void initWith(@NonNull IndicatorOptions indicatorOptions, int pagesCount) {
93
102
if (indicatorOptions .getSelectedElementColor () != NO_COLOR ) {
94
103
selectedElementColor = indicatorOptions .getSelectedElementColor ();
95
104
} else {
96
- selectedElementColor = TutorialPageIndicator .DEFAULT_COLOR ;
105
+ selectedElementColor = TutorialPageIndicator .DEFAULT_SELECTED_ELEMENT_COLOR ;
97
106
}
98
107
mIndicatorSelectedPaint .setColor (selectedElementColor );
99
108
100
109
if (indicatorOptions .getElementSize () != NO_VALUE ) {
101
110
mIndicatorElementSize = indicatorOptions .getElementSize ();
102
- } else {
103
- mIndicatorElementSize = DEFAULT_VALUE ;
104
111
}
105
112
106
113
if (indicatorOptions .getElementSpacing () != NO_VALUE ) {
107
114
mIndicatorElementSpacing = indicatorOptions .getElementSpacing ();
108
- } else {
109
- mIndicatorElementSpacing = DEFAULT_VALUE ;
110
115
}
111
116
112
117
if (indicatorOptions .getRenderer () != null ) {
0 commit comments