Fix mention
This commit is contained in:
parent
e4ef497985
commit
9aae4d927e
|
@ -39,6 +39,7 @@ import android.text.TextUtils;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.text.style.ImageSpan;
|
import android.text.style.ImageSpan;
|
||||||
import android.text.style.URLSpan;
|
import android.text.style.URLSpan;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
@ -706,16 +707,18 @@ public class Status implements Parcelable{
|
||||||
matcher = linkPattern.matcher(spannableString);
|
matcher = linkPattern.matcher(spannableString);
|
||||||
HashMap<String, String> targetedURL = new HashMap<>();
|
HashMap<String, String> targetedURL = new HashMap<>();
|
||||||
HashMap<String, Account> accountsMentionUnknown = new HashMap<>();
|
HashMap<String, Account> accountsMentionUnknown = new HashMap<>();
|
||||||
|
String liveInstance = Helper.getLiveInstance(context);
|
||||||
while (matcher.find()){
|
while (matcher.find()){
|
||||||
String key;
|
String key;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
key = new SpannableString(Html.fromHtml(matcher.group(3), Html.FROM_HTML_MODE_LEGACY)).toString();
|
key = new SpannableString(Html.fromHtml(matcher.group(3), Html.FROM_HTML_MODE_LEGACY)).toString();
|
||||||
else
|
else
|
||||||
key = new SpannableString(Html.fromHtml(matcher.group(3))).toString();
|
key = new SpannableString(Html.fromHtml(matcher.group(3))).toString();
|
||||||
key = key.substring(1);
|
key = key.substring(1);
|
||||||
|
|
||||||
if( !key.startsWith("#") && !key.startsWith("@") && !key.trim().equals("") && !matcher.group(2).contains("search?tag=")) {
|
if( !key.startsWith("#") && !key.startsWith("@") && !key.trim().equals("") && !matcher.group(2).contains("search?tag=") && !matcher.group(2).contains(liveInstance+"/users/")) {
|
||||||
|
|
||||||
String url;
|
String url;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
url = Html.fromHtml(matcher.group(2), Html.FROM_HTML_MODE_LEGACY).toString();
|
url = Html.fromHtml(matcher.group(2), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
|
@ -724,7 +727,7 @@ public class Status implements Parcelable{
|
||||||
url = Html.fromHtml(matcher.group(2)).toString();
|
url = Html.fromHtml(matcher.group(2)).toString();
|
||||||
}
|
}
|
||||||
targetedURL.put(key, url);
|
targetedURL.put(key, url);
|
||||||
}else if( key.startsWith("@") ){
|
}else if( key.startsWith("@") || matcher.group(2).contains(liveInstance+"/users/") ){
|
||||||
String acct;
|
String acct;
|
||||||
String url;
|
String url;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
@ -742,7 +745,10 @@ public class Status implements Parcelable{
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
if( key.startsWith("@"))
|
||||||
acct = key.substring(1).split("\\|")[0];
|
acct = key.substring(1).split("\\|")[0];
|
||||||
|
else
|
||||||
|
acct = key.split("\\|")[0];
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
account.setAcct(acct);
|
account.setAcct(acct);
|
||||||
account.setInstance(instance);
|
account.setInstance(instance);
|
||||||
|
|
Loading…
Reference in New Issue