Created
August 27, 2019 15:21
-
-
Save lukelorusso/0907c6b8b9b27a66685830d5009be6f2 to your computer and use it in GitHub Desktop.
renderCode()
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
private fun renderCode() { | |
for (i in 0 until llCodeWrapper.childCount) { | |
val itemContainer = llCodeWrapper.getChildAt(i) | |
itemContainer.findViewById<TextView>(R.id.tvCode).text = | |
if (text.length > i) | |
(if (maskTheCode) codeMaskChar else text[i]) | |
.toString() | |
else "" | |
if (i == text.length - 1 && !itemContainer.isFullyVisibleInside(hsvCodeWrapperScroller)) | |
hsvCodeWrapperScroller.focusOnView(itemContainer) | |
} | |
notifyCodeChanged() | |
} | |
private fun notifyCodeChanged(): Boolean = (text.length == maxLength).apply { | |
onCodeChangedListener?.invoke(Pair(text.toString(), this)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment