Commit 0bd68e10 by likorn

Some refactoring

parent fc50e836
......@@ -25,10 +25,10 @@ class MainActivityTest {
@Before
fun init() {
answers = mapOf(
getText(withId(R.id.btn_left_top)).toInt() to R.id.btn_left_top,
getText(withId(R.id.btn_right_top)).toInt() to R.id.btn_right_top,
getText(withId(R.id.btn_left_bottom)).toInt() to R.id.btn_left_bottom,
getText(withId(R.id.btn_right_bottom)).toInt() to R.id.btn_right_bottom
getText(withId(R.id.card_left_top)).toInt() to R.id.card_left_top,
getText(withId(R.id.card_right_top)).toInt() to R.id.card_right_top,
getText(withId(R.id.card_left_bottom)).toInt() to R.id.card_left_bottom,
getText(withId(R.id.card_right_bottom)).toInt() to R.id.card_right_bottom
)
}
......@@ -50,9 +50,9 @@ class MainActivityTest {
@Test
fun only_fist_answer_accepted() {
onView(withId(R.id.btn_right_bottom)).perform(click())
onView(withId(R.id.card_right_bottom)).perform(click())
assertTrue(testRule.activity.supportFragmentManager.fragments.size == 1)
onView(withId(R.id.btn_left_bottom)).perform(click())
onView(withId(R.id.card_left_bottom)).perform(click())
assertTrue(testRule.activity.supportFragmentManager.fragments.size == 1)
}
......
......@@ -3,7 +3,7 @@ package com.example.quickmax
class AnswerSet(numDigits: Int): Iterable<Answer> {
private val buttonIds = listOf(R.id.btn_left_top, R.id.btn_right_top, R.id.btn_left_bottom, R.id.btn_right_bottom)
private val buttonIds = listOf(R.id.card_left_top, R.id.card_right_top, R.id.card_left_bottom, R.id.card_right_bottom)
private val numAnswers = 4
private lateinit var correctAnswer: Answer
......
......@@ -5,7 +5,7 @@
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C4BFCC"
android:background="@color/colorBackground"
tools:context=".MainActivity">
<androidx.cardview.widget.CardView
......@@ -38,7 +38,7 @@
android:gravity="center"
android:includeFontPadding="true"
android:text="@string/second_max"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="#323753" />
</androidx.cardview.widget.CardView>
......@@ -56,52 +56,52 @@
app:layout_constraintVertical_chainStyle="packed">
<androidx.cardview.widget.CardView
android:id="@+id/btn_left_top"
android:id="@+id/card_left_top"
style="@style/AnswerCard"
app:layout_constraintBottom_toTopOf="@+id/btn_left_bottom"
app:layout_constraintEnd_toStartOf="@+id/btn_right_top"
app:layout_constraintBottom_toTopOf="@+id/card_left_bottom"
app:layout_constraintEnd_toStartOf="@+id/card_right_top"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >
app:layout_constraintTop_toTopOf="parent">
<TextView style="@style/AnswerCardText"/>
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/btn_right_top"
android:id="@+id/card_right_top"
style="@style/AnswerCard"
app:layout_constraintBottom_toTopOf="@id/btn_right_bottom"
app:layout_constraintBottom_toTopOf="@id/card_right_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/btn_left_top"
app:layout_constraintTop_toTopOf="parent" >
app:layout_constraintStart_toEndOf="@+id/card_left_top"
app:layout_constraintTop_toTopOf="parent">
<TextView style="@style/AnswerCardText"/>
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/btn_left_bottom"
android:id="@+id/card_left_bottom"
style="@style/AnswerCard"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btn_right_bottom"
app:layout_constraintEnd_toStartOf="@+id/card_right_bottom"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_left_top" >
app:layout_constraintTop_toBottomOf="@+id/card_left_top">
<TextView style="@style/AnswerCardText"/>
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/btn_right_bottom"
android:id="@+id/card_right_bottom"
style="@style/AnswerCard"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/btn_left_bottom"
app:layout_constraintTop_toBottomOf="@+id/btn_right_top" >
app:layout_constraintStart_toEndOf="@+id/card_left_bottom"
app:layout_constraintTop_toBottomOf="@+id/card_right_top">
<TextView style="@style/AnswerCardText" />
......
......@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/response_layout"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_height="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
......
......@@ -34,7 +34,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/response_layout"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_height="80dp"
android:background="#F44336"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -3,4 +3,7 @@
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorBackground">#C4BFCC</color>
<color name="colorCorrect">#81C784</color>
</resources>
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