mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-05 06:14:43 +01:00
Change the color of the comment's vertical bar. Long press the comment to expand or collapse. Version 1.0.9.
This commit is contained in:
parent
ee5fc0a5fc
commit
5172ae96a7
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
BIN
.idea/caches/gradle_models.ser
generated
BIN
.idea/caches/gradle_models.ser
generated
Binary file not shown.
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "ml.docilealligator.infinityforreddit"
|
applicationId "ml.docilealligator.infinityforreddit"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 9
|
versionCode 10
|
||||||
versionName "1.0.8"
|
versionName "1.0.9"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -515,6 +515,36 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
|
|
||||||
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 16, 0, 0, 0);
|
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 16, 0, 0, 0);
|
||||||
if(comment.getDepth() > 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();
|
ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
|
||||||
params.width = 16;
|
params.width = 16;
|
||||||
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
((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);
|
((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(placeholder.getDepth() * 16, 0, 0, 0);
|
||||||
if(placeholder.getDepth() > 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();
|
ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
|
||||||
params.width = 16;
|
params.width = 16;
|
||||||
((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
|
((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
|
||||||
@ -1286,16 +1347,28 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
});
|
});
|
||||||
|
|
||||||
expandButton.setOnClickListener(view -> {
|
expandButton.setOnClickListener(view -> {
|
||||||
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
if(expandButton.getVisibility() == View.VISIBLE) {
|
||||||
if(mVisibleComments.get(commentPosition).isExpanded()) {
|
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
||||||
collapseChildren(commentPosition);
|
if(mVisibleComments.get(commentPosition).isExpanded()) {
|
||||||
expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
|
collapseChildren(commentPosition);
|
||||||
} else {
|
expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
|
||||||
expandChildren(commentPosition);
|
} else {
|
||||||
mVisibleComments.get(commentPosition).setExpanded(true);
|
expandChildren(commentPosition);
|
||||||
expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
|
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;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,4 +61,12 @@
|
|||||||
<color name="notificationIconColor">@color/colorPrimary</color>
|
<color name="notificationIconColor">@color/colorPrimary</color>
|
||||||
|
|
||||||
<color name="defaultTextColor">#8A000000</color>
|
<color name="defaultTextColor">#8A000000</color>
|
||||||
|
|
||||||
|
<color name="commentVerticalBar1">#1565C0</color>
|
||||||
|
<color name="commentVerticalBar2">#EE02BE</color>
|
||||||
|
<color name="commentVerticalBar3">#02DFEE</color>
|
||||||
|
<color name="commentVerticalBar4">#EED502</color>
|
||||||
|
<color name="commentVerticalBar5">#EE0220</color>
|
||||||
|
<color name="commentVerticalBar6">#02EE6E</color>
|
||||||
|
<color name="commentVerticalBar7">#EE4602</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user