Fix URL shortener + count

This commit is contained in:
tom79 2019-05-29 18:15:55 +02:00
parent dab00c5089
commit d99b15f353
2 changed files with 3 additions and 6 deletions

View File

@ -3065,9 +3065,7 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
int matchEnd = matcherALink.end();
final String url = content.substring(matcherALink.start(1), matcherALink.end(1));
if( matchEnd <= content.length() && matchEnd >= matchStart){
if( url.length() > 23){
content = content.replaceFirst(url,"abcdefghijklmnopkrstuvw");
}
content = content.replaceFirst(url,"abcdefghijklmnopkrstuvw");
}
}
}

View File

@ -560,11 +560,10 @@ public class Status implements Parcelable{
Pattern aLink = Pattern.compile("<a href=\"([^\"]*)\"[^>]*(((?!<\\/a).)*)<\\/a>");
Matcher matcherALink = aLink.matcher(content);
while (matcherALink.find()){
String beforemodification;
String urlText = matcherALink.group(2);
//urlText += content.substring(matcherALink.start(3), matcherALink.end(3));
urlText = urlText.substring(1);
beforemodification = urlText;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
@ -578,7 +577,7 @@ public class Status implements Parcelable{
urlText += '…';
}
}
content = content.replaceAll(beforemodification,urlText);
content = content.replaceAll(Pattern.quote(beforemodification),urlText);
}
spannableStringContent = new SpannableString(content);
String spoilerText = "";