Commit 625fb6d3 by likorn

Fixed bug; now the cards are disabled after one has been clicked

parent b2b04b68
...@@ -34,7 +34,7 @@ class TaskActivity : AppCompatActivity() { ...@@ -34,7 +34,7 @@ class TaskActivity : AppCompatActivity() {
private fun startNewRound() { private fun startNewRound() {
answerSet = AnswerSet(numDigits, listOf(card_left_top, card_right_top, card_left_bottom, card_right_bottom)) answerSet = AnswerSet(numDigits, listOf(card_left_top, card_right_top, card_left_bottom, card_right_bottom))
setUpButtons() setUpCards()
timer.start() timer.start()
startProgressBarAnimation() startProgressBarAnimation()
} }
...@@ -44,10 +44,11 @@ class TaskActivity : AppCompatActivity() { ...@@ -44,10 +44,11 @@ class TaskActivity : AppCompatActivity() {
millisToSolve = 1000 * intent.getIntExtra("sec_to_solve", 4).toLong() millisToSolve = 1000 * intent.getIntExtra("sec_to_solve", 4).toLong()
} }
private fun setUpButtons() { private fun setUpCards() {
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.isEnabled = true
answer.card.setOnClickListener { processAnswer(answer) } answer.card.setOnClickListener { processAnswer(answer) }
answer.card.setCardBackgroundColor(Color.WHITE) answer.card.setCardBackgroundColor(Color.WHITE)
} }
...@@ -62,7 +63,7 @@ class TaskActivity : AppCompatActivity() { ...@@ -62,7 +63,7 @@ class TaskActivity : AppCompatActivity() {
timer.cancel() timer.cancel()
colorAnimation.cancel() colorAnimation.cancel()
setResponseText(answer) setResponseText(answer)
makeButtonsUncheckable() disableCards()
} }
private fun setResponseText(answer: Answer) { private fun setResponseText(answer: Answer) {
...@@ -83,9 +84,9 @@ class TaskActivity : AppCompatActivity() { ...@@ -83,9 +84,9 @@ class TaskActivity : AppCompatActivity() {
} }
} }
private fun makeButtonsUncheckable() { private fun disableCards() {
for (answer in answerSet) { for (answer in answerSet) {
answer.card.isClickable = false answer.card.isEnabled = false
} }
} }
......
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