From 4592a99fb7ae08ab410107c9b3a2320a55f36f8c Mon Sep 17 00:00:00 2001
From: Jean-Baptiste <87148630+Jean-BaptisteC@users.noreply.github.com>
Date: Wed, 17 Apr 2024 17:50:06 +0200
Subject: [PATCH] Improve dialog (#43)
---
.../foucry/pilldroid/DrugListActivity.java | 10 ++---
.../net/foucry/pilldroid/WelcomeActivity.java | 7 +---
.../custom_dialog_layout_one_button.xml | 4 +-
.../custom_dialog_layout_two_button.xml | 37 ++++++++++---------
app/src/main/res/values-fr-rFR/strings.xml | 4 +-
app/src/main/res/values/strings.xml | 4 +-
6 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java
index 7736c57..974826e 100644
--- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java
@@ -403,11 +403,10 @@ public class DrugListActivity extends AppCompatActivity {
dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
dlg.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dlg.setContentView(R.layout.custom_dialog_layout_one_button);
- dlg.setCancelable(false);
+ dlg.setCancelable(true);
MaterialTextView msg = dlg.findViewById(R.id.msg);
String msgString;
MaterialTextView cpl = dlg.findViewById(R.id.cpl);
- String cplString;
ShapeableImageView icon = dlg.findViewById(R.id.image);
MaterialButton btn = dlg.findViewById(R.id.txtClose);
dlg.show();
@@ -415,11 +414,9 @@ public class DrugListActivity extends AppCompatActivity {
if (aMedicine != null) {
msgString = aMedicine.getName() + " " + getString(R.string.msgFound);
msg.setText(msgString);
- cplString = getString(R.string.addInList);
- if (cplString.isEmpty()) {
- cpl.setEnabled(false);
- }
+ cpl.setText(getString(R.string.addInList));
icon.setImageResource(R.drawable.tickmark);
+ btn.setText(getString(R.string.Yes));
btn.setOnClickListener(v -> {
// TODO Auto-generated method stub
dlg.dismiss();
@@ -431,6 +428,7 @@ public class DrugListActivity extends AppCompatActivity {
msg.setText(msgString);
cpl.setText("");
icon.setImageResource(R.drawable.tickcross);
+ btn.setText(getString(R.string.button_close));
btn.setOnClickListener(v -> {
// TODO Auto-generated method stub
dlg.dismiss();
diff --git a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java
index 1dad17e..ddbe60f 100644
--- a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java
@@ -144,18 +144,15 @@ public class WelcomeActivity extends AppCompatActivity {
MaterialTextView msg = dlg.findViewById(R.id.msg);
String msgString;
MaterialTextView cpl = dlg.findViewById(R.id.cpl);
- String cplString = "";
ShapeableImageView icon = dlg.findViewById(R.id.image);
MaterialButton btn = dlg.findViewById(R.id.txtClose);
dlg.show();
msgString = getString(R.string.understood);
msg.setText(msgString);
- if (cplString.isEmpty()) {
- cpl.setEnabled(false);
- }
+ cpl.setVisibility(View.GONE);
//icon.setImageResource(R.drawable.pilldroid_icon);
- btn.setText(R.string.Yes);
+ btn.setText(R.string.Yes_understood);
btn.setOnClickListener(v -> {
// TODO Auto-generated method stub
dlg.dismiss();
diff --git a/app/src/main/res/layout/custom_dialog_layout_one_button.xml b/app/src/main/res/layout/custom_dialog_layout_one_button.xml
index 446a4a2..df8e602 100644
--- a/app/src/main/res/layout/custom_dialog_layout_one_button.xml
+++ b/app/src/main/res/layout/custom_dialog_layout_one_button.xml
@@ -76,8 +76,8 @@
android:maxLines="1"
android:paddingStart="25dp"
android:paddingEnd="25dp"
- android:text="Close"
- android:textColor="#212121"
+ android:text="@string/button_close"
+ android:textColor="@color/white"
android:textSize="16sp"
tools:ignore="HardcodedText,SpUsage" />
diff --git a/app/src/main/res/layout/custom_dialog_layout_two_button.xml b/app/src/main/res/layout/custom_dialog_layout_two_button.xml
index ae57134..f735162 100644
--- a/app/src/main/res/layout/custom_dialog_layout_two_button.xml
+++ b/app/src/main/res/layout/custom_dialog_layout_two_button.xml
@@ -31,7 +31,7 @@
android:background="@drawable/shadow_bg"
app:srcCompat="@drawable/ic_launcher_foreground" />
-
+
+
+
+
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml
index cbac83f..57a1651 100644
--- a/app/src/main/res/values-fr-rFR/strings.xml
+++ b/app/src/main/res/values-fr-rFR/strings.xml
@@ -21,6 +21,7 @@
Allumer/Eteindre le Flash
Saisir la fin du code CIP 13 ici..
Saisir le code CIP 13
+ Fermer
Bienvenue dans Pilldroid
@@ -66,7 +67,8 @@
Le code barre ne peut pas être interprété
Scan annulé
Autorisation appareil photo manquante
- Oui, j\'ai compris
+ Oui
+ Oui, j\'ai compris
Je comprends que le développeur de Pilldroid n\'est pas responsable de la gestion de vos médicaments. CELA RELÈVE DE VOTRE SEULE RESPONSABILITÉ.
Annuler
Icône de poubelle
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 89efbd2..141e876 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -22,6 +22,7 @@
Enter CIP 13
Pilldroid_NotificationChannel
PilldroidChannel
+ Close
Welcome on Pilldroid
@@ -68,7 +69,8 @@
Bar code cannot be interpreted
Scan canceled
Missing camera permission
- Yes, I understood
+ Yes
+ Yes, I understood
I understood that the developer of Pilldroid cannot be responsible of your medication management. IT\'S YOU OWN RESPONSIBILITY.
Undo
Trash icon