Commit 9eae27a9 by likorn

Made answer cards checkable

parent 625fb6d3
...@@ -48,8 +48,11 @@ class TaskActivity : AppCompatActivity() { ...@@ -48,8 +48,11 @@ class TaskActivity : AppCompatActivity() {
for (answer in answerSet) { for (answer in answerSet) {
getTextView(answer.card).text = answer.value.toString() getTextView(answer.card).text = answer.value.toString()
getTextView(answer.card).setTextColor(color(this, R.color.transparent_black)) getTextView(answer.card).setTextColor(color(this, R.color.transparent_black))
answer.card.isCheckable = true
answer.card.isEnabled = true answer.card.isEnabled = true
answer.card.setOnClickListener { processAnswer(answer) } answer.card.isChecked = false
answer.card.setOnClickListener { answer.card.isChecked = true }
answer.card.setOnCheckedChangeListener { _, isChecked -> if (isChecked) processAnswer(answer) }
answer.card.setCardBackgroundColor(Color.WHITE) answer.card.setCardBackgroundColor(Color.WHITE)
} }
btn_back.setOnClickListener { startActivity(Intent(this@TaskActivity, MainActivity::class.java)) } btn_back.setOnClickListener { startActivity(Intent(this@TaskActivity, MainActivity::class.java)) }
...@@ -86,6 +89,7 @@ class TaskActivity : AppCompatActivity() { ...@@ -86,6 +89,7 @@ class TaskActivity : AppCompatActivity() {
private fun disableCards() { private fun disableCards() {
for (answer in answerSet) { for (answer in answerSet) {
answer.card.isCheckable = false
answer.card.isEnabled = false answer.card.isEnabled = false
} }
} }
...@@ -114,6 +118,7 @@ class TaskActivity : AppCompatActivity() { ...@@ -114,6 +118,7 @@ class TaskActivity : AppCompatActivity() {
btn_next.background.setColorFilter(color(this@TaskActivity, R.color.colorPrimary), PorterDuff.Mode.MULTIPLY) btn_next.background.setColorFilter(color(this@TaskActivity, R.color.colorPrimary), PorterDuff.Mode.MULTIPLY)
btn_next.setTextColor(Color.WHITE) btn_next.setTextColor(Color.WHITE)
btn_next.visibility = View.VISIBLE btn_next.visibility = View.VISIBLE
disableCards()
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment