From 3658fe165c3b7807521e61961aeff1b7bb8f1f53 Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 14 Jul 2023 16:18:52 +0200 Subject: [PATCH] add a second TextView in customlayout --- .../java/net/foucry/pilldroid/DrugListActivity.java | 8 ++++++++ .../java/net/foucry/pilldroid/WelcomeActivity.java | 5 +++++ app/src/main/res/layout/custodialoglayout.xml | 11 +++++++++++ app/src/main/res/values/strings.xml | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java index 1e3cd26..996c42d 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java @@ -58,6 +58,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Locale; +import java.util.Objects; /** * An activity representing a list of Drugs is activity @@ -388,6 +389,8 @@ public class DrugListActivity extends AppCompatActivity { dlg.setCancelable(false); TextView msg = dlg.findViewById(R.id.msg); String msgString; + TextView cpl = dlg.findViewById(R.id.cpl); + String cplString; ImageView icon = dlg.findViewById(R.id.image); Button btn = (Button)dlg.findViewById(R.id.txtClose); dlg.show(); @@ -395,6 +398,10 @@ 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.equals("")) { + cpl.setEnabled(false); + } icon.setImageResource(R.drawable.tickmark); btn.setOnClickListener(new View.OnClickListener() { @Override @@ -407,6 +414,7 @@ public class DrugListActivity extends AppCompatActivity { } else { msgString = getString(R.string.msgNotFound); msg.setText(msgString); + cpl.setText(""); icon.setImageResource(R.drawable.tickcross); btn.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java index 3f0423a..c50a1cd 100644 --- a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java @@ -143,12 +143,17 @@ public class WelcomeActivity extends AppCompatActivity { dlg.setCancelable(false); TextView msg = dlg.findViewById(R.id.msg); String msgString; + TextView cpl = dlg.findViewById(R.id.cpl); + String cplString = new String(); ImageView icon = dlg.findViewById(R.id.image); Button btn = (Button)dlg.findViewById(R.id.txtClose); dlg.show(); msgString = getString(R.string.understood); msg.setText(msgString); + if (cplString.equals("")) { + cpl.setEnabled(false); + } icon.setImageResource(R.drawable.pilldroid_icon); btn.setText(R.string.Yes); btn.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/res/layout/custodialoglayout.xml b/app/src/main/res/layout/custodialoglayout.xml index 319d3c6..04a4791 100644 --- a/app/src/main/res/layout/custodialoglayout.xml +++ b/app/src/main/res/layout/custodialoglayout.xml @@ -45,6 +45,17 @@ android:text="@string/app_name" android:textSize="16dp" tools:ignore="HardcodedText,RtlHardcoded,SpUsage" /> +