From 557bc4b7c0be38d0b22edaf795fd1333a444188f Mon Sep 17 00:00:00 2001 From: MiHi Date: Sat, 6 May 2023 10:36:35 +0530 Subject: [PATCH 1/5] Intergrated with the volunteering --- .idea/.name | 1 - app/build.gradle | 3 + app/src/main/AndroidManifest.xml | 43 ++- .../java/com/example/groapp/MainActivity.kt | 61 ++++ .../java/com/example/groapp/ProfileMain.kt | 97 ++++++ .../java/com/example/groapp/SignInActivity.kt | 4 +- .../java/com/example/groapp/SignUpActivity.kt | 4 +- .../java/com/example/groapp/UserSingleton.kt | 7 + .../activities/FetchingActivity.kt | 13 +- .../activities/InsertionActivity.kt | 12 +- .../volunteering/activities/VolunteerMain.kt | 4 +- .../activities/VolunteeringDetailsActivity.kt | 13 +- .../volunteering/adapters/VolAdapter.kt | 6 +- .../volunteering/models/VolunteeringModel.kt | 2 +- .../groapp/volunteering/services/volHours.kt | 7 + app/src/main/res/drawable/background01.png | Bin 0 -> 139303 bytes .../res/drawable/baseline_lightbulb_24.xml | 5 + .../res/drawable/baseline_newspaper_24.xml | 5 + .../res/drawable/drop_shadow_rectangle.xml | 80 +++++ app/src/main/res/drawable/ic_add.xml | 5 + app/src/main/res/drawable/ic_android.xml | 7 + app/src/main/res/drawable/ic_apps.xml | 9 + app/src/main/res/drawable/ic_arrow.xml | 5 + app/src/main/res/drawable/ic_comment.xml | 9 + app/src/main/res/drawable/ic_email.xml | 5 + app/src/main/res/drawable/ic_home.xml | 10 + app/src/main/res/drawable/ic_notification.xml | 5 + app/src/main/res/drawable/ic_person.xml | 5 + app/src/main/res/drawable/ic_phone.xml | 5 + .../main/res/drawable/ic_question_answer.xml | 10 + app/src/main/res/drawable/ic_shopping.xml | 5 + app/src/main/res/drawable/ic_twitter.xml | 4 + app/src/main/res/drawable/profile.png | Bin 0 -> 180216 bytes app/src/main/res/drawable/profile_bg.xml | 7 + app/src/main/res/drawable/round_user.xml | 6 + app/src/main/res/drawable/signin_screen.png | Bin 0 -> 10940 bytes app/src/main/res/drawable/signup_screen.png | Bin 0 -> 10932 bytes app/src/main/res/drawable/slider.png | Bin 0 -> 1098150 bytes .../res/drawable/user_profile_background.xml | 74 ++++ app/src/main/res/layout/activity_main.xml | 61 ++++ app/src/main/res/layout/activity_sign_in.xml | 85 +++++ app/src/main/res/layout/activity_sign_up.xml | 315 +++++------------- .../layout/activity_volunteering_details.xml | 190 +++++++++++ app/src/main/res/layout/profile_item_add.xml | 112 +++++++ .../main/res/layout/profile_item_email.xml | 54 +++ .../main/res/layout/profile_item_image.xml | 117 +++++++ app/src/main/res/layout/profile_item_info.xml | 53 +++ app/src/main/res/layout/user_profile.xml | 104 ++++++ .../main/res/layout/user_update_dialog.xml | 26 ++ app/src/main/res/layout/vol_list_item.xml | 119 +++++++ app/src/main/res/layout/volunteer_form.xml | 138 ++++++++ app/src/main/res/layout/volunteer_main.xml | 42 +++ .../layout/volunteering_activity_fetching.xml | 37 ++ .../res/layout/volunteering_update_dialog.xml | 33 ++ app/src/main/res/values/colors.xml | 13 +- app/src/main/res/values/themes.xml | 20 ++ build.gradle | 4 +- 57 files changed, 1797 insertions(+), 264 deletions(-) delete mode 100644 .idea/.name create mode 100644 app/src/main/java/com/example/groapp/MainActivity.kt create mode 100644 app/src/main/java/com/example/groapp/ProfileMain.kt create mode 100644 app/src/main/java/com/example/groapp/UserSingleton.kt create mode 100644 app/src/main/java/com/example/groapp/volunteering/services/volHours.kt create mode 100644 app/src/main/res/drawable/background01.png create mode 100644 app/src/main/res/drawable/baseline_lightbulb_24.xml create mode 100644 app/src/main/res/drawable/baseline_newspaper_24.xml create mode 100644 app/src/main/res/drawable/drop_shadow_rectangle.xml create mode 100644 app/src/main/res/drawable/ic_add.xml create mode 100644 app/src/main/res/drawable/ic_android.xml create mode 100644 app/src/main/res/drawable/ic_apps.xml create mode 100644 app/src/main/res/drawable/ic_arrow.xml create mode 100644 app/src/main/res/drawable/ic_comment.xml create mode 100644 app/src/main/res/drawable/ic_email.xml create mode 100644 app/src/main/res/drawable/ic_home.xml create mode 100644 app/src/main/res/drawable/ic_notification.xml create mode 100644 app/src/main/res/drawable/ic_person.xml create mode 100644 app/src/main/res/drawable/ic_phone.xml create mode 100644 app/src/main/res/drawable/ic_question_answer.xml create mode 100644 app/src/main/res/drawable/ic_shopping.xml create mode 100644 app/src/main/res/drawable/ic_twitter.xml create mode 100644 app/src/main/res/drawable/profile.png create mode 100644 app/src/main/res/drawable/profile_bg.xml create mode 100644 app/src/main/res/drawable/round_user.xml create mode 100644 app/src/main/res/drawable/signin_screen.png create mode 100644 app/src/main/res/drawable/signup_screen.png create mode 100644 app/src/main/res/drawable/slider.png create mode 100644 app/src/main/res/drawable/user_profile_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/layout/activity_sign_in.xml create mode 100644 app/src/main/res/layout/activity_volunteering_details.xml create mode 100644 app/src/main/res/layout/profile_item_add.xml create mode 100644 app/src/main/res/layout/profile_item_email.xml create mode 100644 app/src/main/res/layout/profile_item_image.xml create mode 100644 app/src/main/res/layout/profile_item_info.xml create mode 100644 app/src/main/res/layout/user_profile.xml create mode 100644 app/src/main/res/layout/user_update_dialog.xml create mode 100644 app/src/main/res/layout/vol_list_item.xml create mode 100644 app/src/main/res/layout/volunteer_form.xml create mode 100644 app/src/main/res/layout/volunteer_main.xml create mode 100644 app/src/main/res/layout/volunteering_activity_fetching.xml create mode 100644 app/src/main/res/layout/volunteering_update_dialog.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index dc50db0..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -GroApp \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1fb09f3..a02545a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,6 +31,9 @@ android { kotlinOptions { jvmTarget = '1.8' } + buildFeatures { + viewBinding true + } } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 948fc1d..edd2af5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,9 +34,6 @@ - @@ -85,10 +82,6 @@ - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/example/groapp/MainActivity.kt b/app/src/main/java/com/example/groapp/MainActivity.kt new file mode 100644 index 0000000..ebc3885 --- /dev/null +++ b/app/src/main/java/com/example/groapp/MainActivity.kt @@ -0,0 +1,61 @@ +package com.example.groapp + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import android.widget.Button +import android.widget.TextView +import com.example.groapp.volunteering.activities.VolunteerMain +import com.google.firebase.auth.ktx.auth +import com.google.firebase.ktx.Firebase +import kotlin.math.log + +class MainActivity : AppCompatActivity() { + + private lateinit var volunteerfun: Button + private lateinit var signout: Button + private lateinit var profile: Button + private lateinit var tvUserEmail: TextView + private lateinit var tvUserUUI: TextView + + + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val user = Firebase.auth.currentUser + user?.let { + UserSingleton.name = it.displayName + UserSingleton.email = it.email + UserSingleton.uid = it.uid + } + + tvUserEmail = findViewById(R.id.tvUserEmail) + tvUserUUI = findViewById(R.id.tvUserUUI) + volunteerfun = findViewById(R.id.volunteer) + signout = findViewById(R.id.signout) + profile = findViewById(R.id.profile) + + tvUserEmail.text = UserSingleton.email + tvUserUUI.text = UserSingleton.uid + + + volunteerfun.setOnClickListener { + val intent = Intent(this, VolunteerMain::class.java) + startActivity(intent) + } + + signout.setOnClickListener { + Firebase.auth.signOut() + } + + profile.setOnClickListener { + val intent = Intent(this, ProfileMain::class.java) + startActivity(intent) + } + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/groapp/ProfileMain.kt b/app/src/main/java/com/example/groapp/ProfileMain.kt new file mode 100644 index 0000000..00c8444 --- /dev/null +++ b/app/src/main/java/com/example/groapp/ProfileMain.kt @@ -0,0 +1,97 @@ +package com.example.groapp + +import android.app.AlertDialog +import android.os.Bundle +import android.util.Log +import android.view.View +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import com.example.groapp.volunteering.models.VolunteeringModel +import com.google.firebase.auth.ktx.auth +import com.google.firebase.auth.ktx.userProfileChangeRequest +import com.google.firebase.database.FirebaseDatabase +import com.google.firebase.ktx.Firebase + + + +class ProfileMain : AppCompatActivity() { + + private lateinit var userName: TextView + private lateinit var btnUpdate: Button + private lateinit var userEmail: TextView + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.user_profile) + + btnUpdate = findViewById(R.id.btnUpdate) + userName = findViewById(R.id.userName) + userEmail = findViewById(R.id.userEmail) + + btnUpdate.setOnClickListener { + openUpdateDialog() } + + + + if ( UserSingleton.name != null){ + btnUpdate.visibility = View.GONE + } + + userName.text = UserSingleton.name; + userEmail.text = UserSingleton.email; + } + + + + + private fun openUpdateDialog() { + val mDialog = AlertDialog.Builder(this) + val inflater = layoutInflater + val mDialogView = inflater.inflate(R.layout.user_update_dialog, null) + + mDialog.setView(mDialogView) + + val etUserName = mDialogView.findViewById(R.id.etUserName) + + val btnUpdateData = mDialogView.findViewById - - - - - - + android:layout_height="wrap_content" + android:hint="Type your Email" + android:inputType="textEmailAddress" /> + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_volunteering_details.xml b/app/src/main/res/layout/activity_volunteering_details.xml new file mode 100644 index 0000000..7a8006d --- /dev/null +++ b/app/src/main/res/layout/activity_volunteering_details.xml @@ -0,0 +1,190 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/volunteer_main.xml b/app/src/main/res/layout/volunteer_main.xml new file mode 100644 index 0000000..381c731 --- /dev/null +++ b/app/src/main/res/layout/volunteer_main.xml @@ -0,0 +1,42 @@ + + + + + +