Commit 4b248c42 by 霍志良

feat:注册登录未勾选协议下一步弹窗 让用户选择默认勾选协议

parent 677a435b
......@@ -4,13 +4,11 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Handler
import android.text.*
import android.text.method.LinkMovementMethod
import android.text.style.AbsoluteSizeSpan
import android.text.style.ClickableSpan
import android.view.Gravity
import android.view.View
import android.view.animation.AnimationUtils
import androidx.core.content.ContextCompat
......@@ -53,12 +51,15 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.CountryListActivity
import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.presenter.LoginPresenterImpl
import com.yidianling.user.widget.AgreePrivacyBottomDialog
import com.yidianling.user.widget.SecretDialog
import com.yidianling.user.widget.ZDialog
import com.yidianling.user.widget.ZDialogDirection
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_register_and_login_bottom.*
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.*
import kotlinx.android.synthetic.main.user_activity_secret.*
/**
* @author jiucheng
......@@ -82,7 +83,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
private var handler: Handler? = null
private var isFromGuide = false//是否来自启动页
private var isFromOneKeyLogin = false // 是否来自一键登录界面
private var mAgreePrivacyDialog: ZDialog? = null
private var bottomDialog: AgreePrivacyBottomDialog? = null
companion object {
private var BIND_PHONE = "bind_phone"//用于判断时候是绑定手机号
......@@ -322,6 +323,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
et_phone_number.hint = SpannedString(hintStr)
}
/**
* 设置点击事件
*/
......@@ -403,26 +405,22 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
//下一步
ll_next.setOnClickListener {
if (iv_select_protocol.visibility == View.VISIBLE && !isAgreeProtocol && !et_phone_number.text.isNullOrEmpty()) {
if (mAgreePrivacyDialog == null) {
mAgreePrivacyDialog = ZDialog.Builder(this)
.setGravity(ZDialogDirection.FROM_BOTTOM)
.setContentView(R.layout.user_agree_privacy_dialog)
.setOnClickListener(R.id.user_dialog_no_agree) {
mAgreePrivacyDialog?.dismiss()
mAgreePrivacyDialog = null
}
.setAnimation(0)//取消动画
.setFullScreen()
.setCancelAble(true)
.setOnClickListener(R.id.user_dialog_secret_agree) {
mAgreePrivacyDialog?.dismiss()
mAgreePrivacyDialog = null
//勾选隐私协议 TODO
if (null == bottomDialog) {
bottomDialog = AgreePrivacyBottomDialog(
this,
object : AgreePrivacyBottomDialog.OnAgreeBottomListener {
override fun onCancel() {
}
.show()
}
override fun onSure() {
isAgreeProtocol = true
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_selected_new)
}
})
bottomDialog?.show()
} else {
mAgreePrivacyDialog!!.show()
bottomDialog?.show()
}
return@setOnClickListener
}
......
package com.yidianling.user.widget
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.text.Spannable
import android.text.SpannableString
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import androidx.core.content.ContextCompat
import com.yidianling.user.R
import com.yidianling.user.ui.login.H5Activity
import kotlinx.android.synthetic.main.user_agree_privacy_dialog.*
class AgreePrivacyBottomDialog(context: Context, private val listener: OnAgreeBottomListener?) :
Dialog(context, R.style.platform_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.user_agree_privacy_dialog)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
window.setGravity(Gravity.BOTTOM)
window.attributes = params
user_dialog_no_agree.setOnClickListener {
//拒绝
listener?.onCancel()
dismiss()
}
user_dialog_secret_agree.setOnClickListener {
//同意
listener?.onSure()
dismiss()
}
user_agree_dialog_protocol.text = agreeDialogProtocol()
user_agree_dialog_protocol.movementMethod = LinkMovementMethod.getInstance()
}
interface OnAgreeBottomListener {
fun onCancel()
fun onSure()
}
private fun agreeDialogProtocol(): SpannableString {
val name = "请先同意" + context.resources.getString(R.string.user_login_name_start)
val str = "${name}用户使用协议、隐私\n保护政策才能登录使用哦"
var start = name.length
val spannableString = SpannableString(str)
spannableString.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color =
ContextCompat.getColor(context, R.color.user_1da1f2trans)
ds.isUnderlineText = true //设置下划线
}
override fun onClick(widget: View) {
H5Activity.start(context, false)
}
}, start, start + 6, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
spannableString.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color =
ContextCompat.getColor(context, R.color.user_1da1f2trans)
ds.isUnderlineText = true //设置下划线
}
override fun onClick(widget: View) {
H5Activity.start(context, true)
}
}, start + 7, start + 13, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
return spannableString
}
}
\ No newline at end of file
......@@ -24,6 +24,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28"
android:text="请先同意协议才能登录使用哦"
android:textColor="@color/platform_color_BFBFBF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/user_agree_title"></TextView>
......
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