Add string ans field to improve accessiblity

This commit is contained in:
jacques 2021-04-04 20:18:16 +02:00
parent 374c0abd41
commit c8548fdd0b
8 changed files with 34 additions and 27 deletions

View file

@ -94,24 +94,32 @@ public class MedicamentDetailFragment extends Fragment {
TextView stockValue = stockView.findViewById(R.id.valeur); TextView stockValue = stockView.findViewById(R.id.valeur);
stockLibelle.setText(R.string.med_current_stock_label); stockLibelle.setText(R.string.med_current_stock_label);
stockValue.setText(Double.toString(medicament.getStock())); stockValue.setText(Double.toString(medicament.getStock()));
stockValue.setHint(R.string.med_current_stock_label);
stockValue.setSelectAllOnFocus(true);
priseView = detailView.findViewById(R.id.prise_cell); priseView = detailView.findViewById(R.id.prise_cell);
TextView priseLibelle = priseView.findViewById(R.id.libelle); TextView priseLibelle = priseView.findViewById(R.id.libelle);
TextView priseValue = (priseView.findViewById(R.id.valeur)); TextView priseValue = (priseView.findViewById(R.id.valeur));
priseLibelle.setText(R.string.med_take_label); priseLibelle.setText(R.string.med_take_label);
priseValue.setText(Double.toString(medicament.getPrise())); priseValue.setText(Double.toString(medicament.getPrise()));
priseValue.setHint(R.string.med_take_label);
priseValue.setSelectAllOnFocus(true);
warningView = detailView.findViewById(R.id.warning_cell); warningView = detailView.findViewById(R.id.warning_cell);
TextView warningLibelle = warningView.findViewById(R.id.libelle); TextView warningLibelle = warningView.findViewById(R.id.libelle);
TextView warningValue = warningView.findViewById(R.id.valeur); TextView warningValue = warningView.findViewById(R.id.valeur);
warningLibelle.setText(R.string.med_warningTherehold_label); warningLibelle.setText(R.string.med_warningTherehold_label);
warningValue.setText(Integer.toString(medicament.getWarnThreshold())); warningValue.setText(Integer.toString(medicament.getWarnThreshold()));
warningValue.setHint(R.string.med_warningTherehold_label);
warningValue.setSelectAllOnFocus(true);
alertView = detailView.findViewById(R.id.alert_cell); alertView = detailView.findViewById(R.id.alert_cell);
TextView alertLibelle = alertView.findViewById(R.id.libelle); TextView alertLibelle = alertView.findViewById(R.id.libelle);
TextView alertValue = alertView.findViewById(R.id.valeur); TextView alertValue = alertView.findViewById(R.id.valeur);
alertLibelle.setText(R.string.med_criticalTherehold_label); alertLibelle.setText(R.string.med_alertTherehold_label);
alertValue.setText(Integer.toString(medicament.getAlertThreshold())); alertValue.setText(Integer.toString(medicament.getAlertThreshold()));
alertValue.setHint(R.string.med_alertTherehold_label);
alertValue.setSelectAllOnFocus(true);
} }
return detailView; return detailView;

View file

@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".MainActivity"> tools:context=".MedicamentListActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar" android:id="@+id/app_bar"
@ -49,9 +49,6 @@
android:src="@drawable/ic_add_circle_black_24dp" android:src="@drawable/ic_add_circle_black_24dp"
app:backgroundTint="@android:color/darker_gray" app:backgroundTint="@android:color/darker_gray"
app:fabCustomSize="60dp" app:fabCustomSize="60dp"
app:maxImageSize="60dp" /> app:maxImageSize="60dp"
android:contentDescription="@string/add_button" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -9,5 +9,6 @@
android:backgroundTint="@android:color/transparent" android:backgroundTint="@android:color/transparent"
app:fabCustomSize="60dp" app:fabCustomSize="60dp"
app:maxImageSize="60dp" app:maxImageSize="60dp"
android:src="@drawable/ic_add_circle_black_24dp" /> android:src="@drawable/ic_add_circle_black_24dp"
android:contentDescription="@string/add_button" />

View file

@ -11,14 +11,14 @@
android:paddingStart="10sp" android:paddingStart="10sp"
android:paddingEnd="10sp" android:paddingEnd="10sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:text="Valeur" android:text="@string/Value"
android:textColor="#040404" android:textColor="#040404"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Label" android:text="@string/label"
android:layout_below="@+id/valeur" android:layout_below="@+id/valeur"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:textStyle="italic" android:textStyle="italic"

View file

@ -36,10 +36,9 @@
<include <include
android:id="@+id/prise_cell" android:id="@+id/prise_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/value_input" layout="@layout/value_input"
android:layout_marginTop="30sp" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<include <include
android:id="@+id/warning_cell" android:id="@+id/warning_cell"
@ -53,8 +52,6 @@
layout="@layout/value_input" layout="@layout/value_input"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal" />
android:layout_marginTop="5sp" />
</LinearLayout> </LinearLayout>

View file

@ -15,7 +15,7 @@
android:layout_height="50sp" android:layout_height="50sp"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:src="@drawable/ok_stock_vect" android:src="@drawable/ok_stock_vect"
android:contentDescription="Icone de stock" android:contentDescription="@string/icone_de_stock"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_alignParentStart="true" /> android:layout_alignParentStart="true" />
@ -23,14 +23,14 @@
android:id="@+id/valeur" android:id="@+id/valeur"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Nom Médicament" android:text="@string/nom_m_dicament"
android:textColor="#040404" android:textColor="#040404"
android:typeface="sans" android:typeface="sans"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
android:layout_alignTop="@+id/list_image" android:layout_alignTop="@+id/list_image"
android:layout_toEndOf="@+id/list_image" android:layout_toEndOf="@+id/list_image"
android:layout_marginLeft="5dp" /> android:layout_marginStart="5dp" />
<TextView <TextView
android:id="@+id/cip13" android:id="@+id/cip13"
@ -38,7 +38,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#343434" android:textColor="#343434"
android:textSize="14sp" android:textSize="14sp"
android:text="cip13 goes here" android:text="@string/cip13_goes_here"
android:layout_below="@+id/valeur" android:layout_below="@+id/valeur"
android:layout_toEndOf="@+id/list_image" android:layout_toEndOf="@+id/list_image"
android:layout_marginStart="5dp" /> android:layout_marginStart="5dp" />
@ -47,8 +47,8 @@
android:id="@+id/endOfStock" android:id="@+id/endOfStock"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right" android:gravity="end"
android:text="lundi 1 janvier 2001" android:text="@string/Date"
android:textSize="14sp" android:textSize="14sp"
android:textColor="#212121" android:textColor="#212121"
android:textStyle="bold" android:textStyle="bold"
@ -66,9 +66,9 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="10sp" android:layout_marginEnd="10sp"
android:contentDescription="@string/detail_view" android:contentDescription="@string/detail_view"
android:src="@drawable/ic_navigate_next_black_24dp" /> android:src="@drawable/ic_navigate_next_black_24dp" />

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
@ -28,7 +29,6 @@
android:layout_height="50dp" android:layout_height="50dp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:autofillHints=""
android:background="@drawable/rounded_corner" android:background="@drawable/rounded_corner"
android:ems="10" android:ems="10"
android:gravity="end|fill_vertical" android:gravity="end|fill_vertical"
@ -36,7 +36,10 @@
android:labelFor="@id/valeur" android:labelFor="@id/valeur"
android:paddingEnd="25dp" android:paddingEnd="25dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:text="0" android:hint="@string/zero"
android:textAlignment="gravity" /> android:textColorHint="@color/grey"
android:textAlignment="gravity"
android:importantForAutofill="no"
tools:ignore="LabelFor" />
</RelativeLayout> </RelativeLayout>

View file

@ -18,4 +18,5 @@
<color name="tutorial_buttonTextColor">#000000</color> <color name="tutorial_buttonTextColor">#000000</color>
<color name="led">#31f623</color> <color name="led">#31f623</color>
<color name="grey">#777</color>
</resources> </resources>