From 9a2552e02c2be3e6af204c9ad05af7c7e71848a0 Mon Sep 17 00:00:00 2001 From: "Your laurynas.lopata@epfl.ch" Date: Sun, 13 Mar 2022 23:28:52 +0100 Subject: [PATCH 01/10] Implemented edit username --- app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 103 +++++++++--------- .../java/ch/sdp/vibester/profile/EditUser.kt | 18 +++ .../vibester/profile/ProfileDataProvider.kt | 4 +- .../ch/sdp/vibester/profile/ProfileSetup.kt | 35 +++++- .../main/res/layout/activity_edit_user.xml | 103 ++++++++++++++++++ app/src/main/res/layout/activity_profile.xml | 16 +++ app/src/main/res/values/strings.xml | 1 + 8 files changed, 229 insertions(+), 53 deletions(-) create mode 100644 app/src/main/java/ch/sdp/vibester/profile/EditUser.kt create mode 100644 app/src/main/res/layout/activity_edit_user.xml diff --git a/app/build.gradle b/app/build.gradle index df5a53915..5a4abf82e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,6 +52,8 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'com.google.firebase:firebase-auth-ktx:21.0.1' implementation 'com.squareup.okhttp3:okhttp:4.9.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.13.2' testImplementation 'org.json:json:20180813' testImplementation 'org.robolectric:robolectric:4.6' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e19b26012..c1e74ff27 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,51 +1,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ch/sdp/vibester/profile/EditUser.kt b/app/src/main/java/ch/sdp/vibester/profile/EditUser.kt new file mode 100644 index 000000000..d6c1d1198 --- /dev/null +++ b/app/src/main/java/ch/sdp/vibester/profile/EditUser.kt @@ -0,0 +1,18 @@ +package ch.sdp.vibester.profile + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import ch.sdp.vibester.R + +class EditUser : AppCompatActivity() { + + private var popupTitle = "" + private var popupText = "" + private var popupButton = "" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + overridePendingTransition(0, 0) + setContentView(R.layout.activity_edit_user) + } +} \ No newline at end of file diff --git a/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt b/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt index 13bc31158..54a0edaa7 100644 --- a/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt @@ -2,7 +2,7 @@ package ch.sdp.vibester.profile class ProfileDataProvider(userID: String, users: List = emptyList(), scoreboard: List = emptyList()) { private lateinit var user: UserProfile - private val userID:Int = userID.toInt() + private val userID: Int = userID.toInt() private lateinit var users: List private lateinit var scoreboard: List @@ -53,7 +53,7 @@ class ProfileDataProvider(userID: String, users: List = emptyList() /** * Retrieve profile data of user. */ - private fun getUserData():UserProfile { + private fun getUserData(): UserProfile { return users[userID] } diff --git a/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt index 020c89ddf..3b9b3b8c4 100644 --- a/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt @@ -1,9 +1,15 @@ package ch.sdp.vibester.profile +import android.content.DialogInterface import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import android.text.InputType +import android.view.LayoutInflater +import android.widget.Button +import android.widget.EditText import android.widget.ImageView import android.widget.TextView +import androidx.appcompat.app.AlertDialog import ch.sdp.vibester.R const val EXTRA_ID = "userProfile" @@ -14,9 +20,36 @@ class ProfileSetup: AppCompatActivity() { val bundle = intent.extras; val user: UserProfile = bundle?.getSerializable(EXTRA_ID) as UserProfile setupProfile(user) + + val editUsername = findViewById