Commit c8b1f32b by 霍志良

feat:国内手机号校验,国外不做校验

parent 48baa470
...@@ -405,6 +405,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -405,6 +405,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
} }
//手机号输入框 //手机号输入框
et_phone_number.setListener { et_phone_number.setListener {
if (TextUtils.isEmpty(it)) { if (TextUtils.isEmpty(it)) {
setHint() setHint()
...@@ -414,13 +415,33 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -414,13 +415,33 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
iv_del.visibility = View.VISIBLE iv_del.visibility = View.VISIBLE
iv_del.isEnabled = true iv_del.isEnabled = true
} }
if (it.toString().length == 13 || (!countryCode?.equals("+86")!! && et_phone_number.text.toString().length > 0)) { /*if (it.toString().length == 13 || (!splitCode?.equals("+86")!! && et_phone_number.text.toString().length > 0)) {
ll_next.isEnabled = true ll_next.isEnabled = true
ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login) ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
} else { } else {
ll_next.isEnabled = false ll_next.isEnabled = false
ll_next.background = ll_next.background =
ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp) ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp)
}*/
if (country_code.text.equals("+86")!!&&it.toString().length == 13){
ll_next.isEnabled = true
ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
}else{
if (country_code.text.equals("+86")!!){
ll_next.isEnabled = false
ll_next.background =
ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp)
return@setListener
}
if (!country_code.text?.equals("+86")!!&&it.toString().length > 0){
ll_next.isEnabled = true
ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
}else{
ll_next.isEnabled = false
ll_next.background =
ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp)
}
} }
} }
//删除按钮 //删除按钮
...@@ -692,6 +713,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -692,6 +713,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
*/ */
private fun setCountryIcon(code: String?) { private fun setCountryIcon(code: String?) {
country_code.text = "+" + countryCode?.replace("00", "") country_code.text = "+" + countryCode?.replace("00", "")
val splitCode= countryCode?.replace("00", "")
/* when (code) { /* when (code) {
"0086" -> iv_country_icon.setImageResource(R.drawable.user_ic_china) "0086" -> iv_country_icon.setImageResource(R.drawable.user_ic_china)
"001" -> iv_country_icon.setImageResource(R.drawable.user_country_usa) "001" -> iv_country_icon.setImageResource(R.drawable.user_country_usa)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment