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
92f0142c
authored
Sep 24, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced buttons inside cardViews with text views
parent
1a3a2aa2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
36 deletions
app/src/main/java/com/example/quickmax/MainActivity.kt
app/src/main/res/layout/activity_main.xml
app/src/main/java/com/example/quickmax/MainActivity.kt
View file @
92f0142c
...
@@ -2,8 +2,9 @@ package com.example.quickmax
...
@@ -2,8 +2,9 @@ package com.example.quickmax
import
android.os.Bundle
import
android.os.Bundle
import
android.os.CountDownTimer
import
android.os.CountDownTimer
import
android.widget.
Button
import
android.widget.
TextView
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.cardview.widget.CardView
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.activity_main.*
class
MainActivity
:
AppCompatActivity
()
{
class
MainActivity
:
AppCompatActivity
()
{
...
@@ -20,8 +21,8 @@ class MainActivity : AppCompatActivity() {
...
@@ -20,8 +21,8 @@ class MainActivity : AppCompatActivity() {
private
fun
setUpAnswerButtons
()
{
private
fun
setUpAnswerButtons
()
{
for
(
answer
in
answerSet
)
{
for
(
answer
in
answerSet
)
{
findViewById
<
Button
>(
answer
.
buttonId
).
text
=
answer
.
value
.
toString
()
(
findViewById
<
CardView
>(
answer
.
buttonId
).
getChildAt
(
0
)
as
TextView
).
text
=
answer
.
value
.
toString
()
findViewById
<
Button
>(
answer
.
buttonId
).
setOnClickListener
{
processAnswer
(
answer
.
correct
)
}
findViewById
<
CardView
>(
answer
.
buttonId
).
setOnClickListener
{
processAnswer
(
answer
.
correct
)
}
}
}
}
}
...
@@ -41,7 +42,7 @@ class MainActivity : AppCompatActivity() {
...
@@ -41,7 +42,7 @@ class MainActivity : AppCompatActivity() {
private
fun
makeRadioButtonsUncheckable
()
{
private
fun
makeRadioButtonsUncheckable
()
{
for
(
answer
in
answerSet
)
{
for
(
answer
in
answerSet
)
{
findViewById
<
Button
>(
answer
.
buttonId
).
isClickable
=
false
findViewById
<
CardView
>(
answer
.
buttonId
).
isClickable
=
false
}
}
}
}
...
...
app/src/main/res/layout/activity_main.xml
View file @
92f0142c
...
@@ -21,49 +21,47 @@
...
@@ -21,49 +21,47 @@
app:layout_constraintVertical_chainStyle=
"packed"
>
app:layout_constraintVertical_chainStyle=
"packed"
>
<androidx.cardview.widget.CardView
<androidx.cardview.widget.CardView
android:id=
"@+id/
cv
_left_top"
android:id=
"@+id/
btn
_left_top"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_margin=
"8dp"
android:layout_margin=
"8dp"
android:clickable=
"true"
android:clickable=
"true"
android:focusable=
"true"
android:focusable=
"true"
android:foreground=
"?android:attr/selectableItemBackground"
android:foreground=
"?android:attr/selectableItemBackground"
app:layout_constraintBottom_toTopOf=
"@+id/
cv
_left_bottom"
app:layout_constraintBottom_toTopOf=
"@+id/
btn
_left_bottom"
app:layout_constraintEnd_toStartOf=
"@+id/
cv
_right_top"
app:layout_constraintEnd_toStartOf=
"@+id/
btn
_right_top"
app:layout_constraintHorizontal_bias=
"0.5"
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
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
/>
<Button
android:id=
"@+id/btn_left_top"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#00FFFFFF"
/>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
<androidx.cardview.widget.CardView
android:id=
"@+id/
cv
_right_top"
android:id=
"@+id/
btn
_right_top"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_margin=
"8dp"
android:layout_margin=
"8dp"
android:clickable=
"true"
android:clickable=
"true"
android:focusable=
"true"
android:focusable=
"true"
android:foreground=
"?android:attr/selectableItemBackground"
android:foreground=
"?android:attr/selectableItemBackground"
app:layout_constraintBottom_toTopOf=
"@id/
cv
_right_bottom"
app:layout_constraintBottom_toTopOf=
"@id/
btn
_right_bottom"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.5"
app:layout_constraintHorizontal_bias=
"0.5"
app:layout_constraintStart_toEndOf=
"@+id/
cv
_left_top"
app:layout_constraintStart_toEndOf=
"@+id/
btn
_left_top"
app:layout_constraintTop_toTopOf=
"parent"
>
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
/>
<Button
android:id=
"@+id/btn_right_top"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#00FFFFFF"
/>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
<androidx.cardview.widget.CardView
android:id=
"@+id/
cv
_left_bottom"
android:id=
"@+id/
btn
_left_bottom"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_margin=
"8dp"
android:layout_margin=
"8dp"
...
@@ -71,20 +69,19 @@
...
@@ -71,20 +69,19 @@
android:focusable=
"true"
android:focusable=
"true"
android:foreground=
"?android:attr/selectableItemBackground"
android:foreground=
"?android:attr/selectableItemBackground"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/
cv
_right_bottom"
app:layout_constraintEnd_toStartOf=
"@+id/
btn
_right_bottom"
app:layout_constraintHorizontal_bias=
"0.5"
app:layout_constraintHorizontal_bias=
"0.5"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/cv_left_top"
>
app:layout_constraintTop_toBottomOf=
"@+id/btn_right_top"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
/>
<Button
android:id=
"@+id/btn_left_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#00FFFFFF"
/>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
<androidx.cardview.widget.CardView
android:id=
"@+id/
cv
_right_bottom"
android:id=
"@+id/
btn
_right_bottom"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_margin=
"8dp"
android:layout_margin=
"8dp"
...
@@ -94,14 +91,13 @@
...
@@ -94,14 +91,13 @@
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_constraintHorizontal_bias=
"0.5"
app:layout_constraintStart_toEndOf=
"@+id/cv_left_bottom"
app:layout_constraintStart_toEndOf=
"@+id/btn_left_bottom"
app:layout_constraintTop_toBottomOf=
"@+id/cv_right_top"
>
app:layout_constraintTop_toBottomOf=
"@+id/btn_right_top"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
/>
<Button
android:id=
"@+id/btn_right_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#00FFFFFF"
/>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
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