Validate Phone; Password, Forgot Password Function

This commit is contained in:
phanhuuloi27
2022-06-10 22:49:04 +07:00
parent 624d2b0729
commit eb7a5068c9
11 changed files with 598 additions and 73 deletions
+6
View File
@@ -17,6 +17,12 @@
android:theme="@style/Theme.Foodify"
tools:replace="android:theme"
tools:targetApi="31">
<activity
android:name=".ChangePassword"
android:exported="false" />
<activity
android:name=".ForgotPassword"
android:exported="false" />
<activity
android:name=".VerifyPhone"
android:exported="false" />
@@ -0,0 +1,70 @@
package com.waterbase.foodify;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.waterbase.foodify.Model.User;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ChangePassword extends AppCompatActivity {
User user;
EditText edtPassword, edtPasswordVerify;
String phone;
Button btnChangePass;
final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$%^&+=!])(?=\\S+$).{4,}$";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change_password);
edtPassword = findViewById(R.id.edtPassword);
edtPasswordVerify = findViewById(R.id.edtPasswordVerify);
btnChangePass = findViewById(R.id.btnChangePass);
user = (User) getIntent().getSerializableExtra("user");
phone = getIntent().getStringExtra("phone");
//Init Firebase
FirebaseDatabase database = FirebaseDatabase.getInstance();
final DatabaseReference table_user = database.getReference("User");
btnChangePass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Verify password
Pattern patternPassword = Pattern.compile(PASSWORD_PATTERN);
Matcher matcherPassword = patternPassword.matcher(edtPasswordVerify.getText().toString());
if (matcherPassword.matches() && edtPasswordVerify.getText().toString().length() >= 8) {
//Check same password
if (edtPassword.getText().toString().equals(edtPasswordVerify.getText().toString())) {
table_user.child(phone).child("password").setValue(edtPasswordVerify.getText().toString());
Toast.makeText(ChangePassword.this, "Đổi mật khẩu thành công. Vui lòng đăng nhập lại để tiếp tục!", Toast.LENGTH_SHORT).show();
startActivity(new Intent(ChangePassword.this, SignIn.class));
finish();
} else {
edtPasswordVerify.setError("Mật khẩu không giống nhau. Vui lòng kiểm tra lại!");
}
} else {
Toast.makeText(ChangePassword.this, "Mật khẩu của bạn cần tối thiểu có 8 ký tự, 1 ký tự viết hoa, 1 số và 1 ký tự đặc biệt!", Toast.LENGTH_LONG).show();
}
}
});
}
}
@@ -0,0 +1,131 @@
package com.waterbase.foodify;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthProvider;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.waterbase.foodify.Common.Common;
import com.waterbase.foodify.Model.User;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ForgotPassword extends AppCompatActivity {
EditText edtPhone;
ProgressBar progressBar;
Button btnSendOTP;
final String PHONE_PATTERN = "^0[98753]{1}\\d{8}$";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot_password);
btnSendOTP = findViewById(R.id.btnSendOTP);
progressBar = findViewById(R.id.progressBar);
edtPhone = findViewById(R.id.edtPhone);
//Init Firebase
FirebaseDatabase database = FirebaseDatabase.getInstance();
final DatabaseReference table_user = database.getReference("User");
btnSendOTP.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Validate Phone Number
Pattern patternPhone = Pattern.compile(PHONE_PATTERN);
Matcher matcherPhone = patternPhone.matcher(edtPhone.getText().toString());
if (matcherPhone.find()) {
if (!TextUtils.isEmpty(edtPhone.getText().toString())) {
//Check Internet
if (Common.isConnectedToInternet(getBaseContext())) {
progressBar.setVisibility(View.VISIBLE);
btnSendOTP.setVisibility(View.GONE);
//Get data from database
table_user.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//Check phone in database
if (dataSnapshot.child(edtPhone.getText().toString()).exists()) {
progressBar.setVisibility(View.GONE);
btnSendOTP.setVisibility(View.VISIBLE);
PhoneAuthProvider.getInstance().verifyPhoneNumber(
"+84" + edtPhone.getText().toString(),
60,
TimeUnit.SECONDS,
ForgotPassword.this,
new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
progressBar.setVisibility(View.GONE);
btnSendOTP.setVisibility(View.VISIBLE);
}
@Override
public void onVerificationFailed(FirebaseException e) {
progressBar.setVisibility(View.GONE);
btnSendOTP.setVisibility(View.VISIBLE);
Toast.makeText(ForgotPassword.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
@Override
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
progressBar.setVisibility(View.GONE);
btnSendOTP.setVisibility(View.VISIBLE);
Toast.makeText(ForgotPassword.this, "Mã OTP đã được gửi!", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(ForgotPassword.this, VerifyPhone.class);
intent.putExtra("phone", edtPhone.getText().toString());
intent.putExtra("verificationId", verificationId);
intent.putExtra("isForgotPassword", "true");
startActivity(intent);
finish();
}
}
);
} else {
progressBar.setVisibility(View.GONE);
btnSendOTP.setVisibility(View.VISIBLE);
Toast.makeText(ForgotPassword.this, "Số điện thoại này chưa được đăng ký. Vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
} else {
Toast.makeText(ForgotPassword.this, "Vui lòng kiểm tra kết nối mạng!", Toast.LENGTH_SHORT).show();
return;
}
} else {
Toast.makeText(ForgotPassword.this, "Vui lòng điền đầy đủ thông tin!", Toast.LENGTH_SHORT).show();
return;
}
} else {
edtPhone.setError("Số điện thoại không đúng định dạng. Vui lòng kiểm tra lại");
}
}
});
}
}
@@ -27,7 +27,7 @@ public class SignIn extends AppCompatActivity {
EditText edtPhone, edtPassword;
Button btnSignIn;
TextView txtAppName;
TextView txtAppName, edtForgotPassword;
CheckBox ckbRemember;
@Override
@@ -39,6 +39,7 @@ public class SignIn extends AppCompatActivity {
edtPhone = (EditText) findViewById(R.id.edtPhone);
btnSignIn = (Button) findViewById(R.id.btnSignIn);
ckbRemember = (CheckBox)findViewById(R.id.ckbRemember);
edtForgotPassword = findViewById(R.id.forgotPassword);
//Init Paper
Paper.init(this);
@@ -109,6 +110,15 @@ public class SignIn extends AppCompatActivity {
}
}
});
//Set on click Forgot Password
edtForgotPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(SignIn.this, ForgotPassword.class);
startActivity(intent);
}
});
}
public void register(View view) {
@@ -30,13 +30,17 @@ import com.waterbase.foodify.Common.Common;
import com.waterbase.foodify.Model.User;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SignUp extends AppCompatActivity {
EditText edtPhone, edtName, edtPassword;
EditText edtPhone, edtName, edtPassword, edtPasswordVerify;
Button btnSignUp;
TextView txtAppName;
final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$%^&+=!])(?=\\S+$).{4,}$";
final String PHONE_PATTERN = "^0[98753]{1}\\d{8}$";
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -45,6 +49,7 @@ public class SignUp extends AppCompatActivity {
edtName = (EditText) findViewById(R.id.txtFullName);
edtPassword = (EditText) findViewById(R.id.edtPassword);
edtPasswordVerify = (EditText) findViewById(R.id.edtPasswordVerify);
edtPhone = (EditText) findViewById(R.id.edtPhone);
btnSignUp = (Button) findViewById(R.id.btnSignUp);
@@ -62,70 +67,94 @@ public class SignUp extends AppCompatActivity {
btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!TextUtils.isEmpty(edtName.getText().toString()) && !TextUtils.isEmpty(edtPassword.getText().toString())
&& !TextUtils.isEmpty(edtPhone.getText().toString())) {
if (Common.isConnectedToInternet(getBaseContext())) {
progressBar.setVisibility(View.VISIBLE);
btnSignUp.setVisibility(View.GONE);
table_user.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//Check if already user phone
if (dataSnapshot.child(edtPhone.getText().toString()).exists()) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
Toast.makeText(SignUp.this, "Số điện thoại đã được đăng ký!", Toast.LENGTH_SHORT).show();
finish();
} else {
//Success
if (!TextUtils.isEmpty(edtName.getText().toString()) && !TextUtils.isEmpty(edtPassword.getText().toString())
&& !TextUtils.isEmpty(edtPhone.getText().toString())) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
"+84" + edtPhone.getText().toString(),
60,
TimeUnit.SECONDS,
SignUp.this,
new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
}
//Verify password
Pattern patternPassword = Pattern.compile(PASSWORD_PATTERN);
Matcher matcherPassword = patternPassword.matcher(edtPasswordVerify.getText().toString());
@Override
public void onVerificationFailed(FirebaseException e) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
Toast.makeText(SignUp.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
if (matcherPassword.matches() && edtPasswordVerify.getText().toString().length() >= 8) {
@Override
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
User user = new User(edtName.getText().toString(), edtPassword.getText().toString());
Intent intent = new Intent(SignUp.this, VerifyPhone.class);
intent.putExtra("user", user);
intent.putExtra("phone", edtPhone.getText().toString());
intent.putExtra("verificationId", verificationId);
startActivity(intent);
}
//Check same password
if (edtPassword.getText().toString().equals(edtPasswordVerify.getText().toString())) {
//Validate Phone Number
Pattern patternPhone = Pattern.compile(PHONE_PATTERN);
Matcher matcherPhone = patternPhone.matcher(edtPhone.getText().toString());
if (matcherPhone.find()) {
//Check Internet connection
if (Common.isConnectedToInternet(getBaseContext())) {
progressBar.setVisibility(View.VISIBLE);
btnSignUp.setVisibility(View.GONE);
table_user.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//Check if already user phone
if (dataSnapshot.child(edtPhone.getText().toString()).exists()) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
Toast.makeText(SignUp.this, "Số điện thoại đã được đăng ký!", Toast.LENGTH_SHORT).show();
finish();
} else {
//Success
PhoneAuthProvider.getInstance().verifyPhoneNumber(
"+84" + edtPhone.getText().toString(),
60,
TimeUnit.SECONDS,
SignUp.this,
new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
}
@Override
public void onVerificationFailed(FirebaseException e) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
Toast.makeText(SignUp.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
@Override
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
progressBar.setVisibility(View.GONE);
btnSignUp.setVisibility(View.VISIBLE);
User user = new User(edtName.getText().toString(), edtPassword.getText().toString());
Intent intent = new Intent(SignUp.this, VerifyPhone.class);
intent.putExtra("user", user);
intent.putExtra("phone", edtPhone.getText().toString());
intent.putExtra("verificationId", verificationId);
startActivity(intent);
finish();
}
}
);
}
);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
} else {
Toast.makeText(SignUp.this, "Vui lòng kiểm tra kết nối mạng!", Toast.LENGTH_SHORT).show();
return;
}
} else {
edtPhone.setError("Số điện thoại không đúng định dạng. Vui lòng kiểm tra lại!");
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
} else {
edtPasswordVerify.setError("Mật khẩu không giống nhau! Vui lòng kiểm tra lại");
}
} else {
Toast.makeText(SignUp.this, "Vui lòng kiểm tra kết nối mạng!", Toast.LENGTH_SHORT).show();
return;
Toast.makeText(SignUp.this, "Mật khẩu của bạn cần tối thiểu có 8 ký tự, 1 ký tự viết hoa, 1 số và 1 ký tự đặc biệt!", Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(SignUp.this, "Vui lòng điền đầy đủ thông tin!", Toast.LENGTH_SHORT).show();
return;
@@ -15,6 +15,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.firebase.ui.database.ChangeEventListener;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseException;
@@ -35,7 +36,7 @@ public class VerifyPhone extends AppCompatActivity {
private EditText inputCode1, inputCode2, inputCode3, inputCode4, inputCode5, inputCode6;
User user = null;
String verificationId, phone;
String verificationId, phone, isForgotPassword = null;
TextView resendCode, countdown;
@Override
@@ -45,9 +46,10 @@ public class VerifyPhone extends AppCompatActivity {
user = (User) getIntent().getSerializableExtra("user");
phone = getIntent().getStringExtra("phone");
isForgotPassword = getIntent().getStringExtra("isForgotPassword");
TextView textView = findViewById(R.id.txtPhone);
textView.setText("Mã xác thực đã gửi đến số " + String.format("+84-%s", phone) + ". Vui lòng nhập mã OTP khi nhận được tin nhắn!");
textView.setText("Mã xác thực đã gửi đến số " + phone + ". Vui lòng nhập mã OTP khi nhận được tin nhắn!");
inputCode1 = findViewById(R.id.inputCode1);
inputCode2 = findViewById(R.id.inputCode2);
@@ -157,12 +159,25 @@ public class VerifyPhone extends AppCompatActivity {
table_user.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
table_user.child(getIntent().getStringExtra("phone")).setValue(user);
Intent intent = new Intent(getApplicationContext(), SignIn.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
if(isForgotPassword == null){
Toast.makeText(VerifyPhone.this, "Tạo tài khoản thành công! Vui lòng đăng nhập lại để tiếp tục", Toast.LENGTH_SHORT).show();
startActivity(intent);
//Create new User
table_user.child(getIntent().getStringExtra("phone")).setValue(user);
Intent intent = new Intent(getApplicationContext(), SignIn.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Toast.makeText(VerifyPhone.this, "Tạo tài khoản thành công! Vui lòng đăng nhập lại để tiếp tục", Toast.LENGTH_SHORT).show();
startActivity(intent);
finish();
} else {
//Change pass user
Intent intent = new Intent(VerifyPhone.this, ChangePassword.class);
intent.putExtra("user", user);
intent.putExtra("phone", phone);
startActivity(intent);
finish();
}
}
@Override
@@ -170,13 +185,6 @@ public class VerifyPhone extends AppCompatActivity {
}
});
// //-------------------------------------------------------
// User user = new User(edtName.getText().toString(), edtPassword.getText().toString());
// table_user.child(edtPhone.getText().toString()).setValue(user);
// Toast.makeText(SignUp.this, "Đăng ký thành công!", Toast.LENGTH_SHORT).show();
// finish();
// //--------------------------------------------------------
} else {
Toast.makeText(VerifyPhone.this, "Mã code không đúng. Vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
}
@@ -0,0 +1,128 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.waterbase.foodify.SignIn">
<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/foreground_design"
android:scaleType="centerCrop"
android:src="@drawable/bg4"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<TextView
android:id="@+id/txtAppName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="33sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/imageView3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias=".2" />
<TextView
android:id="@+id/txtSignUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="Đổi mật khẩu"
android:textAlignment="center"
android:textColor="#FBFBFB"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:text="Vui lòng nhập mật khẩu mới cho tài khoản của bạn!"
android:textAlignment="center"
android:textColor="#FBFBFB"
android:textSize="12sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
<EditText
android:id="@+id/edtPassword"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:backgroundTint="#CCCCCC"
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
android:drawablePadding="13dp"
android:hint="Mật khẩu"
android:inputType="textPassword"
android:textColor="@color/white"
android:textColorHint="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtSignUp"
app:layout_constraintWidth_percent=".8" />
<EditText
android:id="@+id/edtPasswordVerify"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:backgroundTint="#CCCCCC"
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
android:drawablePadding="13dp"
android:hint="Xác nhận mật khẩu"
android:inputType="textPassword"
android:textColor="@color/white"
android:textColorHint="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/edtPassword"
app:layout_constraintWidth_percent=".8" />
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/edtPasswordVerify">
<Button
android:id="@+id/btnChangePass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_design"
android:padding="10dp"
android:text="Đổi mật khẩu"
android:textAllCaps="false"
android:textStyle="bold"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
/>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/progress_bg"
android:visibility="gone" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,111 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.waterbase.foodify.SignIn">
<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/foreground_design"
android:scaleType="centerCrop"
android:src="@drawable/bg4"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<TextView
android:id="@+id/txtAppName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="33sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/imageView3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias=".2" />
<TextView
android:id="@+id/txtSignUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="Quên mật khẩu"
android:textAlignment="center"
android:textColor="#FBFBFB"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:text="Vui lòng nhập số điện thoại bạn đã đăng ký"
android:textAlignment="center"
android:textColor="#FBFBFB"
android:textSize="12sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
<EditText
android:id="@+id/edtPhone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:backgroundTint="#CCCCCC"
android:drawableLeft="@drawable/ic_baseline_local_phone_24"
android:drawablePadding="13dp"
android:hint="Số điện thoại"
android:inputType="phone"
android:textColor="@color/white"
android:textColorHint="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtSignUp"
app:layout_constraintWidth_percent=".8" />
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/edtPhone">
<Button
android:id="@+id/btnSendOTP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_design"
android:padding="10dp"
android:text="Gửi mã OTP"
android:textAllCaps="false"
android:textStyle="bold"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
/>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/progress_bg"
android:visibility="gone" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -14,7 +14,7 @@
android:scaleType="centerCrop"
android:src="@drawable/bg4"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="-32dp" />
tools:layout_editor_absoluteY="0dp" />
<TextView
android:id="@+id/txtAppName"
@@ -85,7 +85,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="Remember me"
android:text="Ghi nhớ đăng nhập"
android:textColor="@color/white"
app:cbd_strokeColor="@color/white"
app:cbd_tickColor="@color/purple_500"
@@ -94,6 +94,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/edtPassword" />
<TextView
android:id="@+id/forgotPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:textStyle="italic"
android:text="Quên mật khẩu?"
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.85"
app:layout_constraintStart_toStartOf="parent "
app:layout_constraintTop_toBottomOf="@+id/edtPassword"/>
<Button
android:id="@+id/btnSignIn"
android:layout_width="0dp"
@@ -69,6 +69,7 @@
android:drawablePadding="13dp"
android:layout_margin="10dp"
android:hint="Số điện thoại"
android:maxLength="10"
android:inputType="phone"
android:textColor="@color/white"
android:textColorHint="@color/white"
@@ -94,6 +95,23 @@
app:layout_constraintTop_toBottomOf="@+id/edtPhone"
app:layout_constraintWidth_percent=".8" />
<EditText
android:id="@+id/edtPasswordVerify"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:backgroundTint="#CCCCCC"
android:drawableLeft="@drawable/ic_baseline_vpn_key_24"
android:drawablePadding="13dp"
android:hint="Xác nhận mật khẩu"
android:layout_margin="10dp"
android:inputType="textPassword"
android:textColor="@color/white"
android:textColorHint="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/edtPassword"
app:layout_constraintWidth_percent=".8" />
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
@@ -218,6 +218,7 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/progress_bg"
android:visibility="gone" />