|
@@ -1,7 +1,12 @@
|
|
package com.cooleshow.teacher.ui.splash
|
|
package com.cooleshow.teacher.ui.splash
|
|
|
|
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
|
|
+import android.text.Spannable
|
|
|
|
+import android.text.SpannableStringBuilder
|
|
|
|
+import android.text.TextPaint
|
|
import android.text.TextUtils
|
|
import android.text.TextUtils
|
|
|
|
+import android.text.style.ClickableSpan
|
|
|
|
+import android.view.View
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
import com.cooleshow.base.bean.RouteBean
|
|
import com.cooleshow.base.bean.RouteBean
|
|
import com.cooleshow.base.common.ConstantKey
|
|
import com.cooleshow.base.common.ConstantKey
|
|
@@ -11,6 +16,9 @@ import com.cooleshow.base.ui.activity.BaseActivity
|
|
import com.cooleshow.base.utils.GsonUtils
|
|
import com.cooleshow.base.utils.GsonUtils
|
|
import com.cooleshow.base.utils.JumpUtils
|
|
import com.cooleshow.base.utils.JumpUtils
|
|
import com.cooleshow.base.utils.SPUtils
|
|
import com.cooleshow.base.utils.SPUtils
|
|
|
|
+import com.cooleshow.base.utils.ToastUtil
|
|
|
|
+import com.cooleshow.base.widgets.dialog.PrivacyTipDialog
|
|
|
|
+import com.cooleshow.teacher.R
|
|
import com.cooleshow.teacher.databinding.ActivitySplashLayoutBinding
|
|
import com.cooleshow.teacher.databinding.ActivitySplashLayoutBinding
|
|
import com.cooleshow.usercenter.constants.UserConstants
|
|
import com.cooleshow.usercenter.constants.UserConstants
|
|
import com.cooleshow.usercenter.helper.UserHelper
|
|
import com.cooleshow.usercenter.helper.UserHelper
|
|
@@ -31,6 +39,88 @@ class SplashActivity : BaseActivity<ActivitySplashLayoutBinding>() {
|
|
|
|
|
|
override fun initData() {
|
|
override fun initData() {
|
|
super.initData()
|
|
super.initData()
|
|
|
|
+ var privacyMode = UserHelper.getAppPrivacyMode()
|
|
|
|
+ if (privacyMode == 0) {
|
|
|
|
+ //显示隐私协议提示弹窗
|
|
|
|
+ showPrivacyTipDialog()
|
|
|
|
+ } else {
|
|
|
|
+ goIntent()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun showPrivacyTipDialog() {
|
|
|
|
+ val contentStart = "亲爱的用户,感谢您的信任并使用酷乐秀学院APP!\n 在使用我们的产品和服务前,请您先阅读并了解"
|
|
|
|
+ val userProtocol = "《用户协议》"
|
|
|
|
+ val privacy = "和《隐私政策》"
|
|
|
|
+ val contentEnd = """
|
|
|
|
+ 。请您在点击同意之前充分理解相关条款,其中的重点条款已为您标注,方便您了解自己的权利。
|
|
|
|
+ 我们将通过《隐私政策》向您说明 :
|
|
|
|
+ 1.为了您可以更好的学习器乐,我们会需要您填写您的 基本信息,我们会根据您填写内容,收集和使用对应的必要信息(如手机号,声部信息等)。
|
|
|
|
+ 2.您可以对上述信息进行访问、更正、删除以及注销账户,我们也将提供专门的个人信息保护联系方式。
|
|
|
|
+ 3.未经您的授权同意,我们不会将上述信息共享给第三方或用于您未授权的其他用途。
|
|
|
|
+
|
|
|
|
+ 我们将严格按照上述协议为您提供服务,保护您的信息安全,点击“同意”即表示您已阅读并同意全部条款,可以继续使用我们的产品和服务。
|
|
|
|
+
|
|
|
|
+ """.trimIndent()
|
|
|
|
+
|
|
|
|
+ val spannableStringBuilder =
|
|
|
|
+ SpannableStringBuilder(contentStart + userProtocol + privacy + contentEnd)
|
|
|
|
+ val userProtocolSpan: ClickableSpan = object : ClickableSpan() {
|
|
|
|
+ override fun updateDrawState(ds: TextPaint) {
|
|
|
|
+ ds.linkColor = resources.getColor(com.cooleshow.base.R.color.color_2dc7aa)
|
|
|
|
+ super.updateDrawState(ds)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onClick(view: View) {
|
|
|
|
+ //跳转用户协议
|
|
|
|
+ ARouter.getInstance()
|
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
|
+ .withString(WebConstants.WEB_URL, WebConstants.REGISTRATION_AGREEMENT)
|
|
|
|
+ .navigation()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ val privacySpan: ClickableSpan = object : ClickableSpan() {
|
|
|
|
+ override fun updateDrawState(ds: TextPaint) {
|
|
|
|
+ ds.linkColor = resources.getColor(com.cooleshow.base.R.color.color_2dc7aa)
|
|
|
|
+ super.updateDrawState(ds)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onClick(view: View) {
|
|
|
|
+ //跳转隐私协议
|
|
|
|
+ ARouter.getInstance()
|
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
|
+ .withString(WebConstants.WEB_URL, WebConstants.PRIVACY_AGREEMENT)
|
|
|
|
+ .navigation()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ val startIndex = contentStart.length
|
|
|
|
+ spannableStringBuilder.setSpan(
|
|
|
|
+ userProtocolSpan,
|
|
|
|
+ startIndex,
|
|
|
|
+ startIndex + 6,
|
|
|
|
+ Spannable.SPAN_EXCLUSIVE_INCLUSIVE
|
|
|
|
+ )
|
|
|
|
+ spannableStringBuilder.setSpan(
|
|
|
|
+ privacySpan,
|
|
|
|
+ startIndex + 7,
|
|
|
|
+ startIndex + 13,
|
|
|
|
+ Spannable.SPAN_EXCLUSIVE_INCLUSIVE
|
|
|
|
+ )
|
|
|
|
+ var dialog: PrivacyTipDialog = PrivacyTipDialog(this)
|
|
|
|
+ dialog.show()
|
|
|
|
+ dialog.setContent(spannableStringBuilder)
|
|
|
|
+ dialog.setOnCancelClickListener {
|
|
|
|
+ ToastUtil.getInstance().showShort("不同意用户协议及隐私协议将无法正常使用酷乐秀学院哦")
|
|
|
|
+ finish()
|
|
|
|
+ }
|
|
|
|
+ dialog.setOnConfirmClickListener {
|
|
|
|
+ UserHelper.setAppPrivacyModeIsAgree()
|
|
|
|
+ goIntent()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun goIntent() {
|
|
val isFirstLaunch = SPUtils.getInstance().getBoolean(ConstantKey.IS_FIRST_LAUNCH, false)
|
|
val isFirstLaunch = SPUtils.getInstance().getBoolean(ConstantKey.IS_FIRST_LAUNCH, false)
|
|
if (isFirstLaunch) {
|
|
if (isFirstLaunch) {
|
|
if (UserHelper.isLogin()) {
|
|
if (UserHelper.isLogin()) {
|
|
@@ -66,7 +156,7 @@ class SplashActivity : BaseActivity<ActivitySplashLayoutBinding>() {
|
|
|
|
|
|
private fun jumpLogin() {
|
|
private fun jumpLogin() {
|
|
ARouter.getInstance().build(RouterPath.UserCenter.PATH_VERIFY_LOGIN)
|
|
ARouter.getInstance().build(RouterPath.UserCenter.PATH_VERIFY_LOGIN)
|
|
- .withInt(UserConstants.LOGIN_ITEM,VerifyCodeLoginActivity.TEACHER_ITEM)
|
|
|
|
|
|
+ .withInt(UserConstants.LOGIN_ITEM, VerifyCodeLoginActivity.TEACHER_ITEM)
|
|
.navigation()
|
|
.navigation()
|
|
}
|
|
}
|
|
|
|
|