From 64c8f4225ca7e6fe8eff53957c4c9c75e545b57c Mon Sep 17 00:00:00 2001 From: aayush262 Date: Fri, 16 Feb 2024 16:37:31 +0530 Subject: [PATCH] fix: paddings in comments --- .../dantotsu/media/comments/CommentItem.kt | 29 ++++++++++++------- app/src/main/res/layout/activity_comments.xml | 3 +- app/src/main/res/layout/item_anime_watch.xml | 4 +-- app/src/main/res/layout/item_comments.xml | 7 ++--- app/src/main/res/values/strings.xml | 11 ++++--- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt index 35d7a89d..dd6fcc89 100644 --- a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt +++ b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt @@ -4,6 +4,7 @@ import android.view.View import ani.dantotsu.R import ani.dantotsu.connections.comments.Comment import ani.dantotsu.connections.comments.CommentsAPI +import ani.dantotsu.currActivity import ani.dantotsu.databinding.ItemCommentsBinding import ani.dantotsu.loadImage import ani.dantotsu.snackString @@ -42,11 +43,11 @@ class CommentItem(val comment: Comment, var isEditing = false viewBinding.commentEdit.setOnClickListener { if (!isEditing) { - viewBinding.commentEdit.text = "Cancel" + viewBinding.commentEdit.text = currActivity()!!.getString(R.string.cancel) isEditing = true editCallback(this) } else { - viewBinding.commentEdit.text = "Edit" + viewBinding.commentEdit.text = currActivity()!!.getString(R.string.edit) isEditing = false editCallback(this) } @@ -128,15 +129,21 @@ class CommentItem(val comment: Comment, } private fun setVoteButtons(viewBinding: ItemCommentsBinding) { - if (comment.userVoteType == 1) { - viewBinding.commentUpVote.setImageResource(R.drawable.ic_round_upvote_active_24) - viewBinding.commentDownVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) - } else if (comment.userVoteType == -1) { - viewBinding.commentUpVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) - viewBinding.commentDownVote.setImageResource(R.drawable.ic_round_upvote_active_24) - } else { - viewBinding.commentUpVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) - viewBinding.commentDownVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) + when (comment.userVoteType) { + 1 -> { + viewBinding.commentUpVote.setImageResource(R.drawable.ic_round_upvote_active_24) + viewBinding.commentUpVote.alpha = 1f + viewBinding.commentDownVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) + } + -1 -> { + viewBinding.commentUpVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) + viewBinding.commentDownVote.setImageResource(R.drawable.ic_round_upvote_active_24) + viewBinding.commentDownVote.alpha = 1f + } + else -> { + viewBinding.commentUpVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) + viewBinding.commentDownVote.setImageResource(R.drawable.ic_round_upvote_inactive_24) + } } } diff --git a/app/src/main/res/layout/activity_comments.xml b/app/src/main/res/layout/activity_comments.xml index 89bc086f..1f299f4d 100644 --- a/app/src/main/res/layout/activity_comments.xml +++ b/app/src/main/res/layout/activity_comments.xml @@ -14,7 +14,8 @@ + android:orientation="horizontal" + tools:ignore="UseCompoundDrawables"> diff --git a/app/src/main/res/layout/item_comments.xml b/app/src/main/res/layout/item_comments.xml index 30669818..d08af818 100644 --- a/app/src/main/res/layout/item_comments.xml +++ b/app/src/main/res/layout/item_comments.xml @@ -102,7 +102,7 @@ android:id="@+id/commentReply" android:layout_width="wrap_content" android:layout_height="wrap_content" - + android:layout_marginEnd="12dp" android:alpha="0.6" android:fontFamily="@font/poppins_semi_bold" android:text="Reply" @@ -113,22 +113,22 @@ android:id="@+id/commentEdit" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginEnd="12dp" android:alpha="0.6" android:fontFamily="@font/poppins_semi_bold" android:text="Edit" android:textSize="12sp" - android:layout_marginStart="12dp" tools:ignore="HardcodedText" /> Year Apply Cancel + Edit This Season Next Season Previous Season @@ -659,8 +660,10 @@ Try Internal Cast (Experimental) Comments - newest - oldest - highest rated - lowest rated + Newest + Oldest + Highest rated + Lowest rated + +