diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-08-17 03:27:02 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-08-17 03:27:02 +0000 |
commit | 44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c (patch) | |
tree | b34fe4b89f9aa45a5bcb688c24fa10da27d69d13 | |
parent | 400b8b5274a7b5d19e57bfd0f6eaa89afb1b9192 (diff) | |
download | infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.tar infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.tar.gz infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.tar.bz2 infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.tar.lz infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.tar.xz infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.tar.zst infinity-for-reddit-44a4fa16dc4ba24a68c81bc3abfbc16e97923c9c.zip |
Fix spoiler overlap with onClickListener in CommentsListingRecyclerViewAdapter. Fix spoiler text color in comments in CommentAndPostRecyclerViewAdapter.
2 files changed, 13 insertions, 10 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index c63ba1e2..4e1baff3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -242,6 +242,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mRedditDataRoomDatabase = redditDataRoomDatabase; mGlide = glide; mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + mCommentTextColor = customThemeWrapper.getCommentColor(); int markdownColor = customThemeWrapper.getPostContentColor(); int linkColor = customThemeWrapper.getLinkColor(); mPostDetailMarkwon = Markwon.builder(mActivity) @@ -372,10 +373,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy public void updateDrawState(@NonNull TextPaint ds) { if (isShowing) { super.updateDrawState(ds); - ds.setColor(markdownColor); + ds.setColor(mCommentTextColor); } else { ds.bgColor = Color.BLACK; - ds.setColor(markdownColor); + ds.setColor(mCommentTextColor); } ds.setUnderlineText(false); } @@ -480,7 +481,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mCardViewColor = customThemeWrapper.getCardViewBackgroundColor(); mPostTitleColor = customThemeWrapper.getPostTitleColor(); mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); - mCommentTextColor = customThemeWrapper.getCommentColor(); mDividerColor = customThemeWrapper.getDividerColor(); mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(); mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java index 1db1f402..3aeff275 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java @@ -10,9 +10,9 @@ import android.os.Bundle; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextPaint; +import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.text.style.SuperscriptSpan; -import android.text.style.URLSpan; import android.text.util.Linkify; import android.view.LayoutInflater; import android.view.View; @@ -155,10 +155,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment @Override public void onClick(@NonNull View view) { - if (!(isShowing && markdownStringBuilder.getSpans(matcherStart, matcherEnd - 4, URLSpan.class).length > 0)) { - isShowing = !isShowing; - view.invalidate(); - } + isShowing = !isShowing; + view.invalidate(); } }; markdownStringBuilder.setSpan(clickableSpan, matcherStart, matcherEnd - 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -315,8 +313,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment ((CommentViewHolder) holder).verticalBlock.setVisibility(View.GONE); - ((CommentViewHolder) holder).commentMarkdownView.setOnClickListener(view -> - ((CommentViewHolder) holder).linearLayout.callOnClick()); + ((CommentViewHolder) holder).commentMarkdownView.setOnClickListener(view -> { + if (((CommentViewHolder) holder).commentMarkdownView.getSelectionStart() == -1 && ((CommentViewHolder) holder).commentMarkdownView.getSelectionEnd() == -1) { + ((CommentViewHolder) holder).linearLayout.callOnClick(); + } + }); ((CommentViewHolder) holder).upvoteButton.setOnClickListener(view -> { if (mAccessToken == null) { @@ -607,6 +608,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); commentDivider.setBackgroundColor(mDividerColor); + + commentMarkdownView.setMovementMethod(LinkMovementMethod.getInstance()); } } |