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
a9f9c93d
authored
Sep 28, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactoring
parent
53e74182
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
app/src/main/java/com/paktalin/quickmax/AnswerCardView.kt
app/src/main/java/com/paktalin/quickmax/TaskActivity.kt
app/src/main/java/com/paktalin/quickmax/AnswerCardView.kt
View file @
a9f9c93d
...
...
@@ -16,7 +16,7 @@ class AnswerCardView : MaterialCardView {
defStyleAttr
)
fun
clean
(
context
:
Contex
t
)
{
fun
initial
(
context
:
Context
,
text
:
In
t
)
{
isCheckable
=
true
isEnabled
=
true
isChecked
=
false
...
...
@@ -27,6 +27,8 @@ class AnswerCardView : MaterialCardView {
R
.
color
.
transparent_black
)
)
getTextView
(
this
).
text
=
text
.
toString
()
setOnClickListener
{
isChecked
=
true
}
}
fun
markCorrect
(
context
:
Context
)
{
...
...
app/src/main/java/com/paktalin/quickmax/TaskActivity.kt
View file @
a9f9c93d
...
...
@@ -15,6 +15,7 @@ import com.paktalin.quickmax.answers.Answer
import
com.paktalin.quickmax.answers.AnswerSet
import
kotlinx.android.synthetic.main.activity_task.*
// TODO save state
class
TaskActivity
:
AppCompatActivity
()
{
private
lateinit
var
answerSet
:
AnswerSet
...
...
@@ -49,10 +50,8 @@ class TaskActivity : AppCompatActivity() {
private
fun
setUpCards
()
{
answerSet
.
forEach
{
answer
->
answer
.
card
.
setOnClickListener
{
answer
.
card
.
isChecked
=
true
}
answer
.
card
.
setOnCheckedChangeListener
{
_
,
isChecked
->
if
(
isChecked
)
processAnswer
(
answer
)
}
getTextView
(
answer
.
card
).
text
=
answer
.
value
.
toString
()
answer
.
card
.
clean
(
this
@TaskActivity
)
answer
.
card
.
initial
(
this
@TaskActivity
,
answer
.
value
)
}
btn_back
.
setOnClickListener
{
startActivity
(
Intent
(
this
@TaskActivity
,
MainActivity
::
class
.
java
))
}
btn_next
.
apply
{
...
...
@@ -65,7 +64,7 @@ class TaskActivity : AppCompatActivity() {
timer
.
cancel
()
colorAnimation
.
cancel
()
setResponseText
(
answer
)
disableCards
()
answerSet
.
forEach
{
answer
->
answer
.
card
.
disable
()}
}
private
fun
setResponseText
(
answer
:
Answer
)
{
...
...
@@ -85,10 +84,6 @@ class TaskActivity : AppCompatActivity() {
}
}
private
fun
disableCards
()
{
answerSet
.
forEach
{
answer
->
answer
.
card
.
disable
()}
}
private
fun
startProgressBarAnimation
()
{
val
colorFrom
=
Color
.
TRANSPARENT
val
colorTo
=
...
...
@@ -114,7 +109,7 @@ class TaskActivity : AppCompatActivity() {
btn_next
.
backgroundTintList
=
ContextCompat
.
getColorStateList
(
this
@TaskActivity
,
R
.
color
.
colorPrimary
)
btn_next
.
setTextColor
(
Color
.
WHITE
)
btn_next
.
visibility
=
View
.
VISIBLE
disableCards
()
answerSet
.
forEach
{
answer
->
answer
.
card
.
disable
()}
}
}
}
...
...
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