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
48834e53
authored
Sep 25, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactoring
parent
1752e93b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
app/src/main/java/com/example/quickmax/TaskActivity.kt
app/src/main/java/com/example/quickmax/TaskActivity.kt
View file @
48834e53
...
...
@@ -66,12 +66,12 @@ class TaskActivity : AppCompatActivity() {
if
(
answer
.
correct
)
{
tv_timer
.
text
=
resources
.
getString
(
R
.
string
.
response_correct
)
answer
.
card
.
setCardBackgroundColor
(
resources
.
getColor
(
R
.
color
.
colorAccent
))
btn_next
.
background
.
setColorFilter
(
resources
.
getC
olor
(
R
.
color
.
colorAccent
),
PorterDuff
.
Mode
.
MULTIPLY
)
btn_next
.
setTextColor
(
resources
.
getC
olor
(
R
.
color
.
transparent_dark_black
))
btn_next
.
background
.
setColorFilter
(
c
olor
(
R
.
color
.
colorAccent
),
PorterDuff
.
Mode
.
MULTIPLY
)
btn_next
.
setTextColor
(
c
olor
(
R
.
color
.
transparent_dark_black
))
}
else
{
tv_timer
.
text
=
resources
.
getString
(
R
.
string
.
response_wrong
)
answer
.
card
.
setCardBackgroundColor
(
resources
.
getC
olor
(
R
.
color
.
colorPrimary
))
btn_next
.
background
.
setColorFilter
(
resources
.
getC
olor
(
R
.
color
.
colorPrimary
),
PorterDuff
.
Mode
.
MULTIPLY
)
answer
.
card
.
setCardBackgroundColor
(
c
olor
(
R
.
color
.
colorPrimary
))
btn_next
.
background
.
setColorFilter
(
c
olor
(
R
.
color
.
colorPrimary
),
PorterDuff
.
Mode
.
MULTIPLY
)
(
answer
.
card
.
getChildAt
(
0
)
as
TextView
).
setTextColor
(
Color
.
WHITE
)
}
}
...
...
@@ -84,12 +84,12 @@ class TaskActivity : AppCompatActivity() {
private
fun
startProgressBarAnimation
()
{
val
colorFrom
=
Color
.
TRANSPARENT
val
colorTo
=
ContextCompat
.
getColor
(
this
,
R
.
color
.
transparent_red
)
val
colorTo
=
color
(
R
.
color
.
transparent_red
)
colorAnimation
=
ValueAnimator
.
ofObject
(
ArgbEvaluator
(),
colorFrom
,
colorTo
)
colorAnimation
.
duration
=
millisToSolve
colorAnimation
.
addUpdateListener
{
animator
->
layout_gradient
.
background
.
setColorFilter
(
animator
.
animatedValue
as
Int
,
android
.
graphics
.
PorterDuff
.
Mode
.
SRC_ATOP
)
PorterDuff
.
Mode
.
SRC_ATOP
)
}
colorAnimation
.
start
()
}
...
...
@@ -110,4 +110,8 @@ class TaskActivity : AppCompatActivity() {
}
}
}
private
fun
color
(
id
:
Int
):
Int
{
return
ContextCompat
.
getColor
(
this
,
id
)
}
}
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