2018.11.18
override fun onRestart() {
et_password.setText("")
super.onRestart()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if(requestCode == 114 && data != null){
mPassword = data.getStringExtra("new_password")
}
}
private fun doForget(){
val phone = et_phone.text.toString()
if(phone.isBlank() || phone.length < 11){
toast("please input a correct phone number")
return
}
}
private inner class HideTextViewWatcher(private val mView: EditText):TextWatcher{
private val mMaxLength: Int = ViewUtil.getMaxLength(mView)
private var mStr:CharSequence?=null
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
mStr = s
}
override fun afterTextChanged(s: Editable?) {
if(mStr.isNullOrEmpty())
return
if(mStr!!.length == 11 && mMaxLength == 11 || mStr!!.length == 6 && mMaxLength == 6){
ViewUtil.hideOneInputMethod(this@MainActivity, mView)
}
}
}