Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

likorn / quick_max

  • This project
    • Loading...
  • Sign in
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 5 years ago by likorn's avatar likorn
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

AnswerCards are now checked instead of being highlighted

parent 538cc042 master
Hide whitespace changes
Inline Side-by-side
Showing 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 ...@@ -3,6 +3,7 @@ package com.example.quickmax
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.util.AttributeSet import android.util.AttributeSet
import androidx.core.content.ContextCompat
import com.google.android.material.card.MaterialCardView import com.google.android.material.card.MaterialCardView
class MyMaterialCard : MaterialCardView { class MyMaterialCard : MaterialCardView {
...@@ -16,24 +17,23 @@ class MyMaterialCard : MaterialCardView { ...@@ -16,24 +17,23 @@ class MyMaterialCard : MaterialCardView {
) )
fun clean(context: Context) { fun clean(context: Context) {
isCheckable = true isCheckable = true
isEnabled = true isEnabled = true
isChecked = false isChecked = false
setCardBackgroundColor(Color.WHITE) setCardBackgroundColor(Color.WHITE)
getTextView(this).setTextColor(color(context, R.color.transparent_black)) getTextView(this).setTextColor(color(context, R.color.transparent_black))
} }
fun markCorrect() { fun markCorrect(context: Context) {
setCardBackgroundColor(color(context, R.color.colorAccent)) foregroundTintList = ContextCompat.getColorStateList(context, R.color.colorAccent)
} }
fun markWrong(context: Context) { fun markWrong(context: Context) {
setCardBackgroundColor(color(context, R.color.colorPrimary)) foregroundTintList = ContextCompat.getColorStateList(context, R.color.red)
getTextView(this).setTextColor(Color.WHITE)
} }
fun disable() { fun disable() {
isCheckable = false isCheckable = false
isEnabled = false isEnabled = false
} }
} }
\ No newline at end of file
This diff is collapsed. Click to expand it.
app/src/main/java/com/example/quickmax/TaskActivity.kt
View file @ 1e7a6961
...@@ -70,14 +70,14 @@ class TaskActivity : AppCompatActivity() { ...@@ -70,14 +70,14 @@ class TaskActivity : AppCompatActivity() {
btn_next.visibility = View.VISIBLE btn_next.visibility = View.VISIBLE
if (answer.correct) { if (answer.correct) {
answer.card.markCorrect() answer.card.markCorrect(this@TaskActivity)
tv_response.text = resources.getString(R.string.response_correct) tv_response.text = resources.getString(R.string.response_correct)
btn_next.backgroundTintList = ContextCompat.getColorStateList(this, R.color.colorAccent) btn_next.backgroundTintList = ContextCompat.getColorStateList(this, R.color.colorAccent)
btn_next.setTextColor(color(this, R.color.transparent_dark_black)) btn_next.setTextColor(color(this, R.color.transparent_dark_black))
} else { } else {
answer.card.markWrong(this@TaskActivity) answer.card.markWrong(this@TaskActivity)
tv_response.text = resources.getString(R.string.response_wrong) 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) btn_next.setTextColor(Color.WHITE)
} }
} }
......
This diff is collapsed. Click to expand it.
app/src/main/res/drawable/gradient.xml
View file @ 1e7a6961
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<gradient <gradient
android:angle="90" android:angle="90"
android:endColor="@color/colorPrimary" android:endColor="@color/colorPrimary"
android:startColor="@color/colorAccent" android:startColor="@color/transparentAccent"
android:type="linear" /> android:type="linear" />
</shape> </shape>
\ No newline at end of file
This diff is collapsed. Click to expand it.
app/src/main/res/layout/activity_task.xml
View file @ 1e7a6961
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
<com.example.quickmax.MyMaterialCard <com.example.quickmax.MyMaterialCard
android:id="@+id/card_left_top" android:id="@+id/card_left_top"
style="@style/MyCard" style="@style/MyCard"
app:cardBackgroundColor="#F44336"
app:cardCornerRadius="10dp" app:cardCornerRadius="10dp"
app:layout_constraintBottom_toTopOf="@+id/card_left_bottom" app:layout_constraintBottom_toTopOf="@+id/card_left_bottom"
app:layout_constraintEnd_toStartOf="@+id/card_right_top" app:layout_constraintEnd_toStartOf="@+id/card_right_top"
......
This diff is collapsed. Click to expand it.
app/src/main/res/values/colors.xml
View file @ 1e7a6961
...@@ -4,5 +4,7 @@ ...@@ -4,5 +4,7 @@
<color name="colorAccent">#4dd0e1</color> <color name="colorAccent">#4dd0e1</color>
<color name="transparent_black">#83000000</color> <color name="transparent_black">#83000000</color>
<color name="transparent_dark_black">#BB000000</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> </resources>
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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