Skip to content

Commit

Permalink
Fixed deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
heinrichreimer committed Jun 23, 2016
1 parent 2e813da commit 2ee464f
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
Expand Down Expand Up @@ -195,7 +196,13 @@ public Builder title(CharSequence title) {
}

public Builder titleHtml(String titleHtml) {
this.title = Html.fromHtml(titleHtml);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
this.title = Html.fromHtml(titleHtml, Html.FROM_HTML_MODE_LEGACY);
}
else {
//noinspection deprecation
this.title = Html.fromHtml(titleHtml);
}
this.titleRes = 0;
return this;
}
Expand All @@ -213,7 +220,13 @@ public Builder description(CharSequence description) {
}

public Builder descriptionHtml(String descriptionHtml) {
this.description = Html.fromHtml(descriptionHtml);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
this.description = Html.fromHtml(descriptionHtml, Html.FROM_HTML_MODE_LEGACY);
}
else {
//noinspection deprecation
this.description = Html.fromHtml(descriptionHtml);
}
this.descriptionRes = 0;
return this;
}
Expand Down Expand Up @@ -272,7 +285,13 @@ public Builder buttonCtaLabel(CharSequence buttonCtaLabel) {
}

public Builder buttonCtaLabelHtml(String buttonCtaLabelHtml) {
this.buttonCtaLabel = Html.fromHtml(buttonCtaLabelHtml);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
this.buttonCtaLabel = Html.fromHtml(buttonCtaLabelHtml, Html.FROM_HTML_MODE_LEGACY);
}
else {
//noinspection deprecation
this.buttonCtaLabel = Html.fromHtml(buttonCtaLabelHtml);
}
this.buttonCtaLabelRes = 0;
return this;
}
Expand Down

0 comments on commit 2ee464f

Please sign in to comment.