Skip to content

Commit 242b190

Browse files
committed
Fix setting texts.
1 parent 9f3f34d commit 242b190

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseSequence.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,24 @@ public MaterialShowcaseSequence(Activity activity, String sequenceID) {
3535
}
3636

3737
public MaterialShowcaseSequence addSequenceItem(View targetView, String content, String dismissText) {
38-
addSequenceItem(targetView, "", content, dismissText);
38+
addSequenceItem(targetView, "", content, dismissText, "", "");
3939
return this;
4040
}
4141

4242
public MaterialShowcaseSequence addSequenceItem(View targetView, String title, String content, String dismissText) {
43+
addSequenceItem(targetView, title, content, dismissText, "", "");
44+
return this;
45+
}
46+
47+
public MaterialShowcaseSequence addSequenceItem(View targetView, String title, String content, String dismissText, String closeText, String nextText) {
4348

4449
MaterialShowcaseView sequenceItem = new MaterialShowcaseView.Builder(mActivity)
4550
.setTarget(targetView)
4651
.setTitleText(title)
4752
.setDismissText(dismissText)
4853
.setContentText(content)
54+
.setCloseText(closeText)
55+
.setNextText(nextText)
4956
.build();
5057

5158
if (mConfig != null) {

library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java

+18-13
Original file line numberDiff line numberDiff line change
@@ -433,33 +433,33 @@ void setPosition(int x, int y) {
433433
}
434434

435435
private void setTitleText(CharSequence contentText) {
436-
if (mTitleTextView != null && !contentText.equals("")) {
436+
if (mTitleTextView != null && contentText.length() > 0) {
437437
mTitleTextView.setText(contentText);
438438
}
439439
}
440440

441441
private void setContentText(CharSequence contentText) {
442-
if (mContentTextView != null) {
442+
if (mContentTextView != null && contentText.length() > 0) {
443443
mContentTextView.setText(contentText);
444444
}
445445
}
446446

447447
private void setDismissText(CharSequence dismissText) {
448-
if (mDismissButtonText != null) {
448+
if (mDismissButtonText != null && dismissText.length() > 0) {
449449
mDismissButtonText.setText(dismissText);
450450

451451
updateDismissButton();
452452
}
453453
}
454454

455455
private void setCloseText(CharSequence closeText) {
456-
if (mCloseTextView != null) {
456+
if (mCloseTextView != null && closeText.length() > 0) {
457457
mCloseTextView.setText(closeText);
458458
}
459459
}
460460

461461
private void setNextText(CharSequence nextText) {
462-
if (mNextTextView != null) {
462+
if (mNextTextView != null && nextText.length() > 0) {
463463
mNextTextView.setText(nextText);
464464
}
465465
}
@@ -700,18 +700,21 @@ public Builder setDismissText(int resId) {
700700
return setDismissText(activity.getString(resId));
701701
}
702702

703-
public Builder setDismissText(CharSequence dismissText) {
704-
showcaseView.setDismissText(dismissText);
703+
public Builder setDismissText(CharSequence text) {
704+
if (text != null && text.length() > 0)
705+
showcaseView.setDismissText(text);
705706
return this;
706707
}
707708

708-
public Builder setCloseText(CharSequence closeText) {
709-
showcaseView.setCloseText(closeText);
709+
public Builder setCloseText(CharSequence text) {
710+
if (text != null && text.length() > 0)
711+
showcaseView.setCloseText(text);
710712
return this;
711713
}
712714

713-
public Builder setNextText(CharSequence nextText) {
714-
showcaseView.setNextText(nextText);
715+
public Builder setNextText(CharSequence text) {
716+
if (text != null && text.length() > 0)
717+
showcaseView.setNextText(text);
715718
return this;
716719
}
717720

@@ -726,7 +729,8 @@ public Builder setContentText(int resId) {
726729
* Set the descriptive text shown on the ShowcaseView.
727730
*/
728731
public Builder setContentText(CharSequence text) {
729-
showcaseView.setContentText(text);
732+
if (text != null && text.length() > 0)
733+
showcaseView.setContentText(text);
730734
return this;
731735
}
732736

@@ -741,7 +745,8 @@ public Builder setTitleText(int resId) {
741745
* Set the descriptive text shown on the ShowcaseView as the title.
742746
*/
743747
public Builder setTitleText(CharSequence text) {
744-
showcaseView.setTitleText(text);
748+
if (text != null && text.length() > 0)
749+
showcaseView.setTitleText(text);
745750
return this;
746751
}
747752

0 commit comments

Comments
 (0)