Commit 66edac91 by likorn

Changed the check icons for answerCards

parent 1e7a6961
...@@ -6,7 +6,7 @@ import android.util.AttributeSet ...@@ -6,7 +6,7 @@ import android.util.AttributeSet
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.google.android.material.card.MaterialCardView import com.google.android.material.card.MaterialCardView
class MyMaterialCard : MaterialCardView { class AnswerCardView : MaterialCardView {
constructor(context: Context?) : super(context) constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
...@@ -25,10 +25,12 @@ class MyMaterialCard : MaterialCardView { ...@@ -25,10 +25,12 @@ class MyMaterialCard : MaterialCardView {
} }
fun markCorrect(context: Context) { fun markCorrect(context: Context) {
checkedIcon = context.resources.getDrawable(R.drawable.ic_check, null)
foregroundTintList = ContextCompat.getColorStateList(context, R.color.colorAccent) foregroundTintList = ContextCompat.getColorStateList(context, R.color.colorAccent)
} }
fun markWrong(context: Context) { fun markWrong(context: Context) {
checkedIcon = context.resources.getDrawable(R.drawable.ic_cancel, null)
foregroundTintList = ContextCompat.getColorStateList(context, R.color.red) foregroundTintList = ContextCompat.getColorStateList(context, R.color.red)
} }
......
package com.example.quickmax.answers package com.example.quickmax.answers
import com.example.quickmax.MyMaterialCard import com.example.quickmax.AnswerCardView
class Answer(val card: MyMaterialCard, val value: Int) { class Answer(val card: AnswerCardView, val value: Int) {
var correct: Boolean = false var correct: Boolean = false
} }
\ No newline at end of file
package com.example.quickmax.answers package com.example.quickmax.answers
import com.example.quickmax.MyMaterialCard import com.example.quickmax.AnswerCardView
class AnswerSet(numDigits: Int, cards: List<MyMaterialCard>): Iterable<Answer> { class AnswerSet(numDigits: Int, cards: List<AnswerCardView>): Iterable<Answer> {
private val numAnswers = 4 private val numAnswers = 4
private lateinit var correctAnswer: Answer private lateinit var correctAnswer: Answer
......
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFF44336"/>
</shape>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>
</vector>
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M15,1L9,1v2h6L15,1zM11,14h2L13,8h-2v6zM19.03,7.39l1.42,-1.42c-0.43,-0.51 -0.9,-0.99 -1.41,-1.41l-1.42,1.42C16.07,4.74 14.12,4 12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9 9,-4.03 9,-9c0,-2.12 -0.74,-4.07 -1.97,-5.61zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/> android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector> </vector>
<vector android:height="80dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="80dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M15.5,5l-4.5,0l5,7l-5,7l4.5,0l5,-7z"/>
<path android:fillColor="#FF000000" android:pathData="M8.5,5l-4.5,0l5,7l-5,7l4.5,0l5,-7z"/>
</vector>
<vector android:height="40dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M15.5,5l-4.5,0l5,7l-5,7l4.5,0l5,-7z"/>
<path android:fillColor="#FF000000" android:pathData="M8.5,5l-4.5,0l5,7l-5,7l4.5,0l5,-7z"/>
</vector>
<vector android:height="150dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="150dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M15,1L9,1v2h6L15,1zM11,14h2L13,8h-2v6zM19.03,7.39l1.42,-1.42c-0.43,-0.51 -0.9,-0.99 -1.41,-1.41l-1.42,1.42C16.07,4.74 14.12,4 12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9 9,-4.03 9,-9c0,-2.12 -0.74,-4.07 -1.97,-5.61zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
</vector>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
app:layout_constraintVertical_bias="0.5" app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainStyle="packed"> app:layout_constraintVertical_chainStyle="packed">
<com.example.quickmax.MyMaterialCard <com.example.quickmax.AnswerCardView
android:id="@+id/card_left_top" android:id="@+id/card_left_top"
style="@style/MyCard" style="@style/MyCard"
app:cardBackgroundColor="#F44336" app:cardBackgroundColor="#F44336"
...@@ -103,9 +103,9 @@ ...@@ -103,9 +103,9 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.MyMaterialCard> </com.example.quickmax.AnswerCardView>
<com.example.quickmax.MyMaterialCard <com.example.quickmax.AnswerCardView
android:id="@+id/card_right_top" android:id="@+id/card_right_top"
style="@style/MyCard" style="@style/MyCard"
app:layout_constraintBottom_toTopOf="@id/card_right_bottom" app:layout_constraintBottom_toTopOf="@id/card_right_bottom"
...@@ -116,9 +116,9 @@ ...@@ -116,9 +116,9 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.MyMaterialCard> </com.example.quickmax.AnswerCardView>
<com.example.quickmax.MyMaterialCard <com.example.quickmax.AnswerCardView
android:id="@+id/card_left_bottom" android:id="@+id/card_left_bottom"
style="@style/MyCard" style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
...@@ -129,9 +129,9 @@ ...@@ -129,9 +129,9 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.MyMaterialCard> </com.example.quickmax.AnswerCardView>
<com.example.quickmax.MyMaterialCard <com.example.quickmax.AnswerCardView
android:id="@+id/card_right_bottom" android:id="@+id/card_right_bottom"
style="@style/MyCard" style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.MyMaterialCard> </com.example.quickmax.AnswerCardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
......
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