|
|
@@ -12,6 +12,7 @@ import com.yingyangfly.baselib.dialog.BindingPhoneDialog
|
|
|
import com.yingyangfly.baselib.dialog.TipsDialog
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
+import com.yingyangfly.baselib.ext.show
|
|
|
import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.baselib.mvvm.BaseLargeScreenMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
@@ -92,6 +93,8 @@ class BindingEvaluationActivity :
|
|
|
"退出失败,请重试".toast()
|
|
|
}, success = {
|
|
|
runOnUiThread {
|
|
|
+ binding.tvPhone.text = ""
|
|
|
+ binding.loginOutLayout.show(false)
|
|
|
User.saveToken("")
|
|
|
User.savePhone("")
|
|
|
showBindingPhoneDialog()
|
|
|
@@ -148,10 +151,12 @@ class BindingEvaluationActivity :
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
if (TextUtils.isEmpty(User.getToken())) {
|
|
|
+ binding.loginOutLayout.show(false)
|
|
|
showBindingPhoneDialog()
|
|
|
} else {
|
|
|
+ binding.loginOutLayout.show(true)
|
|
|
binding.tvPhone.text = if (TextUtils.isEmpty(User.getPhone()).not()) {
|
|
|
- "手机号:" + User.getPhone()
|
|
|
+ "手机号:" + hideMiddleDigits(User.getPhone())
|
|
|
} else {
|
|
|
"手机号:"
|
|
|
}
|
|
|
@@ -165,7 +170,9 @@ class BindingEvaluationActivity :
|
|
|
private fun showBindingPhoneDialog() {
|
|
|
val bindingPhoneDialog = BindingPhoneDialog()
|
|
|
bindingPhoneDialog.onDialogClickListener = {
|
|
|
- binding.tvPhone.text = "手机号:$it"
|
|
|
+ binding.loginOutLayout.show(true)
|
|
|
+ binding.loginOutLayout.show(true)
|
|
|
+ binding.tvPhone.text = "手机号:" + hideMiddleDigits(it)
|
|
|
}
|
|
|
bindingPhoneDialog.show(supportFragmentManager, "bindingPhoneDialog")
|
|
|
}
|
|
|
@@ -186,4 +193,13 @@ class BindingEvaluationActivity :
|
|
|
}, true)
|
|
|
.show(supportFragmentManager)
|
|
|
}
|
|
|
+
|
|
|
+ private fun hideMiddleDigits(phoneNumber: String): String {
|
|
|
+ if (phoneNumber.length < 7) {
|
|
|
+ return phoneNumber
|
|
|
+ }
|
|
|
+ // 使用正则表达式将中间四位数字替换为*
|
|
|
+ val regex = "(?<=\\d{3})\\d(?=\\d{4})"
|
|
|
+ return phoneNumber.replace(regex.toRegex(), "*")
|
|
|
+ }
|
|
|
}
|