app:layout_constraintStart_toStartOf=“parent”
app:layout_constraintEnd_toEndOf=“parent”/>
<TextView
android:id=“@+id/RegisterTitle”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginBottom=“60dp”
android:text=“Register”
android:textSize=“40dp”
app:layout_constraintBottom_toTopOf=“@+id/AccountText”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent” />
<TextView
android:id=“@+id/LoginButton”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“20dp”
android:text=“已有账号?点击登陆”
android:textSize=“15dp”
app:layout_constraintRight_toRightOf=“@id/PasswordText”
app:layout_constraintTop_toBottomOf=“@id/RegisterButton”/>
<EditText
android:id=“@+id/SMS_Code”
android:layout_width=“150dp”
android:layout_height=“50dp”
android:layout_marginTop=“30dp”
android:ems=“10”
android:hint=“验证码”
android:textSize=“16dp”
android:inputType=“textPersonName”
android:paddingLeft=“10dp”
app:layout_constraintLeft_toLeftOf=“@id/PasswordText”
app:layout_constraintTop_toBottomOf=“@id/PasswordText” />
<Button
android:id=“@+id/GetCode”
android:layout_width=“140dp”
android:layout_height=“50dp”
android:layout_marginTop=“30dp”
android:background=“#00000000”
android:text=“获取验证码”
android:textSize=“18dp”
app:layout_constraintTop_toBottomOf=“@id/PasswordText”
app:layout_constraintRight_toRightOf=“@id/PasswordText”/>
<TextView
android:id=“@+id/ShowButton”
android:layout_width=“50dp”
android:layout_height=“50dp”
android:layout_marginBottom=“5dp”
android:background=“@mipmap/eye”
app:layout_constraintBottom_toBottomOf=“@+id/PasswordText”
app:layout_constraintRight_toRightOf=“@+id/PasswordText”/>
</androidx.constraintlayout.widget.ConstraintLayout>
后台java代码
package com.example.bmobloginservice;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobSMS;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.QueryListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
public class Register extends AppCompatActivity {
TextView RegisterTitle; //注册标题
EditText AccountText; //账号
EditText PasswordText; //密码
EditText SMS_Code; //验证码
TextView LoginButton; //回到登录按钮
Button RegisterButton; //注册按钮
Button GetCode; //获取验证码按钮
TextView ShowButton; //小眼睛按钮
boolean ShowPassword; //密码可见状态(初始不可见)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
Bmob.initialize(Register.this,“你的Application ID(Bmob设置里可以看到)”);
init();
//获取验证码
GetCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//获取客户端输入的账号
final String Account = AccountText.getText().toString().trim();
//isEmpty()方法判断是否为空
if (TextUtils.isEmpty(Account)){
Toast.makeText(Register.this,“请填写手机号码”,Toast.LENGTH_SHORT).show();
}else if (Check.PhoneCheck(Account.trim()) != true){
Toast.makeText(Register.this,“请填写正确的手机号码”,Toast.LENGTH_SHORT).show();
}else {
BmobQuery<User_Table> bmobQuery = new BmobQuery<>();
bmobQuery.findObjects(new FindListener<User_Table>() {
@Override
public void done(List<User_Table> object, BmobException e) {
if (e == null) {
int count=0; //判断是否查询到尾
for (User_Table user_table : object) {
if (user_table.getAccount().equals(Account)){
Toast.makeText(Register.this,“该账号已注册过”,Toast.LENGTH_SHORT).show();
break;
}
count++;
}
//查询到尾,说明没有重复账号
if (count == object.size()){
SendSMS(Account);
}
}else {
SendSMS(Account);
}
}
});
}
}
});
/**
- 注册
*/
RegisterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//账号(Account)、密码(Password)
final String Account = AccountText.getText().toString().trim();
final String Password = PasswordText.getText().toString().trim();
if (TextUtils.isEmpty(Password)){
Toast.makeText(Register.this,“请填写密码”,Toast.LENGTH_SHORT).show();
}else if (Password.length()<6){
Toast.makeText(Register.this,“密码不得少于6位数”,Toast.LENGTH_SHORT).show();
}else if (Password.length()>16){
Toast.makeText(Register.this,“密码不得多于16位数”,Toast.LENGTH_SHORT).show();
}else if (Check.PasswordCheck(Password) != true){
Toast.makeText(Register.this,“密码最少包含3个字母”,Toast.LENGTH_SHORT).show();
}else if (TextUtils.isEmpty(SMS_Code.getText().toString().trim())){
Toast.makeText(Register.this,“请填写验证码”,Toast.LENGTH_SHORT).show();
} else {
//短信验证码效验
BmobSMS.verifySmsCode(Account, SMS_Code.getText().toString().trim(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
//将用户信息存储到Bmob云端数据
final User_Table user = new User_Table();
user.setAccount(Account);
user.setPassword(Password);
user.save(new SaveListener() {
@Override
public void done(String s, BmobException e) {
if (e == null) {
//注册成功,回到登录页面
Toast.makeText(Register.this,“注册成功”,Toast.LENGTH_SHORT).show();
finish();
}else {
Toast.makeText(Register.this,“注册失败”,Toast.LENGTH_SHORT).show();
}
}
});
}else {
SMS_Code.setText(“”);
Toast.makeText(Register.this,“验证码错误”+e.getErrorCode(),Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
//返回登陆界面
LoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
ShowButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ShowPassword == false) {
//密码不可见–>>密码可见
PasswordText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
PasswordText.setSelection(PasswordText.getText().toString().length());
ShowPassword = true;
}else {
//密码可见–>>密码不可见
PasswordText.setTransformationMethod(PasswordTransformationMethod.getInstance());
PasswordText.setSelection(PasswordText.getText().toString().length());
ShowPassword = false;
}
}
});
}
public void init(){
//注册标题(Title)、账号(Account)、密码(Password)、验证码(SMS_Code)
RegisterTitle = findViewById(R.id.RegisterTitle);
AccountText = findViewById(R.id.AccountText);
PasswordText = findViewById(R.id.PasswordText);
SMS_Code = findViewById(R.id.SMS_Code);
//回到登录按钮(Login)、注册按钮(Register)、验证码获取按钮(GetCode)
LoginButton = findViewById(R.id.LoginButton);
RegisterButton = findViewById(R.id.RegisterButton);
GetCode = findViewById(R.id.GetCode);
//将密码文本初始设置为不可见状态
ShowButton = findViewById(R.id.ShowButton);
ShowPassword = false;
//设置标题字体样式(方舒整体 常规)
RegisterTitle.setTypeface(Typeface.createFromAsset(getAssets(),“font/FZSTK.TTF”));
//设置按钮文本字体样式(方舒整体 常规)
RegisterButton.setTypeface(Typeface.createFromAsset(getAssets(),“font/FZSTK.TTF”));
//设置背景图片透明度(0~255,值越小越透明)
RegisterButton.getBackground().setAlpha(100);
}
/**
-
发送验证码
-
@param account:输入的手机号码
-
SMS 为Bmob短信服务自定义的短信模板名字
*/
private void SendSMS(String account){
BmobSMS.requestSMSCode(account, “自定义短信模板的名字”, new QueryListener() {
@Override
public void done(Integer smsId, BmobException e) {
if (e == null) {
Toast.makeText(Register.this,“验证码已发送”,Toast.LENGTH_LONG).show();
} else {
Toast.makeText(Register.this,“发送验证码失败:” + e.getErrorCode() + “-” + e.getMessage(),Toast.LENGTH_SHORT).show();
}
}
});
/**
-
设置按钮60s等待
-
onTick()方法——>>计时进行时的操作
-
:显示倒计时,同时设置按钮不可点击
-
onFinish()方法——>>计时完成时的操作
-
:刷新原文本,同时设置按钮可以点击
*/
CountDownTimer timer =new CountDownTimer(60000,1000) {
@Override
public void onTick(long millisUntilFinished) {
GetCode.setEnabled(false);
GetCode.setText(“重新获取(”+millisUntilFinished/1000+“s)”);
}
@Override
public void onFinish() {
GetCode.setEnabled(true);
GetCode.setText(“获取验证码”);
}
}.start();
}
}
二、登陆模块
布局文件
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:background=“@mipmap/background”>
<EditText
android:id=“@+id/AccountText”
android:layout_width=“300dp”
android:layout_height=“50dp”
android:layout_marginTop=“175dp”
android:ems=“10”
android:hint=“手机号码”
android:drawableLeft=“@mipmap/account”
android:drawablePadding=“10dp”
android:inputType=“textPersonName”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent”
app:layout_constraintTop_toTopOf=“parent” />
<EditText
android:id=“@+id/PasswordText”
android:layout_width=“300dp”
android:layout_height=“50dp”
android:layout_marginTop=“44dp”
android:ems=“10”
android:hint=“密码”
android:drawableLeft=“@mipmap/psd”
android:drawablePadding=“10dp”
android:inputType=“textPassword”
app:layout_constraintStart_toStartOf=“@+id/AccountText”
app:layout_constraintTop_toBottomOf=“@+id/AccountText” />
<Button
android:id=“@+id/LoginButton”
android:layout_width=“200dp”
android:layout_height=“60dp”
android:layout_marginTop=“16dp”
android:background=“@drawable/button_bg”
android:drawableLeft=“@mipmap/login_button”
android:paddingLeft=“50dp”
android:textSize=“26dp”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintHorizontal_bias=“0.497”
app:layout_constraintStart_toStartOf=“parent”
app:layout_constraintTop_toBottomOf=“@id/PasswordText” />
<TextView
android:id=“@+id/LoginTitle”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginBottom=“60dp”
android:text=“Login”
android:textSize=“40dp”
app:layout_constraintBottom_toTopOf=“@+id/AccountText”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent”/>
<TextView
android:id=“@+id/FindPasswordButton”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“20dp”
android:text=“忘记密码?”
android:textSize=“18dp”
app:layout_constraintLeft_toLeftOf=“@+id/PasswordText”
app:layout_constraintTop_toBottomOf=“@+id/LoginButton”/>
<TextView
android:id=“@+id/RegisterButton”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“20dp”
android:text=“注册”
android:textSize=“18dp”
app:layout_constraintRight_toRightOf=“@id/PasswordText”
app:layout_constraintTop_toBottomOf=“@id/LoginButton”/>
<TextView
android:id=“@+id/ShowButton”
android:layout_width=“50dp”
android:layout_height=“50dp”
android:layout_marginBottom=“5dp”
android:background=“@mipmap/eye”
app:layout_constraintRight_toRightOf=“@+id/PasswordText”
app:layout_constraintBottom_toBottomOf=“@+id/PasswordText”/>
</androidx.constraintlayout.widget.ConstraintLayout>
后台java代码
package com.example.bmobloginservice;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
public class Login extends AppCompatActivity {
//标题、账号、密码
TextView LoginTitle;
EditText AccountText;
EditText PasswordText;
//登陆按钮、注册按钮、密码找回按钮
Button LoginButton;
TextView RegisterButton;
TextView FindPasswordButton;
//眼睛按钮
TextView ShowButton;
//密码可见状态
boolean ShowPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
Bmob.initialize(Login.this,“你的Application ID(Bmob设置里可以看到)”);
init();
/**
- 登陆监听
*/
LoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//账号(Account)、密码(Password)
final String Account = AccountText.getText().toString().trim();
final String Password = PasswordText.getText().toString().trim();
if (TextUtils.isEmpty(Account)) {
Toast.makeText(Login.this, “请填写手机号码”, Toast.LENGTH_SHORT).show();
} else if (TextUtils.isEmpty(Password)) {
Toast.makeText(Login.this, “请填写密码”, Toast.LENGTH_SHORT).show();
} else {
BmobQuery<User_Table> bmobQuery = new BmobQuery<>();
bmobQuery.findObjects(new FindListener<User_Table>() {
@Override
public void done(List<User_Table> object, BmobException e) {
if (e == null) {
//判断信号量,若查找结束count和object长度相等,则没有查找到该账号
int count=0;
for (User_Table user_table : object) {
if (user_table.getAccount().equals(Account)) {
//已查找到该账号,检测密码是否正确
if (user_table.getPassword().equals(Password)) {
//密码正确,跳转(Home是登陆后跳转的页面)
Toast.makeText(Login.this, “登陆成功”, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Login.this,Home.class);
startActivity(intent);
break;
}else {
Toast.makeText(Login.this, “密码错误”, Toast.LENGTH_SHORT).show();
break;
}
}
count++;
}
if (count >= object.size()){
Toast.makeText(Login.this,“该账号不存在”,Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(Login.this,“该账号不存在”,Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
//跳转到密码找回界面
FindPasswordButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(Login.this, FindPassword.class);
startActivity(intent);
}
});
//跳转到注册界面
RegisterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(Login.this, Register.class);
startActivity(intent);
}
});
//密码可见和不可见
ShowButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ShowPassword == false) {
PasswordText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
PasswordText.setSelection(PasswordText.getText().toString().length());
ShowPassword = true;
}else {
PasswordText.setTransformationMethod(PasswordTransformationMethod.getInstance());
PasswordText.setSelection(PasswordText.getText().toString().length());
ShowPassword = false;
}
}
});
}
//View初始化
public void init(){
//Login标题(LoginTitle)、账号(AccountText)、密码(PasswordText)
LoginTitle = findViewById(R.id.LoginTitle);
AccountText = findViewById(R.id.AccountText);
PasswordText = findViewById(R.id.PasswordText);
//登录按钮(Login)、跳到注册按钮(Register)、跳到密码找回按钮(FindPassword)
LoginButton = findViewById(R.id.LoginButton);
RegisterButton = findViewById(R.id.RegisterButton);
FindPasswordButton = findViewById(R.id.FindPasswordButton);
ShowButton = findViewById(R.id.ShowButton);
//密码初始状态为不可见(false不可见,true可见)
ShowPassword = false;
//设置Login标题字体样式(华文彩云)
LoginTitle.setTypeface(Typeface.createFromAsset(getAssets(),“font/FZSTK.TTF”));
//设置背景图片透明度(0~255,值越小越透明)
LoginButton.getBackground().setAlpha(100);
}
}
三、找回密码
布局文件
XML代码
<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:background=“@mipmap/background”>
<EditText
android:id=“@+id/AccountText”
android:layout_width=“280dp”
android:layout_height=“50dp”
android:layout_marginTop=“175dp”
android:ems=“10”
android:inputType=“textPersonName”
android:hint=“手机号码”
android:textSize=“16dp”
android:drawableLeft=“@mipmap/account”
android:drawablePadding=“10dp”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent”
app:layout_constraintTop_toTopOf=“parent”/>
<EditText
android:id=“@+id/SMS_Code”
android:layout_width=“120dp”
android:layout_height=“50dp”
android:layout_marginTop=“40dp”
android:ems=“10”
android:inputType=“textPersonName”
android:hint=“验证码”
android:textSize=“16dp”
android:paddingLeft=“10dp”
app:layout_constraintTop_toBottomOf=“@id/AccountText”
app:layout_constraintLeft_toLeftOf=“@id/AccountText”/>
<Button
android:id=“@+id/GetCode”
android:layout_width=“140dp”
android:layout_height=“50dp”
android:layout_marginTop=“40dp”
android:background=“#00000000”
android:text=“获取验证码”
android:textSize=“18dp”
app:layout_constraintTop_toBottomOf=“@id/AccountText”
app:layout_constraintRight_toRightOf=“@id/AccountText”/>
<EditText
android:id=“@+id/PasswordText”
android:layout_width=“280dp”
android:layout_height=“50dp”
android:layout_marginTop=“40dp”
android:ems=“10”
android:hint=“密码由6~16位组成(最少3位字母)”
android:textSize=“16dp”
android:drawableLeft=“@mipmap/psd”
android:drawablePadding=“10dp”
android:inputType=“textPassword”
app:layout_constraintTop_toBottomOf=“@id/SMS_Code”
app:layout_constraintLeft_toLeftOf=“@id/SMS_Code”/>
<TextView
android:id=“@+id/FindPasswordTitle”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginBottom=“60dp”
android:text=“密码找回”
android:textSize=“30dp”
app:layout_constraintStart_toStartOf=“parent”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintBottom_toTopOf=“@id/AccountText”/>
<TextView
android:id=“@+id/LoginButton”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“20dp”
android:text=“返回登陆”
android:textSize=“18dp”
app:layout_constraintTop_toBottomOf=“@id/ModifyButton”
app:layout_constraintRight_toRightOf=“@id/PasswordText”/>
<Button
android:id=“@+id/ModifyButton”
android:layout_width=“200dp”
android:layout_height=“50dp”
android:layout_marginTop=“20dp”
android:background=“@drawable/button_bg”
android:text=“确认修改”
android:textSize=“20dp”
app:layout_constraintTop_toBottomOf=“@+id/PasswordText”
app:layout_constraintRight_toRightOf=“@+id/PasswordText”
app:layout_constraintLeft_toLeftOf=“@+id/PasswordText”/>
<TextView
android:id=“@+id/ShowButton”
android:layout_width=“50dp”
android:layout_height=“50dp”
android:layout_marginBottom=“3dp”
android:background=“@mipmap/eye”
app:layout_constraintRight_toRightOf=“@+id/PasswordText”
app:layout_constraintBottom_toBottomOf=“@+id/PasswordText”/>
</androidx.constraintlayout.widget.ConstraintLayout>
后台java代码
package com.example.bmobloginservice;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobSMS;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.QueryListener;
import cn.bmob.v3.listener.UpdateListener;
public class FindPassword extends AppCompatActivity {
EditText AccountText;
EditText PasswordText;
EditText SMS_Code;
Button ModifyButton;
Button GetCode;
TextView FindPasswordTitle;
TextView LoginButton;
TextView ShowButton;
boolean ShowPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.find_password);
Bmob.initialize(FindPassword.this,“你的Application ID(Bmob设置里可以看到)”);
init();
/**
- 获取验证码
*/
GetCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//获取账号(Account)
final String Account = AccountText.getText().toString().trim();
if (TextUtils.isEmpty(Account)){
Toast.makeText(FindPassword.this,“请填写账号”,Toast.LENGTH_SHORT).show();
}else if (Check.PhoneCheck(Account) != true){
Toast.makeText(FindPassword.this,“请填写正确的手机号码”,Toast.LENGTH_SHORT).show();
}else {
BmobQuery<User_Table> bmobQuery = new BmobQuery<>();
bmobQuery.findObjects(new FindListener<User_Table>() {
@Override
public void done(List<User_Table> object, BmobException e) {
if (e == null) {
int count=0;
for (User_Table user_table : object) {
//检查是否存在该账号
if (user_table.getAccount().equals(Account)){
SendSMS(Account);
break;
}
count++;
}
if (count >= object.size()){
Toast.makeText(FindPassword.this,“该账户不存在”,Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(FindPassword.this,“该账户不存在”,Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
/**
- 修改密码
*/
ModifyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//获取输入的账号(Account)、密码(Password)、验证码(Code)
final String Account = AccountText.getText().toString().trim();
final String Password = PasswordText.getText().toString().trim();
String Code = SMS_Code.getText().toString().trim();
if (TextUtils.isEmpty(Account)){
Toast.makeText(FindPassword.this,“请填写账号”,Toast.LENGTH_SHORT).show();
}else if (TextUtils.isEmpty(Code)){
Toast.makeText(FindPassword.this,“请填写验证码”,Toast.LENGTH_SHORT).show();
}else if (TextUtils.isEmpty(Password)){
Toast.makeText(FindPassword.this,“请填写密码”,Toast.LENGTH_SHORT).show();
}else if (Password.length()<6){
Toast.makeText(FindPassword.this,“密码不得少于6位数”,Toast.LENGTH_SHORT).show();
}else if (Password.length()>16){
Toast.makeText(FindPassword.this,“密码不得多于16位数”,Toast.LENGTH_SHORT).show();
}else if (Check.PasswordCheck(Password) != true){
Toast.makeText(FindPassword.this,“密码最少包含3个字母”,Toast.LENGTH_SHORT).show();
}else {
//发送验证码
BmobSMS.verifySmsCode(Account, Code, new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
BmobQuery<User_Table> bmobQuery = new BmobQuery<>();
bmobQuery.findObjects(new FindListener<User_Table>() {
@Override
public void done(List<User_Table> object, BmobException e) {
if (e == null) {
for (User_Table user_table : object) {
if (user_table.getAccount().equals(Account)){
//Bmob云端数据更新
User_Table user = new User_Table();
user.setPassword(Password);
user.update(user_table.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Toast.makeText(FindPassword.this,“密码修改成功”,Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(FindPassword.this,“修改失败”+“\n”+“错误代码:”+e.getErrorCode(),Toast.LENGTH_LONG).show();
}
}
});
break;
}
}
}else {
Toast.makeText(FindPassword.this,“该账号不存在”,Toast.LENGTH_LONG).show();
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此我收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点!不论你是刚入门Android开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
(Account, Code, new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
BmobQuery<User_Table> bmobQuery = new BmobQuery<>();
bmobQuery.findObjects(new FindListener<User_Table>() {
@Override
public void done(List<User_Table> object, BmobException e) {
if (e == null) {
for (User_Table user_table : object) {
if (user_table.getAccount().equals(Account)){
//Bmob云端数据更新
User_Table user = new User_Table();
user.setPassword(Password);
user.update(user_table.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Toast.makeText(FindPassword.this,“密码修改成功”,Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(FindPassword.this,“修改失败”+“\n”+“错误代码:”+e.getErrorCode(),Toast.LENGTH_LONG).show();
}
}
});
break;
}
}
}else {
Toast.makeText(FindPassword.this,“该账号不存在”,Toast.LENGTH_LONG).show();
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此我收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-8vrK7Og4-1715401213078)]
[外链图片转存中…(img-G2OPBgZN-1715401213080)]
[外链图片转存中…(img-wEoKUvzr-1715401213081)]
[外链图片转存中…(img-aopz1HFt-1715401213083)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点!不论你是刚入门Android开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!