mirror of
https://gitee.com/willfree/min-vpn-client_v2.git
synced 2026-10-04 19:42:00 +08:00
注册界面加入验证码字段
This commit is contained in:
1 parent
58647e61c3
commit
c4c92974fa
3 files changed
+79
-3
No files matched your search
@@ -12,12 +12,16 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.jkb.vcedittext.VerificationCodeEditText;
|
||||
import com.pkusz.min_vpn_client.R;
|
||||
import com.pkusz.min_vpn_client.activity.base.MINVpnBaseActivity;
|
||||
import com.pkusz.min_vpn_client.activity.login.LoginActivity;
|
||||
import com.pkusz.min_vpn_client.model.OriginalRequest.OriginalRegisterRequest;
|
||||
import com.pkusz.min_vpn_client.utils.AccountValidatorRegexUtil;
|
||||
import com.pkusz.min_vpn_client.utils.DigestUtilKt;
|
||||
import com.white.countdownbutton.CountDownButton;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -48,6 +52,9 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
private ClearAbleEditText etEmail;
|
||||
private ClearAbleEditText etInviteCode;
|
||||
private ClearAbleEditText etRePassword;
|
||||
private VerificationCodeEditText etSMSNumber;
|
||||
private CountDownButton getSMScode;
|
||||
private ConstraintLayout SMSRegion;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -63,6 +70,9 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
etEmail=findViewById(R.id.etEmail);
|
||||
etInviteCode=findViewById(R.id.etInviteCode);
|
||||
etRePassword=findViewById(R.id.etRePassword);
|
||||
etSMSNumber=findViewById(R.id.Register_etSMSNumber);
|
||||
getSMScode=findViewById(R.id.Register_getSMScode);
|
||||
SMSRegion=findViewById(R.id.Register_SMSRegion);
|
||||
|
||||
initView();
|
||||
}
|
||||
@@ -95,6 +105,12 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
// etEmail.setText("255526727@qq.com");
|
||||
// etInviteCode.setText("1234");
|
||||
|
||||
// 获取验证码操作的监听器
|
||||
getSMScode.setOnClickListener(v -> {
|
||||
// todo 执行获取验证码的逻辑
|
||||
System.out.println("执行获取验证码的逻辑");
|
||||
});
|
||||
|
||||
btnRegister.setBackgroundResource(R.drawable.button_shape_default);
|
||||
btnRegister.setOnClickListener(v->{
|
||||
ContextExtensionKt.hideSoftKeyboard(this,btnRegister);
|
||||
@@ -128,6 +144,7 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
String password= Objects.requireNonNull(etPassword.getText()).toString().trim();
|
||||
String rePassword= Objects.requireNonNull(etPassword.getText()).toString().trim();
|
||||
String inviteCode= Objects.requireNonNull(etInviteCode.getText()).toString().trim();
|
||||
String verifyCode= Objects.requireNonNull(etSMSNumber.getText()).toString().trim();
|
||||
if(username.length()==0 || password.length()==0 || rePassword.length()==0 || inviteCode.length()==0){
|
||||
showWarning("请将信息填写完整");
|
||||
btnRegister.revertAnimation();
|
||||
@@ -158,6 +175,11 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isInviteCode(inviteCode)){
|
||||
showWarning("请输入有效的验证码,验证码长度需要大于0小于等于6");
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
|
||||
// 密码经md5哈希
|
||||
String md5Password = DigestUtilKt.encodeToMD5(password);
|
||||
@@ -188,6 +210,8 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
0f, -DisplayUtils.dp2px(this, 90)),
|
||||
ViewExtensionKt.transYAnimation(etEmail,
|
||||
0f, -DisplayUtils.dp2px(this, 90)),
|
||||
ViewExtensionKt.transYAnimation(SMSRegion,
|
||||
0f, -DisplayUtils.dp2px(this, 90)),
|
||||
ViewExtensionKt.transYAnimation(btnRegister,
|
||||
0f, -DisplayUtils.dp2px(this, 90))
|
||||
);
|
||||
@@ -209,6 +233,8 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
-DisplayUtils.dp2px(this, 90),0f),
|
||||
ViewExtensionKt.transYAnimation(etEmail,
|
||||
-DisplayUtils.dp2px(this, 90),0f),
|
||||
ViewExtensionKt.transYAnimation(SMSRegion,
|
||||
-DisplayUtils.dp2px(this, 90),0f),
|
||||
ViewExtensionKt.transYAnimation(btnRegister,
|
||||
-DisplayUtils.dp2px(this, 90),0f)
|
||||
);
|
||||
|
||||
@@ -130,6 +130,55 @@
|
||||
app:right_drawable="@drawable/delete"
|
||||
app:tinColor="@color/light_grey" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Register_SMSRegion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etInviteCode"
|
||||
>
|
||||
<com.jkb.vcedittext.VerificationCodeEditText
|
||||
android:id="@+id/Register_etSMSNumber"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:inputType="number"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:bottomLineHeight="2dp"
|
||||
app:bottomLineNormalColor="@color/grey"
|
||||
app:bottomLineSelectedColor="@color/grey"
|
||||
app:figures="6"
|
||||
app:selectedBackgroundColor="@color/transparent"
|
||||
app:verCodeMargin="10dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/Register_getSMScode"
|
||||
/>
|
||||
<com.white.countdownbutton.CountDownButton
|
||||
android:id="@+id/Register_getSMScode"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="42dp"
|
||||
android:text="获取验证码"
|
||||
android:textSize="17.5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@drawable/countdownbutton_text"
|
||||
android:background="@color/transparent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="40dp"
|
||||
app:countDownFormat="%dS后重试"
|
||||
app:countDown="60000"
|
||||
app:countDownInterval="1000"
|
||||
app:enableCountDown="true"
|
||||
app:cdFinishText="重新获取"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvSendVerifyCode"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
@@ -192,7 +241,7 @@
|
||||
app:spinning_bar_width="3dp"
|
||||
android:text="@string/register"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintLeft_toLeftOf="@id/etInviteCode"
|
||||
app:layout_constraintRight_toRightOf="@id/etInviteCode"
|
||||
app:layout_constraintTop_toBottomOf="@id/etInviteCode" />
|
||||
app:layout_constraintLeft_toLeftOf="@id/Register_SMSRegion"
|
||||
app:layout_constraintRight_toRightOf="@id/Register_SMSRegion"
|
||||
app:layout_constraintTop_toBottomOf="@id/Register_SMSRegion" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -91,6 +91,7 @@
|
||||
Some of the specified package names do not correspond to any installed packages.
|
||||
</string>
|
||||
<string name="invite_code">邀请码</string>
|
||||
<string name="verification_code">验证码</string>
|
||||
|
||||
|
||||
<string name="page_preview">人脸属性检测(视频)</string>
|
||||
|
||||
Reference in new issue
Block a user