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
1e7a6961
authored
Sep 26, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AnswerCards are now checked instead of being highlighted
parent
538cc042
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
15 deletions
app/src/main/java/com/example/quickmax/MyMaterialCard.kt
app/src/main/java/com/example/quickmax/TaskActivity.kt
app/src/main/res/drawable/gradient.xml
app/src/main/res/layout/activity_task.xml
app/src/main/res/values/colors.xml
app/src/main/java/com/example/quickmax/MyMaterialCard.kt
View file @
1e7a6961
...
...
@@ -3,6 +3,7 @@ package com.example.quickmax
import
android.content.Context
import
android.graphics.Color
import
android.util.AttributeSet
import
androidx.core.content.ContextCompat
import
com.google.android.material.card.MaterialCardView
class
MyMaterialCard
:
MaterialCardView
{
...
...
@@ -16,24 +17,23 @@ class MyMaterialCard : MaterialCardView {
)
fun
clean
(
context
:
Context
)
{
isCheckable
=
true
isEnabled
=
true
isChecked
=
false
setCardBackgroundColor
(
Color
.
WHITE
)
getTextView
(
this
).
setTextColor
(
color
(
context
,
R
.
color
.
transparent_black
))
isCheckable
=
true
isEnabled
=
true
isChecked
=
false
setCardBackgroundColor
(
Color
.
WHITE
)
getTextView
(
this
).
setTextColor
(
color
(
context
,
R
.
color
.
transparent_black
))
}
fun
markCorrect
()
{
setCardBackgroundColor
(
color
(
context
,
R
.
color
.
colorAccent
)
)
fun
markCorrect
(
context
:
Context
)
{
foregroundTintList
=
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
colorAccent
)
}
fun
markWrong
(
context
:
Context
)
{
setCardBackgroundColor
(
color
(
context
,
R
.
color
.
colorPrimary
))
getTextView
(
this
).
setTextColor
(
Color
.
WHITE
)
foregroundTintList
=
ContextCompat
.
getColorStateList
(
context
,
R
.
color
.
red
)
}
fun
disable
()
{
isCheckable
=
false
isEnabled
=
false
isCheckable
=
false
isEnabled
=
false
}
}
\ No newline at end of file
app/src/main/java/com/example/quickmax/TaskActivity.kt
View file @
1e7a6961
...
...
@@ -70,14 +70,14 @@ class TaskActivity : AppCompatActivity() {
btn_next
.
visibility
=
View
.
VISIBLE
if
(
answer
.
correct
)
{
answer
.
card
.
markCorrect
()
answer
.
card
.
markCorrect
(
this
@TaskActivity
)
tv_response
.
text
=
resources
.
getString
(
R
.
string
.
response_correct
)
btn_next
.
backgroundTintList
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
colorAccent
)
btn_next
.
setTextColor
(
color
(
this
,
R
.
color
.
transparent_dark_black
))
}
else
{
answer
.
card
.
markWrong
(
this
@TaskActivity
)
tv_response
.
text
=
resources
.
getString
(
R
.
string
.
response_wrong
)
btn_next
.
backgroundTintList
=
ContextCompat
.
getColorStateList
(
this
,
(
R
.
color
.
colorPrimary
)
)
btn_next
.
backgroundTintList
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
colorPrimary
)
btn_next
.
setTextColor
(
Color
.
WHITE
)
}
}
...
...
app/src/main/res/drawable/gradient.xml
View file @
1e7a6961
...
...
@@ -3,6 +3,6 @@
<gradient
android:angle=
"90"
android:endColor=
"@color/colorPrimary"
android:startColor=
"@color/
color
Accent"
android:startColor=
"@color/
transparent
Accent"
android:type=
"linear"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_task.xml
View file @
1e7a6961
...
...
@@ -93,6 +93,7 @@
<com.example.quickmax.MyMaterialCard
android:id=
"@+id/card_left_top"
style=
"@style/MyCard"
app:cardBackgroundColor=
"#F44336"
app:cardCornerRadius=
"10dp"
app:layout_constraintBottom_toTopOf=
"@+id/card_left_bottom"
app:layout_constraintEnd_toStartOf=
"@+id/card_right_top"
...
...
app/src/main/res/values/colors.xml
View file @
1e7a6961
...
...
@@ -4,5 +4,7 @@
<color
name=
"colorAccent"
>
#4dd0e1
</color>
<color
name=
"transparent_black"
>
#83000000
</color>
<color
name=
"transparent_dark_black"
>
#BB000000
</color>
<color
name=
"transparent_red"
>
#97FF0000
</color>
<color
name=
"transparent_red"
>
#97F44336
</color>
<color
name=
"transparentAccent"
>
#444DD0E1
</color>
<color
name=
"red"
>
#FFF44336
</color>
</resources>
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