Html support
This commit is contained in:
parent
b77f629949
commit
8683ba2612
|
@ -861,10 +861,10 @@ public class Status implements Parcelable{
|
||||||
}
|
}
|
||||||
SpannableString spannableStringT;
|
SpannableString spannableStringT;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>",""), Html.FROM_HTML_MODE_LEGACY));
|
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString(), Html.FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH));
|
||||||
else
|
else
|
||||||
//noinspection deprecation
|
//noinspection deprecation
|
||||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>","")));
|
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString()));
|
||||||
|
|
||||||
URLSpan[] spans = spannableStringT.getSpans(0, spannableStringT.length(), URLSpan.class);
|
URLSpan[] spans = spannableStringT.getSpans(0, spannableStringT.length(), URLSpan.class);
|
||||||
for (URLSpan span : spans) {
|
for (URLSpan span : spans) {
|
||||||
|
|
|
@ -1891,10 +1891,10 @@ public class Helper {
|
||||||
accountsMentionUnknown.add(account);
|
accountsMentionUnknown.add(account);
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
spannableString = new SpannableString(Html.fromHtml(spannableStringT.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>",""), Html.FROM_HTML_MODE_LEGACY));
|
spannableString = new SpannableString(Html.fromHtml(spannableStringT.toString(), Html.TO_HTML_PARAGRAPH_LINES_INDIVIDUAL));
|
||||||
else
|
else
|
||||||
//noinspection deprecation
|
//noinspection deprecation
|
||||||
spannableString = new SpannableString(Html.fromHtml(spannableStringT.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>","")));
|
spannableString = new SpannableString(Html.fromHtml(spannableStringT.toString()));
|
||||||
|
|
||||||
URLSpan[] urls = spannableString.getSpans(0, spannableString.length(), URLSpan.class);
|
URLSpan[] urls = spannableString.getSpans(0, spannableString.length(), URLSpan.class);
|
||||||
for(URLSpan span : urls)
|
for(URLSpan span : urls)
|
||||||
|
|
|
@ -265,11 +265,9 @@
|
||||||
<fr.gouv.etalab.mastodon.helper.CustomTextView
|
<fr.gouv.etalab.mastodon.helper.CustomTextView
|
||||||
android:id="@+id/status_content"
|
android:id="@+id/status_content"
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
<Button
|
<Button
|
||||||
android:layout_marginTop="-10dp"
|
|
||||||
android:paddingTop="2dp"
|
android:paddingTop="2dp"
|
||||||
android:paddingBottom="2dp"
|
android:paddingBottom="2dp"
|
||||||
android:id="@+id/status_show_more_content"
|
android:id="@+id/status_show_more_content"
|
||||||
|
|
|
@ -158,7 +158,6 @@
|
||||||
<fr.gouv.etalab.mastodon.helper.CustomTextView
|
<fr.gouv.etalab.mastodon.helper.CustomTextView
|
||||||
android:id="@+id/status_content"
|
android:id="@+id/status_content"
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
<Button
|
<Button
|
||||||
|
@ -169,7 +168,6 @@
|
||||||
android:drawableStart="@drawable/ic_more_toot_content"
|
android:drawableStart="@drawable/ic_more_toot_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:drawablePadding="5dp"
|
android:drawablePadding="5dp"
|
||||||
android:layout_marginTop="-10dp"
|
|
||||||
android:paddingTop="2dp"
|
android:paddingTop="2dp"
|
||||||
android:paddingBottom="2dp"
|
android:paddingBottom="2dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
|
Loading…
Reference in New Issue