├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── themes.xml
│ │ │ ├── drawable
│ │ │ │ ├── view_circle_bg.xml
│ │ │ │ ├── rec_top_bottom_radius_bg_white.xml
│ │ │ │ ├── view_bg.xml
│ │ │ │ ├── rec_top_corner_radius_bg_white.xml
│ │ │ │ ├── baseline_close_24.xml
│ │ │ │ ├── baseline_person_24.xml
│ │ │ │ ├── baseline_email_24.xml
│ │ │ │ ├── baseline_phone_android_24.xml
│ │ │ │ ├── baseline_edit_24.xml
│ │ │ │ ├── switchoff.xml
│ │ │ │ ├── baseline_remove_red_eye_24.xml
│ │ │ │ ├── baseline_lock_outline_24.xml
│ │ │ │ ├── ic_launcher_foreground.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── values-night
│ │ │ │ └── themes.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_splash_screen.xml
│ │ │ │ ├── activity_forget_password.xml
│ │ │ │ ├── activity_create_user_data.xml
│ │ │ │ ├── activity_user_registration.xml
│ │ │ │ ├── fragment_update_user_info.xml
│ │ │ │ ├── activity_user_login.xml
│ │ │ │ └── activity_user_information.xml
│ │ │ └── xml
│ │ │ │ ├── backup_rules.xml
│ │ │ │ └── data_extraction_rules.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── regularexpression
│ │ │ │ ├── models
│ │ │ │ └── UserDataModelClass.java
│ │ │ │ ├── screen
│ │ │ │ └── SplashScreenActivity.java
│ │ │ │ ├── login
│ │ │ │ ├── ForgetPasswordActivity.java
│ │ │ │ ├── UserRegistrationActivity.java
│ │ │ │ └── UserLoginActivity.java
│ │ │ │ └── CRUD
│ │ │ │ ├── UserInformationActivity.java
│ │ │ │ ├── UpdateUserInfoFragment.java
│ │ │ │ └── CreateUserDataActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── regularexpression
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── regularexpression
│ │ └── ExampleInstrumentedTest.java
├── google-services.json
├── proguard-rules.pro
└── build.gradle.kts
├── .idea
├── .name
├── .gitignore
├── compiler.xml
├── vcs.xml
├── deploymentTargetDropDown.xml
├── migrations.xml
├── misc.xml
├── gradle.xml
└── appInsightsSettings.xml
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── libs.versions.toml
├── .gitignore
├── settings.gradle.kts
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Regular Expression
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laidbackvalen/FirebaseRealtime_CRUD_Regex_ViewBinding/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/view_circle_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Regular Expression
3 |
4 | Hello blank fragment
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rec_top_bottom_radius_bg_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/view_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Apr 19 17:21:33 IST 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rec_top_corner_radius_bg_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_close_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_person_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_email_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_phone_android_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_edit_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/regularexpression/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/switchoff.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_remove_red_eye_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_lock_outline_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | rootProject.name = "Regular Expression"
23 | include(":app")
24 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "886469417954",
4 | "project_id": "pracnow2042024",
5 | "storage_bucket": "pracnow2042024.appspot.com"
6 | },
7 | "client": [
8 | {
9 | "client_info": {
10 | "mobilesdk_app_id": "1:886469417954:android:fa7cbf055d5b01e58df7bb",
11 | "android_client_info": {
12 | "package_name": "com.example.regularexpression"
13 | }
14 | },
15 | "oauth_client": [],
16 | "api_key": [
17 | {
18 | "current_key": "AIzaSyAS5w20vYHYLuzIocbDG_sk0rQdrzEawGg"
19 | }
20 | ],
21 | "services": {
22 | "appinvite_service": {
23 | "other_platform_oauth_client": []
24 | }
25 | }
26 | }
27 | ],
28 | "configuration_version": "1"
29 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/regularexpression/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.example.regularexpression", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/.idea/appInsightsSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/models/UserDataModelClass.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.models;
2 |
3 | import java.io.Serializable;
4 |
5 | public class UserDataModelClass implements Serializable {
6 | String email, url, phone, name;
7 | public UserDataModelClass() {
8 |
9 | }
10 |
11 | public UserDataModelClass(String email, String url, String phone, String name) {
12 | this.email = email;
13 | this.url = url;
14 | this.phone = phone;
15 | this.name = name;
16 | }
17 |
18 | public String getEmail() {
19 | return email;
20 | }
21 |
22 | public void setEmail(String email) {
23 | this.email = email;
24 | }
25 |
26 | public String getUrl() {
27 | return url;
28 | }
29 |
30 | public void setUrl(String url) {
31 | this.url = url;
32 | }
33 |
34 | public String getPhone() {
35 | return phone;
36 | }
37 |
38 | public void setPhone(String phone) {
39 | this.phone = phone;
40 | }
41 | public String getName() {
42 | return name;
43 | }
44 |
45 | public void setName(String name) {
46 | this.name = name;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import com.android.build.api.dsl.BuildFeatures
2 |
3 | plugins {
4 | alias(libs.plugins.androidApplication)
5 | id("com.google.gms.google-services")
6 | }
7 |
8 | android {
9 | namespace = "com.example.regularexpression"
10 | compileSdk = 34
11 |
12 | defaultConfig {
13 | applicationId = "com.example.regularexpression"
14 | minSdk = 24
15 | targetSdk = 34
16 | versionCode = 1
17 | versionName = "1.0"
18 |
19 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
20 | }
21 |
22 | buildTypes {
23 | release {
24 | isMinifyEnabled = false
25 | proguardFiles(
26 | getDefaultProguardFile("proguard-android-optimize.txt"),
27 | "proguard-rules.pro"
28 | )
29 | }
30 | }
31 | compileOptions {
32 | sourceCompatibility = JavaVersion.VERSION_1_8
33 | targetCompatibility = JavaVersion.VERSION_1_8
34 | }
35 | buildFeatures {
36 | viewBinding = true
37 | }
38 | }
39 |
40 | dependencies {
41 |
42 | implementation(libs.appcompat)
43 | implementation(libs.material)
44 | implementation(libs.activity)
45 | implementation(libs.constraintlayout)
46 | implementation(libs.firebase.analytics)
47 | implementation(libs.firebase.auth)
48 | implementation(libs.firebase.database)
49 | implementation(libs.firebase.storage)
50 | testImplementation(libs.junit)
51 | androidTestImplementation(libs.ext.junit)
52 | androidTestImplementation(libs.espresso.core)
53 | implementation("com.github.bumptech.glide:glide:4.16.0")
54 | }
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.3.2"
3 | junit = "4.13.2"
4 | junitVersion = "1.1.5"
5 | espressoCore = "3.5.1"
6 | appcompat = "1.6.1"
7 | material = "1.11.0"
8 | activity = "1.8.0"
9 | constraintlayout = "2.1.4"
10 | googleServices = "4.4.1"
11 | firebaseAnalytics = "21.6.2"
12 | firebaseAuth = "22.3.1"
13 | firebaseDatabase = "20.3.1"
14 | firebaseStorage = "20.3.0"
15 |
16 | [libraries]
17 | junit = { group = "junit", name = "junit", version.ref = "junit" }
18 | ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
19 | espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
20 | appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
21 | material = { group = "com.google.android.material", name = "material", version.ref = "material" }
22 | activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
23 | constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
24 | google-services = { group = "com.google.gms", name = "google-services", version.ref = "googleServices" }
25 | firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics", version.ref = "firebaseAnalytics" }
26 | firebase-auth = { group = "com.google.firebase", name = "firebase-auth", version.ref = "firebaseAuth" }
27 | firebase-database = { group = "com.google.firebase", name = "firebase-database", version.ref = "firebaseDatabase" }
28 | firebase-storage = { group = "com.google.firebase", name = "firebase-storage", version.ref = "firebaseStorage" }
29 |
30 | [plugins]
31 | androidApplication = { id = "com.android.application", version.ref = "agp" }
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
16 |
19 |
22 |
25 |
28 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/screen/SplashScreenActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.screen;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 |
7 | import androidx.activity.EdgeToEdge;
8 | import androidx.appcompat.app.AppCompatActivity;
9 | import androidx.core.graphics.Insets;
10 | import androidx.core.view.ViewCompat;
11 | import androidx.core.view.WindowInsetsCompat;
12 |
13 | import com.example.regularexpression.CRUD.UserInformationActivity;
14 | import com.example.regularexpression.R;
15 | import com.example.regularexpression.login.UserLoginActivity;
16 | import com.google.firebase.auth.FirebaseAuth;
17 | import com.google.firebase.auth.FirebaseUser;
18 |
19 | public class SplashScreenActivity extends AppCompatActivity {
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | EdgeToEdge.enable(this);
25 | setContentView(R.layout.activity_splash_screen);
26 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
27 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
28 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
29 | return insets;
30 | });
31 | FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
32 | FirebaseUser user = firebaseAuth.getCurrentUser();
33 | new Handler().postDelayed(new Runnable() {
34 | @Override
35 | public void run() {
36 | if (user != null) {
37 | startActivity(new Intent(SplashScreenActivity.this, UserInformationActivity.class));
38 | finish();
39 | } else {
40 | startActivity(new Intent(SplashScreenActivity.this, UserLoginActivity.class));
41 | finish();
42 | }
43 | }
44 | }, 4000);
45 |
46 | }
47 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_forget_password.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
32 |
33 |
44 |
45 |
46 |
58 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/login/ForgetPasswordActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.login;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.widget.Toast;
6 |
7 | import androidx.activity.EdgeToEdge;
8 | import androidx.annotation.NonNull;
9 | import androidx.appcompat.app.AppCompatActivity;
10 | import androidx.core.graphics.Insets;
11 | import androidx.core.view.ViewCompat;
12 | import androidx.core.view.WindowInsetsCompat;
13 |
14 | import com.example.regularexpression.R;
15 | import com.example.regularexpression.databinding.ActivityForgetPasswordBinding;
16 | import com.google.android.gms.tasks.OnCompleteListener;
17 | import com.google.android.gms.tasks.OnFailureListener;
18 | import com.google.android.gms.tasks.Task;
19 | import com.google.firebase.auth.FirebaseAuth;
20 |
21 | import java.util.regex.Matcher;
22 | import java.util.regex.Pattern;
23 |
24 | public class ForgetPasswordActivity extends AppCompatActivity {
25 | private ActivityForgetPasswordBinding binding;
26 | public static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | EdgeToEdge.enable(this);
31 | binding = ActivityForgetPasswordBinding.inflate(getLayoutInflater());
32 | setContentView(binding.getRoot());
33 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
34 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
35 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
36 | return insets;
37 | });
38 |
39 | binding.resetPasswordButton.setOnClickListener(new View.OnClickListener() {
40 | @Override
41 | public void onClick(View view) {
42 | if(!emailConditions(binding.txtInpEdTxtEmailForgetPassword.getText().toString().trim())){
43 | binding.txtInpEdTxtEmailForgetPassword.setError("Wrongly Email Input");
44 | }else{
45 | FirebaseAuth.getInstance().sendPasswordResetEmail(binding.txtInpEdTxtEmailForgetPassword.getText().toString().trim()).addOnCompleteListener(new OnCompleteListener() {
46 | @Override
47 | public void onComplete(@NonNull Task task) {
48 | Toast.makeText(ForgetPasswordActivity.this, "Check Email, You'll get a link to reset your password!", Toast.LENGTH_SHORT).show();
49 | }
50 | }).addOnFailureListener(new OnFailureListener() {
51 | @Override
52 | public void onFailure(@NonNull Exception e) {
53 | Toast.makeText(ForgetPasswordActivity.this, "Invalid Email"+e.getMessage(), Toast.LENGTH_SHORT).show();
54 | }
55 | });
56 | }
57 | }
58 | });
59 | }
60 | private boolean emailConditions(String email) {
61 | Pattern pattern = Pattern.compile(EMAIL_REGEX);
62 | Matcher matcher = pattern.matcher(email);
63 | return matcher.matches();
64 | }
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/CRUD/UserInformationActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.CRUD;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.Toast;
7 | import androidx.activity.EdgeToEdge;
8 | import androidx.annotation.NonNull;
9 | import androidx.appcompat.app.AppCompatActivity;
10 | import androidx.core.graphics.Insets;
11 | import androidx.core.view.ViewCompat;
12 | import androidx.core.view.WindowInsetsCompat;
13 | import com.bumptech.glide.Glide;
14 | import com.example.regularexpression.R;
15 | import com.example.regularexpression.databinding.ActivityUserLoginBinding;
16 | import com.example.regularexpression.login.UserLoginActivity;
17 | import com.example.regularexpression.models.UserDataModelClass;
18 | import com.example.regularexpression.databinding.ActivityUserInformationBinding;
19 | import com.google.firebase.auth.FirebaseAuth;
20 | import com.google.firebase.auth.FirebaseUser;
21 | import com.google.firebase.database.DataSnapshot;
22 | import com.google.firebase.database.DatabaseError;
23 | import com.google.firebase.database.DatabaseReference;
24 | import com.google.firebase.database.FirebaseDatabase;
25 | import com.google.firebase.database.ValueEventListener;
26 |
27 | public class UserInformationActivity extends AppCompatActivity {
28 | private ActivityUserInformationBinding binding;
29 | FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
30 | FirebaseUser user = firebaseAuth.getCurrentUser();
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | EdgeToEdge.enable(this);
35 | binding = ActivityUserInformationBinding.inflate(getLayoutInflater());
36 | setContentView(binding.getRoot());
37 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
38 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
39 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
40 | return insets;
41 | });
42 | retrieveUserdata();
43 | binding.editUserInfo.setOnClickListener(new View.OnClickListener() {
44 | @Override
45 | public void onClick(View view) {
46 | UpdateUserInfoFragment fragment = new UpdateUserInfoFragment();
47 | fragment.show(getSupportFragmentManager(), fragment.getTag());
48 | }
49 | });
50 | binding.logOutImg.setOnClickListener(new View.OnClickListener() {
51 | @Override
52 | public void onClick(View view) {
53 | firebaseAuth.signOut();
54 | startActivity(new Intent(getApplicationContext(), UserLoginActivity.class));
55 | finish();
56 | }
57 | });
58 | }
59 | private void retrieveUserdata() {
60 | DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("Users").child(user.getUid());
61 | databaseReference.addValueEventListener(new ValueEventListener() {
62 | @Override
63 | public void onDataChange(@NonNull DataSnapshot snapshot) {
64 | if (snapshot.exists()) {
65 | UserDataModelClass modelClass = snapshot.getValue(UserDataModelClass.class);
66 | String email = modelClass.getEmail();
67 | String phone = modelClass.getPhone();
68 | binding.userEmailRetrieved.setText(email);
69 | binding.userPhoneRetrieved.setText(phone);
70 | binding.usernameRetrieved.setText(modelClass.getName());
71 | Glide.with(UserInformationActivity.this)
72 | .asBitmap()
73 | .load(modelClass.getUrl())
74 | .placeholder(R.drawable.baseline_person_24)
75 | .error(R.drawable.ic_launcher_background)
76 | .into(binding.retrieveUserImage);
77 | }
78 | }
79 | @Override
80 | public void onCancelled(@NonNull DatabaseError error) {
81 | Toast.makeText(UserInformationActivity.this, ""+error, Toast.LENGTH_SHORT).show();
82 | }
83 | });
84 | }
85 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_create_user_data.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
30 |
31 |
43 |
54 |
55 |
56 |
69 |
70 |
81 |
82 |
83 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_user_registration.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
33 |
34 |
45 |
46 |
47 |
58 |
59 |
70 |
71 |
72 |
83 |
84 |
96 |
97 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_update_user_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
27 |
28 |
37 |
38 |
50 |
51 |
62 |
63 |
64 |
76 |
77 |
88 |
89 |
90 |
101 |
102 |
109 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_user_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
33 |
34 |
45 |
46 |
47 |
58 |
59 |
70 |
71 |
72 |
83 |
84 |
94 |
95 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_user_information.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
34 |
35 |
48 |
49 |
60 |
66 |
67 |
68 |
80 |
81 |
94 |
95 |
108 |
109 |
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/login/UserRegistrationActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.login;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.widget.Toast;
6 |
7 | import androidx.activity.EdgeToEdge;
8 | import androidx.annotation.NonNull;
9 | import androidx.appcompat.app.AppCompatActivity;
10 | import androidx.core.graphics.Insets;
11 | import androidx.core.view.ViewCompat;
12 | import androidx.core.view.WindowInsetsCompat;
13 |
14 | import com.example.regularexpression.R;
15 | import com.example.regularexpression.databinding.ActivityUserRegistrationBinding;
16 | import com.google.android.gms.tasks.OnCompleteListener;
17 | import com.google.android.gms.tasks.OnFailureListener;
18 | import com.google.android.gms.tasks.Task;
19 | import com.google.firebase.auth.AuthResult;
20 | import com.google.firebase.auth.FirebaseAuth;
21 | import com.google.firebase.auth.FirebaseUser;
22 |
23 | import java.util.regex.Matcher;
24 | import java.util.regex.Pattern;
25 |
26 | public class UserRegistrationActivity extends AppCompatActivity {
27 | public static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
28 | public static final String PASSWORD_REGEX = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#&()–[{}]:;',?/*~$^+=<>]).{8,20}$";
29 | private ActivityUserRegistrationBinding binding;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | EdgeToEdge.enable(this);
35 | binding = ActivityUserRegistrationBinding.inflate(getLayoutInflater());
36 | setContentView(binding.getRoot());
37 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
38 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
39 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
40 | return insets;
41 | });
42 | binding.registrationButton.setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View view) {
45 | String email = binding.txtInpEdTxtEmailRegistration.getText().toString().trim();
46 | String password = binding.txtInpEdTxtPasswordRegistration.getText().toString().trim();
47 | if (!emailConditions(email)) { //!emailConditions(email) would evaluate to false
48 | // Do something if the email conditions are NOT met
49 | binding.txtInpEdTxtEmailRegistration.setError("Wrongly added email");
50 | } else if (emailConditions(email)) {
51 | if (!passwordValidator(password)) {
52 | binding.txtInpEdTxtPasswordRegistration.setError("Password must:\n" +
53 | "- Be at least 8 characters long\n" +
54 | "- Contain at least one uppercase letter\n" +
55 | "- Contain at least one lowercase letter\n" +
56 | "- Contain at least one digit\n" +
57 | "- Contain at least one special character (@$!%*?&)");
58 | } else {
59 | createUser(email, password);
60 | finish();
61 | }
62 | }
63 | }
64 | });
65 | }
66 |
67 | private void createUser(String email, String password) {
68 | FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
69 | firebaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener() {
70 | @Override
71 | public void onComplete(@NonNull Task task) {
72 | if (task.isSuccessful()) {
73 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
74 | assert user != null;
75 | user.sendEmailVerification().addOnCompleteListener(new OnCompleteListener() {
76 | @Override
77 | public void onComplete(@NonNull Task task) {
78 | Toast.makeText(UserRegistrationActivity.this, "An Email verification link has been sent to your Email Address", Toast.LENGTH_SHORT).show();
79 | Toast.makeText(UserRegistrationActivity.this, "Click on it to verify and login", Toast.LENGTH_SHORT).show();
80 | }
81 | }).addOnFailureListener(new OnFailureListener() {
82 | @Override
83 | public void onFailure(@NonNull Exception e) {
84 | Toast.makeText(UserRegistrationActivity.this, "Unsuccessful", Toast.LENGTH_SHORT).show();
85 | }
86 | });
87 | }
88 | }
89 | }).addOnFailureListener(new OnFailureListener() {
90 | @Override
91 | public void onFailure(@NonNull Exception e) {
92 | Toast.makeText(UserRegistrationActivity.this, "Unsuccessful", Toast.LENGTH_SHORT).show();
93 |
94 | }
95 | });
96 | }
97 |
98 | private boolean passwordValidator(String password) {
99 | Pattern pattern = Pattern.compile(PASSWORD_REGEX);
100 | Matcher matcher = pattern.matcher(password);
101 | // boolean matchValue = matcher.matches();
102 | return matcher.matches();
103 | }
104 |
105 | private boolean emailConditions(String email) {
106 | Pattern pattern = Pattern.compile(EMAIL_REGEX);
107 | Matcher matcher = pattern.matcher(email);
108 | return matcher.matches();
109 | }
110 |
111 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/login/UserLoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.login;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import androidx.activity.EdgeToEdge;
9 | import androidx.annotation.NonNull;
10 | import androidx.appcompat.app.AppCompatActivity;
11 | import androidx.core.graphics.Insets;
12 | import androidx.core.view.ViewCompat;
13 | import androidx.core.view.WindowInsetsCompat;
14 |
15 | import com.example.regularexpression.CRUD.CreateUserDataActivity;
16 | import com.example.regularexpression.R;
17 | import com.example.regularexpression.databinding.ActivityUserLoginBinding;
18 | import com.google.android.gms.tasks.OnCompleteListener;
19 | import com.google.android.gms.tasks.OnFailureListener;
20 | import com.google.android.gms.tasks.Task;
21 | import com.google.firebase.auth.AuthResult;
22 | import com.google.firebase.auth.FirebaseAuth;
23 | import com.google.firebase.auth.FirebaseUser;
24 |
25 | import java.util.regex.Matcher;
26 | import java.util.regex.Pattern;
27 |
28 | public class UserLoginActivity extends AppCompatActivity {
29 | public static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
30 | public static final String PASSWORD_REGEX = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#&()–[{}]:;',?/*~$^+=<>]).{8,20}$";
31 | private ActivityUserLoginBinding binding; // Generated binding class
32 | String email;
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | EdgeToEdge.enable(this);
38 | //viewBinding
39 | binding = ActivityUserLoginBinding.inflate(getLayoutInflater());
40 | setContentView(binding.getRoot());
41 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
42 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
43 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
44 | return insets;
45 | });
46 | binding.registrationUserText.setOnClickListener(new View.OnClickListener() {
47 | @Override
48 | public void onClick(View view) {
49 | startActivity(new Intent(UserLoginActivity.this, UserRegistrationActivity.class));
50 | }
51 | });
52 | binding.forgetPassword.setOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View view) {
55 | startActivity(new Intent(UserLoginActivity.this, ForgetPasswordActivity.class));
56 | }
57 | });
58 | binding.loginButton.setOnClickListener(new View.OnClickListener() {
59 | @Override
60 | public void onClick(View view) {
61 | email = binding.txtInpEdTxtEmail.getText().toString().trim();
62 | String password = binding.txtInpEdTxtPassword.getText().toString().trim();
63 | if (!emailConditions(email)) { //!emailConditions(email) would evaluate to false
64 | // Do something if the email conditions are NOT met
65 | binding.txtInpEdTxtEmail.setError("Wrongly added email");
66 | } else if (emailConditions(email)) {
67 | if (!passwordValidator(password)) {
68 | binding.txtInpEdTxtPassword.setError("Password must:\n" +
69 | "- Be at least 8 characters long\n" +
70 | "- Contain at least one uppercase letter\n" +
71 | "- Contain at least one lowercase letter\n" +
72 | "- Contain at least one digit\n" +
73 | "- Contain at least one special character (@$!%*?&)");
74 | } else {
75 | loginUser(email, password);
76 | }
77 | }
78 | }
79 | });
80 | }
81 |
82 | private void loginUser(String email, String password) {
83 | FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
84 | firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener() {
85 | @Override
86 | public void onComplete(@NonNull Task task) {
87 | if (task.isSuccessful()) {
88 | FirebaseUser firebaseUser = task.getResult().getUser();
89 | assert firebaseUser != null;
90 | if (firebaseUser.isEmailVerified()) {
91 | Intent intent =new Intent(UserLoginActivity.this, CreateUserDataActivity.class);
92 | intent.putExtra("email", email);
93 | startActivity(intent);
94 | finish();
95 | } else {
96 | Toast.makeText(UserLoginActivity.this, "Check if you have verified Email", Toast.LENGTH_SHORT).show();
97 | }
98 | }
99 | }
100 | }).addOnFailureListener(new OnFailureListener() {
101 | @Override
102 | public void onFailure(@NonNull Exception e) {
103 | Toast.makeText(UserLoginActivity.this, "Login Failed!"+e.getMessage(), Toast.LENGTH_SHORT).show();
104 | }
105 | });
106 | }
107 |
108 | private boolean passwordValidator(String password) {
109 | Pattern pattern = Pattern.compile(PASSWORD_REGEX);
110 | Matcher matcher = pattern.matcher(password);
111 | // boolean matchValue = matcher.matches();
112 | return matcher.matches();
113 | }
114 |
115 | private boolean emailConditions(String email) {
116 | Pattern pattern = Pattern.compile(EMAIL_REGEX);
117 | Matcher matcher = pattern.matcher(email);
118 | return matcher.matches();
119 | }
120 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/CRUD/UpdateUserInfoFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.CRUD;
2 |
3 | import android.net.Uri;
4 | import android.os.Bundle;
5 |
6 | import androidx.activity.result.ActivityResultCallback;
7 | import androidx.activity.result.ActivityResultLauncher;
8 | import androidx.activity.result.contract.ActivityResultContracts;
9 | import androidx.annotation.NonNull;
10 |
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.Toast;
15 |
16 | import com.example.regularexpression.databinding.FragmentUpdateUserInfoBinding;
17 | import com.google.android.gms.tasks.OnCompleteListener;
18 | import com.google.android.gms.tasks.OnFailureListener;
19 | import com.google.android.gms.tasks.Task;
20 | import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
21 | import com.google.firebase.auth.FirebaseAuth;
22 | import com.google.firebase.auth.FirebaseUser;
23 | import com.google.firebase.database.DatabaseReference;
24 | import com.google.firebase.database.FirebaseDatabase;
25 | import com.google.firebase.storage.FirebaseStorage;
26 | import com.google.firebase.storage.StorageReference;
27 | import com.google.firebase.storage.UploadTask;
28 |
29 | import java.util.HashMap;
30 |
31 | public class UpdateUserInfoFragment extends BottomSheetDialogFragment {
32 | String url;
33 | FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
34 | FirebaseUser user = firebaseAuth.getCurrentUser();
35 | private com.example.regularexpression.databinding.FragmentUpdateUserInfoBinding binding;
36 |
37 | @Override
38 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
39 | binding = com.example.regularexpression.databinding.FragmentUpdateUserInfoBinding.inflate(inflater, container, false);
40 | binding.updateUserImage.setOnClickListener(new View.OnClickListener() {
41 | @Override
42 | public void onClick(View view) {
43 | //if you're using an intent to select an image from the device's storage,
44 | // you can specify image/* as the MIME type to indicate that your application can accept any image format
45 | activityResultLauncher.launch("image/*");
46 | }
47 | });
48 | binding.updateDetailsButton.setOnClickListener(new View.OnClickListener() {
49 | @Override
50 | public void onClick(View view) {
51 | updateUserInfo(url, binding.updateName.getText().toString(), binding.updatePhone.getText().toString());
52 | // dismiss();
53 | }
54 | });
55 | binding.closeUpdateBottomSheet.setOnClickListener(new View.OnClickListener() {
56 | @Override
57 | public void onClick(View view) {
58 | dismiss();
59 | }
60 | });
61 | return binding.getRoot();
62 | }
63 |
64 | private void updateUserInfo(String image, String name, String phone) {
65 | DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
66 | HashMap map = new HashMap<>();
67 | map.put("url", image);
68 | map.put("name", name);
69 | map.put("phone", phone);
70 | databaseReference.child("Users")
71 | .child(user.getUid())
72 | .updateChildren(map)
73 | .addOnCompleteListener(new OnCompleteListener() {
74 | @Override
75 | public void onComplete(@NonNull Task task) {
76 | if ((task.isSuccessful())) {
77 | Toast.makeText(getContext(), "Updated Successfully", Toast.LENGTH_SHORT).show();
78 | }
79 | }
80 | }).addOnFailureListener(new OnFailureListener() {
81 | @Override
82 | public void onFailure(@NonNull Exception e) {
83 | Toast.makeText(getContext(), "" + e.getMessage(), Toast.LENGTH_SHORT).show();
84 | }
85 | });
86 | }
87 |
88 | ActivityResultLauncher activityResultLauncher = registerForActivityResult(new ActivityResultContracts.GetContent(), new ActivityResultCallback() {
89 | @Override
90 | public void onActivityResult(Uri uri) {
91 | StorageReference storageReference = FirebaseStorage.getInstance().getReference();
92 | storageReference.child("UserImages")
93 | .child(user.getUid())
94 | .child("image")
95 | .child("IMG_" + System.currentTimeMillis())
96 | .putFile(uri)
97 | .addOnCompleteListener(new OnCompleteListener() {
98 | @Override
99 | public void onComplete(@NonNull Task task) {
100 | if (task.isSuccessful()) {
101 | task.getResult().getStorage().getDownloadUrl().addOnCompleteListener(new OnCompleteListener() {
102 | @Override
103 | public void onComplete(@NonNull Task task) {
104 | url = uri.toString();
105 | binding.updateUserImage.setImageURI(uri);
106 | }
107 | }).addOnFailureListener(new OnFailureListener() {
108 | @Override
109 | public void onFailure(@NonNull Exception e) {
110 | Toast.makeText(getContext(), "" + e.getMessage(), Toast.LENGTH_SHORT).show();
111 | }
112 | });
113 | }
114 | }
115 | }).addOnFailureListener(new OnFailureListener() {
116 | @Override
117 | public void onFailure(@NonNull Exception e) {
118 | Toast.makeText(getContext(), "" + e.getMessage(), Toast.LENGTH_SHORT).show();
119 | }
120 | });
121 | }
122 | });
123 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/regularexpression/CRUD/CreateUserDataActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.regularexpression.CRUD;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Toast;
8 | import androidx.activity.EdgeToEdge;
9 | import androidx.activity.result.ActivityResultCallback;
10 | import androidx.activity.result.ActivityResultLauncher;
11 | import androidx.activity.result.contract.ActivityResultContracts;
12 | import androidx.annotation.NonNull;
13 | import androidx.appcompat.app.AppCompatActivity;
14 | import androidx.core.graphics.Insets;
15 | import androidx.core.view.ViewCompat;
16 | import androidx.core.view.WindowInsetsCompat;
17 | import com.example.regularexpression.R;
18 | import com.example.regularexpression.models.UserDataModelClass;
19 | import com.example.regularexpression.databinding.ActivityCreateUserDataBinding;
20 | import com.google.android.gms.tasks.OnCompleteListener;
21 | import com.google.android.gms.tasks.OnFailureListener;
22 | import com.google.android.gms.tasks.OnSuccessListener;
23 | import com.google.android.gms.tasks.Task;
24 | import com.google.firebase.auth.FirebaseAuth;
25 | import com.google.firebase.auth.FirebaseUser;
26 | import com.google.firebase.database.DatabaseReference;
27 | import com.google.firebase.database.FirebaseDatabase;
28 | import com.google.firebase.storage.FirebaseStorage;
29 | import com.google.firebase.storage.UploadTask;
30 | import java.util.Objects;
31 |
32 | public class CreateUserDataActivity extends AppCompatActivity {
33 | private ActivityCreateUserDataBinding binding;
34 | String url;
35 | String email;
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | EdgeToEdge.enable(this);
40 | binding = ActivityCreateUserDataBinding.inflate(getLayoutInflater());
41 | setContentView(binding.getRoot());
42 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
43 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
44 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
45 | return insets;
46 | });
47 | email = getIntent().getStringExtra("email");
48 | binding.userImage.setOnClickListener(new View.OnClickListener() {
49 | @Override
50 | public void onClick(View view) {
51 | activityResultLauncher.launch("image/*");
52 | }
53 | });
54 | binding.addDetailsButton.setOnClickListener(new View.OnClickListener() {
55 | @Override
56 | public void onClick(View view) {
57 | String phoneNumberInput = binding.phone.getText().toString();
58 | String nameInput = binding.name.getText().toString();
59 | addUserInfo(email, url, phoneNumberInput, nameInput);
60 | Toast.makeText(CreateUserDataActivity.this, ""+email, Toast.LENGTH_SHORT).show();
61 | }
62 | });
63 | }
64 | private void addUserInfo(String email, String url, String phoneNumberInput, String name) {
65 | DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
66 | FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
67 | FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
68 | assert firebaseUser != null;
69 | UserDataModelClass modelClass = new UserDataModelClass(email, url, phoneNumberInput, name);
70 | databaseReference.child("Users")
71 | .child(firebaseUser.getUid())
72 | .setValue(modelClass)
73 | .addOnCompleteListener(new OnCompleteListener() {
74 | @Override
75 | public void onComplete(@NonNull Task task) {
76 | Toast.makeText(CreateUserDataActivity.this, "User Details Added Successfully", Toast.LENGTH_SHORT).show();
77 | startActivity(new Intent(getApplicationContext(), UserInformationActivity.class));
78 | finish();
79 | }
80 | }).addOnFailureListener(new OnFailureListener() {
81 | @Override
82 | public void onFailure(@NonNull Exception e) {
83 | Toast.makeText(CreateUserDataActivity.this, "Error Adding User data" + e.getMessage(), Toast.LENGTH_SHORT).show();
84 | }
85 | });
86 | }
87 | ActivityResultLauncher activityResultLauncher = registerForActivityResult(new ActivityResultContracts.GetContent(), new ActivityResultCallback() {
88 | @Override
89 | public void onActivityResult(Uri results) {
90 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
91 | FirebaseStorage.getInstance().getReference().child("UserImages")
92 | .child(user.getUid())
93 | .child("image")
94 | .child("IMG_" + System.currentTimeMillis())
95 | .putFile(results)
96 | .addOnCompleteListener(new OnCompleteListener() {
97 | @Override
98 | public void onComplete(@NonNull Task task) {
99 | if (task.isSuccessful()) {
100 | task.getResult().getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
101 | @Override
102 | public void onSuccess(Uri uri) {
103 | url = uri.toString();
104 | binding.userImage.setImageURI(results);
105 | }
106 | }).addOnFailureListener(new OnFailureListener() {
107 | @Override
108 | public void onFailure(@NonNull Exception e) {
109 | Toast.makeText(CreateUserDataActivity.this, "" + e.getMessage(), Toast.LENGTH_SHORT).show();
110 | }
111 | });
112 | }
113 | }
114 | });
115 | }
116 | });
117 | }
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------