fix: text | reply bar not hiding

This commit is contained in:
rebelonion 2024-03-17 21:07:54 -05:00
parent af1bc944d8
commit 385198e69a
4 changed files with 11 additions and 9 deletions

View file

@ -130,12 +130,12 @@ class CommentItem(val comment: Comment,
viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE
viewBinding.commentDelete.setOnClickListener { viewBinding.commentDelete.setOnClickListener {
dialogBuilder("Delete CommentNotificationWorker", "Are you sure you want to delete this comment?") { dialogBuilder("Delete Comment", "Are you sure you want to delete this comment?") {
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob()) val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
scope.launch { scope.launch {
val success = CommentsAPI.deleteComment(comment.commentId) val success = CommentsAPI.deleteComment(comment.commentId)
if (success) { if (success) {
snackString("CommentNotificationWorker Deleted") snackString("Comment Deleted")
parentSection.remove(this@CommentItem) parentSection.remove(this@CommentItem)
} }
} }
@ -153,12 +153,12 @@ class CommentItem(val comment: Comment,
} }
} }
viewBinding.commentReport.setOnClickListener { viewBinding.commentReport.setOnClickListener {
dialogBuilder("Report CommentNotificationWorker", "Only report comments that violate the rules. Are you sure you want to report this comment?") { dialogBuilder("Report Comment", "Only report comments that violate the rules. Are you sure you want to report this comment?") {
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob()) val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
scope.launch { scope.launch {
val success = CommentsAPI.reportComment(comment.commentId, comment.username, commentsFragment.mediaName, comment.userId) val success = CommentsAPI.reportComment(comment.commentId, comment.username, commentsFragment.mediaName, comment.userId)
if (success) { if (success) {
snackString("CommentNotificationWorker Reported") snackString("Comment Reported")
} }
} }
} }

View file

@ -264,7 +264,7 @@ class CommentsFragment : Fragment() {
300, 300,
activity.binding.commentInput.text.length activity.binding.commentInput.text.length
) )
snackString("CommentNotificationWorker cannot be longer than 300 characters") snackString("Comment cannot be longer than 300 characters")
} }
} }
}) })
@ -475,6 +475,7 @@ class CommentsFragment : Fragment() {
} }
InteractionState.REPLY -> { InteractionState.REPLY -> {
activity.binding.commentReplyToContainer.visibility = View.GONE
activity.binding.commentInput.setText("") activity.binding.commentInput.setText("")
val imm = activity.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager val imm = activity.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(activity.binding.commentInput.windowToken, 0) imm.hideSoftInputFromWindow(activity.binding.commentInput.windowToken, 0)
@ -602,7 +603,7 @@ class CommentsFragment : Fragment() {
private fun processComment() { private fun processComment() {
val commentText = activity.binding.commentInput.text.toString() val commentText = activity.binding.commentInput.text.toString()
if (commentText.isEmpty()) { if (commentText.isEmpty()) {
snackString("CommentNotificationWorker cannot be empty") snackString("Comment cannot be empty")
return return
} }
@ -619,6 +620,7 @@ class CommentsFragment : Fragment() {
null null
) )
} }
resetOldState()
} }
} }
@ -638,7 +640,7 @@ class CommentsFragment : Fragment() {
groups.forEach { item -> groups.forEach { item ->
if (item is CommentItem && item.comment.commentId == commentWithInteraction?.comment?.commentId) { if (item is CommentItem && item.comment.commentId == commentWithInteraction?.comment?.commentId) {
updateCommentItem(item, commentText) updateCommentItem(item, commentText)
snackString("CommentNotificationWorker edited") snackString("Comment edited")
} }
} }
} }

View file

@ -97,7 +97,7 @@ class CommentNotificationWorker(appContext: Context, workerParams: WorkerParamet
} }
NotificationType.COMMENT_REPLY -> { NotificationType.COMMENT_REPLY -> {
val title = "New CommentNotificationWorker Reply" val title = "New Comment Reply"
val mediaName = names[it.mediaId]?.title ?: "Unknown" val mediaName = names[it.mediaId]?.title ?: "Unknown"
val message = "${it.username} replied to your comment in $mediaName" val message = "${it.username} replied to your comment in $mediaName"

View file

@ -147,7 +147,7 @@ object Notifications {
setGroup(GROUP_COMMENTS) setGroup(GROUP_COMMENTS)
}, },
buildNotificationChannel(CHANNEL_COMMENT_WARING, IMPORTANCE_HIGH) { buildNotificationChannel(CHANNEL_COMMENT_WARING, IMPORTANCE_HIGH) {
setName("CommentNotificationWorker Warnings") setName("Comment Warnings")
setGroup(GROUP_COMMENTS) setGroup(GROUP_COMMENTS)
}, },
buildNotificationChannel(CHANNEL_ANILIST, IMPORTANCE_DEFAULT) { buildNotificationChannel(CHANNEL_ANILIST, IMPORTANCE_DEFAULT) {