diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/MarkdownConverter.java b/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/MarkdownConverter.java index 5fb0489d..f2419402 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/MarkdownConverter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/MarkdownConverter.java @@ -23,7 +23,7 @@ public class MarkdownConverter { public List markdownItems; public MarkdownItem getByPosition(int position) { - if (markdownItems != null && markdownItems.size() > 0 && position < markdownItems.size()) { + if (markdownItems != null && !markdownItems.isEmpty() && position < markdownItems.size()) { for (MarkdownItem markdownItem : markdownItems) { if (markdownItem.position == position) { return markdownItem; diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java index b4c01e7f..c4b8a6fe 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java @@ -148,7 +148,9 @@ public class SpannableHelper { if (status != null && status.mentions != null) { mentions.addAll(status.mentions); } - text = text.replaceAll("((<\\s?p\\s?>|<\\s?br\\s?/?>)>(((?!(<\\s?br\\s?/?>|<\\s?/s?p\\s?>)).)*))", "$2
$3
"); + if(!convertMarkdown) { + text = text.replaceAll("((<\\s?p\\s?>|<\\s?br\\s?/?>)>(((?!(<\\s?br\\s?/?>|<\\s?/s?p\\s?>)).)*))", "$2
$3
"); + } text = text.trim().replaceAll("\\s{3}", "   "); text = text.trim().replaceAll("\\s{2}", "  "); SpannableString initialContent; @@ -181,7 +183,7 @@ public class SpannableHelper { markdownItem.urlSpan = spans[0]; } - if (markdownItem.code.trim().length() > 0) { + if (!markdownItem.code.trim().isEmpty()) { markdownConverter.markdownItems.add(markdownItem); position++; }