mirror of
https://github.com/Nezumi-2711/PRM392.git
synced 2026-09-22 13:48:29 +00:00
Development Progress - 1
This commit is contained in:
@@ -17,10 +17,14 @@
|
||||
android:theme="@style/Theme.Foodify"
|
||||
tools:replace="android:theme"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".VerifyPhone"
|
||||
android:exported="false" />
|
||||
|
||||
<service
|
||||
android:name=".Service.ListenOrder"
|
||||
android:enabled="true"
|
||||
android:exported="true"></service>
|
||||
android:exported="true" />
|
||||
|
||||
<activity
|
||||
android:name=".OrderStatus"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.waterbase.foodify.Model;
|
||||
|
||||
public class User {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class User implements Serializable {
|
||||
|
||||
private String Name;
|
||||
private String Password;
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.waterbase.foodify.Model.User;
|
||||
|
||||
public class SignUp extends AppCompatActivity {
|
||||
|
||||
EditText edtPhone, edtName, edtPassword, edtEmail;
|
||||
EditText edtPhone, edtName, edtPassword;
|
||||
Button btnSignUp;
|
||||
TextView txtAppName;
|
||||
|
||||
@@ -40,7 +40,6 @@ public class SignUp extends AppCompatActivity {
|
||||
edtName = (EditText) findViewById(R.id.txtFullName);
|
||||
edtPassword = (EditText) findViewById(R.id.edtPassword);
|
||||
edtPhone = (EditText) findViewById(R.id.edtPhone);
|
||||
edtEmail = (EditText) findViewById(R.id.edtEmail);
|
||||
btnSignUp = (Button) findViewById(R.id.btnSignUp);
|
||||
|
||||
txtAppName = (TextView) findViewById(R.id.txtAppName);
|
||||
@@ -56,7 +55,7 @@ public class SignUp extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(!TextUtils.isEmpty(edtName.getText().toString()) && !TextUtils.isEmpty(edtPassword.getText().toString())
|
||||
&& !TextUtils.isEmpty(edtPhone.getText().toString()) && !TextUtils.isEmpty(edtEmail.getText().toString())) {
|
||||
&& !TextUtils.isEmpty(edtPhone.getText().toString())) {
|
||||
if (Common.isConnectedToInternet(getBaseContext())) {
|
||||
final ProgressDialog mDialog = new ProgressDialog(SignUp.this);
|
||||
mDialog.setMessage("Vui lòng chờ...");
|
||||
@@ -71,24 +70,16 @@ public class SignUp extends AppCompatActivity {
|
||||
Toast.makeText(SignUp.this, "Số điện thoại đã được đăng ký!", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
//Firebase Auth
|
||||
final FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
|
||||
firebaseAuth.createUserWithEmailAndPassword(edtEmail.getText().toString(), edtPassword.getText().toString()).addOnCompleteListener((task) -> {
|
||||
if(task.isSuccessful()) {
|
||||
firebaseAuth.getCurrentUser().sendEmailVerification().addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
if(task.isSuccessful()) {
|
||||
mDialog.dismiss();
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
mDialog.dismiss();
|
||||
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());
|
||||
startActivity(intent);
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class VerifyPhone extends AppCompatActivity {
|
||||
|
||||
private EditText inputCode1, inputCode2, inputCode3, inputCode4, inputCode5, inputCode6;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_verify_phone);
|
||||
|
||||
inputCode1 = findViewById(R.id.inputCode1);
|
||||
inputCode2 = findViewById(R.id.inputCode2);
|
||||
inputCode3 = findViewById(R.id.inputCode3);
|
||||
inputCode4 = findViewById(R.id.inputCode4);
|
||||
inputCode5 = findViewById(R.id.inputCode5);
|
||||
inputCode6 = findViewById(R.id.inputCode6);
|
||||
}
|
||||
|
||||
private void setupOTPInputs() {
|
||||
inputCode1.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if(!s.toString().trim().isEmpty()){
|
||||
inputCode2.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -44,28 +44,11 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtAppName" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edtEmail"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_email_24"
|
||||
android:drawablePadding="13dp"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress"
|
||||
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/txtFullName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:drawableLeft="@drawable/ic_baseline_account_circle_24"
|
||||
android:drawablePadding="13dp"
|
||||
@@ -74,7 +57,7 @@
|
||||
android:textColorHint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edtEmail"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtSignUp"
|
||||
app:layout_constraintWidth_percent=".8" />
|
||||
|
||||
<EditText
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:background="@drawable/bg4"
|
||||
tools:context=".VerifyPhone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@drawable/sms"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="70dp"
|
||||
android:text="Mã xác thực OTP"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20dp"
|
||||
android:textAllCaps="true"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textAlignment="center"
|
||||
android:text="Chúng tôi đã gửi mã xác thực cho bạn. Vui lòng nhập mã OTP khi nhận được tin nhắn!"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/common_google_signin_btn_text_dark"
|
||||
android:textSize="12dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textAlignment="center"
|
||||
android:text="Nhập mã xác thực"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/common_google_signin_btn_text_dark"
|
||||
android:textSize="12dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputCode1"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="LabelFor"/>
|
||||
<EditText
|
||||
android:id="@+id/inputCode2"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="LabelFor"/>
|
||||
<EditText
|
||||
android:id="@+id/inputCode3"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="LabelFor"/>
|
||||
<EditText
|
||||
android:id="@+id/inputCode4"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="LabelFor"/>
|
||||
<EditText
|
||||
android:id="@+id/inputCode5"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="LabelFor"/>
|
||||
<EditText
|
||||
android:id="@+id/inputCode6"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionNext"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="#CCCCCC"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="LabelFor"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Không nhận được mã OTP?"
|
||||
android:textSize="12dp"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Gửi lại"
|
||||
android:textSize="12dp"
|
||||
android:textColor="@color/purple_500"
|
||||
android:textStyle="bold"
|
||||
android:textAllCaps="true"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVerify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_bg_design"
|
||||
android:padding="10dp"
|
||||
android:text="Xác thực"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
Reference in New Issue
Block a user