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 7350cf0909
commit 820a89fa80
2 changed files with 15 additions and 1 deletions

View file

@ -347,6 +347,7 @@ public class DrugListActivity extends AppCompatActivity {
Button ok = dialog.findViewById(R.id.agreed);
Button cancel = dialog.findViewById(R.id.notagreed);
ok.setEnabled(false);
ok.setBackground(getDrawable(R.drawable.rounded_btn_disabled));
//TextView title = (TextView ) dialog.findViewById(R.id.title);
final EditText editText=(EditText)dialog.findViewById(R.id.editcip13);
String cip13 = String.valueOf(editText.getText());
@ -362,12 +363,16 @@ public class DrugListActivity extends AppCompatActivity {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
//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() {

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>