so I made a password with some validations, the first thing I made was validation on the passittord edittext, when I entered the password a red close icon will appear and display a messase error, after the password has been filled the close icon still hasn't changed to the green check icon, when the password is filled with letters, big letters, and numbers, then the icon that was closed turned into a sucess or checklist icon, can friends help me solve this problem?
I made this still displays the close icon
this is code
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputPassword"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:hint="Password"
app:counterEnabled="true"
app:counterMaxLength="6"
app:endIconMode="clear_text"
app:endIconDrawable="@drawable/ic_canceles"
app:errorEnabled="true"
app:endIconTint="#DF0000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInputEmail">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:maxLines="1"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
this is code kotlin
submitButtom.setOnClickListener {
if (editTextPassword.text.toString().length < 6) {
editTextPassword.setError("password minimum contain 6 character")
editTextPassword.requestFocus()
editTextPassword.isEnabled = true
}
if (editTextPassword.text.toString().length > 6) {
editTextPassword.setError("password maximum contain 6 character")
editTextPassword.requestFocus()
}
if (editTextPassword.text.toString().equals("")) {
editTextPassword.setError("please enter password")
editTextPassword.requestFocus();
}
}