Last active
December 7, 2024 04:41
-
-
Save ibrahim-mrq/6350b6ca0099ebaa56164dd6091a30e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun isTextMoreThan(editText: EditText, charNumber: Int): Boolean { | |
return if (editText.text.toString().length >= charNumber) { | |
editText.background = | |
ContextCompat.getDrawable(requireContext(), R.drawable.shape_edit_text) | |
editText.background.alpha = 180 | |
true | |
} else { | |
editText.background = ContextCompat.getDrawable( | |
requireContext(), | |
R.drawable.shape_edit_text_error | |
) | |
editText.error = | |
"${getString(R.string.password_must_than)} $charNumber characters" | |
editText.background.alpha = 180 | |
false | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment