Fix an issue with cw

This commit is contained in:
tom79 2019-06-16 19:14:03 +02:00
parent 9b8bf68bfe
commit a7c532f98c
1 changed files with 13 additions and 11 deletions

View File

@ -560,7 +560,7 @@ public class Status implements Parcelable{
return;
String content = status.getReblog() != null ?status.getReblog().getContent():status.getContent();
Pattern aLink = Pattern.compile("<a href=\"([^\"]*)\"[^>]*(((?!<\\/a).)*)<\\/a>");
Matcher matcherALink = aLink.matcher(content);
while (matcherALink.find()){
@ -569,18 +569,20 @@ public class Status implements Parcelable{
urlText = urlText.substring(1);
beforemodification = urlText;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
urlText = new SpannableString(Html.fromHtml(urlText, Html.FROM_HTML_MODE_LEGACY)).toString();
else
urlText = new SpannableString(Html.fromHtml(urlText)).toString();
if( urlText.startsWith("http") ){
urlText = urlText.replace("http://","").replace("https://","").replace("www.","");
if( urlText.length() > 31){
urlText = urlText.substring(0,30);
urlText += '…';
if( !beforemodification.startsWith("http")) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
urlText = new SpannableString(Html.fromHtml(urlText, Html.FROM_HTML_MODE_LEGACY)).toString();
else
urlText = new SpannableString(Html.fromHtml(urlText)).toString();
if (urlText.startsWith("http")) {
urlText = urlText.replace("http://", "").replace("https://", "").replace("www.", "");
if (urlText.length() > 31) {
urlText = urlText.substring(0, 30);
urlText += '…';
}
}
content = content.replace(beforemodification, urlText);
}
content = content.replace(beforemodification,urlText);
}
spannableStringContent = new SpannableString(content);
String spoilerText = "";