-
-
Save nicemak/b8512e7e7603cddb090d8f17070b0b2d 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