Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Zabka
Companion App Android
Commits
500e95d0
Commit
500e95d0
authored
Aug 17, 2019
by
Andreas Schildbach
Browse files
MainFragment: Button for pairing (invokes ScannerFragment)
parent
60f1b86c
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/de/ccc/events/badge/card10/main/MainFragment.kt
View file @
500e95d0
...
...
@@ -32,6 +32,8 @@ import androidx.constraintlayout.widget.ConstraintLayout
import
androidx.fragment.app.Fragment
import
de.ccc.events.badge.card10.R
import
de.ccc.events.badge.card10.common.ConnectionService
import
de.ccc.events.badge.card10.scanner.ScannerFragment
import
kotlinx.android.synthetic.main.main_fragment.*
class
MainFragment
:
Fragment
()
{
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)
=
...
...
@@ -66,6 +68,13 @@ class MainFragment : Fragment() {
val
tvStatus
=
view
.
findViewById
<
TextView
>(
R
.
id
.
label_status
)
tvStatus
.
text
=
getString
(
R
.
string
.
main_label_not_connected
)
button_pair
.
setOnClickListener
{
fragmentManager
!!
.
beginTransaction
()
.
replace
(
R
.
id
.
fragment_container
,
ScannerFragment
())
.
addToBackStack
(
null
)
.
commit
()
}
val
buttonConnect
=
view
.
findViewById
<
Button
>(
R
.
id
.
button_connect
)
buttonConnect
.
setOnClickListener
{
// TODO: Open scan fragment
...
...
app/src/main/res/layout/main_fragment.xml
View file @
500e95d0
...
...
@@ -12,7 +12,7 @@
android:src=
"@drawable/card10_logo_text"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -21,7 +21,7 @@
android:gravity=
"center"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/image_logo"
/>
app:layout_constraintTop_toBottomOf=
"@+id/image_logo"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -35,7 +35,7 @@
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -45,7 +45,7 @@
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_hatchery"
/>
app:layout_constraintTop_toBottomOf=
"@+id/button_hatchery"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -55,20 +55,27 @@
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_send"
/>
app:layout_constraintTop_toBottomOf=
"@+id/button_send"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@+id/label_status"
android:id=
"@+id/container_disconnected"
>
<Button
android:id=
"@+id/button_
connect
"
<Button
android:id=
"@+id/button_
pair
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
@string/main_button_connect
"
android:text=
"
pair
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
/>
<Button
android:id=
"@+id/button_connect"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/main_button_connect"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@id/button_pair"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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