Data binding and Room for storage not working yet

This commit is contained in:
2020-04-14 09:35:24 +02:00
parent 6c997af508
commit 6903a584fc
12 changed files with 436 additions and 190 deletions

View File

@ -1,234 +1,256 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".ui.add.AddFragment">
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.core.widget.NestedScrollView
<data>
<variable
name="viewModel"
type="fr.sanchezm.attestationsCovid19.ui.add.AddViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
tools:context=".ui.add.AddFragment">
<LinearLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="50dp"
android:paddingVertical="20dp">
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/attestation_title"
android:textColor="?attr/colorPrimary"
android:textSize="25sp" />
android:orientation="vertical"
android:paddingHorizontal="50dp"
android:paddingVertical="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/attestation_subtitle"
android:textColor="?attr/colorAccent"
android:textSize="15sp" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/firstName"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/first_name">
<com.google.android.material.textfield.TextInputEditText
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords" />
android:text="@string/attestation_title"
android:textColor="?attr/colorPrimary"
android:textSize="25sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/lastName"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/last_name">
<com.google.android.material.textfield.TextInputEditText
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords" />
android:layout_marginBottom="20dp"
android:text="@string/attestation_subtitle"
android:textColor="?attr/colorAccent"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/birthday"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/birthday">
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/first_name"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date" />
android:hint="@string/first_name">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:text="@={viewModel.firstName}" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/birthPlace"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/birth_place">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/last_name"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords" />
android:hint="@string/last_name">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:text="@{viewModel.lastName}" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/address"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/address">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/birthday"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress|textCapWords" />
android:hint="@string/birthday">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date"
android:text="@{viewModel.birthday}" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/city"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/city">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/birth_place"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords" />
android:hint="@string/birth_place">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords"
android:text="@{viewModel.birthPlace}" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/postalCode"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/postal_code">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/address"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords" />
android:hint="@string/address">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress|textCapWords"
android:text="@{viewModel.address}" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/exitDate"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/exit_date">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/city"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date" />
android:hint="@string/city">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords"
android:text="@{viewModel.city}" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/exitHour"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/exit_hour">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/postal_code"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="time" />
android:hint="@string/postal_code">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords"
android:text="@{viewModel.postalCode}" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/reason"
android:textColor="?attr/colorPrimary"
android:textSize="18sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason1"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_1" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/exit_date"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/exit_date">
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason2"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_2" />
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date"
android:text="@{viewModel.exitDate}" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason3"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_3" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason4"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_4" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/exit_hour"
style="@style/TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/exit_hour">
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason5"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_5" />
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="time"
android:text="@{viewModel.exitHour}" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason6"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_6" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason7"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_7" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/reason"
android:textColor="?attr/colorPrimary"
android:textSize="18sp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/containedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:enabled="false"
android:text="@string/generate_attestation_button" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_1"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_1" />
</LinearLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_2"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_2" />
</androidx.core.widget.NestedScrollView>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_3"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_3" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_4"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_4" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_5"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_5" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_6"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_6" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/reason_7"
style="@style/MaterialCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reason_7" />
<com.google.android.material.button.MaterialButton
android:id="@+id/generate_attestation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:onClick="@{() -> viewModel.onGenerateAttestationClick()}"
android:text="@string/generate_attestation_button" />
<!-- android:enabled="false"-->
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>