|
10 | 10 | import android.database.Cursor; |
11 | 11 | import android.inputmethodservice.Keyboard; |
12 | 12 | import android.os.Bundle; |
| 13 | +import android.text.Editable; |
13 | 14 | import android.text.InputType; |
| 15 | +import android.text.TextWatcher; |
14 | 16 | import android.view.Menu; |
15 | 17 | import android.view.MenuInflater; |
16 | 18 | import android.view.MenuItem; |
@@ -93,7 +95,7 @@ public static Intent newIntent(@NonNull Context context, @NonNull String claimUU |
93 | 95 | RadioButton rbEmergency, rbReferral, rbOther, rbPositive, rbNegative; |
94 | 96 | ImageButton btnScan; |
95 | 97 | LinearLayout llFagepFields; |
96 | | - TextInputLayout ettClaimPrefix, ettGuaranteeNo; |
| 98 | + TextInputLayout ettClaimPrefix, ettGuaranteeNo, tilCHFID; |
97 | 99 |
|
98 | 100 | @Override |
99 | 101 | protected void onCreate(Bundle savedInstanceState) { |
@@ -140,6 +142,7 @@ protected void onCreate(Bundle savedInstanceState) { |
140 | 142 | etVisitType = findViewById(R.id.etVisitType); |
141 | 143 | ettClaimPrefix = findViewById(R.id.ettClaimPrefix); |
142 | 144 | ettGuaranteeNo = findViewById(R.id.ettGuaranteeNo); |
| 145 | + tilCHFID = findViewById(R.id.tilCHFID); |
143 | 146 |
|
144 | 147 | String[] visitTypes = getResources().getStringArray(R.array.visitType); |
145 | 148 | ArrayAdapter<String> visitTypeAdapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, visitTypes); |
@@ -340,6 +343,24 @@ public void onItemClick(AdapterView<?> adapterView, View view, int position, lon |
340 | 343 | } |
341 | 344 | }); |
342 | 345 | } |
| 346 | + |
| 347 | + etInsureeNumber.addTextChangedListener(new TextWatcher() { |
| 348 | + @Override |
| 349 | + public void beforeTextChanged(CharSequence s, int start, int count, int after) {} |
| 350 | + |
| 351 | + @Override |
| 352 | + public void onTextChanged(CharSequence s, int start, int before, int count) {} |
| 353 | + |
| 354 | + @Override |
| 355 | + public void afterTextChanged(Editable s) { |
| 356 | + int length = s != null ? s.length() : 0; |
| 357 | + if (length > 0 && length < 12) { |
| 358 | + tilCHFID.setError(getResources().getString(R.string.minChfIdRequired)); |
| 359 | + } else { |
| 360 | + tilCHFID.setError(null); |
| 361 | + } |
| 362 | + } |
| 363 | + }); |
343 | 364 | } |
344 | 365 |
|
345 | 366 | private boolean isIntentReadonly() { |
@@ -776,6 +797,9 @@ private boolean isValidData() { |
776 | 797 | if (etInsureeNumber.getText().length() == 0) { |
777 | 798 | showValidationDialog(etInsureeNumber, getResources().getString(R.string.MissingCHFID)); |
778 | 799 | return false; |
| 800 | + } else if(etInsureeNumber.getText().length() < 12){ |
| 801 | + showValidationDialog(etInsureeNumber, getResources().getString(R.string.minChfIdRequired)); |
| 802 | + return false; |
779 | 803 | } |
780 | 804 |
|
781 | 805 | /*if (!etProgram.getText().toString().equals("VIH")) { |
|
0 commit comments