@@ -50,9 +50,8 @@ class TabStrip extends LinearLayout {
50
50
private TabLayout .TabColorizer mCustomTabColorizer ;
51
51
private final SimpleTabColorizer mDefaultTabColorizer ;
52
52
53
- private int mDefaultTabTextColor ;
54
- private int mTabTextColor = -1 ;
55
- private int mSelectedTabTextColor = -1 ;
53
+ private int mTabTextColor ;
54
+ private int mSelectedTabTextColor ;
56
55
57
56
TabStrip (Context context ) {
58
57
this (context , null );
@@ -83,7 +82,10 @@ class TabStrip extends LinearLayout {
83
82
mSelectedIndicatorPaint = new Paint ();
84
83
85
84
TextView defaultTextView = new TextView (context );
86
- mDefaultTabTextColor = defaultTextView .getTextColors ().getDefaultColor ();
85
+ mTabTextColor = defaultTextView .getTextColors ().getDefaultColor ();
86
+
87
+ // Default selected color is the same as mTabTextColor
88
+ mSelectedTabTextColor = mTabTextColor ;
87
89
}
88
90
89
91
void setCustomTabColorizer (TabLayout .TabColorizer customTabColorizer ) {
@@ -122,20 +124,10 @@ private void updateTabsTextColor(){
122
124
LinearLayout linearLayout = (LinearLayout )getChildAt (i );
123
125
TextView textView = (TextView )linearLayout .getChildAt (1 );
124
126
if (i == mSelectedPosition ){
125
- if (mSelectedTabTextColor >= 0 ){
126
- textView .setTextColor (mSelectedTabTextColor );
127
- }
128
- else {
129
- textView .setTextColor (mDefaultTabTextColor );
130
- }
127
+ textView .setTextColor (mSelectedTabTextColor );
131
128
}
132
129
else {
133
- if (mTabTextColor >= 0 ){
134
- textView .setTextColor (mTabTextColor );
135
- }
136
- else {
137
- textView .setTextColor (mDefaultTabTextColor );
138
- }
130
+ textView .setTextColor (mTabTextColor );
139
131
}
140
132
}
141
133
}
0 commit comments