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
ae72ab10
authored
Sep 23, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a timer
parent
2867fdfd
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
0 deletions
app/src/androidTest/java/com/example/quickmax/MainActivityTest.kt
app/src/main/java/com/example/quickmax/MainActivity.kt
app/src/main/res/drawable/ic_timer_big.xml
app/src/main/res/drawable/ic_timer_small.xml
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/fragment_time_is_over.xml
app/src/androidTest/java/com/example/quickmax/MainActivityTest.kt
View file @
ae72ab10
...
@@ -56,6 +56,10 @@ class MainActivityTest {
...
@@ -56,6 +56,10 @@ class MainActivityTest {
assertTrue
(
testRule
.
activity
.
supportFragmentManager
.
fragments
.
size
==
1
)
assertTrue
(
testRule
.
activity
.
supportFragmentManager
.
fragments
.
size
==
1
)
}
}
@Test
fun
timer
()
{
// TODO write test
}
private
fun
getCorrectAnswerIndex
():
Int
{
private
fun
getCorrectAnswerIndex
():
Int
{
val
options
=
getOptions
()
val
options
=
getOptions
()
...
...
app/src/main/java/com/example/quickmax/MainActivity.kt
View file @
ae72ab10
...
@@ -6,6 +6,7 @@ import android.widget.RadioButton
...
@@ -6,6 +6,7 @@ import android.widget.RadioButton
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.activity_main.*
import
android.os.CountDownTimer
class
MainActivity
:
AppCompatActivity
()
{
class
MainActivity
:
AppCompatActivity
()
{
...
@@ -17,6 +18,20 @@ class MainActivity : AppCompatActivity() {
...
@@ -17,6 +18,20 @@ class MainActivity : AppCompatActivity() {
setContentView
(
R
.
layout
.
activity_main
)
setContentView
(
R
.
layout
.
activity_main
)
addRadioButtons
()
addRadioButtons
()
setTimer
()
}
private
fun
setTimer
()
{
object
:
CountDownTimer
(
3000
,
500
)
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
tv_time_left
.
text
=
(
millisUntilFinished
/
1000.0
).
toString
()
}
override
fun
onFinish
()
{
tv_time_left
.
text
=
"OVER"
}
}.
start
()
}
}
private
fun
addRadioButtons
()
{
private
fun
addRadioButtons
()
{
...
...
app/src/main/res/drawable/ic_timer_big.xml
0 → 100644
View file @
ae72ab10
<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>
app/src/main/res/drawable/ic_timer_small.xml
0 → 100644
View file @
ae72ab10
<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=
"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>
app/src/main/res/layout/activity_main.xml
View file @
ae72ab10
...
@@ -7,6 +7,32 @@
...
@@ -7,6 +7,32 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".MainActivity"
>
tools:context=
".MainActivity"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/timer_layout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"8dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:tint=
"#4CAF50"
app:layout_constraintEnd_toStartOf=
"@+id/tv_time_left"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_timer_small"
/>
<TextView
android:id=
"@+id/tv_time_left"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
<TextView
android:id=
"@+id/task"
android:id=
"@+id/task"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
app/src/main/res/layout/fragment_time_is_over.xml
0 → 100644
View file @
ae72ab10
<?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"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/imageView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:tint=
"#F44336"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_timer_big"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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