diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java index ef1e90a2..25e4114d 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java @@ -57,6 +57,7 @@ import android.os.Looper; import android.os.Parcelable; import android.provider.MediaStore; import android.provider.OpenableColumns; +import android.text.Html; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.TypedValue; @@ -2121,6 +2122,15 @@ public class Helper { .build(); } + public static String parseHtml(String html) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY).toString(); + } else { + //noinspection deprecation + return Html.fromHtml(html).toString(); + } + } + //Enum that described actions to replace inside a toot content public enum PatternType { MENTION, diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountsSearchAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountsSearchAdapter.java index f52e99aa..974b2325 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountsSearchAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountsSearchAdapter.java @@ -31,6 +31,7 @@ import java.util.List; import app.fedilab.android.databinding.DrawerAccountSearchBinding; import app.fedilab.android.mastodon.client.entities.api.Account; import app.fedilab.android.mastodon.client.entities.api.Field; +import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.MastodonHelper; @@ -120,7 +121,7 @@ public class AccountsSearchAdapter extends ArrayAdapter implements Filt account.pronouns = null; for (Field field : account.fields) { if (field.name.trim().equalsIgnoreCase("pronouns")) { - account.pronouns = field.value; + account.pronouns = Helper.parseHtml(field.value); break; } } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java index cefdefa0..1578e4de 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java @@ -1429,7 +1429,7 @@ public class ComposeAdapter extends RecyclerView.Adapter 0) { for (Field field : accountFromUser.fields) { if (field.name.toLowerCase().startsWith("pronoun")) { - statusList.get(position).pronouns = field.value; + statusList.get(position).pronouns = Helper.parseHtml(field.value); break; } } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java index 2fde9086..479c8746 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java @@ -484,7 +484,7 @@ public class StatusAdapter extends RecyclerView.Adapter if (statusToDeal.pronouns == null && statusToDeal.account.fields != null && statusToDeal.account.fields.size() > 0) { for (Field field : statusToDeal.account.fields) { if (field.name.toLowerCase().startsWith("pronoun")) { - statusToDeal.pronouns = field.value; + statusToDeal.pronouns = Helper.parseHtml(field.value); break; } }