33
44import android .os .Parcel ;
55import android .os .Parcelable ;
6+ import android .support .annotation .ColorRes ;
7+ import android .support .annotation .DrawableRes ;
8+ import android .support .annotation .NonNull ;
9+ import android .support .annotation .Nullable ;
10+ import android .support .annotation .StringRes ;
611
712public class TutorialItem implements Parcelable {
813 private String titleText ;
914 private String subTitleText ;
1015 private int backgroundColor ;
11- private int foregroundImageRes ;
16+ private int foregroundImageRes = - 1 ;
1217 private int backgroundImageRes = -1 ;
18+ private int titleTextRes = -1 ;
19+ private int subTitleTextRes = -1 ;
1320
14- public TutorialItem (String titleText , String subTitleText , int backgroundColor , int foregroundImageRes , int backgroundImageRes ) {
21+ public TutorialItem (@ NonNull String titleText , @ Nullable String subTitleText , @ ColorRes int backgroundColor , @ DrawableRes int foregroundImageRes , @ DrawableRes int backgroundImageRes ) {
1522 this .titleText = titleText ;
1623 this .subTitleText = subTitleText ;
1724 this .backgroundColor = backgroundColor ;
1825 this .foregroundImageRes = foregroundImageRes ;
1926 this .backgroundImageRes = backgroundImageRes ;
2027 }
2128
22- public TutorialItem (String titleText , String subTitleText , int backgroundColor , int foregroundImageRes ) {
29+ public TutorialItem (@ NonNull String titleText , @ Nullable String subTitleText , @ ColorRes int backgroundColor , @ DrawableRes int foregroundImageRes ) {
2330 this .titleText = titleText ;
2431 this .subTitleText = subTitleText ;
2532 this .backgroundColor = backgroundColor ;
2633 this .foregroundImageRes = foregroundImageRes ;
2734 }
2835
36+ public TutorialItem (@ StringRes int titleTextRes , @ StringRes int subTitleTextRes , @ ColorRes int backgroundColor , @ DrawableRes int foregroundImageRes , @ DrawableRes int backgroundImageRes ) {
37+ this .titleTextRes = titleTextRes ;
38+ this .subTitleTextRes = subTitleTextRes ;
39+ this .backgroundColor = backgroundColor ;
40+ this .foregroundImageRes = foregroundImageRes ;
41+ this .backgroundImageRes = backgroundImageRes ;
42+ }
43+
44+ public TutorialItem (@ StringRes int titleTextRes , @ StringRes int subTitleTextRes , @ ColorRes int backgroundColor , @ DrawableRes int foregroundImageRes ) {
45+ this .subTitleTextRes = titleTextRes ;
46+ this .subTitleTextRes = subTitleTextRes ;
47+ this .backgroundColor = backgroundColor ;
48+ this .foregroundImageRes = foregroundImageRes ;
49+ }
50+
2951 public String getTitleText () {
3052 return titleText ;
3153 }
@@ -46,6 +68,14 @@ public int getBackgroundImageRes() {
4668 return backgroundImageRes ;
4769 }
4870
71+ public int getTitleTextRes () {
72+ return titleTextRes ;
73+ }
74+
75+ public int getSubTitleTextRes () {
76+ return subTitleTextRes ;
77+ }
78+
4979 @ Override
5080 public int describeContents () {
5181 return 0 ;
@@ -58,6 +88,8 @@ public void writeToParcel(Parcel dest, int flags) {
5888 dest .writeInt (this .backgroundColor );
5989 dest .writeInt (this .foregroundImageRes );
6090 dest .writeInt (this .backgroundImageRes );
91+ dest .writeInt (this .titleTextRes );
92+ dest .writeInt (this .subTitleTextRes );
6193 }
6294
6395 protected TutorialItem (Parcel in ) {
@@ -66,6 +98,8 @@ protected TutorialItem(Parcel in) {
6698 this .backgroundColor = in .readInt ();
6799 this .foregroundImageRes = in .readInt ();
68100 this .backgroundImageRes = in .readInt ();
101+ this .titleTextRes = in .readInt ();
102+ this .subTitleTextRes = in .readInt ();
69103 }
70104
71105 public static final Parcelable .Creator <TutorialItem > CREATOR = new Parcelable .Creator <TutorialItem >() {
0 commit comments