Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
quick_max
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f00fff82
authored
Sep 25, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The answer is highlighted
parent
65de2a50
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
app/src/main/java/com/example/quickmax/TaskActivity.kt
app/src/main/java/com/example/quickmax/answers/Answer.kt
app/src/main/java/com/example/quickmax/TaskActivity.kt
View file @
f00fff82
...
...
@@ -10,6 +10,7 @@ import android.widget.TextView
import
androidx.appcompat.app.AppCompatActivity
import
androidx.cardview.widget.CardView
import
androidx.core.content.ContextCompat
import
com.example.quickmax.answers.Answer
import
com.example.quickmax.answers.AnswerSet
import
kotlinx.android.synthetic.main.activity_task.*
...
...
@@ -42,19 +43,20 @@ class TaskActivity : AppCompatActivity() {
private
fun
setUpAnswerButtons
()
{
for
(
answer
in
answerSet
)
{
(
findViewById
<
CardView
>(
answer
.
button
Id
).
getChildAt
(
0
)
as
TextView
).
text
=
answer
.
value
.
toString
()
findViewById
<
CardView
>(
answer
.
buttonId
).
setOnClickListener
{
processAnswer
(
answer
.
correct
)
}
(
findViewById
<
CardView
>(
answer
.
card
Id
).
getChildAt
(
0
)
as
TextView
).
text
=
answer
.
value
.
toString
()
findViewById
<
CardView
>(
answer
.
cardId
).
setOnClickListener
{
processAnswer
(
answer
)
}
}
}
private
fun
processAnswer
(
correct
:
Boolean
)
{
private
fun
processAnswer
(
answer
:
Answer
)
{
timer
.
cancel
()
colorAnimation
.
cancel
()
findViewById
<
CardView
>(
answer
.
cardId
).
setCardBackgroundColor
(
resources
.
getColor
(
R
.
color
.
colorAccent
))
makeButtonsUncheckable
()
val
responseFragment
=
ResponseFragment
.
newInstance
().
also
{
f
->
f
.
arguments
=
Bundle
().
also
{
b
->
b
.
putBoolean
(
"correct"
,
correct
)
}
}
b
->
b
.
putBoolean
(
"correct"
,
answer
.
correct
)
}
}
supportFragmentManager
.
beginTransaction
()
...
...
@@ -64,7 +66,7 @@ class TaskActivity : AppCompatActivity() {
private
fun
makeButtonsUncheckable
()
{
for
(
answer
in
answerSet
)
{
findViewById
<
CardView
>(
answer
.
button
Id
).
isClickable
=
false
findViewById
<
CardView
>(
answer
.
card
Id
).
isClickable
=
false
}
}
...
...
app/src/main/java/com/example/quickmax/answers/Answer.kt
View file @
f00fff82
package
com.example.quickmax.answers
class
Answer
(
val
button
Id
:
Int
,
val
value
:
Int
)
{
class
Answer
(
val
card
Id
:
Int
,
val
value
:
Int
)
{
var
correct
:
Boolean
=
false
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment