chore: resolve media.comments SetTextI18n

This commit is contained in:
TwistedUmbrellaX
2024-03-20 10:40:52 -04:00
parent a70552019e
commit 642cc3a83f
3 changed files with 11 additions and 6 deletions

View File

@@ -53,7 +53,6 @@ class CommentItem(val comment: Comment,
adapter.add(repliesSection)
}
@SuppressLint("SetTextI18n")
override fun bind(viewBinding: ItemCommentsBinding, position: Int) {
binding = viewBinding
setAnimation(binding.root.context, binding.root)
@@ -95,10 +94,15 @@ class CommentItem(val comment: Comment,
if (repliesVisible) {
repliesSection.clear()
removeSubCommentIds()
viewBinding.commentTotalReplies.text = "View ${comment.replyCount} repl${if (comment.replyCount == 1) "y" else "ies"}"
viewBinding.commentTotalReplies.context.run {
viewBinding.commentTotalReplies.text = if (comment.replyCount == 1)
getString(R.string.view_reply)
else
getString(R.string.view_replies, comment.replyCount)
}
repliesVisible = false
} else {
viewBinding.commentTotalReplies.text = "Hide Replies"
viewBinding.commentTotalReplies.setText(R.string.hide_replies)
repliesSection.clear()
commentsFragment.viewReplyCallback(this)
repliesVisible = true
@@ -220,7 +224,8 @@ class CommentItem(val comment: Comment,
}
comment.profilePictureUrl?.let { viewBinding.commentUserAvatar.loadImage(it) }
viewBinding.commentUserName.text = comment.username
viewBinding.commentUserLevel.text = "[${levelColor.second}]"
val userColor = "[${levelColor.second}]"
viewBinding.commentUserLevel.text = userColor
viewBinding.commentUserLevel.setTextColor(levelColor.first)
viewBinding.commentUserTime.text = formatTimestamp(comment.timestamp)
}

View File

@@ -523,11 +523,10 @@ class CommentsFragment : Fragment() {
}
@SuppressLint("SetTextI18n")
fun replyTo(comment: CommentItem, username: String) {
if (comment.isReplying) {
activity.binding.commentReplyToContainer.visibility = View.VISIBLE
activity.binding.commentReplyTo.text = "Replying to $username"
activity.binding.commentReplyTo.text = getString(R.string.replying_to, username)
activity.binding.commentReplyToCancel.setOnClickListener {
comment.replying(false)
replyCallback(comment)

View File

@@ -717,6 +717,7 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
<string name="hide_replies">Hide Replies</string>
<string name="view_reply">View reply</string>
<string name="view_replies">View %1$d replies</string>
<string name="replying_to">Replying to %1$s</string>
<string name="delete_comment">Delete Comment</string>
<string name="delete_comment_confirm">Are you sure you want to delete this comment?</string>