From 2ee464f8a7117481154ae4667b5661523ecebc48 Mon Sep 17 00:00:00 2001 From: Heinrich Reimer Date: Thu, 23 Jun 2016 21:57:43 +0200 Subject: [PATCH] Fixed deprecation --- .../materialintro/slide/SimpleSlide.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/heinrichreimersoftware/materialintro/slide/SimpleSlide.java b/library/src/main/java/com/heinrichreimersoftware/materialintro/slide/SimpleSlide.java index ecd4c94..a946dad 100644 --- a/library/src/main/java/com/heinrichreimersoftware/materialintro/slide/SimpleSlide.java +++ b/library/src/main/java/com/heinrichreimersoftware/materialintro/slide/SimpleSlide.java @@ -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; @@ -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; } @@ -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; } @@ -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; }