Added the Alexandre's updated code.
This commit is contained in:
parent
304fb5a204
commit
f288b6e81a
307 changed files with 8423 additions and 5873 deletions
|
@ -22,4 +22,8 @@ public class About extends AppCompatActivity {
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), Settings.class));
|
||||
}
|
||||
}
|
||||
|
|
29
UI/app/src/main/java/com/example/capstone/Apps.java
Normal file
29
UI/app/src/main/java/com/example/capstone/Apps.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package com.example.capstone;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
|
||||
public class Apps extends AppCompatActivity {
|
||||
FirebaseAuth fAuth;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_apps);
|
||||
fAuth = FirebaseAuth.getInstance();
|
||||
}
|
||||
|
||||
public void logout(View view){
|
||||
fAuth.signOut();
|
||||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), homepage.class));
|
||||
}
|
||||
}
|
|
@ -129,4 +129,8 @@ public class Drivers extends AppCompatActivity{
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), Settings.class));
|
||||
}
|
||||
}
|
||||
|
|
59
UI/app/src/main/java/com/example/capstone/Email.java
Normal file
59
UI/app/src/main/java/com/example/capstone/Email.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package com.example.capstone;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
|
||||
public class Email extends AppCompatActivity {
|
||||
FirebaseAuth fauth;
|
||||
FirebaseFirestore fstore;
|
||||
Button resend, con;
|
||||
FirebaseUser user;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_email);
|
||||
|
||||
fauth = FirebaseAuth.getInstance();
|
||||
fstore = FirebaseFirestore.getInstance();
|
||||
resend = findViewById(R.id.resend);
|
||||
con = findViewById(R.id.con);
|
||||
user = fauth.getCurrentUser();
|
||||
|
||||
con.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
}
|
||||
});
|
||||
|
||||
resend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
user.sendEmailVerification().addOnSuccessListener(new OnSuccessListener<Void>() {
|
||||
public void onSuccess(Void aVoid) {
|
||||
Toast.makeText(Email.this, "Verification Email has been sent.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(Email.this, "Please use valid Email address", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -125,4 +125,8 @@ public class Enrollment extends AppCompatActivity {
|
|||
|
||||
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), Settings.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.example.capstone;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
@ -13,14 +15,17 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.AuthResult;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
|
||||
public class Login extends AppCompatActivity {
|
||||
private EditText email, password;
|
||||
private Button save;
|
||||
private TextView account;
|
||||
private TextView account, pass;
|
||||
FirebaseAuth fAuth;
|
||||
private String em, pw;
|
||||
|
||||
|
@ -33,6 +38,8 @@ public class Login extends AppCompatActivity {
|
|||
password = (EditText) findViewById(R.id.password);
|
||||
save = (Button) findViewById(R.id.signin);
|
||||
account = findViewById(R.id.account);
|
||||
pass = findViewById(R.id.pass);
|
||||
|
||||
fAuth = FirebaseAuth.getInstance();
|
||||
|
||||
account.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -42,6 +49,43 @@ public class Login extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
pass.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final EditText mail = new EditText(v.getContext());
|
||||
final AlertDialog.Builder passwordReset = new AlertDialog.Builder(v.getContext());
|
||||
passwordReset.setTitle("Reset Password?");
|
||||
passwordReset.setMessage("Don't worry! Just fill in your email and we'll send you a link to reset your password.");
|
||||
passwordReset.setView(mail);
|
||||
passwordReset.setPositiveButton("Reset password", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String mail2 = mail.getText().toString();
|
||||
fAuth.sendPasswordResetEmail(mail2).addOnSuccessListener(new OnSuccessListener<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void aVoid) {
|
||||
Toast.makeText(Login.this, "Reset password link has been sent to your email.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(Login.this, "Error! Email not sent "+ e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
passwordReset.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
passwordReset.create().show();
|
||||
}
|
||||
});
|
||||
|
||||
save.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -62,8 +106,13 @@ public class Login extends AppCompatActivity {
|
|||
@Override
|
||||
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||
if(task.isSuccessful()){
|
||||
Toast.makeText(Login.this, "Successful Login", Toast.LENGTH_LONG).show();
|
||||
openHomepage();
|
||||
FirebaseUser fuser = fAuth.getCurrentUser();
|
||||
if(fuser != null && fuser.isEmailVerified()){
|
||||
Toast.makeText(Login.this, "Successful Login", Toast.LENGTH_LONG).show();
|
||||
openHomepage();
|
||||
} else {
|
||||
startActivity(new Intent(getApplicationContext(), Email.class));
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(Login.this, task.getException().toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,58 @@
|
|||
package com.example.capstone;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
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.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
|
||||
public class Password extends AppCompatActivity {
|
||||
FirebaseAuth fAuth;
|
||||
private Button reset, backb;
|
||||
private EditText email;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_password);
|
||||
fAuth = FirebaseAuth.getInstance();
|
||||
email = (EditText) findViewById(R.id.email);
|
||||
reset = (Button) findViewById(R.id.Resetpassword);
|
||||
backb = (Button) findViewById(R.id.backb);
|
||||
|
||||
reset.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String mail = email.getText().toString();
|
||||
fAuth.sendPasswordResetEmail(mail).addOnSuccessListener(new OnSuccessListener<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void aVoid) {
|
||||
Toast.makeText(Password.this, "Reset password link has been sent to your email.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(Password.this, "Error! Email not sent "+ e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
backb.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getApplicationContext(), Settings.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void logout(View view){
|
||||
|
@ -22,4 +60,8 @@ public class Password extends AppCompatActivity {
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), Settings.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,4 +67,8 @@ public class Settings extends AppCompatActivity {
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), homepage.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,8 @@ public class Support extends AppCompatActivity {
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), Settings.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,15 @@ public class User {
|
|||
|
||||
private String Firstname;
|
||||
private String Lastname;
|
||||
private Long phone;
|
||||
private String phone;
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
public User(String fn, String ln, Long ph, String em, String pw) {
|
||||
public User(String fn, String ln, String ph, String em) {
|
||||
Firstname = fn;
|
||||
Lastname = ln;
|
||||
phone = ph;
|
||||
email = em;
|
||||
password = pw;
|
||||
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
|
@ -32,11 +31,11 @@ public class User {
|
|||
Lastname = lastname;
|
||||
}
|
||||
|
||||
public Long getPhone() {
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(Long phone) {
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
@ -48,11 +47,4 @@ public class User {
|
|||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import com.google.android.gms.tasks.OnSuccessListener;
|
|||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.AuthResult;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.firestore.DocumentReference;
|
||||
import com.google.firebase.firestore.DocumentSnapshot;
|
||||
import com.google.firebase.firestore.EventListener;
|
||||
|
@ -36,6 +38,7 @@ public class add extends AppCompatActivity {
|
|||
String userID;
|
||||
int numOfDrivers;
|
||||
private String fn, ln, em, ph;
|
||||
DatabaseReference reff;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -118,6 +121,11 @@ public class add extends AppCompatActivity {
|
|||
public void onSuccess(Void aVoid) {
|
||||
}
|
||||
});
|
||||
reff = FirebaseDatabase.getInstance().getReference().child("signal");
|
||||
reff.child("2").child("E-Mail").setValue(em);
|
||||
reff.child("2").child("First Name").setValue(fn);
|
||||
reff.child("2").child("Last Name").setValue(ln);
|
||||
reff.child("2").child("Phone").setValue(ph);
|
||||
openDriver();
|
||||
}
|
||||
});
|
||||
|
@ -152,4 +160,8 @@ public class add extends AppCompatActivity {
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
startActivity(new Intent(getApplicationContext(), Drivers.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.example.capstone;
|
|||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -11,6 +12,8 @@ import android.widget.EditText;
|
|||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatDialogFragment;
|
||||
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
|
||||
public class addDriver extends AppCompatDialogFragment {
|
||||
private EditText fn, ln, ph, em;
|
||||
private addDriverListener listener;
|
||||
|
@ -59,4 +62,5 @@ public class addDriver extends AppCompatDialogFragment {
|
|||
public interface addDriverListener{
|
||||
void applyTexts(String fn, String ln, String ph, String em);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.HashMap;
|
|||
|
||||
public class homepage extends AppCompatActivity {
|
||||
FirebaseAuth fAuth;
|
||||
private Button setting, poweron, alarmoff;
|
||||
private Button setting, poweron, alarmoff, apps;
|
||||
DatabaseReference reff;
|
||||
Signal sig;
|
||||
int check = 0;
|
||||
|
@ -39,6 +39,7 @@ public class homepage extends AppCompatActivity {
|
|||
setting = findViewById(R.id.settings);
|
||||
poweron = findViewById(R.id.poweron);
|
||||
alarmoff = findViewById(R.id.alarmoff);
|
||||
apps = findViewById(R.id.apps);
|
||||
at = findViewById(R.id.alarmtitle3);
|
||||
a = findViewById(R.id.alarm);
|
||||
et = findViewById(R.id.enginetitle3);
|
||||
|
@ -58,6 +59,14 @@ public class homepage extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
apps.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getApplicationContext(), Apps.class));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
poweron.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -103,4 +112,9 @@ public class homepage extends AppCompatActivity {
|
|||
startActivity(new Intent(getApplicationContext(), Login.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.example.capstone;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@ -16,14 +20,22 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.AuthResult;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
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.google.firebase.firestore.DocumentReference;
|
||||
import com.google.firebase.firestore.DocumentSnapshot;
|
||||
import com.google.firebase.firestore.EventListener;
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
import com.google.firebase.firestore.FirebaseFirestoreException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -34,9 +46,11 @@ private Button save;
|
|||
FirebaseAuth fAuth;
|
||||
private TextView account;
|
||||
private String fn, ln, em, pw, ph;
|
||||
private boolean check;
|
||||
private boolean check, check2, check3, check4;
|
||||
FirebaseFirestore fstore;
|
||||
String userID;
|
||||
DatabaseReference reff, sigR;
|
||||
private String uCount;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -52,6 +66,7 @@ String userID;
|
|||
fAuth = FirebaseAuth.getInstance();
|
||||
account = findViewById(R.id.account1);
|
||||
fstore = FirebaseFirestore.getInstance();
|
||||
|
||||
account.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -90,7 +105,7 @@ String userID;
|
|||
}
|
||||
|
||||
if(ph.length() < 10){
|
||||
phone.setError("Invalid phone number");
|
||||
phone.setError("Invalid phone number length");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -105,15 +120,42 @@ String userID;
|
|||
}
|
||||
|
||||
if(pw.length() < 6){
|
||||
password.setError("Password must be more than 6 characters.");
|
||||
password.setError("Password must be minumum of 6 characters.");
|
||||
return;
|
||||
}
|
||||
|
||||
check2 = FindUpperCase(pw);
|
||||
if(!check2){
|
||||
password.setError("Password must contain one uppercase letter");
|
||||
return;
|
||||
}
|
||||
|
||||
check3 = FindNumber(pw);
|
||||
if(!check3){
|
||||
password.setError("Password must contain one number");
|
||||
return;
|
||||
}
|
||||
|
||||
check4 = FindSpecialCharacter(pw);
|
||||
if(!check4){
|
||||
password.setError("Password must contain one special character");
|
||||
return;
|
||||
}
|
||||
fAuth.createUserWithEmailAndPassword(em, pw).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||
if(task.isSuccessful()){
|
||||
Toast.makeText(signup.this, "Successful Registration", Toast.LENGTH_LONG).show();
|
||||
FirebaseUser fuser = fAuth.getCurrentUser();
|
||||
fuser.sendEmailVerification().addOnSuccessListener(new OnSuccessListener<Void>() {
|
||||
public void onSuccess(Void aVoid) {
|
||||
Toast.makeText(signup.this, "Successful Registration. Verification Email has been sent.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(signup.this, "Please use valid Email address", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
userID = fAuth.getCurrentUser().getUid();
|
||||
DocumentReference documentReference = fstore.collection("users").document(userID);
|
||||
Map<String,Object> user = new HashMap<>();
|
||||
|
@ -127,7 +169,28 @@ String userID;
|
|||
public void onSuccess(Void aVoid) {
|
||||
}
|
||||
});
|
||||
openHomepage();
|
||||
|
||||
reff = FirebaseDatabase.getInstance().getReference().child("signal");
|
||||
|
||||
/*DocumentReference noteRef = fstore.document("UserNum/Num");
|
||||
noteRef.addSnapshotListener(new EventListener<DocumentSnapshot>() {
|
||||
@Override
|
||||
public void onEvent(@Nullable DocumentSnapshot value, @Nullable FirebaseFirestoreException error) {
|
||||
if (value.exists()) {
|
||||
uCount = value.getString("UNum");
|
||||
}
|
||||
}
|
||||
});
|
||||
Map<String, Object> note = new HashMap<>();
|
||||
note.put("UNum", String.valueOf(uCount+1));
|
||||
noteRef.set(note);*/
|
||||
|
||||
reff.child("2").child("E-Mail").setValue(em);
|
||||
reff.child("2").child("First Name").setValue(fn);
|
||||
reff.child("2").child("Last Name").setValue(ln);
|
||||
reff.child("2").child("Phone").setValue(ph);
|
||||
|
||||
openEmail();
|
||||
} else {
|
||||
Toast.makeText(signup.this, task.getException().toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
@ -137,8 +200,8 @@ String userID;
|
|||
});
|
||||
}
|
||||
|
||||
public void openHomepage() {
|
||||
Intent intent = new Intent(this, homepage.class);
|
||||
public void openEmail() {
|
||||
Intent intent = new Intent(this, Email.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -153,4 +216,39 @@ String userID;
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean FindUpperCase(String str){
|
||||
int count = 0;
|
||||
for(int i = 0; i<str.length(); i++){
|
||||
if(Character.isUpperCase(str.charAt(i))){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(count >= 1){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean FindNumber(String str){
|
||||
int count = 0;
|
||||
for(int i = 0; i<str.length(); i++){
|
||||
if(Character.isDigit(str.charAt(i))){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(count >= 1){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean FindSpecialCharacter(String s) {
|
||||
Pattern p = Pattern.compile("[^A-Za-z0-9]");
|
||||
Matcher m = p.matcher(s);
|
||||
boolean b = m.find();
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue