登录协议跳转功能完善

This commit is contained in:
lijia 2024-06-18 16:07:25 +08:00
parent b271ec0566
commit ec0a0c2902
4 changed files with 59 additions and 8 deletions

View File

@ -52,7 +52,7 @@ public class TagAliasOperatorHelper {
}
logs += ", errorCode:" + jPushMessage.getErrorCode();
Log.e(TAG, logs);
ToastUtils.showToast(context,logs);
// ToastUtils.showToast(context,logs);
}
}
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage){
@ -66,7 +66,7 @@ public class TagAliasOperatorHelper {
}else{
String logs = "Failed to modify tags, errorCode:" + jPushMessage.getErrorCode();
Log.e(TAG, logs);
ToastUtils.showToast(context,logs);
// ToastUtils.showToast(context,logs);
}
}
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {

View File

@ -4,12 +4,19 @@ import android.Manifest
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.util.Log
import android.view.View
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.text.toSpannable
import com.arpa.glex.bean.UserBean
import com.arpa.hndahesudintocctmsdriver.R
import com.arpa.hndahesudintocctmsdriver.base.AppConfig
import com.arpa.hndahesudintocctmsdriver.base.WebActivity
import com.arpa.hndahesudintocctmsdriver.databinding.ActivityLoginBinding
import com.arpa.hndahesudintocctmsdriver.event.RefreshEvent
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
@ -67,17 +74,59 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>(), View.OnClickListener
binding.ok.setOnClickListener(this)
binding.imgHead.setOnLongClickListener {
// TODO: 调试图片上传
// ActivityUtils.startActivity(mContext, AuthTrailerActivity::class.java,Bundle().apply {
// putString(AppConfig.CAR_ID,"25")
// })
ActivityUtils.startActivity(mContext, SelectRoleActivity::class.java)
// ActivityUtils.startActivity(mContext, HomeActivity::class.java)
return@setOnLongClickListener true
}
dealAgreement()
}
private fun dealAgreement(){
val toSpannable = binding.tvContent.text.toSpannable()
toSpannable.run {
val start = indexOf("")
setSpan(object : ClickableSpan(){
override fun onClick(widget: View) {
//用户服务协议点击事件
startActivity(Intent(this@LoginActivity, WebActivity::class.java).apply {
putExtra("url", "http://agreement.dahehuoyun.com/huawei/#/private")
putExtra("title", "用户服务协议")
})
}
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = resources.getColor(R.color.theme_color, null)
// 去掉下划线
ds.isUnderlineText = false
}
}, start, start + 8, 0)
val end = lastIndexOf("")
setSpan(object : ClickableSpan(){
override fun onClick(widget: View) {
//用户服务协议点击事件
startActivity(Intent(this@LoginActivity, WebActivity::class.java).apply {
putExtra("url", "http://agreement.dahehuoyun.com/#/user")
putExtra("title", "隐私政策")
})
}
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = resources.getColor(R.color.theme_color, null)
// 去掉下划线
ds.isUnderlineText = false
}
}, end, end + 6, 0)
}
binding.tvContent.run {
movementMethod = LinkMovementMethod.getInstance()
setText(toSpannable, TextView.BufferType.SPANNABLE)
}
}

View File

@ -50,7 +50,7 @@ class UserUtils private constructor() {
fun loginIn(context: Context, userBean: UserBean) {
SPUtils.instance.setUserInfo(context, Gson().toJson(userBean))
//设置推送别名
// PushHelper.setAlias(context, userBean)
PushHelper.setAlias(context, userBean)
// ActivityUtils.startActivity(
// context,

View File

@ -98,6 +98,7 @@
android:textSize="@dimen/sp_15" />
<LinearLayout
android:gravity="top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
@ -108,6 +109,7 @@
<CheckBox
android:layout_marginTop="@dimen/dp_3"
android:id="@+id/cb"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_18"
@ -118,7 +120,7 @@
</CheckBox>
<TextView
android:id="@+id/tv_content"
android:id="@+id/tvContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_6"