fix mentions outside of content warnings not being clickable (#1405)
This commit is contained in:
parent
43cf0e0ec8
commit
590cfbbcd2
|
@ -20,6 +20,8 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.browser.customtabs.CustomTabsIntent;
|
||||
import android.text.SpannableStringBuilder;
|
||||
|
@ -81,7 +83,7 @@ public class LinkHelper {
|
|||
final String tag = text.subSequence(1, text.length()).toString();
|
||||
customSpan = new ClickableSpanNoUnderline() {
|
||||
@Override
|
||||
public void onClick(View widget) { listener.onViewTag(tag); }
|
||||
public void onClick(@NonNull View widget) { listener.onViewTag(tag); }
|
||||
};
|
||||
} else if (text.charAt(0) == '@' && mentions != null && mentions.length > 0) {
|
||||
String accountUsername = text.subSequence(1, text.length()).toString();
|
||||
|
@ -101,7 +103,7 @@ public class LinkHelper {
|
|||
final String accountId = id;
|
||||
customSpan = new ClickableSpanNoUnderline() {
|
||||
@Override
|
||||
public void onClick(View widget) { listener.onViewAccount(accountId); }
|
||||
public void onClick(@NonNull View widget) { listener.onViewAccount(accountId); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ public class LinkHelper {
|
|||
final String accountId = mention.getId();
|
||||
ClickableSpan customSpan = new ClickableSpanNoUnderline() {
|
||||
@Override
|
||||
public void onClick(View widget) { listener.onViewAccount(accountId); }
|
||||
public void onClick(@NonNull View widget) { listener.onViewAccount(accountId); }
|
||||
};
|
||||
|
||||
end += 1 + accountUsername.length(); // length of @ + username
|
||||
|
@ -175,6 +177,8 @@ public class LinkHelper {
|
|||
start = end;
|
||||
}
|
||||
view.setText(builder);
|
||||
view.setLinksClickable(true);
|
||||
view.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue