@@ -50,9 +50,8 @@ class TabStrip extends LinearLayout {
5050 private TabLayout .TabColorizer mCustomTabColorizer ;
5151 private final SimpleTabColorizer mDefaultTabColorizer ;
5252
53- private int mDefaultTabTextColor ;
54- private int mTabTextColor = -1 ;
55- private int mSelectedTabTextColor = -1 ;
53+ private int mTabTextColor ;
54+ private int mSelectedTabTextColor ;
5655
5756 TabStrip (Context context ) {
5857 this (context , null );
@@ -83,7 +82,10 @@ class TabStrip extends LinearLayout {
8382 mSelectedIndicatorPaint = new Paint ();
8483
8584 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 ;
8789 }
8890
8991 void setCustomTabColorizer (TabLayout .TabColorizer customTabColorizer ) {
@@ -122,20 +124,10 @@ private void updateTabsTextColor(){
122124 LinearLayout linearLayout = (LinearLayout )getChildAt (i );
123125 TextView textView = (TextView )linearLayout .getChildAt (1 );
124126 if (i == mSelectedPosition ){
125- if (mSelectedTabTextColor >= 0 ){
126- textView .setTextColor (mSelectedTabTextColor );
127- }
128- else {
129- textView .setTextColor (mDefaultTabTextColor );
130- }
127+ textView .setTextColor (mSelectedTabTextColor );
131128 }
132129 else {
133- if (mTabTextColor >= 0 ){
134- textView .setTextColor (mTabTextColor );
135- }
136- else {
137- textView .setTextColor (mDefaultTabTextColor );
138- }
130+ textView .setTextColor (mTabTextColor );
139131 }
140132 }
141133 }
0 commit comments