Add new gray drawable for disabled button

Use the round_btn_disable drawable to show that de number of digit are not set.
This commit is contained in:
jacques 2023-09-18 17:49:12 +02:00
parent f9b06100d4
commit 2890afea19
2 changed files with 15 additions and 1 deletions

View file

@ -347,6 +347,7 @@ public class DrugListActivity extends AppCompatActivity {
Button ok = (Button) dialog.findViewById(R.id.agreed); Button ok = (Button) dialog.findViewById(R.id.agreed);
Button cancel = (Button) dialog.findViewById(R.id.notagreed); Button cancel = (Button) dialog.findViewById(R.id.notagreed);
ok.setEnabled(false); ok.setEnabled(false);
ok.setBackground(getDrawable(R.drawable.rounded_btn_disabled));
//TextView title = (TextView ) dialog.findViewById(R.id.title); //TextView title = (TextView ) dialog.findViewById(R.id.title);
final EditText editText=(EditText)dialog.findViewById(R.id.editcip13); final EditText editText=(EditText)dialog.findViewById(R.id.editcip13);
String cip13 = String.valueOf(editText.getText()); String cip13 = String.valueOf(editText.getText());
@ -362,12 +363,16 @@ public class DrugListActivity extends AppCompatActivity {
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
} }
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
//alert.getButton(alert.BUTTON_POSITIVE).setEnabled(s.length() == 8); //alert.getButton(alert.BUTTON_POSITIVE).setEnabled(s.length() == 8);
ok.setEnabled(s.length() == 8); if (s.length() == 8) {
ok.setEnabled(true);
ok.setBackground(getDrawable(R.drawable.rounded_btn));
}
} }
}); });
ok.setOnClickListener(new View.OnClickListener() { ok.setOnClickListener(new View.OnClickListener() {

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/grey" />
<corners android:bottomRightRadius="24dp"
android:bottomLeftRadius="24dp"
android:topRightRadius="24dp"
android:topLeftRadius="24dp"/>
</shape>