Improve dialog (#43)

This commit is contained in:
Jean-Baptiste 2024-04-17 17:50:06 +02:00 committed by jacques
parent f66e34546f
commit 4592a99fb7
6 changed files with 33 additions and 33 deletions

View file

@ -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();

View file

@ -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();

View file

@ -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" />
</LinearLayout>

View file

@ -31,7 +31,7 @@
android:background="@drawable/shadow_bg"
app:srcCompat="@drawable/ic_launcher_foreground" />
<com.google.android.material.card.MaterialCardView
<com.google.android.material.textview.MaterialTextView
android:id="@id/msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -64,6 +64,23 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/notagreed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="170dp"
android:layout_marginStart="30dp"
android:layout_marginBottom="38dp"
android:background="@drawable/rounded_btn"
android:text="@string/button_cancel"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="16sp" />
<Space
android:layout_width="100dp"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:id="@+id/agreed"
android:layout_width="wrap_content"
@ -74,25 +91,9 @@
android:background="@drawable/rounded_btn"
android:text="@string/button_ok"
android:textAlignment="center"
android:textColor="#212121"
android:textColor="@color/white"
android:textSize="16sp" />
<Space
android:layout_width="155dp"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:id="@+id/notagreed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="170dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="38dp"
android:background="@drawable/rounded_btn"
android:text="@string/button_cancel"
android:textAlignment="center"
android:textColor="#212121"
android:textSize="16sp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -21,6 +21,7 @@
<string name="flashlightButton">Allumer/Eteindre le Flash</string>
<string name="enter_cip_13_here">Saisir la fin du code CIP 13 ici..</string>
<string name="enter_cip_13">Saisir le code CIP 13</string>
<string name="button_close">Fermer</string>
<!-- Slide Strings -->
<string name="slide1_Pilldroid">Bienvenue dans Pilldroid</string>
@ -66,7 +67,8 @@
<string name="notInterpreted">Le code barre ne peut pas être interprété</string>
<string name="cancelled_scan">Scan annulé</string>
<string name="missing_camera_permission">Autorisation appareil photo manquante</string>
<string name="Yes">Oui, j\'ai compris</string>
<string name="Yes">Oui</string>
<string name="Yes_understood">Oui, j\'ai compris</string>
<string name="understood">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É.</string>
<string name="Undo">Annuler</string>
<string name="trash_icon">Icône de poubelle</string>

View file

@ -22,6 +22,7 @@
<string name="enter_cip_13">Enter CIP 13</string>
<string name="channel_description" translatable="false">Pilldroid_NotificationChannel</string>
<string name="channel_name" translatable="false">PilldroidChannel</string>
<string name="button_close">Close</string>
<!-- slides strings -->
<string name="slide1_Pilldroid">Welcome on Pilldroid</string>
@ -68,7 +69,8 @@
<string name="notInterpreted">Bar code cannot be interpreted</string>
<string name="cancelled_scan">Scan canceled</string>
<string name="missing_camera_permission">Missing camera permission</string>
<string name="Yes">Yes, I understood</string>
<string name="Yes">Yes</string>
<string name="Yes_understood">Yes, I understood</string>
<string name="understood">I understood that the developer of Pilldroid cannot be responsible of your medication management. IT\'S YOU OWN RESPONSIBILITY.</string>
<string name="Undo">Undo</string>
<string name="trash_icon">Trash icon</string>