From 217d1ee58526f2098491ccae7f7ebfac05d9e336 Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 12:32:16 +0100 Subject: [PATCH 01/37] activity_profile.xml: add the profile layout --- app/src/main/res/layout/activity_profile.xml | 74 ++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 app/src/main/res/layout/activity_profile.xml diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml new file mode 100644 index 000000000..2e1e07720 --- /dev/null +++ b/app/src/main/res/layout/activity_profile.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file From 57063e9fd56e2a9dd7dc0da7b48d3e8b763c2404 Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:25:07 +0100 Subject: [PATCH 02/37] strings.xml: fix the conflict --- app/src/main/res/values/strings.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c34b07ed0..d5924ea5f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,4 +5,9 @@ Enter Enter S C O R E B O A R D + Best Score + Total Games + Correct Songs + Ranking +>>>>>>> 23f6fa9 (strings.xml: new strings used for table in profile) \ No newline at end of file From 7e72d821bdc383df6b9ae127fb42dfcace57bb6e Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 22:59:54 +0100 Subject: [PATCH 03/37] activity_profile.xml: basic profile --- app/src/main/res/layout/activity_profile.xml | 158 ++++++++++++++----- 1 file changed, 117 insertions(+), 41 deletions(-) diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml index 2e1e07720..c2601826c 100644 --- a/app/src/main/res/layout/activity_profile.xml +++ b/app/src/main/res/layout/activity_profile.xml @@ -5,31 +5,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".profile.ProfileSetup" - android:layout_marginTop="@dimen/mtrl_toolbar_default_height"> - - - - - - + android:layout_marginTop="@dimen/mtrl_toolbar_default_height" + > - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 8152aff76bc0a965db2bba21f6e7faf77ccebf2c Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:00:12 +0100 Subject: [PATCH 04/37] table_shape.xml: design for the profile table --- app/src/main/res/drawable/table_shape.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/src/main/res/drawable/table_shape.xml diff --git a/app/src/main/res/drawable/table_shape.xml b/app/src/main/res/drawable/table_shape.xml new file mode 100644 index 000000000..83104ad3d --- /dev/null +++ b/app/src/main/res/drawable/table_shape.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From b4304d065b702d113b46ccb3720ccb31cced5241 Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:00:46 +0100 Subject: [PATCH 05/37] UserProfile.kt: userProfile data class --- .../main/java/ch/sdp/vibester/profile/UserProfile.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/src/main/java/ch/sdp/vibester/profile/UserProfile.kt diff --git a/app/src/main/java/ch/sdp/vibester/profile/UserProfile.kt b/app/src/main/java/ch/sdp/vibester/profile/UserProfile.kt new file mode 100644 index 000000000..44a978e51 --- /dev/null +++ b/app/src/main/java/ch/sdp/vibester/profile/UserProfile.kt @@ -0,0 +1,10 @@ +package ch.sdp.vibester.profile + +data class UserProfile( + val handle: String = "", + val username: String = "", + val image: String = "", + val totalGames: Int = 0, + val bestScore: Int = 0, + val correctSongs: Int = 0, + val ranking: Int = 0) \ No newline at end of file From 23f7a4be8f94342f429bafe59c94eb41184d5acc Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:01:44 +0100 Subject: [PATCH 06/37] ProfileSetup.kt: set profile activity --- .../java/ch/sdp/vibester/profile/ProfileSetup.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt diff --git a/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt new file mode 100644 index 000000000..3901df950 --- /dev/null +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt @@ -0,0 +1,14 @@ +package ch.sdp.vibester.profile + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.widget.TextView +import ch.sdp.vibester.R + + +class ProfileSetup: AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_profile) + } +} \ No newline at end of file From 58771e426083e7cd58d0f8dff095fd1a55335cfa Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:02:34 +0100 Subject: [PATCH 07/37] ProfileSetup.kt: initialize user data --- .../java/ch/sdp/vibester/profile/ProfileSetup.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 3901df950..70ca87e8e 100644 --- a/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt @@ -10,5 +10,18 @@ class ProfileSetup: AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_profile) + private fun setupProfile(user: UserProfile){ + findViewById(R.id.handle).text = user.handle + findViewById(R.id.username).text = user.username + findViewById(R.id.totalGames).text = user.totalGames.toString() + findViewById(R.id.correctSongs).text = user.correctSongs.toString() + findViewById(R.id.bestScore).text = user.bestScore.toString() + findViewById(R.id.ranking).text = user.ranking.toString() + Glide.with(this) + .load(image) + .circleCrop() + .into(binding.imageView) } + + } \ No newline at end of file From 7b0caa26a0498f5246dc0451abebd5783c36f7ad Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:03:39 +0100 Subject: [PATCH 08/37] ProfileSetup.kt: extract ID to retrieve user's data --- app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt | 8 ++++++++ 1 file changed, 8 insertions(+) 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 70ca87e8e..5a2a28eea 100644 --- a/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt @@ -10,6 +10,14 @@ class ProfileSetup: AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_profile) + val bundle = intent.extras; + val userID: String? = bundle?.getString("userID") + val dataProvider = userID?.let { ProfileDataProvider(it) } + val user = dataProvider!!.getUserData() + + setupProfile(user); + } + private fun setupProfile(user: UserProfile){ findViewById(R.id.handle).text = user.handle findViewById(R.id.username).text = user.username From 9dc3a2c6b5127faed1171ac3555f71088b530294 Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:06:28 +0100 Subject: [PATCH 09/37] ProfileSetup.kt: remove useless code --- app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt | 6 ------ 1 file changed, 6 deletions(-) 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 5a2a28eea..eed8d3d5b 100644 --- a/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileSetup.kt @@ -25,11 +25,5 @@ class ProfileSetup: AppCompatActivity() { findViewById(R.id.correctSongs).text = user.correctSongs.toString() findViewById(R.id.bestScore).text = user.bestScore.toString() findViewById(R.id.ranking).text = user.ranking.toString() - Glide.with(this) - .load(image) - .circleCrop() - .into(binding.imageView) } - - } \ No newline at end of file From 0c58e9a12d91ac37f4ffa7a65e0ce5a63828631f Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:19:14 +0100 Subject: [PATCH 10/37] ProfileDataProvider.kt: class to retrieve profile data --- .../vibester/profile/ProfileDataProvider.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt diff --git a/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt b/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt new file mode 100644 index 000000000..8d3ea09cc --- /dev/null +++ b/app/src/main/java/ch/sdp/vibester/profile/ProfileDataProvider.kt @@ -0,0 +1,27 @@ +package ch.sdp.vibester.profile + +class ProfileDataProvider(userID: String) { + private lateinit var user: UserProfile + private val userID = userID + + private val users: List = listOf( + UserProfile("user0", "username0","", 5, 8, 34), + UserProfile("user1", "username1", "", 5, 8, 34), + UserProfile("user2", "username2", "", 5, 8, 34), + UserProfile("user3", "username3", "", 5, 8, 34), + UserProfile("user4", "username4", "", 5, 8, 34), + UserProfile("user5", "username5", "", 5, 8, 34) + ) +// private val globalRanking: List + + + fun getUserData():UserProfile{ +// TODO: get data from the Firebase based on id + return users[userID.toInt()] + } + + fun getUserRanking(){ + // TODO: get user ranking from the firebase + } + +} \ No newline at end of file From 83e8501b5ba0256640bbd0153b51e8b07e930bb5 Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:25:43 +0100 Subject: [PATCH 11/37] strings.xml: fix the conflict --- app/src/main/res/values/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5924ea5f..c0c4dad38 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,5 +9,4 @@ Total Games Correct Songs Ranking ->>>>>>> 23f6fa9 (strings.xml: new strings used for table in profile) \ No newline at end of file From 105008f18f1ad69564cf90537b6923c09be56694 Mon Sep 17 00:00:00 2001 From: Kamila Babayeva Date: Wed, 9 Mar 2022 23:27:24 +0100 Subject: [PATCH 12/37] MainActivity.kt: fix the conflict --- app/src/main/java/ch/sdp/vibester/MainActivity.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/ch/sdp/vibester/MainActivity.kt b/app/src/main/java/ch/sdp/vibester/MainActivity.kt index f97703275..f0f6c1958 100644 --- a/app/src/main/java/ch/sdp/vibester/MainActivity.kt +++ b/app/src/main/java/ch/sdp/vibester/MainActivity.kt @@ -6,6 +6,7 @@ import android.widget.Button import android.widget.EditText import androidx.appcompat.app.AppCompatActivity import ch.sdp.vibester.scoreboard.ScoreBoardActivity +import ch.sdp.vibester.profile.ProfileSetup class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -15,11 +16,12 @@ class MainActivity : AppCompatActivity() { val txtInput = findViewById(R.id.mainNameInput) val btnGreeting = findViewById