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
b1e5f2a7
authored
Sep 23, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ResponseWrongFragment and ResponseCorrectFragment added
parent
d19c7892
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
57 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/ResponseCorrectFragment.kt
app/src/main/java/com/example/quickmax/ResponseWrongFragment.kt
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/fragment_response.xml → app/src/main/res/layout/fragment_response_correct.xml
app/src/main/res/layout/fragment_response_wrong.xml
app/src/main/java/com/example/quickmax/MainActivity.kt
View file @
b1e5f2a7
...
...
@@ -4,6 +4,7 @@ import android.os.Bundle
import
android.view.View
import
android.widget.RadioButton
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.Fragment
import
kotlinx.android.synthetic.main.activity_main.*
class
MainActivity
:
AppCompatActivity
()
{
...
...
@@ -28,11 +29,14 @@ class MainActivity : AppCompatActivity() {
}
private
fun
processAnswer
(
answer
:
Int
)
{
if
(
numberSet
.
isCorrect
(
answer
))
{
response
.
text
=
getString
(
R
.
string
.
response_correct
)
}
else
response
.
text
=
getString
(
R
.
string
.
response_wrong
)
val
responseFragment
:
Fragment
=
if
(
numberSet
.
isCorrect
(
answer
))
{
ResponseCorrectFragment
.
newInstance
()
}
else
ResponseWrongFragment
.
newInstance
()
supportFragmentManager
.
beginTransaction
()
.
add
(
R
.
id
.
main_layout
,
responseFragment
)
.
commit
()
}
}
app/src/main/java/com/example/quickmax/ResponseFragment.kt
→
app/src/main/java/com/example/quickmax/Response
Correct
Fragment.kt
View file @
b1e5f2a7
...
...
@@ -6,18 +6,17 @@ import android.view.View
import
android.view.ViewGroup
import
androidx.fragment.app.Fragment
class
ResponseFragment
:
Fragment
()
{
companion
object
{
class
ResponseCorrectFragment
:
Fragment
()
{
fun
newInstance
():
ResponseFragment
{
return
ResponseFragment
()
companion
object
{
fun
newInstance
():
ResponseCorrectFragment
{
return
ResponseCorrectFragment
()
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_response
,
container
,
false
)
return
inflater
.
inflate
(
R
.
layout
.
fragment_response
_correct
,
container
,
false
)
}
}
\ No newline at end of file
app/src/main/java/com/example/quickmax/ResponseWrongFragment.kt
0 → 100644
View file @
b1e5f2a7
package
com.example.quickmax
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.fragment.app.Fragment
class
ResponseWrongFragment
:
Fragment
()
{
companion
object
{
fun
newInstance
():
ResponseWrongFragment
{
return
ResponseWrongFragment
()
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_response_wrong
,
container
,
false
)
}
}
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
b1e5f2a7
...
...
@@ -2,6 +2,7 @@
<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"
tools:context=
".MainActivity"
>
...
...
@@ -10,57 +11,21 @@
android:id=
"@+id/task"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_goneMarginStart=
"8dp"
android:layout_marginTop=
"8dp"
android:text=
"@string/second_max"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/response_layout"
android:layout_width=
"0dp"
android:layout_height=
"120dp"
android:background=
"#4CAF50"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
>
<ImageButton
android:id=
"@+id/imageButton"
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"
/>
<TextView
android:id=
"@+id/response"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"24dp"
android:textColor=
"@android:color/white"
android:textSize=
"30sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"@string/response_correct"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintTop_toTopOf=
"parent"
app:layout_goneMarginStart=
"8dp"
/>
<RadioGroup
android:id=
"@+id/radio_group"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
a
pp:layout_goneM
arginStart=
"8dp"
a
ndroid:layout_m
arginStart=
"8dp"
android:layout_marginTop=
"8dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/task"
a
ndroid:layout_m
arginStart=
"8dp"
>
a
pp:layout_goneM
arginStart=
"8dp"
>
</RadioGroup>
...
...
app/src/main/res/layout/fragment_response.xml
→
app/src/main/res/layout/fragment_response
_correct
.xml
View file @
b1e5f2a7
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/response_layout"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"120dp"
android:background=
"#4CAF50"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:background=
"#4CAF50"
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"
>
...
...
@@ -29,10 +29,10 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"24dp"
android:text=
"@string/response_correct"
android:textColor=
"@android:color/white"
android:textSize=
"30sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"@string/response_correct"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_response_wrong.xml
0 → 100644
View file @
b1e5f2a7
<?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/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/imageButton"
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"
/>
<TextView
android:id=
"@+id/response"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"24dp"
android:text=
"@string/response_wrong"
android:textColor=
"@android:color/white"
android:textSize=
"30sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</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