Skip to content

Instantly share code, notes, and snippets.

@gsrathoreniks
Created December 6, 2020 12:32
Show Gist options
  • Save gsrathoreniks/9669802b3fad80b8f0842912e7d1bf25 to your computer and use it in GitHub Desktop.
Save gsrathoreniks/9669802b3fad80b8f0842912e7d1bf25 to your computer and use it in GitHub Desktop.
MainActivity.kt
package `in`.gsrathoreniks.validationdemo
import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.google.android.material.button.MaterialButton
import com.google.android.material.textfield.TextInputEditText
class MainActivity : AppCompatActivity() {
private lateinit var et : TextInputEditText
lateinit var btn : MaterialButton
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupViews()
}
@SuppressLint("SetTextI18n")
private fun setupViews(){
et = findViewById(R.id.et)
btn = findViewById(R.id.btn)
btn.setOnClickListener { view ->
ValidationUtil.isValidUsername(et, et.text.toString())
ValidationUtil.isValidUsername(view = et,username = et.text.toString())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment