18
18
19
19
import android .os .Parcel ;
20
20
import android .os .Parcelable ;
21
+ import android .text .TextUtils ;
21
22
22
23
import androidx .annotation .ColorInt ;
23
24
import androidx .annotation .DrawableRes ;
@@ -52,17 +53,17 @@ public class DynamicTutorial implements Parcelable,
52
53
/**
53
54
* Title used by this tutorial.
54
55
*/
55
- private String title ;
56
+ private CharSequence title ;
56
57
57
58
/**
58
59
* Subtitle used by this tutorial.
59
60
*/
60
- private String subtitle ;
61
+ private CharSequence subtitle ;
61
62
62
63
/**
63
64
* Description used by this tutorial.
64
65
*/
65
- private String description ;
66
+ private CharSequence description ;
66
67
67
68
/**
68
69
* Image resource used by this tutorial.
@@ -100,7 +101,7 @@ public class DynamicTutorial implements Parcelable,
100
101
* @param imageRes The image resource for this tutorial.
101
102
*/
102
103
public DynamicTutorial (int id , @ ColorInt int color , @ ColorInt int tintColor ,
103
- @ Nullable String title , @ Nullable String description , @ DrawableRes int imageRes ) {
104
+ @ Nullable CharSequence title , @ Nullable CharSequence description , @ DrawableRes int imageRes ) {
104
105
this (id , color , tintColor , title , null , description , imageRes );
105
106
}
106
107
@@ -116,8 +117,8 @@ public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor,
116
117
* @param imageRes The image resource for this tutorial.
117
118
*/
118
119
public DynamicTutorial (int id , @ ColorInt int color ,
119
- @ ColorInt int tintColor , @ Nullable String title , @ Nullable String subtitle ,
120
- @ Nullable String description , @ DrawableRes int imageRes ) {
120
+ @ ColorInt int tintColor , @ Nullable CharSequence title , @ Nullable CharSequence subtitle ,
121
+ @ Nullable CharSequence description , @ DrawableRes int imageRes ) {
121
122
this (id , color , tintColor , title , subtitle , description ,
122
123
imageRes , false );
123
124
}
@@ -135,7 +136,7 @@ public DynamicTutorial(int id, @ColorInt int color,
135
136
* @param tintImage {@code true} to tint the image according to the tint color.
136
137
*/
137
138
public DynamicTutorial (int id , @ ColorInt int color , @ ColorInt int tintColor ,
138
- @ Nullable String title , @ Nullable String subtitle , @ Nullable String description ,
139
+ @ Nullable CharSequence title , @ Nullable CharSequence subtitle , @ Nullable CharSequence description ,
139
140
@ DrawableRes int imageRes , boolean tintImage ) {
140
141
this (id , color , tintColor , title , subtitle , description ,
141
142
imageRes , tintImage , false );
@@ -155,7 +156,7 @@ public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor,
155
156
* @param sharedElement {@code true} to set the shared element.
156
157
*/
157
158
public DynamicTutorial (int id , @ ColorInt int color , @ ColorInt int tintColor ,
158
- @ Nullable String title , @ Nullable String subtitle , @ Nullable String description ,
159
+ @ Nullable CharSequence title , @ Nullable CharSequence subtitle , @ Nullable CharSequence description ,
159
160
@ DrawableRes int imageRes , boolean tintImage , boolean sharedElement ) {
160
161
this (id , color , tintColor , title , subtitle , description , imageRes ,
161
162
tintImage , id == ADS_TUTORIAL_WELCOME , sharedElement );
@@ -176,7 +177,7 @@ public DynamicTutorial(int id, @ColorInt int color, @ColorInt int tintColor,
176
177
* @param sharedElement {@code true} to set the shared element.
177
178
*/
178
179
public DynamicTutorial (int id , @ ColorInt int color , @ ColorInt int tintColor ,
179
- @ Nullable String title , @ Nullable String subtitle , @ Nullable String description ,
180
+ @ Nullable CharSequence title , @ Nullable CharSequence subtitle , @ Nullable CharSequence description ,
180
181
@ DrawableRes int imageRes , boolean tintImage , boolean backgroundAnimation ,
181
182
boolean sharedElement ) {
182
183
this .id = id ;
@@ -200,9 +201,9 @@ public DynamicTutorial(@NonNull Parcel in) {
200
201
this .id = in .readInt ();
201
202
this .color = in .readInt ();
202
203
this .tintColor = in .readInt ();
203
- this .title = in . readString ( );
204
- this .subtitle = in . readString ( );
205
- this .description = in . readString ( );
204
+ this .title = TextUtils . CHAR_SEQUENCE_CREATOR . createFromParcel ( in );
205
+ this .subtitle = TextUtils . CHAR_SEQUENCE_CREATOR . createFromParcel ( in );
206
+ this .description = TextUtils . CHAR_SEQUENCE_CREATOR . createFromParcel ( in );
206
207
this .imageRes = in .readInt ();
207
208
this .tintImage = in .readByte () != 0 ;
208
209
this .backgroundAnimation = in .readByte () != 0 ;
@@ -235,9 +236,9 @@ public void writeToParcel(Parcel dest, int flags) {
235
236
dest .writeInt (id );
236
237
dest .writeInt (color );
237
238
dest .writeInt (tintColor );
238
- dest . writeString (title );
239
- dest . writeString (subtitle );
240
- dest . writeString (description );
239
+ TextUtils . writeToParcel (title , dest , flags );
240
+ TextUtils . writeToParcel (subtitle , dest , flags );
241
+ TextUtils . writeToParcel (description , dest , flags );
241
242
dest .writeInt (imageRes );
242
243
dest .writeByte ((byte ) (tintImage ? 1 : 0 ));
243
244
dest .writeByte ((byte ) (backgroundAnimation ? 1 : 0 ));
@@ -365,7 +366,7 @@ public boolean isSharedElement() {
365
366
*
366
367
* @return The title used by this tutorial.
367
368
*/
368
- public @ Nullable String getTitle () {
369
+ public @ Nullable CharSequence getTitle () {
369
370
return title ;
370
371
}
371
372
@@ -377,7 +378,7 @@ public boolean isSharedElement() {
377
378
* @return The {@link DynamicTutorial} object to allow for chaining of calls to
378
379
* set methods.
379
380
*/
380
- public @ NonNull DynamicTutorial setTitle (@ Nullable String title ) {
381
+ public @ NonNull DynamicTutorial setTitle (@ Nullable CharSequence title ) {
381
382
this .title = title ;
382
383
383
384
return this ;
@@ -388,7 +389,7 @@ public boolean isSharedElement() {
388
389
*
389
390
* @return The subtitle used by this tutorial.
390
391
*/
391
- public @ Nullable String getSubtitle () {
392
+ public @ Nullable CharSequence getSubtitle () {
392
393
return subtitle ;
393
394
}
394
395
@@ -400,7 +401,7 @@ public boolean isSharedElement() {
400
401
* @return The {@link DynamicTutorial} object to allow for chaining of calls to
401
402
* set methods.
402
403
*/
403
- public @ NonNull DynamicTutorial setSubtitle (@ Nullable String subtitle ) {
404
+ public @ NonNull DynamicTutorial setSubtitle (@ Nullable CharSequence subtitle ) {
404
405
this .subtitle = subtitle ;
405
406
406
407
return this ;
@@ -411,7 +412,7 @@ public boolean isSharedElement() {
411
412
*
412
413
* @return The description used by this tutorial.
413
414
*/
414
- public @ Nullable String getDescription () {
415
+ public @ Nullable CharSequence getDescription () {
415
416
return description ;
416
417
}
417
418
@@ -423,7 +424,7 @@ public boolean isSharedElement() {
423
424
* @return The {@link DynamicTutorial} object to allow for chaining of calls to
424
425
* set methods.
425
426
*/
426
- public @ NonNull DynamicTutorial setDescription (@ Nullable String description ) {
427
+ public @ NonNull DynamicTutorial setDescription (@ Nullable CharSequence description ) {
427
428
this .description = description ;
428
429
429
430
return this ;
0 commit comments