fix: replying message hide correctly
This commit is contained in:
parent
f128dee3e4
commit
d5c87c46aa
3 changed files with 13 additions and 14 deletions
|
@ -42,7 +42,7 @@ class CommentItem(val comment: Comment,
|
||||||
private var subCommentIds: MutableList<Int> = mutableListOf()
|
private var subCommentIds: MutableList<Int> = mutableListOf()
|
||||||
val repliesSection = Section()
|
val repliesSection = Section()
|
||||||
private var isEditing = false
|
private var isEditing = false
|
||||||
private var isReplying = false
|
var isReplying = false
|
||||||
private var repliesVisible = false
|
private var repliesVisible = false
|
||||||
var MAX_DEPTH = 3
|
var MAX_DEPTH = 3
|
||||||
|
|
||||||
|
@ -201,7 +201,6 @@ class CommentItem(val comment: Comment,
|
||||||
|
|
||||||
fun replying(isReplying: Boolean) {
|
fun replying(isReplying: Boolean) {
|
||||||
binding?.commentReply?.text = if (isReplying) currActivity()!!.getString(R.string.cancel) else "Reply"
|
binding?.commentReply?.text = if (isReplying) currActivity()!!.getString(R.string.cancel) else "Reply"
|
||||||
PrefManager.setVal(PrefName.ReplyTo, isReplying)
|
|
||||||
this.isReplying = isReplying
|
this.isReplying = isReplying
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,10 +225,6 @@ class CommentItem(val comment: Comment,
|
||||||
subCommentIds.clear()
|
subCommentIds.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test(isEditing: Boolean){
|
|
||||||
this.isEditing = isEditing
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setVoteButtons(viewBinding: ItemCommentsBinding) {
|
private fun setVoteButtons(viewBinding: ItemCommentsBinding) {
|
||||||
when (comment.userVoteType) {
|
when (comment.userVoteType) {
|
||||||
1 -> {
|
1 -> {
|
||||||
|
@ -351,7 +346,7 @@ class CommentItem(val comment: Comment,
|
||||||
* @param message the message of the dialog
|
* @param message the message of the dialog
|
||||||
* @param callback the callback to call when the user clicks yes
|
* @param callback the callback to call when the user clicks yes
|
||||||
*/
|
*/
|
||||||
fun dialogBuilder(title: String, message: String, callback: () -> Unit) {
|
private fun dialogBuilder(title: String, message: String, callback: () -> Unit) {
|
||||||
val alertDialog = android.app.AlertDialog.Builder(commentsActivity, R.style.MyPopup)
|
val alertDialog = android.app.AlertDialog.Builder(commentsActivity, R.style.MyPopup)
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
|
|
|
@ -283,6 +283,7 @@ class CommentsActivity : AppCompatActivity() {
|
||||||
interactionState = InteractionState.NONE
|
interactionState = InteractionState.NONE
|
||||||
return when (oldState) {
|
return when (oldState) {
|
||||||
InteractionState.EDIT -> {
|
InteractionState.EDIT -> {
|
||||||
|
binding.commentReplyToContainer.visibility = View.GONE
|
||||||
binding.commentInput.setText("")
|
binding.commentInput.setText("")
|
||||||
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.hideSoftInputFromWindow(binding.commentInput.windowToken, 0)
|
imm.hideSoftInputFromWindow(binding.commentInput.windowToken, 0)
|
||||||
|
@ -337,12 +338,16 @@ class CommentsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
fun replyTo(comment: CommentItem,Username: String) {
|
fun replyTo(comment: CommentItem, username: String) {
|
||||||
binding.commentReplyToContainer.visibility = if (PrefManager.getVal(PrefName.ReplyTo)) View.VISIBLE else View.GONE
|
if (comment.isReplying) {
|
||||||
binding.commentReplyTo.text = "Replying to $Username"
|
binding.commentReplyToContainer.visibility = View.VISIBLE
|
||||||
binding.commentReplyToCancel.setOnClickListener {
|
binding.commentReplyTo.text = "Replying to $username"
|
||||||
comment.replying(false)
|
binding.commentReplyToCancel.setOnClickListener {
|
||||||
replyCallback(comment)
|
comment.replying(false)
|
||||||
|
replyCallback(comment)
|
||||||
|
binding.commentReplyToContainer.visibility = View.GONE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
binding.commentReplyToContainer.visibility = View.GONE
|
binding.commentReplyToContainer.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,6 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
||||||
TagsListNonAdult(Pref(Location.Irrelevant, Set::class, setOf<String>())),
|
TagsListNonAdult(Pref(Location.Irrelevant, Set::class, setOf<String>())),
|
||||||
MakeDefault(Pref(Location.Irrelevant, Boolean::class, true)),
|
MakeDefault(Pref(Location.Irrelevant, Boolean::class, true)),
|
||||||
FirstComment(Pref(Location.Irrelevant, Boolean::class, true)),
|
FirstComment(Pref(Location.Irrelevant, Boolean::class, true)),
|
||||||
ReplyTo(Pref(Location.Irrelevant, Boolean::class, false)),
|
|
||||||
|
|
||||||
//Protected
|
//Protected
|
||||||
DiscordToken(Pref(Location.Protected, String::class, "")),
|
DiscordToken(Pref(Location.Protected, String::class, "")),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue