Adding style and form for creating attestation

This commit is contained in:
Mathieu Sanchez 2020-04-12 13:33:57 +02:00
parent 114f5ca078
commit 6c997af508
6 changed files with 278 additions and 24 deletions

View File

@ -15,6 +15,8 @@ class MainActivity : AppCompatActivity() {
val navController = findNavController(R.id.nav_host_fragment) val navController = findNavController(R.id.nav_host_fragment)
navController
actionBar?.hide()
navView.setupWithNavController(navController) navView.setupWithNavController(navController)
navView.setBackgroundColor(resources.getColor(R.color.itemBackground, theme)) navView.setBackgroundColor(resources.getColor(R.color.itemBackground, theme))
} }

View File

@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
@ -22,9 +21,7 @@ class AddFragment : Fragment() {
homeViewModel = homeViewModel =
ViewModelProviders.of(this).get(AddViewModel::class.java) ViewModelProviders.of(this).get(AddViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_add_attestation, container, false) val root = inflater.inflate(R.layout.fragment_add_attestation, container, false)
val textView: TextView = root.findViewById(R.id.text_home)
homeViewModel.text.observe(viewLifecycleOwner, Observer { homeViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it
}) })
return root return root
} }

View File

@ -3,16 +3,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:paddingTop="?attr/actionBarSize">
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view" android:id="@+id/nav_view"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="56dp"
android:layout_marginStart="0dp" android:layout_margin="0dp"
android:layout_marginEnd="0dp"
android:background="@color/colorPrimaryBackground"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
@ -24,10 +21,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:defaultNavHost="true" app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/nav_view" android:layout_marginBottom="56dp"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintBottom_toTopOf="@+id/nav_view"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:navGraph="@navigation/mobile_navigation" /> app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,22 +1,234 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".ui.add.AddFragment"> tools:context=".ui.add.AddFragment">
<TextView <androidx.core.widget.NestedScrollView
android:id="@+id/text_home"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="50dp"
android:paddingVertical="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/attestation_title"
android:textColor="?attr/colorPrimary"
android:textSize="25sp" />
<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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords" />
</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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords" />
</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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date" />
</com.google.android.material.textfield.TextInputLayout>
<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.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords" />
</com.google.android.material.textfield.TextInputLayout>
<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.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress|textCapWords" />
</com.google.android.material.textfield.TextInputLayout>
<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.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords" />
</com.google.android.material.textfield.TextInputLayout>
<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.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textCapWords" />
</com.google.android.material.textfield.TextInputLayout>
<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.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="date" />
</com.google.android.material.textfield.TextInputLayout>
<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.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="time" />
</com.google.android.material.textfield.TextInputLayout>
<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.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.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.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.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.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.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.checkbox.MaterialCheckBox
android:id="@+id/reason7"
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/containedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:enabled="false"
android:text="@string/generate_attestation_button" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2,4 +2,27 @@
<string name="app_name">Attestation de déplacement dérogatoire</string> <string name="app_name">Attestation de déplacement dérogatoire</string>
<string name="title_add">Nouvelle Attestation</string> <string name="title_add">Nouvelle Attestation</string>
<string name="title_attestations">Mes Attestations</string> <string name="title_attestations">Mes Attestations</string>
<string name="attestation_title">Attestation de déplacement dérogatoire</string>
<string name="attestation_subtitle">#RestonsChezNous</string>
<string name="first_name">Prénom</string>
<string name="last_name">Nom</string>
<string name="birthday">Date de naissance</string>
<string name="birth_place">Lieu de naissance</string>
<string name="address">Adresse</string>
<string name="city">Ville</string>
<string name="postal_code">Code Postal</string>
<string name="reason">Choisissez le ou les motif(s) de sortie</string>
<string name="exit_date">Date de sortie</string>
<string name="exit_hour">Heure de sortie</string>
<string name="generate_attestation_button">Générer l\'attestation</string>
<string name="reason_1">Déplacements entre le domicile et le lieu dexercice de lactivité professionnelle, lorsqu\'ils sont indispensables à l\'exercice dactivités ne pouvant être organisées sous forme de télétravail ou déplacements professionnels ne pouvant être différés.</string>
<string name="reason_2">Déplacements pour effectuer des achats de fournitures nécessaires à lactivité professionnelle et des achats de première nécessité dans des établissements dont les activités demeurent autorisées</string>
<string name="reason_3">Consultations et soins ne pouvant être assurés à distance et ne pouvant être différés ; consultations et soins des patients atteints d\'une affection de longue durée.</string>
<string name="reason_4">Déplacements pour motif familial impérieux, pour lassistance aux personnes vulnérables ou la garde denfants.</string>
<string name="reason_5">Déplacements brefs, dans la limite d\'une heure quotidienne et dans un rayon maximal d\'un kilomètre autour du domicile, liés soit à l\'activité physique individuelle des personnes, à l\'exclusion de toute pratique sportive collective et de toute proximité avec d\'autres personnes, soit à la promenade avec les seules personnes regroupées dans un même domicile, soit aux besoins des animaux de compagnie.</string>
<string name="reason_6">Convocation judiciaire ou administrative.</string>
<string name="reason_7">Participation à des missions dintérêt général sur demande de lautorité administrative.</string>
</resources> </resources>

View File

@ -1,7 +1,7 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme.Light" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme.Light" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@ -13,6 +13,28 @@
<item name="android:windowActionBarOverlay">true</item> <item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="textInputStyle">@style/TextInputLayout</item>
</style> </style>
<style name="TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="boxBackgroundColor">@color/itemBackground</item>
<item name="boxStrokeWidth">@dimen/emptySize</item>
<item name="boxStrokeWidthFocused">@dimen/emptySize</item>
<item name="android:layout_marginTop">@dimen/margin5dp</item>
<item name="android:layout_marginBottom">@dimen/margin5dp</item>
<item name="boxCornerRadiusTopStart">@dimen/textInputCornerRadius</item>
<item name="boxCornerRadiusTopEnd">@dimen/textInputCornerRadius</item>
<item name="boxCornerRadiusBottomStart">@dimen/textInputCornerRadius</item>
<item name="boxCornerRadiusBottomEnd">@dimen/textInputCornerRadius</item>
</style>
<style name="MaterialCheckBox">
<item name="android:layout_marginTop">@dimen/margin5dp</item>
<item name="android:layout_marginBottom">@dimen/margin5dp</item>
<item name="android:textColor">@color/colorAccent</item>
</style>
<dimen name="textInputCornerRadius">20dp</dimen>
<dimen name="margin5dp">5dp</dimen>
<dimen name="emptySize">0dp</dimen>
</resources> </resources>