feat(comments): "reply to" above text input
This commit is contained in:
parent
70c87b4067
commit
8ea6bf85b8
4 changed files with 24 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
package ani.dantotsu.media.comments
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.text.TextWatcher
|
||||
|
@ -82,13 +83,13 @@ class CommentsActivity : AppCompatActivity() {
|
|||
markwonEditor
|
||||
)
|
||||
)
|
||||
binding.commentReplyToContainer.visibility = View.GONE //TODO: implement reply
|
||||
|
||||
binding.commentsRefresh.setOnRefreshListener {
|
||||
lifecycleScope.launch {
|
||||
loadAndDisplayComments()
|
||||
binding.commentsRefresh.isRefreshing = false
|
||||
}
|
||||
binding.commentReplyToContainer.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.commentsList.adapter = adapter
|
||||
|
@ -291,13 +292,24 @@ class CommentsActivity : AppCompatActivity() {
|
|||
fun replyCallback(comment: CommentItem) {
|
||||
if (resetOldState() == InteractionState.REPLY) return
|
||||
commentWithInteraction = comment
|
||||
binding.commentReplyToContainer.visibility = View.VISIBLE
|
||||
binding.commentInput.requestFocus()
|
||||
binding.commentInput.setSelection(binding.commentInput.text.length)
|
||||
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(binding.commentInput, InputMethodManager.SHOW_IMPLICIT)
|
||||
interactionState = InteractionState.REPLY
|
||||
}
|
||||
|
||||
}
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun replyTo(comment: CommentItem,Username: String) {
|
||||
binding.commentReplyToContainer.visibility = if (PrefManager.getVal(PrefName.ReplyTo)) View.VISIBLE else View.GONE
|
||||
binding.commentReplyTo.text = "Replying to $Username"
|
||||
binding.commentReplyToCancel.setOnClickListener {
|
||||
comment.replying(false)
|
||||
replyCallback(comment)
|
||||
binding.commentReplyToContainer.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
fun viewReplyCallback(comment: CommentItem) {
|
||||
lifecycleScope.launch {
|
||||
val replies = withContext(Dispatchers.IO) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue