I'm new to Kotlin, not so new to Java and Android development. But willing and trying to make a switch. I've wrote a simple validator for EditText
and was wondering if there is a way to write it more compact with lambdas.
textMTU.addTextChangedListener(object : EditTextValidator(textMTU) {
    override fun validate(textView: EditText, text: String) {
        val textToInt = if (text.isEmpty()) 0  else text.toInt()
        if (textToInt < 1280 || textToInt > 1500) {
            textView.error = getString(R.string.errorTroubleshoot)
        }
        else {
            textView.error = null
            val input = if (textMTU.rawText.isEmpty()) defaultSize else textMTU.rawText.toInt()
            if (input in 1281..1499) {
                prefs.mtuSize = input
            }
        }
    }
EditTextValidator here is simply extended TextWatcher without beforeTextChanged and onTextChanged methods