From 3815abec3654801b9cda1dfad510ca2c892487ae Mon Sep 17 00:00:00 2001 From: scria1000 <91804886+scria1000@users.noreply.github.com> Date: Wed, 2 Nov 2022 15:48:52 +0300 Subject: Don't pick up hyperlink text as a link (#1182) --- .../infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java | 2 ++ .../infinityforreddit/markdown/SpoilerAwareMovementMethod.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 9c9e4411..1ad0ba21 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -7,6 +7,7 @@ import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; +import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; @@ -243,6 +244,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { if (textView.getSelectionStart() == -1 && textView.getSelectionEnd() == -1) { CopyTextBottomSheetFragment.show( diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerAwareMovementMethod.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerAwareMovementMethod.java index 19ab96f3..1b343e6a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerAwareMovementMethod.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerAwareMovementMethod.java @@ -66,7 +66,8 @@ public class SpoilerAwareMovementMethod extends BetterLinkMovementMethod { private ClickableSpan selectClickableSpan(@NonNull Object[] spans) { SpoilerSpan spoilerSpan = 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) { spoilerSpan = (SpoilerSpan) span; } else if (span instanceof ClickableSpan) { -- cgit v1.2.3