aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-09-17 08:56:04 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-09-17 08:56:04 +0000
commit5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7 (patch)
tree2df109032c5bd570f23ea330aebf20df22d9bfc9 /app/src/main/java/ml/docilealligator
parentee5fc0a5fc652c9e0b83b4f82ec80f1ec81380fd (diff)
downloadinfinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.tar
infinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.tar.gz
infinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.tar.bz2
infinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.tar.lz
infinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.tar.xz
infinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.tar.zst
infinity-for-reddit-5172ae96a7b919532ea6054c2f3d98c5fe1ec4f7.zip
Change the color of the comment's vertical bar. Long press the comment to expand or collapse. Version 1.0.9.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java89
1 files changed, 81 insertions, 8 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
index 158e48a0..b68628fb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
@@ -515,6 +515,36 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 16, 0, 0, 0);
if(comment.getDepth() > 0) {
+ switch (comment.getDepth() % 7) {
+ case 0:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar7));
+ break;
+ case 1:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar1));
+ break;
+ case 2:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar2));
+ break;
+ case 3:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar3));
+ break;
+ case 4:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar4));
+ break;
+ case 5:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar5));
+ break;
+ case 6:
+ ((CommentViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar6));
+ break;
+ }
ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
params.width = 16;
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
@@ -724,6 +754,37 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(placeholder.getDepth() * 16, 0, 0, 0);
if(placeholder.getDepth() > 0) {
+ switch (placeholder.getDepth() % 7) {
+ case 0:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar7));
+ break;
+ case 1:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar1));
+ break;
+ case 2:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar2));
+ break;
+ case 3:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar3));
+ break;
+ case 4:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar4));
+ break;
+ case 5:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar5));
+ break;
+ case 6:
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock
+ .setBackgroundColor(ContextCompat.getColor(mActivity, R.color.commentVerticalBar6));
+ break;
+ }
+
ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
params.width = 16;
((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
@@ -1286,16 +1347,28 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
});
expandButton.setOnClickListener(view -> {
- int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
- if(mVisibleComments.get(commentPosition).isExpanded()) {
- collapseChildren(commentPosition);
- expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
- } else {
- expandChildren(commentPosition);
- mVisibleComments.get(commentPosition).setExpanded(true);
- expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
+ if(expandButton.getVisibility() == View.VISIBLE) {
+ int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
+ if(mVisibleComments.get(commentPosition).isExpanded()) {
+ collapseChildren(commentPosition);
+ expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
+ } else {
+ expandChildren(commentPosition);
+ mVisibleComments.get(commentPosition).setExpanded(true);
+ expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
+ }
}
});
+
+ commentMarkdownView.setOnLongClickListener(view -> {
+ expandButton.performClick();
+ return true;
+ });
+
+ itemView.setOnLongClickListener(view -> {
+ expandButton.performClick();
+ return true;
+ });
}
}