Commit aafd69a6 authored by jyx's avatar jyx

添加登录勾选按钮

parent dc9e1cd2
package com.mints.flowbox.ui.activitys
import android.Manifest
import android.os.Bundle
import android.text.TextPaint
import android.text.TextUtils
import android.text.style.ClickableSpan
import android.view.View
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.hjq.toast.ToastUtils
import com.tbruyelle.rxpermissions.RxPermissions
import com.mints.library.utils.nodoubleclick.AntiShake
import com.mints.flowbox.R
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.presenters.LoginPresenter
......@@ -13,7 +20,15 @@ import com.mints.flowbox.mvp.views.LoginView
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.BackInputUtil
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.SpanUtils
import kotlinx.android.synthetic.main.activity_bind_mobile.*
import kotlinx.android.synthetic.main.activity_bind_mobile.etLoginCode
import kotlinx.android.synthetic.main.activity_bind_mobile.etLoginMobile
import kotlinx.android.synthetic.main.activity_bind_mobile.tvLoginNext
import kotlinx.android.synthetic.main.activity_bind_mobile.tvLoginSendcode
import kotlinx.android.synthetic.main.activity_mobile_login.*
import kotlinx.android.synthetic.main.activity_mobile_login.tvLoginAgreement
import kotlinx.android.synthetic.main.activity_wx_login.*
import kotlinx.android.synthetic.main.header_layout.*
/**
......@@ -61,6 +76,12 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
loginPresenter.sendMobileCode(mobile)
}
R.id.tvLoginNext -> {
if (!tvLoginAgreement.isChecked) {
ToastUtils.show("请勾选同意《用户注册协议》及《用户隐私协议》")
YoYo.with(Techniques.Shake).duration(1000).repeat(1).playOn(tvLoginAgreement)
return
}
var mobile = etLoginMobile.text.toString().trim()
if (mobile.length < 13) {
showToast("请输入手机号")
......@@ -131,6 +152,37 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
etLoginMobile.setText(mobile)
etLoginMobile.setSelection(mobile!!.length + 2)
}
SpanUtils.with(tvLoginAgreement)
.append("《用户注册协议》").setClickSpan(object : ClickableSpan() {
override fun onClick(widget: View) {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.register_name))
bundle.putString(WebActivity.WEB_URL, Constant.REGISTER_URL)
readyGo(WebActivity::class.java, bundle)
}
override fun updateDrawState(ds: TextPaint) {
ds.color = resources.getColor(R.color.color_main)
ds.isUnderlineText = false
}
})
.append("、")
.append("《用户隐私协议》").setClickSpan(object : ClickableSpan() {
override fun onClick(widget: View) {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.privacy_name))
bundle.putString(WebActivity.WEB_URL, Constant.PRIVACY_URL)
readyGo(WebActivity::class.java, bundle)
}
override fun updateDrawState(ds: TextPaint) {
ds.color = resources.getColor(R.color.color_main)
ds.isUnderlineText = false
}
})
.append("与您的利益切身相关。请您注册前务必仔细阅读!")
.create()
}
private fun initListener() {
......
......@@ -9,6 +9,9 @@ import android.view.KeyEvent
import android.view.View
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.hjq.toast.ToastUtils
import com.tbruyelle.rxpermissions.RxPermissions
import com.mints.library.utils.CommonUtils
import com.mints.library.utils.json.JsonUtil
......@@ -90,6 +93,12 @@ class WxLoginActivity : BaseActivity(), LoginView, View.OnClickListener, OnLogin
readyGo(MobileLoginActivity::class.java)
}
R.id.rlLoginWx -> {
if (!tvLoginAgreement.isChecked) {
ToastUtils.show("请勾选同意《用户注册协议》及《用户隐私协议》")
YoYo.with(Techniques.Shake).duration(1000).repeat(1).playOn(tvLoginAgreement)
return
}
val wechat = ShareSDK.getPlatform(Wechat.NAME)
if (!wechat.isClientValid) {
showToast("请先安装微信")
......@@ -191,7 +200,7 @@ class WxLoginActivity : BaseActivity(), LoginView, View.OnClickListener, OnLogin
ds.isUnderlineText = false
}
})
.append("与您的利益切身相关。请您注册前务必仔细阅读!点击登录即表示您同意并愿意遵守协议")
.append("与您的利益切身相关。请您注册前务必仔细阅读!")
.create()
}
......
......@@ -90,7 +90,7 @@
android:layout_centerVertical="true"
android:gravity="center"
android:text="发送验证码"
android:textColor="@color/color_FF9837"
android:textColor="@color/color_main"
android:textSize="12sp" />
</RelativeLayout>
......@@ -115,6 +115,17 @@
android:textColor="@color/white"
android:textSize="14sp" />
<CheckBox
android:id="@+id/tvLoginAgreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:textColor="@color/color_707A8D"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -67,7 +67,7 @@
android:textColor="@color/gray"
android:textSize="14sp" />
<TextView
<CheckBox
android:id="@+id/tvLoginAgreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -19,6 +19,8 @@
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/color_main</item>
<item name="colorAccent">@color/color_main</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
......
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