Commit be03d715 authored by 张释方's avatar 张释方

提交防止重复点击代码

parent 69b06f74
......@@ -47,6 +47,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
return@setOnClickListener
}
sendCodeThread()
mobile = mobile.replace(" ".toRegex(), "")
viewModel.sendMobileCode(mobile)
......@@ -117,4 +118,31 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
R.id.iv_left_icon -> finish()
}
}
/**
* 发送手机验证码,按钮动态改变状态
*/
var num = 0
var run: Runnable? = null
fun sendCodeThread() {
num = 60
tv_send_sms?.let {
it.isEnabled = false
it.text = "($num)重新获取"
run = object : Runnable {
override fun run() {
num--
if (num == 0) {
it.text = "重新获取"
it.isEnabled = true
} else {
it.text = "($num)重新获取"
it.postDelayed(this, 1000)
}
}
}
it.postDelayed(run, 1000)
}
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.mints.street.manager.UserManager
import kotlinx.android.synthetic.main.activity_moresettings.*
import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
import org.w3c.dom.Text
......@@ -53,6 +54,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
item_phone.findViewById<TextView>(R.id.tv_right).setTextColor(Color.BLACK)
item_phone.findViewById<TextView>(R.id.tv_right).text = "去绑定"
item_phone.setOnClickListener(this)
RxUtils.onMultiClick(item_phone){
if (userManager.userIsLogin()) {
startActivity(BindMobileActivity::class.java)
return@onMultiClick
} else {
ToastUtils.showLong("请先使用微信登录")
}
}
}
}
private fun initView() {
......@@ -96,14 +105,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
R.id.iv_left_icon -> {
finish()
}
R.id.item_phone -> {
if (userManager.userIsLogin()) {
startActivity(BindMobileActivity::class.java)
return
} else {
ToastUtils.showLong("请先使用微信登录")
}
}
// R.id.item_phone -> {
// if (userManager.userIsLogin()) {
// startActivity(BindMobileActivity::class.java)
// return
// } else {
// ToastUtils.showLong("请先使用微信登录")
// }
// }
R.id.btn_switch -> {//退出登录
UserManager.INSTANCE.userLogout()
......
......@@ -32,6 +32,7 @@ import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.tbruyelle.rxpermissions2.RxPermissions
import kotlinx.android.synthetic.main.fragment_my.*
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
import java.util.*
......@@ -90,7 +91,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private fun initListener() {
//设置登录点击事件
binding.llMyLogin.setOnClickListener {
RxUtils.onMultiClick(binding.llMyLogin){
// binding.llMyLogin.setOnClickListener {
if (!userManager.userIsLogin()) {
//创建弹窗
......@@ -109,7 +111,15 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
tv_regist?.setOnClickListener(this)
tv_private?.setOnClickListener(this)
iv_weixin?.setOnClickListener(this)
ly_phone?.setOnClickListener(this)
// ly_phone?.setOnClickListener(this)
RxUtils.onMultiClick(ly_phone){
if (cb_checked!!.isChecked) {
startActivity(LoginActivity::class.java)
mBottomSheetDialog!!.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
}
}
}
}
......@@ -124,8 +134,13 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
}
aboutus.setOnClickListener(this)
moresettings.setOnClickListener(this)
RxUtils.onMultiClick(aboutus){
startActivity(AboutusActivity::class.java)
}
RxUtils.onMultiClick(moresettings){
startActivity(MoresettingsActivity::class.java)
}
}
private fun initView() {
......@@ -147,13 +162,6 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override fun onClick(v: View?) {
when (v?.id) {
R.id.aboutus -> {
startActivity(AboutusActivity::class.java)
// startActivity(PermissionsActivity::class.java)
}
R.id.moresettings -> {
startActivity(MoresettingsActivity::class.java)
}
R.id.iv_weixin -> {
if (cb_checked!!.isChecked) {
// ToastUtils.showShort("未完成微信登录对接")
......@@ -178,14 +186,14 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
ToastUtils.showShort("请先同意用户协议与隐私政策")
}
}
R.id.ly_phone -> {
if (cb_checked!!.isChecked) {
startActivity(LoginActivity::class.java)
mBottomSheetDialog!!.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
}
}
// R.id.ly_phone -> {
// if (cb_checked!!.isChecked) {
// startActivity(LoginActivity::class.java)
// mBottomSheetDialog!!.dismiss()
// } else {
// ToastUtils.showShort("请先同意用户协议与隐私政策")
// }
// }
R.id.tv_regist -> {
KLog.e("sssss", "点击了《注册协议》")
ToastUtils.showShort("点击了《注册协议》")
......
......@@ -4,7 +4,7 @@
<!-- 边框的颜色和粗细 -->
<stroke
android:width="1dp"
android:color="#C7EDCC"
android:color="#03A9F4"
/>
<solid android:color="#ffffffff" />
<corners android:radius="10dp" />
......
......@@ -104,8 +104,8 @@
<TextView
android:id="@+id/tv_send_sms"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:gravity="center"
......
......@@ -219,8 +219,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:gravity="bottom|center_horizontal"
android:orientation="horizontal">
......
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