@@ -19,11 +19,12 @@ public class OnboardingFragment extends Fragment implements Serializable {
19
19
20
20
// the fragment initialization parameters
21
21
private static final String TITLE = "TITLE" ;
22
+ private final static String TITLE_TEXT_COLOR = "TITLE_TEXT_COLOR" ;
22
23
private static final String BODY_TEXT = "BODY_TEXT" ;
24
+ private final static String BODY_TEXT_COLOR = "TITLE_TEXT_COLOR" ;
23
25
private static final String IMAGE_RESOURCE_ID = "IMAGE_RESOURCE_ID" ;
24
26
private static final String POSITION = "POSITION" ;
25
27
private static final String BUTTON_TEXT = "BUTTON_TEXT" ;
26
- public final static String BUTTON_BACKGROUND_COLOR = "BUTTON_BACKGROUND_COLOR" ;
27
28
28
29
public OnboardingFragment () {
29
30
// Required empty public constructor
@@ -37,6 +38,8 @@ public static OnboardingFragment newInstance(OnboardingPage onboardingPage, int
37
38
args .putInt (IMAGE_RESOURCE_ID , onboardingPage .getImageResId ());
38
39
args .putInt (POSITION , position );
39
40
args .putString (BUTTON_TEXT , onboardingPage .getButtonText ());
41
+ args .putInt (TITLE_TEXT_COLOR , onboardingPage .getTitleTextColor ());
42
+ args .putInt (BODY_TEXT_COLOR ,onboardingPage .getBodyTextColor ());
40
43
fragment .setArguments (args );
41
44
return fragment ;
42
45
}
@@ -60,6 +63,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
60
63
/* The button text (if the user set any) */
61
64
String buttonText = bundle .getString (BUTTON_TEXT , null );
62
65
66
+ @ ColorRes int titleTextColor = bundle .getInt (TITLE_TEXT_COLOR , -1 );
67
+ @ ColorRes int bodyTextColor = bundle .getInt (BODY_TEXT_COLOR ,-1 );
68
+
63
69
TextView titleTextView = (TextView ) view .findViewById (R .id .onboarding_fragment_title );
64
70
TextView bodyTextView = (TextView ) view .findViewById (R .id .onboarding_fragment_body_text );
65
71
ImageView imageView = (ImageView ) view .findViewById (R .id .onboarding_fragment_image );
@@ -68,13 +74,21 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
68
74
//Set the title
69
75
if (title !=null ) {
70
76
titleTextView .setText (title );
77
+ //Set the body text color
78
+ if (titleTextColor !=-1 ) {
79
+ titleTextView .setTextColor (getResources ().getColor (titleTextColor ));
80
+ }
71
81
} else {
72
82
titleTextView .setVisibility (View .GONE );
73
83
}
74
84
75
85
//Set the body text
76
86
if (bodyText !=null ) {
77
87
bodyTextView .setText (bodyText );
88
+ //Set the body text color
89
+ if (bodyTextColor !=-1 ) {
90
+ bodyTextView .setTextColor (getResources ().getColor (bodyTextColor ));
91
+ }
78
92
} else {
79
93
bodyTextView .setVisibility (View .GONE );
80
94
}
0 commit comments