Commit 500e95d0 authored by Andreas Schildbach's avatar Andreas Schildbach
Browse files

MainFragment: Button for pairing (invokes ScannerFragment)

parent 60f1b86c
......@@ -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
......
......@@ -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>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment