diff --git a/app/build.gradle b/app/build.gradle
index 2172b23..564c75c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
+ id 'com.google.gms.google-services'
}
android {
@@ -38,14 +39,13 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'com.google.firebase:firebase-auth-ktx:21.1.0'
+ implementation 'com.google.firebase:firebase-database-ktx:20.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
//retrofit
implementation "com.squareup.retrofit2:retrofit:2.3.0"
- implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
-
- implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
}
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 0000000..8fbd1ac
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,39 @@
+{
+ "project_info": {
+ "project_number": "1052295142832",
+ "project_id": "the-queezy",
+ "storage_bucket": "the-queezy.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:1052295142832:android:67543867b7d271c290ca75",
+ "android_client_info": {
+ "package_name": "com.mr_17.queezy"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "1052295142832-2tslr5nmi1fb05cgvlrel7sjcho997e4.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyBmMSRHFeAgMKNknVjizr92oCcVr9AyRaU"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "1052295142832-2tslr5nmi1fb05cgvlrel7sjcho997e4.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index edb4941..f8da49e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -16,49 +16,56 @@
tools:targetApi="31">
+ android:exported="false"
+ android:screenOrientation="portrait">
+ android:exported="false"
+ android:screenOrientation="portrait">
+ android:exported="false"
+ android:screenOrientation="portrait">
+ android:exported="false"
+ android:screenOrientation="portrait">
+ android:exported="false"
+ android:screenOrientation="portrait">
+ android:exported="false"
+ android:screenOrientation="portrait">
+ android:exported="true"
+ android:screenOrientation="portrait">
@@ -71,7 +78,8 @@
+ android:exported="false"
+ android:screenOrientation="portrait">
diff --git a/app/src/main/java/com/mr_17/queezy/activity/CreateAccountActivity.kt b/app/src/main/java/com/mr_17/queezy/activity/CreateAccountActivity.kt
index 64e78e0..9f31d5e 100644
--- a/app/src/main/java/com/mr_17/queezy/activity/CreateAccountActivity.kt
+++ b/app/src/main/java/com/mr_17/queezy/activity/CreateAccountActivity.kt
@@ -1,12 +1,127 @@
package com.mr_17.queezy.activity
-import androidx.appcompat.app.AppCompatActivity
+import android.app.Activity
+import android.app.ProgressDialog
+import android.content.Intent
import android.os.Bundle
+import android.text.TextUtils
+import android.widget.Button
+import android.widget.EditText
+import android.widget.Toast
+import androidx.appcompat.widget.Toolbar
+import androidx.appcompat.app.AppCompatActivity
+import com.google.android.gms.tasks.OnCompleteListener
+import com.google.firebase.auth.FirebaseAuth
+import com.google.firebase.database.DatabaseReference
+import com.google.firebase.database.FirebaseDatabase
import com.mr_17.queezy.R
+import com.mr_17.queezy.model.FirebaseModel
class CreateAccountActivity : AppCompatActivity() {
+
+ private var toolbar: Toolbar? = null
+ private var createAccountButton: Button? = null
+
+ private var firstName: EditText? = null
+ private var lastName:EditText? = null
+ private var userEmail:EditText? = null
+ private var userPassword:EditText? = null
+ private var confirmUserPassword:EditText? = null
+
+ private var myAuth: FirebaseAuth? = null
+ private var rootRef: DatabaseReference? = null
+
+ private var loadingBar: ProgressDialog? = null
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_create_account)
+
+ myAuth = FirebaseAuth.getInstance()
+ rootRef = FirebaseDatabase.getInstance().getReference()
+
+ InitializeFields()
+
+ createAccountButton!!.setOnClickListener{ CreateNewAccount() }
+
+ toolbar!!.setNavigationOnClickListener { onBackPressed() }
+ }
+
+ private fun InitializeFields() {
+ toolbar = findViewById(R.id.toolbar)
+ createAccountButton = findViewById(R.id.create_account_button)
+ firstName = findViewById(R.id.first_name_edittext)
+ lastName = findViewById(R.id.last_name_edittext)
+ userEmail = findViewById(R.id.email_address_edittext)
+ userPassword = findViewById(R.id.password_edittext)
+ confirmUserPassword = findViewById(R.id.confirm_password_edittext)
+
+ loadingBar = ProgressDialog(this)
+ }
+
+ private fun CreateNewAccount() {
+ val email = userEmail!!.text.toString()
+ val password = userPassword!!.text.toString()
+ val confirmPassword = confirmUserPassword!!.text.toString()
+ val first_Name = firstName!!.text.toString()
+ val last_Name = lastName!!.text.toString()
+
+ if (TextUtils.isEmpty(email)) {
+ Toast.makeText(this, "Email Required...", Toast.LENGTH_LONG).show()
+ } else if (TextUtils.isEmpty(password)) {
+ Toast.makeText(this, "Password Required...", Toast.LENGTH_LONG).show()
+ } else if (TextUtils.isEmpty(confirmPassword)) {
+ Toast.makeText(this, "Password Confirmation Required...", Toast.LENGTH_LONG).show()
+ } else if (TextUtils.isEmpty(first_Name)) {
+ Toast.makeText(this, "First Name Required...", Toast.LENGTH_LONG).show()
+ } else if (TextUtils.isEmpty(last_Name)) {
+ Toast.makeText(this, "Last Name Required...", Toast.LENGTH_LONG).show()
+ } else if (password != confirmPassword) {
+ Toast.makeText(this, "Passwords Mismatch...", Toast.LENGTH_LONG).show()
+ } else {
+ loadingBar!!.setTitle("Creating New Account")
+ loadingBar!!.setMessage("Please wait, while we are creating a new account for you...")
+ loadingBar!!.setCanceledOnTouchOutside(false)
+ loadingBar!!.show()
+ myAuth!!.createUserWithEmailAndPassword(email, password)
+ .addOnCompleteListener { task ->
+ if (task.isSuccessful) {
+ val currentUserID = myAuth!!.currentUser!!.uid
+ val profileMap = HashMap()
+ profileMap[FirebaseModel.node_uid] = currentUserID
+ profileMap[FirebaseModel.node_firstName] = first_Name
+ profileMap[FirebaseModel.node_lastName] = last_Name
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ FirebaseModel.databaseRef_users.child(currentUserID)
+ .setValue("") // test this
+ //rootRef.child("Programs").child("subTopics").child("VIII").setValue("");
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ FirebaseModel.databaseRef_users.child(currentUserID).setValue(profileMap)
+ .addOnCompleteListener(
+ OnCompleteListener {
+ SendToActivity(LoginActivity::class.java, false)
+ Toast.makeText(
+ this@CreateAccountActivity,
+ "Account Created Successfully. Login to continue.",
+ Toast.LENGTH_LONG
+ ).show()
+ loadingBar!!.dismiss()
+ })
+ } else {
+ val message = task.exception!!.message
+ Toast.makeText(this@CreateAccountActivity, "Error: $message", Toast.LENGTH_LONG)
+ .show()
+ loadingBar!!.dismiss()
+ }
+ }
+ }
+ }
+
+ private fun SendToActivity(activityClass: Class, backEnabled: Boolean) {
+ val intent = Intent(this, activityClass)
+ if (!backEnabled) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ startActivity(intent)
+ if (!backEnabled) finish()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mr_17/queezy/activity/LoginActivity.kt b/app/src/main/java/com/mr_17/queezy/activity/LoginActivity.kt
index 294dd44..ead5779 100644
--- a/app/src/main/java/com/mr_17/queezy/activity/LoginActivity.kt
+++ b/app/src/main/java/com/mr_17/queezy/activity/LoginActivity.kt
@@ -1,12 +1,151 @@
package com.mr_17.queezy.activity
-import androidx.appcompat.app.AppCompatActivity
+import android.app.Activity
+import android.app.AlertDialog
+import android.app.ProgressDialog
+import android.content.Intent
import android.os.Bundle
+import android.text.TextUtils
+import android.view.View
+import android.widget.Button
+import android.widget.EditText
+import android.widget.TextView
+import android.widget.Toast
+import androidx.appcompat.widget.Toolbar
+import androidx.appcompat.app.AppCompatActivity
+import com.google.firebase.auth.FirebaseAuth
import com.mr_17.queezy.R
class LoginActivity : AppCompatActivity() {
+
+ private var toolbar: Toolbar? = null
+ private var loginButton: Button? = null
+ private var userEmail: EditText? = null
+ private var userPassword:EditText? = null
+ private var forgotPasswordLink:TextView? = null
+
+ private var loginWithGoogleButton: Button? = null
+ private var loginWithFacebookButton: Button? = null
+
+ private var myAuth: FirebaseAuth? = null
+
+ private var loadingBar: ProgressDialog? = null
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
+
+ InitializeFields() // initializing all elements
+
+ // checking clicks respective buttons and text
+ loginButton!!.setOnClickListener { AllowUserTolLogin() }
+
+ forgotPasswordLink!!.setOnClickListener { v -> ForgotPassword(v) }
+
+ loginWithGoogleButton!!.setOnClickListener {
+ Toast.makeText(applicationContext, "This feature is not available yet. Please login using Email & Password", Toast.LENGTH_SHORT).show()
+ }
+
+ loginWithFacebookButton!!.setOnClickListener {
+ Toast.makeText(applicationContext, "This feature is not available yet. Please login using Email & Password", Toast.LENGTH_SHORT).show()
+ }
+
+ toolbar!!.setNavigationOnClickListener { onBackPressed() }
+ }
+
+ private fun InitializeFields() {
+ toolbar = findViewById(R.id.toolbar)
+ loginButton = findViewById(R.id.login_button)
+ loginWithGoogleButton = findViewById(R.id.login_with_google_button)
+ loginWithFacebookButton = findViewById(R.id.login_with_fb_button)
+ userEmail = findViewById(R.id.email_address_edittext)
+ userPassword = findViewById(R.id.password_edittext)
+ forgotPasswordLink = findViewById(R.id.forgot_password_button)
+ loadingBar = ProgressDialog(this)
+ myAuth = FirebaseAuth.getInstance()
+ }
+
+ private fun AllowUserTolLogin() {
+ // storing the email and password as String
+ val email = userEmail!!.text.toString()
+ val password = userPassword!!.text.toString()
+
+ // checking that none of the fields are empty and giving appropriate toasts
+ if (TextUtils.isEmpty(email)) {
+ Toast.makeText(this, "Email Required...", Toast.LENGTH_LONG).show()
+ } else if (TextUtils.isEmpty(password)) {
+ Toast.makeText(this, "Password Required...", Toast.LENGTH_LONG).show()
+ } else {
+ // setting up the loading bar
+ loadingBar!!.setTitle("Signing In")
+ loadingBar!!.setMessage("Please Wait...")
+ loadingBar!!.setCanceledOnTouchOutside(false)
+ loadingBar!!.show()
+
+ // attempting to sign in using firebase
+ myAuth!!.signInWithEmailAndPassword(email, password).addOnCompleteListener { task ->
+ if (task.isSuccessful) {
+ // sending user to main activity on successful sign in
+ SendToActivity(MainActivity::class.java, false)
+ //Toast.makeText(LoginActivity.this, "Logged in Successfully...", Toast.LENGTH_SHORT).show();
+ loadingBar!!.dismiss()
+ } else {
+ // otherwise displaying the error message
+ val message = task.exception!!.message
+ Toast.makeText(this@LoginActivity, "Error: $message", Toast.LENGTH_LONG).show()
+ loadingBar!!.dismiss()
+ }
+ }
+ }
+ }
+
+ private fun ForgotPassword(v: View) {
+ // edit text for the alert dialog
+ val resetEmail = EditText(v.context)
+ resetEmail.hint = "Email Address"
+
+ // setting up the alert dialog
+ val passwordResetDialog = AlertDialog.Builder(v.context)
+ passwordResetDialog.setTitle("Reset Password ?")
+ passwordResetDialog.setMessage("Enter your e-mail to receive the reset link.")
+ passwordResetDialog.setView(resetEmail)
+
+ // creating functionality of the "yes" button
+ passwordResetDialog.setPositiveButton(
+ "Yes"
+ ) { dialog, which ->
+ // getting the email text from the edit text
+ val mail = resetEmail.text.toString()
+ // checking for empty edit text
+ if (TextUtils.isEmpty(mail)) {
+ Toast.makeText(this@LoginActivity, "Email Required...", Toast.LENGTH_LONG)
+ .show()
+ } else {
+ // resetting the password using firebase
+ myAuth!!.sendPasswordResetEmail(mail).addOnSuccessListener {
+ Toast.makeText(
+ this@LoginActivity,
+ "Reset link has been sent to your e-mail.",
+ Toast.LENGTH_SHORT
+ ).show()
+ }.addOnFailureListener { e -> // displaying a toast on failure
+ val message = e.message
+ Toast.makeText(this@LoginActivity, "Error: $message", Toast.LENGTH_LONG).show()
+ }
+ }
+ }
+
+ // creating the "no" button
+ passwordResetDialog.setNegativeButton(
+ "No"
+ ) { dialog, which -> }
+ passwordResetDialog.create().show()
+ }
+
+ private fun SendToActivity(activityClass: Class, backEnabled: Boolean) {
+ val intent = Intent(this, activityClass)
+ if (!backEnabled) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ startActivity(intent)
+ if (!backEnabled) finish()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mr_17/queezy/activity/MainActivity.kt b/app/src/main/java/com/mr_17/queezy/activity/MainActivity.kt
index c4af2ed..93c1537 100644
--- a/app/src/main/java/com/mr_17/queezy/activity/MainActivity.kt
+++ b/app/src/main/java/com/mr_17/queezy/activity/MainActivity.kt
@@ -1,21 +1,23 @@
package com.mr_17.queezy.activity
import android.app.Activity
+import android.app.AlertDialog
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.View
-import android.widget.Button
-import android.widget.LinearLayout
-import android.widget.Spinner
-import android.widget.TextView
-import android.widget.Toast
+import android.widget.*
import androidx.appcompat.app.AppCompatActivity
+import com.google.firebase.auth.FirebaseAuth
+import com.google.firebase.database.DataSnapshot
+import com.google.firebase.database.DatabaseError
+import com.google.firebase.database.ValueEventListener
import com.mr_17.queezy.R
import com.mr_17.queezy.api.Api
import com.mr_17.queezy.api.ApiCount
import com.mr_17.queezy.api.QuizQuestions
import com.mr_17.queezy.api.Result
+import com.mr_17.queezy.model.FirebaseModel
import com.mr_17.queezy.model.Question
import retrofit2.Call
import retrofit2.Callback
@@ -28,18 +30,20 @@ import java.util.*
class MainActivity : AppCompatActivity() {
+ private var myAuth: FirebaseAuth? = null
+
private var startQuizButton: Button? = null
private var categorySpinner: Spinner? = null
private var difficultySpinner: Spinner? = null
private var wishingMsg: TextView? = null
+ private var fullName: TextView? = null
+ private var logoutButton: ImageView? = null
private var loading: LinearLayout? = null
private var category: String? = "science_computer"
private var difficulty: String? = "easy"
- //private var progressBar: ProgressBar? = null
-
private var q: Question? = null
override fun onCreate(savedInstanceState: Bundle?) {
@@ -53,28 +57,82 @@ class MainActivity : AppCompatActivity() {
loading!!.visibility = View.VISIBLE
fetchQuestionCount()
}
+
+ logoutButton!!.setOnClickListener {
+ // setting up the alert dialog
+
+ // setting up the alert dialog
+ val confirmLogoutDialog = AlertDialog.Builder(this@MainActivity)
+ confirmLogoutDialog.setTitle("Confirm Logout")
+ confirmLogoutDialog.setMessage("Are sure you want to logout?")
+
+ // creating functionality of the "yes" button
+
+ // creating functionality of the "yes" button
+ confirmLogoutDialog.setPositiveButton(
+ "Yes"
+ ) { dialog, which ->
+ myAuth!!.signOut()
+ SendToActivity(WelcomeActivity::class.java, false)
+ }
+
+ // creating the "no" button
+
+ // creating the "no" button
+ confirmLogoutDialog.setNegativeButton(
+ "No"
+ ) { dialog, which -> }
+
+ confirmLogoutDialog.create().show()
+ }
}
- private fun InitializeFields() {
+ private fun InitializeFields()
+ {
+ myAuth = FirebaseAuth.getInstance()
wishingMsg = findViewById(R.id.wishing_msg)
wishingMsg!!.setText("Good " + GetWishing())
+ fullName = findViewById(R.id.full_name)
startQuizButton = findViewById(R.id.start_quiz_button)
categorySpinner = findViewById(R.id.choose_category_spinner)
difficultySpinner = findViewById(R.id.choose_difficulty_spinner)
+ logoutButton = findViewById(R.id.logout_button)
loading = findViewById(R.id.loading)
- }
- private fun SendToActivity(activityClass: Class, backEnabled: Boolean) {
- val intent = Intent(this, activityClass)
- if (!backEnabled) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
- startActivity(intent)
- if (!backEnabled) finish()
+ if(myAuth!!.currentUser != null) {
+ FirebaseModel.databaseRef_users.child(myAuth!!.currentUser!!.uid)
+ .addValueEventListener(object : ValueEventListener {
+ override fun onDataChange(snapshot: DataSnapshot) {
+ if (snapshot.exists()) {
+ val retrieveFirstName =
+ snapshot.child(FirebaseModel.node_firstName).value.toString()
+ val retrieveLastName =
+ snapshot.child(FirebaseModel.node_lastName).value.toString()
+ fullName!!.setText(retrieveFirstName + " " + retrieveLastName)
+ }
+ }
+
+ override fun onCancelled(error: DatabaseError) {}
+ })
+ }
+ else
+ fullName!!.setText("Guest User")
}
- private fun fetchQuestionCount() {
+ private fun fetchQuestionCount()
+ {
difficulty = (difficultySpinner!!.selectedItem as String?)?.lowercase()
val category_value = resources.getStringArray(R.array.values2)[categorySpinner!!.selectedItemId.toInt()].toInt()
+
+ if (category_value == 0)
+ {
+ Toast.makeText(applicationContext, "Select a Category.", Toast.LENGTH_SHORT).show()
+ loading!!.visibility = View.GONE
+ startQuizButton!!.visibility = View.VISIBLE
+ return
+ }
+
val retrofit: Retrofit = Retrofit.Builder()
.baseUrl(Api.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
@@ -111,7 +169,8 @@ class MainActivity : AppCompatActivity() {
})
}
- fun fetchQuestionAPI(categoryCount: Int) {
+ fun fetchQuestionAPI(categoryCount: Int)
+ {
q = Question(applicationContext)
val category_value = resources.getStringArray(R.array.values2)[categorySpinner!!.selectedItemId.toInt()].toInt()
val retrofit = Retrofit.Builder()
@@ -186,7 +245,8 @@ class MainActivity : AppCompatActivity() {
})
}
- fun setOptions(r: Result, ran: Int) {
+ fun setOptions(r: Result, ran: Int)
+ {
val wrong: List
when (ran) {
0 -> {
@@ -301,4 +361,11 @@ class MainActivity : AppCompatActivity() {
val timeOfDay = c[Calendar.HOUR_OF_DAY]
return if (timeOfDay < 12) "Morning" else if (timeOfDay < 16) "Afternoon" else if (timeOfDay < 21) "Evening" else "Night"
}
+
+ private fun SendToActivity(activityClass: Class, backEnabled: Boolean) {
+ val intent = Intent(this, activityClass)
+ if (!backEnabled) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ startActivity(intent)
+ if (!backEnabled) finish()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mr_17/queezy/activity/SplashActivity.kt b/app/src/main/java/com/mr_17/queezy/activity/SplashActivity.kt
index 75585ec..d78dd87 100644
--- a/app/src/main/java/com/mr_17/queezy/activity/SplashActivity.kt
+++ b/app/src/main/java/com/mr_17/queezy/activity/SplashActivity.kt
@@ -4,18 +4,59 @@ import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
+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.ValueEventListener
import com.mr_17.queezy.R
+import com.mr_17.queezy.model.FirebaseModel
class SplashActivity : AppCompatActivity() {
+ private var myAuth: FirebaseAuth? = null
+ private var currentUser: FirebaseUser? = null
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
+
+ InitializeFields()
+
Handler().postDelayed({
- var intent = Intent(this@SplashActivity, WelcomeActivity::class.java)
+ var intent: Intent
+ if(currentUser == null) {
+ intent = Intent(this@SplashActivity, WelcomeActivity::class.java)
+ }
+ else
+ {
+ CheckJoining()
+ intent = Intent(this@SplashActivity, MainActivity::class.java)
+ }
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
startActivity(intent)
finish()
}, 3000)
}
+
+ private fun InitializeFields() {
+ myAuth = FirebaseAuth.getInstance()
+ currentUser = myAuth!!.currentUser
+ }
+
+ private fun CheckJoining() {
+ FirebaseModel.databaseRef_users.child(currentUser!!.uid)
+ .addValueEventListener(object : ValueEventListener {
+ override fun onDataChange(snapshot: DataSnapshot) {
+ if (!snapshot.child(FirebaseModel.node_joiningDate).exists()) {
+ FirebaseModel.databaseRef_users.child(currentUser!!.uid)
+ .child(FirebaseModel.node_joiningDate).setValue(
+ currentUser!!.metadata!!.creationTimestamp
+ )
+ }
+ }
+
+ override fun onCancelled(error: DatabaseError) {}
+ })
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mr_17/queezy/model/FirebaseModel.kt b/app/src/main/java/com/mr_17/queezy/model/FirebaseModel.kt
new file mode 100644
index 0000000..2c3c40a
--- /dev/null
+++ b/app/src/main/java/com/mr_17/queezy/model/FirebaseModel.kt
@@ -0,0 +1,15 @@
+package com.mr_17.queezy.model
+
+import com.google.firebase.database.DatabaseReference
+import com.google.firebase.database.FirebaseDatabase
+
+object FirebaseModel {
+ var node_users = "Users"
+ var node_uid = "uid"
+ var node_firstName = "firstName"
+ var node_lastName = "lastName"
+ var node_joiningDate = "joiningDate"
+
+ var databaseRef_root: DatabaseReference = FirebaseDatabase.getInstance().getReference()
+ var databaseRef_users: DatabaseReference = databaseRef_root.child(node_users)
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_create_account.xml b/app/src/main/res/layout/activity_create_account.xml
index 58c0a13..030bd64 100644
--- a/app/src/main/res/layout/activity_create_account.xml
+++ b/app/src/main/res/layout/activity_create_account.xml
@@ -174,7 +174,7 @@
android:layout_height="wrap_content"
android:fontFamily="@font/rubik"
android:gravity="center"
- android:text="Password"
+ android:text="Confirm Password"
android:textColor="@color/purple_black"
android:textSize="16dp"
android:layout_marginTop="25dp"
@@ -192,7 +192,7 @@
android:layout_marginTop="10dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
- android:hint="Your password"
+ android:hint="Your password confirmation"
android:textColorHint="@color/grey"
android:inputType="textPassword"
android:textAllCaps="false"
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 78804ac..7cb6290 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -29,13 +29,13 @@
android:fontFamily="@font/rubik_medium"
android:layout_marginTop="8dp"
android:gravity="center"
- android:text="Guest User"
android:textColor="@color/white"
android:textSize="26dp"
app:layout_constraintTop_toBottomOf="@id/wishing_msg"
app:layout_constraintStart_toStartOf="@+id/wishing_msg" />