Don't pick up hyperlink text as a link (#1182)

This commit is contained in:
scria1000 2022-11-02 15:48:52 +03:00 committed by GitHub
parent 4bec3e0922
commit 3815abec36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import android.content.SharedPreferences;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -243,6 +244,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
textView.setTypeface(mActivity.contentTypeface); textView.setTypeface(mActivity.contentTypeface);
} }
textView.setTextColor(markdownColor); textView.setTextColor(markdownColor);
textView.setHighlightColor(Color.TRANSPARENT);
textView.setOnLongClickListener(view -> { textView.setOnLongClickListener(view -> {
if (textView.getSelectionStart() == -1 && textView.getSelectionEnd() == -1) { if (textView.getSelectionStart() == -1 && textView.getSelectionEnd() == -1) {
CopyTextBottomSheetFragment.show( CopyTextBottomSheetFragment.show(

View File

@ -66,7 +66,8 @@ public class SpoilerAwareMovementMethod extends BetterLinkMovementMethod {
private ClickableSpan selectClickableSpan(@NonNull Object[] spans) { private ClickableSpan selectClickableSpan(@NonNull Object[] spans) {
SpoilerSpan spoilerSpan = null; SpoilerSpan spoilerSpan = null;
ClickableSpan nonSpoilerSpan = null; ClickableSpan nonSpoilerSpan = null;
for (final Object span : spans) { for (int i = spans.length - 1; i >= 0; i--) {
final Object span = spans[i];
if (span instanceof SpoilerSpan) { if (span instanceof SpoilerSpan) {
spoilerSpan = (SpoilerSpan) span; spoilerSpan = (SpoilerSpan) span;
} else if (span instanceof ClickableSpan) { } else if (span instanceof ClickableSpan) {