Adding pickers for date and time

This commit is contained in:
2020-05-02 15:46:08 +02:00
parent 52892c13d4
commit 5cb3478bb6
6 changed files with 100 additions and 16 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".ui.add.AddFragment">
<data>
@ -12,9 +12,9 @@
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintContext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/constraintContext">
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
@ -34,10 +34,10 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/attestation_title"
android:textColor="?attr/colorPrimary"
android:textSize="25sp" />
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
@ -88,9 +88,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date"
android:focusable="false"
android:onClick="@{() -> viewModel.onBirthdayClick()}"
android:text="@={viewModel.birthday}"
app:validateDate='@{"dd/MM/yyyy"}'
app:validateDateMessage="@{@string/date_error_message}"/>
app:validateDateMessage="@{@string/date_error_message}" />
</com.google.android.material.textfield.TextInputLayout>
@ -164,10 +166,12 @@
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:inputType="date"
android:onClick="@{() -> viewModel.onExitDateClick()}"
android:text="@={viewModel.exitDate}"
app:validateDate='@{"dd/MM/yyyy"}'
app:validateDateMessage="@{@string/date_error_message}"/>
app:validateDateMessage="@{@string/date_error_message}" />
</com.google.android.material.textfield.TextInputLayout>
@ -181,7 +185,9 @@
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:inputType="time"
android:onClick="@{() -> viewModel.onExitHourClick()}"
android:text="@={viewModel.exitHour}" />
</com.google.android.material.textfield.TextInputLayout>
@ -257,7 +263,6 @@
android:layout_marginTop="20dp"
android:onClick="@{() -> viewModel.onGenerateAttestationClick()}"
android:text="@string/generate_attestation_button" />
<!-- android:enabled="false"-->
</LinearLayout>