邮箱帮助

This commit is contained in:
coldmint 2022-04-17 18:29:28 +08:00
parent 46eeda943a
commit 6c3676e57e
11 changed files with 47 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.coldmint.rust.pro
import android.os.Bundle
import android.text.Editable
import android.text.InputType
import android.text.TextWatcher
import com.coldmint.rust.pro.base.BaseActivity
import android.view.View
@ -10,6 +11,7 @@ import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.web.ServerConfiguration
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.input.input
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.RegisterRequestData
import com.coldmint.rust.core.web.User
@ -84,6 +86,36 @@ class RegisterActivity : BaseActivity<ActivityRegisterBinding>() {
})
viewBinding.mailHelpTextView.setOnClickListener {
//预填充qq号
val tail = "@qq.com"
val oldEmailValue = viewBinding.emailView.text.toString()
val hasOldQQ = oldEmailValue.endsWith(tail)
var oldQQ = ""
if (hasOldQQ) {
oldQQ = oldEmailValue.subSequence(0, oldEmailValue.length - tail.length).toString()
}
//显示对话框
MaterialDialog(this).show {
title(R.string.email).message(R.string.mail_helper_tip)
.input(
hintRes = R.string.qq_number,
maxLength = viewBinding.emailInputLayout.counterMaxLength - tail.length,
inputType = InputType.TYPE_CLASS_NUMBER,
prefill = oldQQ
) { materialDialog, charSequence ->
val email = "${charSequence}${tail}"
viewBinding.emailView.setText(email)
Snackbar.make(
viewBinding.registerButton,
R.string.email_fill_complete,
Snackbar.LENGTH_SHORT
).show()
}
.positiveButton(R.string.dialog_ok).negativeButton(R.string.dialog_close)
}
}
viewBinding.registerButton.setOnClickListener(View.OnClickListener { v ->

View File

@ -120,12 +120,21 @@
android:maxLength="30"
android:maxLines="1" />
<TextView
android:id="@+id/mailHelpTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mail_helper"
android:textColor="?android:colorPrimary"
android:textSize="13sp" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/registerButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/register" />
</LinearLayout>

View File

@ -193,6 +193,8 @@
android:id="@+id/titleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="标题"
android:textColor="@color/black"
android:textSize="16sp" />

View File

@ -821,4 +821,8 @@
<string name="paid_no">放弃订单</string>
<string name="preferential_price">已为您优惠%1$.2f元,仍然放弃订单嘛,放弃订单后不返还优惠券。</string>
<string name="paid_continue">继续支付</string>
<string name="mail_helper">不知道自己的邮箱地址?点击这里查看帮助</string>
<string name="qq_number">QQ号</string>
<string name="mail_helper_tip">建议您使用QQ邮箱注册请输入QQ号我们会自动填充您的QQ邮箱。</string>
<string name="email_fill_complete">邮箱地址填充完成。</string>
</resources>