Commit 70ac0fd1 by likorn

WIP MainActivity

parent e9056a6a
...@@ -11,14 +11,15 @@ import androidx.test.espresso.UiController ...@@ -11,14 +11,15 @@ import androidx.test.espresso.UiController
import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.* import androidx.test.espresso.matcher.ViewMatchers.*
import com.example.quickmax.answers.findSecondMax
import junit.framework.Assert.assertNotNull import junit.framework.Assert.assertNotNull
import junit.framework.Assert.assertTrue import junit.framework.Assert.assertTrue
import org.hamcrest.Matcher import org.hamcrest.Matcher
import org.junit.Before import org.junit.Before
class MainActivityTest { class TaskActivityTest {
@get:Rule @get:Rule
val testRule = ActivityTestRule<MainActivity>(MainActivity::class.java, true, true) val testRule = ActivityTestRule<TaskActivity>(TaskActivity::class.java, true, true)
private lateinit var answers: Map<Int, Int> private lateinit var answers: Map<Int, Int>
......
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".MainActivity" <activity android:name=".TaskActivity"
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"> android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
</activity>
<activity android:name=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
package com.example.quickmax package com.example.quickmax
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.CountDownTimer
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
private lateinit var answerSet: AnswerSet class MainActivity: AppCompatActivity() {
private val timeToSolve:Long = 4000
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
answerSet = AnswerSet(3)
setUpAnswerButtons()
timer.start()
startProgressBarAnimation()
} }
}
private fun setUpAnswerButtons() { \ No newline at end of file
for (answer in answerSet) {
(findViewById<CardView>(answer.buttonId).getChildAt(0) as TextView).text = answer.value.toString()
findViewById<CardView>(answer.buttonId).setOnClickListener { processAnswer(answer.correct) }
}
}
private fun processAnswer(correct: Boolean) {
timer.cancel()
makeButtonsUncheckable()
val responseFragment = ResponseFragment.newInstance().also {
f -> f.arguments = Bundle().also {
b -> b.putBoolean("correct", correct) } }
supportFragmentManager
.beginTransaction()
.add(R.id.main_layout, responseFragment, "response")
.commitAllowingStateLoss()
}
private fun makeButtonsUncheckable() {
for (answer in answerSet) {
findViewById<CardView>(answer.buttonId).isClickable = false
}
}
private fun startProgressBarAnimation() {
val colorFrom = ContextCompat.getColor(this, R.color.gradient_dark)
val colorTo = ContextCompat.getColor(this, R.color.red)
val colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
colorAnimation.duration = timeToSolve
colorAnimation.addUpdateListener { animator ->
progress_bar.progressDrawable.setColorFilter(animator.animatedValue as Int,
android.graphics.PorterDuff.Mode.SRC_ATOP)
}
colorAnimation.start()
}
fun reload() {
val intent = intent
finish()
startActivity(intent)
}
private val timer = object : CountDownTimer(timeToSolve, 100) {
override fun onTick(millisUntilFinished: Long) {
val progress = ((timeToSolve - millisUntilFinished).toFloat() / timeToSolve) * 100
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
progress_bar.setProgress(progress.toInt(), true)
else
progress_bar.progress = progress.toInt()
}
override fun onFinish() {
cv_task.elevation = 0f
makeButtonsUncheckable()
supportFragmentManager
.beginTransaction()
.replace(R.id.main_layout, TimeIsOverFragment.newInstance(), "time_is_over")
.commitAllowingStateLoss()
}
}
}
...@@ -32,7 +32,7 @@ class ResponseFragment: Fragment() { ...@@ -32,7 +32,7 @@ class ResponseFragment: Fragment() {
private fun view(view: View, color: Int, responseId: Int): View { private fun view(view: View, color: Int, responseId: Int): View {
view.findViewById<TextView>(R.id.tv_response).text = resources.getString(responseId) view.findViewById<TextView>(R.id.tv_response).text = resources.getString(responseId)
view.findViewById<ConstraintLayout>(R.id.response_layout).setBackgroundColor(color) view.findViewById<ConstraintLayout>(R.id.response_layout).setBackgroundColor(color)
view.findViewById<ImageButton>(R.id.btn_next).setOnClickListener { (activity as MainActivity).reload() } view.findViewById<ImageButton>(R.id.btn_next).setOnClickListener { (activity as TaskActivity).reload() }
return view return view
} }
} }
\ No newline at end of file
package com.example.quickmax
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.os.Build
import android.os.Bundle
import android.os.CountDownTimer
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import com.example.quickmax.answers.AnswerSet
import kotlinx.android.synthetic.main.activity_task.*
class TaskActivity : AppCompatActivity() {
private lateinit var answerSet: AnswerSet
private val timeToSolve:Long = 4000
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_task)
answerSet = AnswerSet(3)
setUpAnswerButtons()
timer.start()
startProgressBarAnimation()
}
private fun setUpAnswerButtons() {
for (answer in answerSet) {
(findViewById<CardView>(answer.buttonId).getChildAt(0) as TextView).text = answer.value.toString()
findViewById<CardView>(answer.buttonId).setOnClickListener { processAnswer(answer.correct) }
}
}
private fun processAnswer(correct: Boolean) {
timer.cancel()
makeButtonsUncheckable()
val responseFragment = ResponseFragment.newInstance().also {
f -> f.arguments = Bundle().also {
b -> b.putBoolean("correct", correct) } }
supportFragmentManager
.beginTransaction()
.add(R.id.main_layout, responseFragment, "response")
.commitAllowingStateLoss()
}
private fun makeButtonsUncheckable() {
for (answer in answerSet) {
findViewById<CardView>(answer.buttonId).isClickable = false
}
}
private fun startProgressBarAnimation() {
val colorFrom = ContextCompat.getColor(this, R.color.gradient_dark)
val colorTo = ContextCompat.getColor(this, R.color.red)
val colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
colorAnimation.duration = timeToSolve
colorAnimation.addUpdateListener { animator ->
progress_bar.progressDrawable.setColorFilter(animator.animatedValue as Int,
android.graphics.PorterDuff.Mode.SRC_ATOP)
}
colorAnimation.start()
}
fun reload() {
val intent = intent
finish()
startActivity(intent)
}
private val timer = object : CountDownTimer(timeToSolve, 100) {
override fun onTick(millisUntilFinished: Long) {
val progress = ((timeToSolve - millisUntilFinished).toFloat() / timeToSolve) * 100
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
progress_bar.setProgress(progress.toInt(), true)
else
progress_bar.progress = progress.toInt()
}
override fun onFinish() {
cv_task.elevation = 0f
makeButtonsUncheckable()
supportFragmentManager
.beginTransaction()
.replace(R.id.main_layout, TimeIsOverFragment.newInstance(), "time_is_over")
.commitAllowingStateLoss()
}
}
}
...@@ -18,7 +18,7 @@ class TimeIsOverFragment: Fragment() { ...@@ -18,7 +18,7 @@ class TimeIsOverFragment: Fragment() {
container: ViewGroup?, container: ViewGroup?,
savedInstanceState: Bundle?): View? { savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_time_is_over, container, false) val view = inflater.inflate(R.layout.fragment_time_is_over, container, false)
view.findViewById<ImageButton>(R.id.btn_next).setOnClickListener { (activity as MainActivity).reload() } view.findViewById<ImageButton>(R.id.btn_next).setOnClickListener { (activity as TaskActivity).reload() }
return view return view
} }
} }
\ No newline at end of file
package com.example.quickmax package com.example.quickmax.answers
class Answer(val buttonId: Int, val value: Int) { class Answer(val buttonId: Int, val value: Int) {
var correct: Boolean = false var correct: Boolean = false
} }
\ No newline at end of file
package com.example.quickmax package com.example.quickmax.answers
import com.example.quickmax.R
class AnswerSet(numDigits: Int): Iterable<Answer> { class AnswerSet(numDigits: Int): Iterable<Answer> {
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 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 val numAnswers = 4
private lateinit var correctAnswer: Answer private lateinit var correctAnswer: Answer
val answers: MutableList<Answer> = mutableListOf() val answers: MutableList<Answer> = mutableListOf()
init { init {
val randomNumbers = generateNRandomNumbers(numDigits, numAnswers) val randomNumbers =
generateNRandomNumbers(numDigits, numAnswers)
for (i in 0 until numAnswers) for (i in 0 until numAnswers)
answers.add(Answer(buttonIds[i], randomNumbers.elementAt(i))) answers.add(
Answer(
buttonIds[i],
randomNumbers.elementAt(i)
)
)
val correctAnswerNum = findSecondMax(answers.map { answer -> answer.value }) val correctAnswerNum =
findSecondMax(answers.map { answer -> answer.value })
answers.forEach { n -> answers.forEach { n ->
n.correct = n.value == correctAnswerNum n.correct = n.value == correctAnswerNum
if (n.correct) if (n.correct)
......
package com.example.quickmax package com.example.quickmax.answers
import kotlin.math.pow import kotlin.math.pow
......
...@@ -2,169 +2,93 @@ ...@@ -2,169 +2,93 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#DADADA" android:background="@drawable/gradient">
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout <TextView
android:layout_width="0dp" android:id="@+id/textView4"
android:layout_height="200dp" android:layout_width="wrap_content"
android:background="@drawable/gradient" android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginStart="16dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"> android:layout_marginEnd="16dp"
android:gravity="center"
<FrameLayout android:text="@string/how_many_digits"
android:id="@+id/layout_progress_bar" android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4"
android:layout_width="match_parent" android:textColor="@color/white"
android:layout_height="4dp" app:layout_constraintBottom_toTopOf="@+id/layout_num_digits"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_gravity="center"
android:foregroundTint="#320A64"
android:indeterminate="false"
android:max="100" />
</FrameLayout>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@android:color/transparent"
android:tint="@android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_progress_bar"
app:srcCompat="@drawable/ic_back" />
<TextView
android:id="@+id/tv_score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="Score: 5"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="@+id/imageButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_progress_bar" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cv_task"
style="@style/CardView.Light"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="16dp"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="4dp"
app:cardElevation="2dp"
app:layout_constraintBottom_toTopOf="@+id/layout_answers"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" app:layout_constraintVertical_chainStyle="packed" />
app:layout_constraintVertical_chainStyle="packed">
<TextView
android:id="@+id/tv_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:includeFontPadding="true"
android:text="@string/second_max"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="#323753" />
</androidx.cardview.widget.CardView>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_answers" android:id="@+id/layout_num_digits"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="200dp" android:layout_height="100dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="@+id/textView4"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/cv_task" app:layout_constraintTop_toBottomOf="@+id/textView4">
app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainStyle="packed">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/card_left_top" android:id="@+id/card_2_digits"
style="@style/AnswerCard" style="@style/MyCard"
app:layout_constraintBottom_toTopOf="@+id/card_left_bottom" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/card_right_top" app:layout_constraintEnd_toStartOf="@+id/card_3_digits"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" 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> android:text="@string/number_digits_2" />
<androidx.cardview.widget.CardView
android:id="@+id/card_right_top"
style="@style/AnswerCard"
app:layout_constraintBottom_toTopOf="@id/card_right_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/card_left_top"
app:layout_constraintTop_toTopOf="parent">
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/card_left_bottom" android:id="@+id/card_3_digits"
style="@style/AnswerCard" style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/card_right_bottom" app:layout_constraintEnd_toStartOf="@+id/card_4_digits"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/card_2_digits"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@+id/card_left_top">
<TextView style="@style/AnswerCardText" />
<TextView
style="@style/AnswerCardText"
android:text="@string/number_digits_3" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/card_right_bottom" android:id="@+id/card_4_digits"
style="@style/AnswerCard" style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@id/card_3_digits"
app:layout_constraintStart_toEndOf="@+id/card_left_bottom" app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@+id/card_right_top">
<TextView style="@style/AnswerCardText" />
<TextView
style="@style/AnswerCardText"
android:text="@string/number_digits_4" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<SeekBar
android:id="@+id/seekBar"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toEndOf="@+id/textView4"
app:layout_constraintStart_toStartOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/layout_num_digits" >
</SeekBar>
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TIme to solve"
app:layout_constraintStart_toStartOf="@+id/seekBar"
app:layout_constraintTop_toBottomOf="@+id/seekBar" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DADADA"
tools:context=".TaskActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="200dp"
android:background="@drawable/gradient"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/layout_progress_bar"
android:layout_width="match_parent"
android:layout_height="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_gravity="center"
android:foregroundTint="#320A64"
android:indeterminate="false"
android:max="100" />
</FrameLayout>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@android:color/transparent"
android:tint="@android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_progress_bar"
app:srcCompat="@drawable/ic_back" />
<TextView
android:id="@+id/tv_score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="Score: 5"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="@+id/imageButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_progress_bar" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cv_task"
style="@style/CardView.Light"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="16dp"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="4dp"
app:cardElevation="2dp"
app:layout_constraintBottom_toTopOf="@+id/layout_answers"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainStyle="packed">
<TextView
android:id="@+id/tv_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:includeFontPadding="true"
android:text="@string/second_max"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="#323753" />
</androidx.cardview.widget.CardView>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_answers"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cv_task"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainStyle="packed">
<androidx.cardview.widget.CardView
android:id="@+id/card_left_top"
style="@style/MyCard"
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">
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/card_right_top"
style="@style/MyCard"
app:layout_constraintBottom_toTopOf="@id/card_right_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/card_left_top"
app:layout_constraintTop_toTopOf="parent">
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/card_left_bottom"
style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/card_right_bottom"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/card_left_top">
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/card_right_bottom"
style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/card_left_bottom"
app:layout_constraintTop_toBottomOf="@+id/card_right_top">
<TextView style="@style/AnswerCardText" />
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/time_is_over" android:text="@string/time_is_over"
android:textAppearance="@android:style/TextAppearance.Material.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@color/white" android:textColor="@color/white"
app:layout_constraintBottom_toTopOf="@+id/response_layout" app:layout_constraintBottom_toTopOf="@+id/response_layout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<resources> <resources>
<color name="colorPrimary">#008577</color> <color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color> <color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color> <color name="colorAccent">#FF4A148C</color>
<color name="colorBackground">#C4BFCC</color> <color name="colorBackground">#C4BFCC</color>
<color name="colorCorrect">#81C784</color> <color name="colorCorrect">#81C784</color>
......
...@@ -4,4 +4,8 @@ ...@@ -4,4 +4,8 @@
<string name="response_correct">CORRECT</string> <string name="response_correct">CORRECT</string>
<string name="response_wrong">WRONG</string> <string name="response_wrong">WRONG</string>
<string name="time_is_over">TIME IS OVER</string> <string name="time_is_over">TIME IS OVER</string>
<string name="number_digits_2">2</string>
<string name="number_digits_3">3</string>
<string name="number_digits_4">4</string>
<string name="how_many_digits">HOW MANY DIGITS?</string>
</resources> </resources>
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
</style> </style>
<style name="AnswerCard" parent="CardView"> <style name="MyCard" parent="CardView">
<item name="android:layout_width">0dp</item> <item name="android:layout_width">0dp</item>
<item name="android:layout_height">0dp</item> <item name="android:layout_height">0dp</item>
<item name="android:layout_margin">8dp</item> <item name="android:layout_margin">8dp</item>
<item name="android:clickable">true</item> <item name="android:clickable">true</item>
<item name="android:focusable">true</item> <item name="android:focusable">true</item>
<item name="android:foreground">?android:attr/selectableItemBackground</item> <item name="android:foreground">?attr/selectableItemBackground</item>
<item name="cardCornerRadius">4dp</item> <item name="cardCornerRadius">4dp</item>
<item name="cardBackgroundColor">@android:color/white</item> <item name="cardBackgroundColor">@android:color/white</item>
</style> </style>
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
<item name="android:layout_marginTop">8dp</item> <item name="android:layout_marginTop">8dp</item>
<item name="android:layout_marginEnd">24dp</item> <item name="android:layout_marginEnd">24dp</item>
<item name="android:layout_marginBottom">8dp</item> <item name="android:layout_marginBottom">8dp</item>
<item name="android:background">@android:color/transparent</item> <item name="background">@android:color/transparent</item>
<item name="android:tint">@color/white</item> <item name="tint">@color/white</item>
</style> </style>
</resources> </resources>
package com.example.quickmax package com.example.quickmax
import com.example.quickmax.answers.AnswerSet
import com.example.quickmax.answers.findSecondMax
import org.junit.Test import org.junit.Test
import org.junit.Assert.* import org.junit.Assert.*
......
package com.example.quickmax package com.example.quickmax
import com.example.quickmax.answers.findSecondMax
import com.example.quickmax.answers.generateRandom
import org.junit.Test import org.junit.Test
import org.junit.Assert.* import org.junit.Assert.*
......
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