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
0bd68e10
authored
Sep 24, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some refactoring
parent
fc50e836
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
28 deletions
app/src/androidTest/java/com/example/quickmax/MainActivityTest.kt
app/src/main/java/com/example/quickmax/AnswerSet.kt
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/fragment_response.xml
app/src/main/res/layout/fragment_time_is_over.xml
app/src/main/res/values/colors.xml
app/src/androidTest/java/com/example/quickmax/MainActivityTest.kt
View file @
0bd68e10
...
...
@@ -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
)
}
...
...
app/src/main/java/com/example/quickmax/AnswerSet.kt
View file @
0bd68e10
...
...
@@ -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
...
...
app/src/main/res/layout/activity_main.xml
View file @
0bd68e10
...
...
@@ -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"
/>
...
...
app/src/main/res/layout/fragment_response.xml
View file @
0bd68e10
...
...
@@ -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=
"
12
0dp"
android:layout_height=
"
8
0dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
>
...
...
app/src/main/res/layout/fragment_time_is_over.xml
View file @
0bd68e10
...
...
@@ -34,7 +34,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/response_layout"
android:layout_width=
"match_parent"
android:layout_height=
"
12
0dp"
android:layout_height=
"
8
0dp"
android:background=
"#F44336"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
...
app/src/main/res/values/colors.xml
View file @
0bd68e10
...
...
@@ -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>
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