Compare commits

...

4 commits

Author SHA1 Message Date
jacques
7aca0ee21b Chnage backupprefs layout 2024-07-09 21:47:17 +02:00
jacques
c45957d813 Fix typo in attributes 2024-07-09 21:47:17 +02:00
jacques
6582ea770a Change custom btn radius
Add constraint for some layout
Add dimens for the custom btn radius
2024-07-09 21:47:17 +02:00
jacques
2daf06ec3b Add Constraint between button
Remove style assertion which remove button define style
Fix some accessibility issues
2024-07-09 21:47:17 +02:00
11 changed files with 286 additions and 124 deletions

View file

@ -87,7 +87,8 @@ public class CustomScannerActivity extends AppCompatActivity implements Decorate
} }
@Override @Override
public void onBackPressed(){ public void onBackPressed() {
super.onBackPressed();
onCancel(this.getCurrentFocus()); onCancel(this.getCurrentFocus());
} }

View file

@ -310,8 +310,7 @@ public class DrugListActivity extends AppCompatActivity {
startActivity(new Intent(this, WelcomeActivity.class)); startActivity(new Intent(this, WelcomeActivity.class));
return true; return true;
} else if (id == R.id.ImportExport) { } else if (id == R.id.ImportExport) {
//backupPrescriptions(); backupprefs();
// TODO: a changer ainsi que le menu.
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@ -711,4 +710,33 @@ public class DrugListActivity extends AppCompatActivity {
} }
} }
} }
void backupprefs() {
final Dialog dlg = new Dialog(this);
dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
Objects.requireNonNull(dlg.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dlg.setContentView(R.layout.backupprefs);
dlg.setCancelable(false);
Button btn_export = dlg.findViewById(R.id.switch_btn_export);
Button btn_import = dlg.findViewById(R.id.switch_btn_import);
Button btn_location = dlg.findViewById(R.id.btn_backup_location);
Button btn_properties = dlg.findViewById(R.id.btn_properties);
btn_export.setEnabled(true);
btn_import.setEnabled(false);
Button ok = dlg.findViewById(R.id.ok_btn);
Button cancel = dlg.findViewById(R.id.cancel_btn);
ok.setOnClickListener(v -> {
dlg.cancel();
//TODO: manage the options
Log.i(TAG, "ok button");
});
cancel.setOnClickListener(v -> {
dlg.cancel();
Log.i(TAG, "dismiss dialog");
});
dlg.show();
}
} }

View file

@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/bg_screen1" /> <solid android:color="@color/bg_screen1" />
<corners android:bottomRightRadius="24dp" <corners android:bottomRightRadius="@dimen/btn_radius"
android:bottomLeftRadius="24dp" android:bottomLeftRadius="@dimen/btn_radius"
android:topRightRadius="24dp" android:topRightRadius="@dimen/btn_radius"
android:topLeftRadius="24dp"/> android:topLeftRadius="@dimen/btn_radius"/>
</shape> </shape>

View file

@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/grey" /> <solid android:color="@color/grey" />
<corners android:bottomRightRadius="24dp" <corners android:bottomRightRadius="@dimen/btn_radius"
android:bottomLeftRadius="24dp" android:bottomLeftRadius="@dimen/btn_radius"
android:topRightRadius="24dp" android:topRightRadius="@dimen/btn_radius"
android:topLeftRadius="24dp"/> android:topLeftRadius="@dimen/btn_radius"/>
</shape> </shape>

View file

@ -1,75 +1,148 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="16dp" tools:ignore="MissingDefaultResource">
tools:ignore="HardcodedText"
tools:context=".DrugListActivity">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout" android:id="@+id/materialCardView"
android:layout_width="match_parent" android:layout_width="370dp"
android:layout_height="match_parent"/> android:layout_height="319dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
app:cardCornerRadius="@dimen/btn_radius"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.35">
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_addFruit" android:id="@+id/switch_btn_export"
android:layout_width="wrap_content" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_height="wrap_content" android:layout_width="0dp"
android:layout_gravity="bottom|end"
android:layout_margin="32dp"
android:src="@drawable/ic_add"
android:contentDescription="Add new Fruit" />
<LinearLayout
android:id="@+id/ll_properties"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="160dp"
android:orientation="vertical"
android:padding="16dp"
app:layout_anchor="@+id/constraintLayout"
app:layout_anchorGravity="center">
<include layout="@layout/custom_switch_btn"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:layout_marginEnd="68dp"
android:layout_weight="1"
android:backgroundTint="@color/selected_background"
android:gravity="center"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/export_prescriptions"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="@+id/switch_btn_import"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/switch_btn_import" />
<Button <com.google.android.material.button.MaterialButton
android:id="@+id/btn_backup_location" android:id="@+id/switch_btn_import"
style="@style/Widget.MaterialComponents.Button" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="16dp" android:layout_weight="1"
android:layout_weight="1" android:backgroundTint="@color/unselected_background"
android:background="@drawable/rounded_btn" android:gravity="center"
android:text="Backup Location" android:maxLines="1"
android:textAllCaps="false" android:minWidth="100dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:paddingStart="25dp"
android:textColor="@android:color/white" /> android:paddingEnd="25dp"
android:text="@string/import_prescriptions"
android:textColor="@color/white"
app:layout_constraintEnd_toStartOf="@+id/switch_btn_export"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="93dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/notagreed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/rounded_btn"
android:gravity="center"
android:maxLines="1"
android:minWidth="100dp"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/button_cancel"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/agreed"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText,SpUsage" />
<Button <com.google.android.material.button.MaterialButton
android:id="@+id/btn_properties" android:id="@+id/btn_backup_location"
style="@style/Widget.MaterialComponents.Button" android:layout_width="wrap_content"
android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_marginStart="76dp"
android:layout_marginStart="16dp" android:layout_marginEnd="2dp"
android:layout_weight="1" android:background="@drawable/rounded_btn"
android:background="@drawable/rounded_btn" android:gravity="center"
android:text="Properties" android:maxLines="1"
android:textAllCaps="false" android:minWidth="100dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:paddingStart="25dp"
android:textColor="@android:color/white" /> android:paddingEnd="25dp"
android:text="@string/location"
app:layout_constraintBottom_toBottomOf="@+id/btn_properties"
app:layout_constraintEnd_toStartOf="@+id/btn_properties"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/btn_properties"
app:layout_constraintVertical_bias="0.0" />
</LinearLayout> <com.google.android.material.button.MaterialButton
</LinearLayout> android:id="@+id/btn_properties"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="68dp"
android:background="@drawable/rounded_btn"
android:gravity="center"
android:maxLines="1"
android:minWidth="100dp"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/properties"
app:layout_constraintEnd_toEndOf="parent"
tools:layout_editor_absoluteY="173dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/agreed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:background="@drawable/rounded_btn"
android:gravity="center"
android:maxLines="1"
android:minWidth="100dp"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/button_ok"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/notagreed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/notagreed"
app:layout_constraintVertical_bias="0.0"
tools:ignore="HardcodedText,SpUsage" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/shapeableImageView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="4dp"
android:background="@drawable/shadow_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="61dp"
tools:layout_conversion_absoluteWidth="61dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@+id/ok_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="178dp"
android:text="@string/button_ok"
android:textColor="@color/white"
android:backgroundTint="@color/colorPrimary"
app:layout_constraintEnd_toStartOf="@+id/cancel_btn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@+id/cancel_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:text="@string/button_cancel"
android:textColor="@color/white"
android:backgroundTint="@color/material_on_surface_disabled"
app:layout_constraintBaseline_toBaselineOf="@+id/ok_btn"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,99 +1,113 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" 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"
tools:ignore="MissingDefaultResource"> tools:ignore="MissingDefaultResource">
<com.google.android.material.card.MaterialCardView <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:id="@+id/materialCardView"
android:layout_height="wrap_content" android:layout_width="368dp"
android:layout_height="237dp"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
app:cardCornerRadius="11dp" app:cardCornerRadius="@dimen/btn_radius"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="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="match_parent"
android:orientation="vertical">
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="61dp"
android:layout_height="61dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:background="@drawable/shadow_bg"
app:srcCompat="@drawable/ic_launcher_foreground" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@id/msg" android:id="@id/msg"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="22dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="12dp"
android:fontFamily="@font/opensans_semibold" android:fontFamily="@font/opensans_semibold"
android:hint="@+id/msg"
android:text="@string/app_name" android:text="@string/app_name"
android:textColor="@color/grey" android:textColor="@color/grey"
android:textSize="15dp" android:textSize="15dp"
android:labelFor="@+id/msg" app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="HardcodedText,SpUsage" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.057"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.347"
tools:ignore="HardcodedText,SpUsage"
tools:layout_conversion_absoluteHeight="21dp"
tools:layout_conversion_absoluteWidth="91dp" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@id/cpl" android:id="@id/cpl"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="22dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="12dp"
android:fontFamily="@font/opensans_regular" android:fontFamily="@font/opensans_regular"
android:text="@string/app_version" android:text="@string/app_version"
android:textColor="@color/grey" android:textColor="@color/grey"
android:textSize="14dp" android:textSize="14dp"
tools:ignore="HardcodedText,SpUsage" /> android:labelFor="@+id/cpl"
</LinearLayout> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
<LinearLayout app:layout_constraintHorizontal_bias="0.046"
android:layout_width="match_parent" app:layout_constraintStart_toStartOf="parent"
android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent"
android:orientation="horizontal"> tools:ignore="HardcodedText,SpUsage"
tools:layout_conversion_absoluteHeight="19dp"
tools:layout_conversion_absoluteWidth="24dp" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/notagreed" android:id="@+id/notagreed"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="170dp" android:layout_marginStart="16dp"
android:layout_marginStart="30dp" android:layout_marginBottom="16dp"
android:layout_marginBottom="38dp"
android:background="@drawable/rounded_btn" android:background="@drawable/rounded_btn"
android:gravity="center"
android:maxLines="1"
android:minWidth="100dp"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/button_cancel" android:text="@string/button_cancel"
android:textAlignment="center"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
<Space app:layout_constraintEnd_toStartOf="@+id/agreed"
android:layout_width="100dp" app:layout_constraintHorizontal_bias="0.0"
android:layout_height="wrap_content" /> app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText,SpUsage" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/agreed" android:id="@+id/agreed"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="30dp" android:layout_marginEnd="16dp"
android:layout_marginTop="170dp"
android:layout_marginBottom="38dp"
android:background="@drawable/rounded_btn" android:background="@drawable/rounded_btn"
android:gravity="center"
android:maxLines="1"
android:minWidth="100dp"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/button_ok" android:text="@string/button_ok"
android:textAlignment="center"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/notagreed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/notagreed"
app:layout_constraintVertical_bias="0.0"
tools:ignore="HardcodedText,SpUsage" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/shapeableImageView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="4dp"
android:background="@drawable/shadow_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="61dp"
tools:layout_conversion_absoluteWidth="61dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -14,6 +14,7 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:labelFor="@+id/cip13_input_dialog" android:labelFor="@+id/cip13_input_dialog"
android:background="@drawable/background_dialog" android:background="@drawable/background_dialog"
android:contentDescription="@string/enter_cip_13"
app:cardCornerRadius="25dp" app:cardCornerRadius="25dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -68,7 +69,7 @@
android:autofillHints="cip13" android:autofillHints="cip13"
android:ems="10" android:ems="10"
android:inputType="number" android:inputType="number"
android:labelFor="@id/startcip13" android:hint="@string/enter_cip_13_here"
android:minHeight="48dp" android:minHeight="48dp"
android:textAlignment="textStart" android:textAlignment="textStart"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View file

@ -74,4 +74,6 @@
<string name="Undo">Annuler</string> <string name="Undo">Annuler</string>
<string name="trash_icon">Icône de poubelle</string> <string name="trash_icon">Icône de poubelle</string>
<string name="addInList">Ajouter à votre liste de médicament</string> <string name="addInList">Ajouter à votre liste de médicament</string>
<string name="location">Chemin</string>
<string name="properties">Préférences</string>
</resources> </resources>

View file

@ -7,6 +7,7 @@
<dimen name="fab_width">48dp</dimen> <dimen name="fab_width">48dp</dimen>
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="btn_radius">5dp</dimen>
<!-- Slide dimens --> <!-- Slide dimens -->
<dimen name="dots_height">75dp</dimen> <dimen name="dots_height">75dp</dimen>
<dimen name="dots_margin_bottom">20dp</dimen> <dimen name="dots_margin_bottom">20dp</dimen>

View file

@ -79,4 +79,6 @@
<string name="import_export" translatable="false">Import/Export</string> <string name="import_export" translatable="false">Import/Export</string>
<string name="import_prescriptions" translatable="false">Import</string> <string name="import_prescriptions" translatable="false">Import</string>
<string name="export_prescriptions" translatable="false">Export</string> <string name="export_prescriptions" translatable="false">Export</string>
<string name="location">Location</string>
<string name="properties">Properties</string>
</resources> </resources>