Skip to content

Instantly share code, notes, and snippets.

@Nublo
Created July 23, 2019 10:03
Show Gist options
  • Save Nublo/e2398904e2c9dcd4b17bb1ae0721381b to your computer and use it in GitHub Desktop.
Save Nublo/e2398904e2c9dcd4b17bb1ae0721381b to your computer and use it in GitHub Desktop.
class DateEditText : AppCompatEditText(context, attrs, defStyleAttr) {
private var canChange: Boolean = false
private var actualText: StringBuilder = StringBuilder()
override fun onSelectionChanged(selStart: Int, selEnd: Int) {
super.onSelectionChanged(selStart, selEnd)
if (!canChange) return
canChange = false
setSelection(actualText.length)
canChange = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment