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
84a2e414
authored
Sep 23, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move to next question from TimeIsOverFragment
parent
8d4a1791
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
12 deletions
app/src/main/java/com/example/quickmax/MainActivity.kt
app/src/main/java/com/example/quickmax/ResponseFragment.kt
app/src/main/java/com/example/quickmax/TimeIsOverFragment.kt
app/src/main/res/layout/fragment_time_is_over.xml
app/src/main/java/com/example/quickmax/MainActivity.kt
View file @
84a2e414
...
@@ -50,6 +50,12 @@ class MainActivity : AppCompatActivity() {
...
@@ -50,6 +50,12 @@ class MainActivity : AppCompatActivity() {
}
}
}
}
fun
reload
()
{
val
intent
=
intent
finish
()
startActivity
(
intent
)
}
private
val
timer
=
object
:
CountDownTimer
(
4000
,
1000
)
{
private
val
timer
=
object
:
CountDownTimer
(
4000
,
1000
)
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
tv_time_left
.
text
=
(
millisUntilFinished
/
1000
).
toString
()
tv_time_left
.
text
=
(
millisUntilFinished
/
1000
).
toString
()
...
...
app/src/main/java/com/example/quickmax/ResponseFragment.kt
View file @
84a2e414
...
@@ -35,13 +35,7 @@ class ResponseFragment: Fragment() {
...
@@ -35,13 +35,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
{
reloadActivity
()
}
view
.
findViewById
<
ImageButton
>(
R
.
id
.
btn_next
).
setOnClickListener
{
(
activity
as
MainActivity
).
reload
()
}
return
view
return
view
}
}
private
fun
reloadActivity
()
{
val
intent
=
activity
?.
intent
activity
?.
finish
()
activity
?.
startActivity
(
intent
)
}
}
}
\ No newline at end of file
app/src/main/java/com/example/quickmax/TimeIsOverFragment.kt
View file @
84a2e414
...
@@ -4,6 +4,7 @@ import android.os.Bundle
...
@@ -4,6 +4,7 @@ import android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.ImageButton
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
class
TimeIsOverFragment
:
Fragment
()
{
class
TimeIsOverFragment
:
Fragment
()
{
...
@@ -16,6 +17,8 @@ class TimeIsOverFragment: Fragment() {
...
@@ -16,6 +17,8 @@ class TimeIsOverFragment: Fragment() {
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
savedInstanceState
:
Bundle
?):
View
?
{
return
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
()
}
return
view
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_time_is_over.xml
View file @
84a2e414
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
android:background=
"#A80C0000"
>
android:background=
"#A80C0000"
>
<ImageView
<ImageView
android:id=
"@+id/im
ageView
"
android:id=
"@+id/im
g_view_timer
"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:layout_marginBottom=
"8dp"
...
@@ -26,8 +26,35 @@
...
@@ -26,8 +26,35 @@
android:text=
"@string/time_is_over"
android:text=
"@string/time_is_over"
android:textAppearance=
"@android:style/TextAppearance.Material.Large"
android:textAppearance=
"@android:style/TextAppearance.Material.Large"
android:textColor=
"#F44336"
android:textColor=
"#F44336"
app:layout_constraintBottom_to
BottomOf=
"paren
t"
app:layout_constraintBottom_to
TopOf=
"@+id/response_layou
t"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/imageView"
/>
app:layout_constraintTop_toBottomOf=
"@+id/img_view_timer"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/response_layout"
android:layout_width=
"match_parent"
android:layout_height=
"120dp"
android:background=
"#F44336"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
>
<ImageButton
android:id=
"@+id/btn_next"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"24dp"
android:layout_marginBottom=
"8dp"
android:background=
"#009C27B0"
android:tint=
"#FFFFFF"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_double_arrow"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</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