add a second TextView in customlayout

This commit is contained in:
jacques 2023-07-14 16:18:52 +02:00
parent 3b84d41a44
commit 3658fe165c
4 changed files with 25 additions and 1 deletions

View file

@ -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

View file

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

View file

@ -45,6 +45,17 @@
android:text="@string/app_name"
android:textSize="16dp"
tools:ignore="HardcodedText,RtlHardcoded,SpUsage" />
<TextView
android:id="@+id/cpl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="22dp"
android:layout_marginTop="18dp"
android:layout_marginRight="12dp"
android:fontFamily="@font/opensans_regular"
android:text="@string/app_name"
android:textSize="16dp"
tools:ignore="HardcodedText,RtlHardcoded,SpUsage" />
<Button
android:id="@+id/txtClose"

View file

@ -72,5 +72,5 @@
<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>
<string name="addInList">ad to your list of medicine</string>
<string name="addInList">add to your list of medicine</string>
</resources>