fix: paddings in comments

This commit is contained in:
aayush262 2024-02-16 16:37:31 +05:30
parent a7c9604c43
commit 64c8f4225c
5 changed files with 31 additions and 23 deletions

View file

@ -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)
}
}
}

View file

@ -14,7 +14,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="@+id/commentTitle"
android:layout_width="0dp"

View file

@ -29,11 +29,9 @@
android:insetTop="0dp"
android:insetBottom="0dp"
android:text="@string/comments"
android:textAlignment="center"
android:textColor="@color/bg_white"
android:visibility="gone"
app:cornerRadius="12dp"
app:icon="@drawable/ic_round_comment_24"
app:iconTint="@color/bg_white"
tools:ignore="TextContrastCheck"
tools:visibility="visible"/>

View file

@ -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" />
<TextView
android:id="@+id/commentDelete"
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="Delete"
android:textSize="12sp"
android:layout_marginStart="12dp"
tools:ignore="HardcodedText" />
<TextView
@ -139,7 +139,6 @@
android:fontFamily="@font/poppins_semi_bold"
android:text="Ban User"
android:textSize="12sp"
android:layout_marginStart="12dp"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView

View file

@ -342,6 +342,7 @@
<string name="year">Year</string>
<string name="apply">Apply</string>
<string name="cancel">Cancel</string>
<string name="edit">Edit</string>
<string name="this_season">This Season</string>
<string name="next_season">Next Season</string>
<string name="previous_season">Previous Season</string>
@ -659,8 +660,10 @@
<string name="try_internal_cast_experimental">Try Internal Cast (Experimental)</string>
<string name="comments">Comments</string>
<string name="newest">newest</string>
<string name="oldest">oldest</string>
<string name="highest_rated">highest rated</string>
<string name="lowest_rated">lowest rated</string>
<string name="newest">Newest</string>
<string name="oldest">Oldest</string>
<string name="highest_rated">Highest rated</string>
<string name="lowest_rated">Lowest rated</string>
</resources>