Bug fix #2064. Updated Task Notes expanded state logic (#2077)

This commit is contained in:
Dinesh Thiyagarajan 2024-09-05 20:48:32 +05:30 committed by GitHub
parent 2d5dc6f0a4
commit 5a27d7cd98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,7 +105,10 @@ abstract class BaseTaskViewHolder(
notesTextView?.movementMethod = LinkMovementMethod.getInstance()
titleTextView.movementMethod = LinkMovementMethod.getInstance()
expandNotesButton?.setOnClickListener { expandTask() }
expandNotesButton?.setOnClickListener {
notesExpanded = !notesExpanded
updateExpandedTaskLogic()
}
iconViewChallenge?.setOnClickListener {
task?.let { t ->
if (task?.challengeBroken?.isNotBlank() == true) brokenTaskFunc(t)
@ -127,8 +130,7 @@ abstract class BaseTaskViewHolder(
context = itemView.context
}
private fun expandTask() {
notesExpanded = !notesExpanded
private fun updateExpandedTaskLogic() {
if (notesExpanded) {
notesTextView?.maxLines = 100
expandNotesButton?.text = context.getString(R.string.collapse_notes)
@ -162,6 +164,7 @@ abstract class BaseTaskViewHolder(
if (data.notes?.isNotEmpty() == true) {
notesTextView?.visibility = View.VISIBLE
notesTextView?.setTextColor(ContextCompat.getColor(context, R.color.text_ternary))
updateExpandedTaskLogic()
} else {
notesTextView?.visibility = View.GONE
}