mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Fix spoiler overlap with onClickListener in CommentsListingRecyclerViewAdapter. Fix spoiler text color in comments in CommentAndPostRecyclerViewAdapter.
This commit is contained in:
parent
400b8b5274
commit
44a4fa16dc
@ -242,6 +242,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
mRedditDataRoomDatabase = redditDataRoomDatabase;
|
mRedditDataRoomDatabase = redditDataRoomDatabase;
|
||||||
mGlide = glide;
|
mGlide = glide;
|
||||||
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
|
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
|
||||||
|
mCommentTextColor = customThemeWrapper.getCommentColor();
|
||||||
int markdownColor = customThemeWrapper.getPostContentColor();
|
int markdownColor = customThemeWrapper.getPostContentColor();
|
||||||
int linkColor = customThemeWrapper.getLinkColor();
|
int linkColor = customThemeWrapper.getLinkColor();
|
||||||
mPostDetailMarkwon = Markwon.builder(mActivity)
|
mPostDetailMarkwon = Markwon.builder(mActivity)
|
||||||
@ -372,10 +373,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
public void updateDrawState(@NonNull TextPaint ds) {
|
public void updateDrawState(@NonNull TextPaint ds) {
|
||||||
if (isShowing) {
|
if (isShowing) {
|
||||||
super.updateDrawState(ds);
|
super.updateDrawState(ds);
|
||||||
ds.setColor(markdownColor);
|
ds.setColor(mCommentTextColor);
|
||||||
} else {
|
} else {
|
||||||
ds.bgColor = Color.BLACK;
|
ds.bgColor = Color.BLACK;
|
||||||
ds.setColor(markdownColor);
|
ds.setColor(mCommentTextColor);
|
||||||
}
|
}
|
||||||
ds.setUnderlineText(false);
|
ds.setUnderlineText(false);
|
||||||
}
|
}
|
||||||
@ -480,7 +481,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
mCardViewColor = customThemeWrapper.getCardViewBackgroundColor();
|
mCardViewColor = customThemeWrapper.getCardViewBackgroundColor();
|
||||||
mPostTitleColor = customThemeWrapper.getPostTitleColor();
|
mPostTitleColor = customThemeWrapper.getPostTitleColor();
|
||||||
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
||||||
mCommentTextColor = customThemeWrapper.getCommentColor();
|
|
||||||
mDividerColor = customThemeWrapper.getDividerColor();
|
mDividerColor = customThemeWrapper.getDividerColor();
|
||||||
mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor();
|
mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor();
|
||||||
mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor();
|
mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor();
|
||||||
|
@ -10,9 +10,9 @@ import android.os.Bundle;
|
|||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.text.style.SuperscriptSpan;
|
import android.text.style.SuperscriptSpan;
|
||||||
import android.text.style.URLSpan;
|
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -155,11 +155,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(@NonNull View view) {
|
public void onClick(@NonNull View view) {
|
||||||
if (!(isShowing && markdownStringBuilder.getSpans(matcherStart, matcherEnd - 4, URLSpan.class).length > 0)) {
|
|
||||||
isShowing = !isShowing;
|
isShowing = !isShowing;
|
||||||
view.invalidate();
|
view.invalidate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
markdownStringBuilder.setSpan(clickableSpan, matcherStart, matcherEnd - 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
markdownStringBuilder.setSpan(clickableSpan, matcherStart, matcherEnd - 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
start = matcherEnd - 4;
|
start = matcherEnd - 4;
|
||||||
@ -315,8 +313,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
|
|
||||||
((CommentViewHolder) holder).verticalBlock.setVisibility(View.GONE);
|
((CommentViewHolder) holder).verticalBlock.setVisibility(View.GONE);
|
||||||
|
|
||||||
((CommentViewHolder) holder).commentMarkdownView.setOnClickListener(view ->
|
((CommentViewHolder) holder).commentMarkdownView.setOnClickListener(view -> {
|
||||||
((CommentViewHolder) holder).linearLayout.callOnClick());
|
if (((CommentViewHolder) holder).commentMarkdownView.getSelectionStart() == -1 && ((CommentViewHolder) holder).commentMarkdownView.getSelectionEnd() == -1) {
|
||||||
|
((CommentViewHolder) holder).linearLayout.callOnClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
((CommentViewHolder) holder).upvoteButton.setOnClickListener(view -> {
|
((CommentViewHolder) holder).upvoteButton.setOnClickListener(view -> {
|
||||||
if (mAccessToken == null) {
|
if (mAccessToken == null) {
|
||||||
@ -607,6 +608,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
commentDivider.setBackgroundColor(mDividerColor);
|
commentDivider.setBackgroundColor(mDividerColor);
|
||||||
|
|
||||||
|
commentMarkdownView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user