From 3228dbd51b7dcbb1f27145c071d875c1613394dc Mon Sep 17 00:00:00 2001
From: Ashutosh Aswal <75999921+yellowHatpro@users.noreply.github.com>
Date: Sat, 26 Mar 2022 21:32:23 +0530
Subject: [PATCH 1/6] initial profile section
---
app/build.gradle | 1 +
app/src/main/AndroidManifest.xml | 31 +++++-----
.../features/login/LoginActivity.kt | 9 ++-
.../features/userprofile/ProfileActivity.kt | 48 +++++++++++++++
.../userprofile/ProfileViewPagerAdapter.kt | 29 +++++++++
.../CollectionsFragment.kt | 60 +++++++++++++++++++
.../profile_section/ProfileFragment.kt | 22 +++++++
.../ratings_section/RatingsFragment.kt | 60 +++++++++++++++++++
.../SubscribersFragment.kt | 60 +++++++++++++++++++
.../SubscriptionsFragment.kt | 20 +++++++
.../userprofile/tags_section/TagsFragment.kt | 60 +++++++++++++++++++
.../main/res/layout/activity_dashboard.xml | 4 +-
app/src/main/res/layout/activity_profile.xml | 24 ++++++++
.../main/res/layout/fragment_collections.xml | 14 +++++
app/src/main/res/layout/fragment_profile.xml | 14 +++++
app/src/main/res/layout/fragment_ratings.xml | 14 +++++
.../main/res/layout/fragment_subscribers.xml | 14 +++++
.../res/layout/fragment_subscriptions.xml | 14 +++++
app/src/main/res/layout/fragment_tags.xml | 14 +++++
19 files changed, 492 insertions(+), 20 deletions(-)
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
create mode 100644 app/src/main/res/layout/activity_profile.xml
create mode 100644 app/src/main/res/layout/fragment_collections.xml
create mode 100644 app/src/main/res/layout/fragment_profile.xml
create mode 100644 app/src/main/res/layout/fragment_ratings.xml
create mode 100644 app/src/main/res/layout/fragment_subscribers.xml
create mode 100644 app/src/main/res/layout/fragment_subscriptions.xml
create mode 100644 app/src/main/res/layout/fragment_tags.xml
diff --git a/app/build.gradle b/app/build.gradle
index 61394f3c..da0f387d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -97,6 +97,7 @@ dependencies {
//Image downloading and Caching library
implementation 'com.github.bumptech.glide:glide:4.13.1'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt 'com.github.bumptech.glide:compiler:4.13.1'
//Fragment Setup For Kotlin
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d72cf612..00957554 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -25,7 +25,9 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="31">
-
+
+ android:exported="true"
+ android:theme="@style/AppThemeNoActionBar">
+
@@ -60,16 +63,16 @@
+ android:parentActivityName=".presentation.features.collection.CollectionActivity">
+ android:exported="true"
+ android:label="@string/auth_title">
@@ -112,19 +115,18 @@
android:name=".presentation.features.dashboard.DonateActivity"
android:label="@string/donate_title" />
-
+
-
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/login/LoginActivity.kt b/app/src/main/java/org/metabrainz/android/presentation/features/login/LoginActivity.kt
index 456fc29c..70308d24 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/login/LoginActivity.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/login/LoginActivity.kt
@@ -15,6 +15,7 @@ import org.metabrainz.android.data.sources.api.entities.userdata.UserInfo
import org.metabrainz.android.databinding.ActivityLoginBinding
import org.metabrainz.android.presentation.features.base.MusicBrainzActivity
import org.metabrainz.android.presentation.features.dashboard.DashboardActivity
+import org.metabrainz.android.presentation.features.userprofile.ProfileActivity
import org.metabrainz.android.util.Log.d
@AndroidEntryPoint
@@ -39,9 +40,11 @@ class LoginActivity : MusicBrainzActivity() {
)
}
if (LoginSharedPreferences.loginStatus == LoginSharedPreferences.STATUS_LOGGED_IN) {
- binding!!.loginPromptId.setText(R.string.logout_prompt)
- binding!!.loginBtn.setText(R.string.logout)
- binding!!.loginBtn.setOnClickListener { logoutUser() }
+ startActivity(Intent(this,ProfileActivity::class.java))
+ finish()
+// binding!!.loginPromptId.setText(R.string.logout_prompt)
+// binding!!.loginBtn.setText(R.string.logout)
+// binding!!.loginBtn.setOnClickListener { logoutUser() }
} else binding!!.loginBtn.setOnClickListener { startLogin() }
}
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
new file mode 100644
index 00000000..9e8a97e4
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
@@ -0,0 +1,48 @@
+package org.metabrainz.android.presentation.features.userprofile
+
+import android.graphics.drawable.ColorDrawable
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.view.MenuItem
+import com.google.android.material.tabs.TabLayoutMediator
+import org.metabrainz.android.R
+import org.metabrainz.android.databinding.ActivityProfileBinding
+
+class ProfileActivity : AppCompatActivity() {
+ lateinit var binding: ActivityProfileBinding
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ binding= ActivityProfileBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ supportActionBar!!.setBackgroundDrawable(ColorDrawable(resources.getColor(R.color.app_bg)))
+ supportActionBar!!.title = "User Profile"
+ supportActionBar!!.setDisplayHomeAsUpEnabled(true)
+
+ val pagerAdapter= ProfileViewPagerAdapter(this)
+ binding.profilePager.adapter = pagerAdapter
+ TabLayoutMediator(binding.profileTabLayout, binding.profilePager){tab,position->
+ run{
+ when(position){
+ 0->tab.text = "Profile"
+ 1->tab.text = "Subscriptions"
+ 2->tab.text = "Subscribers"
+ 3->tab.text = "Collections"
+ 4->tab.text = "Tags"
+ 5->tab.text = "Ratings"
+ }
+ }
+
+ }.attach()
+
+ }
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ return when (item.itemId) {
+ android.R.id.home -> {
+ onBackPressed()
+ true
+ }
+ else -> super.onOptionsItemSelected(item)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt
new file mode 100644
index 00000000..93fdad99
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt
@@ -0,0 +1,29 @@
+package org.metabrainz.android.presentation.features.userprofile
+
+import androidx.appcompat.app.AppCompatActivity
+import androidx.fragment.app.Fragment
+import androidx.viewpager2.adapter.FragmentStateAdapter
+import org.metabrainz.android.presentation.features.userprofile.collections_section.CollectionsFragment
+import org.metabrainz.android.presentation.features.userprofile.profile_section.ProfileFragment
+import org.metabrainz.android.presentation.features.userprofile.ratings_section.RatingsFragment
+import org.metabrainz.android.presentation.features.userprofile.subscribers_section.SubscribersFragment
+import org.metabrainz.android.presentation.features.userprofile.subscriptions_section.SubscriptionsFragment
+import org.metabrainz.android.presentation.features.userprofile.tags_section.TagsFragment
+
+class ProfileViewPagerAdapter(appCompatActivity: AppCompatActivity): FragmentStateAdapter(appCompatActivity) {
+ override fun getItemCount(): Int {
+ return 6
+ }
+
+ override fun createFragment(position: Int): Fragment {
+ return when(position){
+ 0 -> ProfileFragment()
+ 1-> SubscriptionsFragment()
+ 2-> SubscribersFragment()
+ 3-> CollectionsFragment()
+ 4-> TagsFragment()
+ else -> RatingsFragment()
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
new file mode 100644
index 00000000..e15054bd
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
@@ -0,0 +1,60 @@
+package org.metabrainz.android.presentation.features.userprofile.collections_section
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import org.metabrainz.android.R
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [CollectionsFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class CollectionsFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_collections, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment CollectionsFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ CollectionsFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
new file mode 100644
index 00000000..5810a0ff
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
@@ -0,0 +1,22 @@
+package org.metabrainz.android.presentation.features.userprofile.profile_section
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import org.metabrainz.android.R
+import org.metabrainz.android.databinding.FragmentProfileBinding
+
+class ProfileFragment : Fragment() {
+ lateinit var binding: FragmentProfileBinding
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ // Inflate the layout for this fragment
+ binding = FragmentProfileBinding.inflate(inflater,container,false)
+ return binding.root
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
new file mode 100644
index 00000000..542d931e
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
@@ -0,0 +1,60 @@
+package org.metabrainz.android.presentation.features.userprofile.ratings_section
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import org.metabrainz.android.R
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [RatingsFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class RatingsFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_ratings, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment RatingsFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ RatingsFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
new file mode 100644
index 00000000..8b185472
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
@@ -0,0 +1,60 @@
+package org.metabrainz.android.presentation.features.userprofile.subscribers_section
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import org.metabrainz.android.R
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [SubscribersFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class SubscribersFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_subscribers, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment SubscribersFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ SubscribersFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
new file mode 100644
index 00000000..55fa5e14
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
@@ -0,0 +1,20 @@
+package org.metabrainz.android.presentation.features.userprofile.subscriptions_section
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import org.metabrainz.android.databinding.FragmentSubscriptionsBinding
+
+
+class SubscriptionsFragment : Fragment() {
+ private lateinit var binding: FragmentSubscriptionsBinding
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ binding = FragmentSubscriptionsBinding.inflate(layoutInflater,container,false)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
new file mode 100644
index 00000000..f914ab8d
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
@@ -0,0 +1,60 @@
+package org.metabrainz.android.presentation.features.userprofile.tags_section
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import org.metabrainz.android.R
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [TagsFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class TagsFragment : Fragment() {
+ // TODO: Rename and change types of parameters
+ private var param1: String? = null
+ private var param2: String? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ arguments?.let {
+ param1 = it.getString(ARG_PARAM1)
+ param2 = it.getString(ARG_PARAM2)
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_tags, container, false)
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment TagsFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance(param1: String, param2: String) =
+ TagsFragment().apply {
+ arguments = Bundle().apply {
+ putString(ARG_PARAM1, param1)
+ putString(ARG_PARAM2, param2)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_dashboard.xml b/app/src/main/res/layout/activity_dashboard.xml
index c6d71239..de28951c 100644
--- a/app/src/main/res/layout/activity_dashboard.xml
+++ b/app/src/main/res/layout/activity_dashboard.xml
@@ -37,8 +37,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_collections.xml b/app/src/main/res/layout/fragment_collections.xml
new file mode 100644
index 00000000..9e84070a
--- /dev/null
+++ b/app/src/main/res/layout/fragment_collections.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_profile.xml b/app/src/main/res/layout/fragment_profile.xml
new file mode 100644
index 00000000..caa0798c
--- /dev/null
+++ b/app/src/main/res/layout/fragment_profile.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_ratings.xml b/app/src/main/res/layout/fragment_ratings.xml
new file mode 100644
index 00000000..5f9b4ca3
--- /dev/null
+++ b/app/src/main/res/layout/fragment_ratings.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_subscribers.xml b/app/src/main/res/layout/fragment_subscribers.xml
new file mode 100644
index 00000000..5d705b02
--- /dev/null
+++ b/app/src/main/res/layout/fragment_subscribers.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_subscriptions.xml b/app/src/main/res/layout/fragment_subscriptions.xml
new file mode 100644
index 00000000..8679a72a
--- /dev/null
+++ b/app/src/main/res/layout/fragment_subscriptions.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_tags.xml b/app/src/main/res/layout/fragment_tags.xml
new file mode 100644
index 00000000..7386e00a
--- /dev/null
+++ b/app/src/main/res/layout/fragment_tags.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
From 9993e6e1943d37b1c26d11df0ad8334eb50d1a12 Mon Sep 17 00:00:00 2001
From: Ashutosh Aswal <75999921+yellowHatpro@users.noreply.github.com>
Date: Mon, 4 Apr 2022 20:22:07 +0530
Subject: [PATCH 2/6] added user profile feature
---
app/build.gradle | 1 +
.../features/userprofile/ProfileTheme.kt | 45 ++++++
.../CollectionsFragment.kt | 64 +++-----
.../CollectionsSectionScreen.kt | 9 ++
.../profile_section/ProfileFragment.kt | 25 +++-
.../profile_section/ProfileSectionScreen.kt | 138 ++++++++++++++++++
.../userprofile/ratings_section/RatingBar.kt | 103 +++++++++++++
.../ratings_section/RatingsFragment.kt | 97 ++++++------
.../ratings_section/RatingsSectionScreen.kt | 80 ++++++++++
.../SubscribersFragment.kt | 64 +++-----
.../SubscribersSectionScreen.kt | 31 ++++
.../SubscriptionsFragment.kt | 52 ++++++-
.../SubscriptionsSectionScreen.kt | 80 ++++++++++
.../userprofile/tags_section/TagsFragment.kt | 93 ++++++------
.../tags_section/TagsSectionScreen.kt | 116 +++++++++++++++
app/src/main/res/drawable/ic_downvote.xml | 5 +
app/src/main/res/drawable/ic_editor_image.xml | 18 +++
app/src/main/res/drawable/ic_upvote.xml | 5 +
app/src/main/res/layout/activity_profile.xml | 3 +
.../main/res/layout/fragment_collections.xml | 14 --
app/src/main/res/layout/fragment_profile.xml | 14 --
app/src/main/res/layout/fragment_ratings.xml | 14 --
.../main/res/layout/fragment_subscribers.xml | 14 --
.../res/layout/fragment_subscriptions.xml | 14 --
app/src/main/res/layout/fragment_tags.xml | 14 --
25 files changed, 839 insertions(+), 274 deletions(-)
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileSectionScreen.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingBar.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt
create mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt
create mode 100644 app/src/main/res/drawable/ic_downvote.xml
create mode 100644 app/src/main/res/drawable/ic_editor_image.xml
create mode 100644 app/src/main/res/drawable/ic_upvote.xml
delete mode 100644 app/src/main/res/layout/fragment_collections.xml
delete mode 100644 app/src/main/res/layout/fragment_profile.xml
delete mode 100644 app/src/main/res/layout/fragment_ratings.xml
delete mode 100644 app/src/main/res/layout/fragment_subscribers.xml
delete mode 100644 app/src/main/res/layout/fragment_subscriptions.xml
delete mode 100644 app/src/main/res/layout/fragment_tags.xml
diff --git a/app/build.gradle b/app/build.gradle
index 26125711..78af339f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -140,6 +140,7 @@ dependencies {
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.animation:animation:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
+ implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0"
implementation "androidx.navigation:navigation-compose:2.5.0-alpha03"
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1'
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt
new file mode 100644
index 00000000..01e8d64a
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt
@@ -0,0 +1,45 @@
+package org.metabrainz.android.presentation.features.userprofile
+
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.MaterialTheme.shapes
+import androidx.compose.material.MaterialTheme.typography
+import androidx.compose.material.darkColors
+import androidx.compose.material.lightColors
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.graphics.Color
+
+
+//Colors
+val Appbg = Color(0xFF263238)
+val AppbgLight = Color(0xFFe0e0e0)
+val EnabledChipColor = Color(0xFFccabff)
+val DisabledChipColor = Color(0xFFd8cfe8)
+val ChipTextColor = Color(0xFF323232)
+
+private val DarkColorPalette = darkColors(
+ surface = Appbg
+)
+
+private val LightColorPalette = lightColors(
+ surface = AppbgLight
+)
+
+@Composable
+fun ProfileTheme(
+ darkTheme: Boolean = isSystemInDarkTheme(),
+ content: @Composable () -> Unit
+) {
+ val colors = if (darkTheme) {
+ DarkColorPalette
+ } else {
+ LightColorPalette
+ }
+
+ MaterialTheme(
+ colors = colors,
+ typography = typography,
+ shapes = shapes,
+ content = content
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
index e15054bd..becd9492 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
@@ -1,60 +1,36 @@
package org.metabrainz.android.presentation.features.userprofile.collections_section
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import org.metabrainz.android.R
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.platform.ComposeView
+import androidx.fragment.app.Fragment
+import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-/**
- * A simple [Fragment] subclass.
- * Use the [CollectionsFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
class CollectionsFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
- }
-
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
- ): View? {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_collections, container, false)
- }
-
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment CollectionsFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- CollectionsFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
+ ): View {
+ val view = ComposeView(requireContext())
+ view.apply {
+ setContent {
+ ProfileTheme {
+ Surface {
+ CollectionFragmentSection()
+ }
}
}
+ }
+ return view
}
+}
+
+@Composable
+fun CollectionFragmentSection(){
+ CollectionsSectionScreen()
}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt
new file mode 100644
index 00000000..e54ca70d
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt
@@ -0,0 +1,9 @@
+package org.metabrainz.android.presentation.features.userprofile.collections_section
+
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+
+@Composable
+fun CollectionsSectionScreen(){
+ Text("Coming Soon!!")
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
index 5810a0ff..de3660a5 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
@@ -5,18 +5,31 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import org.metabrainz.android.R
-import org.metabrainz.android.databinding.FragmentProfileBinding
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.platform.ComposeView
+import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
class ProfileFragment : Fragment() {
- lateinit var binding: FragmentProfileBinding
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- // Inflate the layout for this fragment
- binding = FragmentProfileBinding.inflate(inflater,container,false)
- return binding.root
+ val view = ComposeView(requireContext())
+ view.apply {
+ setContent {
+ ProfileTheme {
+ Surface {
+ ProfileFragmentScreen()
+ }
+ }
+ }
+ }
+ return view
}
+}
+@Composable
+private fun ProfileFragmentScreen(){
+ ProfileSectionScreen()
}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileSectionScreen.kt
new file mode 100644
index 00000000..7ce691b5
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileSectionScreen.kt
@@ -0,0 +1,138 @@
+package org.metabrainz.android.presentation.features.userprofile.profile_section
+
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.*
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.layout.layoutId
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.constraintlayout.compose.*
+import org.metabrainz.android.R
+
+val CardWidth = Dimension.matchParent
+val CardHeight = Dimension.value(60.dp)
+
+@Composable
+fun ProfileSectionScreen(){
+ ProfileSection()
+}
+
+@Composable
+fun ProfileSection(){
+ val constraints = ConstraintSet {
+ val image = createRefFor("mbProfileImage")
+ val nameCard = createRefFor("nameCard")
+ val mailCard = createRefFor("mailCard")
+ val tagsCard = createRefFor("tagsCard")
+ val ratingsCard = createRefFor("ratingsCard")
+ val collectionsCard = createRefFor("collectionsCard")
+ val subscriptionsCard = createRefFor("subscriptionsCard")
+ val subscribersCard = createRefFor("subscribersCard")
+
+ constrain(image){
+ top.linkTo(parent.top, margin = 12.dp)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ width = Dimension.wrapContent
+ width = Dimension.wrapContent
+ }
+
+ constrain(nameCard){
+ top.linkTo(image.bottom, margin = 12.dp)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ constrain(mailCard){
+ top.linkTo(nameCard.bottom)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ constrain(tagsCard){
+ top.linkTo(mailCard.bottom)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ constrain(ratingsCard){
+ top.linkTo(tagsCard.bottom)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ constrain(collectionsCard){
+ top.linkTo(ratingsCard.bottom)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ constrain(subscriptionsCard){
+ top.linkTo(collectionsCard.bottom)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ constrain(subscribersCard){
+ top.linkTo(subscriptionsCard.bottom)
+ start.linkTo(parent.start, margin = 12.dp)
+ end.linkTo(parent.end, margin = 12.dp)
+ width = CardWidth
+ height = CardHeight
+ }
+ }
+ ConstraintLayout(constraints, modifier = Modifier.fillMaxSize()) {
+ Image(
+ painterResource(R.drawable.ic_editor_image),
+ "MusicBrainz Profile",
+ modifier = Modifier.layoutId("mbProfileImage")
+ .size(155.dp))
+
+ ProfileCard("Name","YellowHatPro","nameCard")
+ ProfileCard("Email","yellowhatpro3119@gmail.com","mailCard")
+ ProfileCard("Tags","12","tagsCard")
+ ProfileCard("Ratings","1","ratingsCard")
+ ProfileCard("Collections","5","collectionsCard")
+ ProfileCard("Subscriptions","2","subscriptionsCard")
+ ProfileCard("Subscribers","0","subscribersCard")
+ }
+}
+
+@Composable
+fun ProfileCard(
+ key:String,
+ value:String,
+ layoutId:String,
+
+){
+ Card(modifier = Modifier
+ .layoutId(layoutId)
+ .padding(2.dp),
+ elevation = 6.dp,
+ shape = RoundedCornerShape(10.dp),
+ backgroundColor = colorResource(R.color.dark_gray)
+ ) {
+ Row(verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween,
+ modifier = Modifier.padding(10.dp)
+
+ ) {
+ Text(key, fontWeight = FontWeight.Bold, color = colorResource(R.color.white))
+ Text(value,color = colorResource(R.color.white))
+ }
+ }
+}
+
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingBar.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingBar.kt
new file mode 100644
index 00000000..9f70ae3b
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingBar.kt
@@ -0,0 +1,103 @@
+package org.metabrainz.android.presentation.features.userprofile.ratings_section
+
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.shape.GenericShape
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.SolidColor
+import kotlin.math.cos
+import kotlin.math.sin
+
+
+@Composable
+fun RatingBar(
+ rating: Float,
+ modifier: Modifier = Modifier,
+ color: Color = Color.Yellow
+) {
+ Row(modifier = modifier.wrapContentSize()) {
+ (1..5).forEach { step ->
+ val stepRating = when {
+ rating > step -> 1f
+ step.rem(rating) < 1 -> rating - (step - 1f)
+ else -> 0f
+ }
+ RatingStar(stepRating, color)
+ }
+ }
+}
+
+
+@Composable
+private fun RatingStar(
+ rating: Float,
+ ratingColor: Color = Color.Yellow,
+ backgroundColor: Color = Color.Gray
+) {
+ BoxWithConstraints(
+ modifier = Modifier
+ .fillMaxHeight()
+ .aspectRatio(1f)
+ .clip(starShape)
+ ) {
+ Canvas(modifier = Modifier.size(maxHeight)) {
+ drawRect(
+ brush = SolidColor(backgroundColor),
+ size = Size(
+ height = size.height * 1.4f,
+ width = size.width * 1.4f
+ ),
+ topLeft = Offset(
+ x = -(size.width * 0.1f),
+ y = -(size.height * 0.1f)
+ )
+ )
+ if (rating > 0) {
+ drawRect(
+ brush = SolidColor(ratingColor),
+ size = Size(
+ height = size.height * 1.1f,
+ width = size.width * rating
+ )
+ )
+ }
+ }
+ }
+}
+
+private val starShape = GenericShape { size, _ ->
+ addPath(starPath(size.height))
+}
+
+private val starPath = { size: Float ->
+ Path().apply {
+ val outerRadius: Float = size / 1.8f
+ val innerRadius: Double = outerRadius / 2.5
+ var rot: Double = Math.PI / 2 * 3
+ val cx: Float = size / 2
+ val cy: Float = size / 20 * 11
+ var x: Float
+ var y: Float
+ val step = Math.PI / 5
+
+ moveTo(cx, cy - outerRadius)
+ repeat(5) {
+ x = (cx + cos(rot) * outerRadius).toFloat()
+ y = (cy + sin(rot) * outerRadius).toFloat()
+ lineTo(x, y)
+ rot += step
+
+ x = (cx + cos(rot) * innerRadius).toFloat()
+ y = (cy + sin(rot) * innerRadius).toFloat()
+ lineTo(x, y)
+ rot += step
+ }
+ close()
+ }
+}
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
index 542d931e..9f259a94 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
@@ -1,60 +1,63 @@
package org.metabrainz.android.presentation.features.userprofile.ratings_section
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import org.metabrainz.android.R
-
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-
-/**
- * A simple [Fragment] subclass.
- * Use the [RatingsFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
-class RatingsFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
- }
+import androidx.compose.foundation.layout.*
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.ComposeView
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.ConstraintSet
+import androidx.fragment.app.Fragment
+import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
+
+
+class RatingsFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
- ): View? {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_ratings, container, false)
- }
-
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment RatingsFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- RatingsFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
+ ): View {
+ val view = ComposeView(requireContext())
+ view.apply {
+ setContent {
+ ProfileTheme {
+ Surface {
+ RatingsFragmentScreen()
+ }
}
}
+ }
+ return view
}
-}
\ No newline at end of file
+}
+
+@Composable
+fun RatingsFragmentScreen(){
+ val constraints = ConstraintSet {
+ val chipSet = createRefFor("chipSet")
+ val ratings = createRefFor("ratings")
+
+ constrain(chipSet){
+ top.linkTo(parent.top)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ constrain(ratings){
+ top.linkTo(chipSet.bottom)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ }
+ ConstraintLayout(constraints,modifier = Modifier.fillMaxSize()) {
+ val ratingEntities = listOf("Artist","Event","Label","Release Group","Recording","Work")
+ val ratedEntities = listOf(Pair("Fall Out Boy",3f),Pair("Sean Paul",4.5f),Pair("Ed Sheeren",5f))
+ RatingChipsSection(ratingEntities,"chipSet")
+ Ratings(items = ratedEntities, layoutID = "ratings")
+
+ }
+}
+
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt
new file mode 100644
index 00000000..20e91b49
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt
@@ -0,0 +1,80 @@
+package org.metabrainz.android.presentation.features.userprofile.ratings_section
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.Card
+import androidx.compose.material.Text
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.layout.layoutId
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import org.metabrainz.android.R
+import org.metabrainz.android.presentation.features.userprofile.ChipTextColor
+import org.metabrainz.android.presentation.features.userprofile.DisabledChipColor
+import org.metabrainz.android.presentation.features.userprofile.EnabledChipColor
+
+@Composable
+fun RatingChipsSection(
+ ratingEntities: List,
+ layoutID: String
+){
+ var selectedChipIndex by remember {
+ mutableStateOf(0)
+ }
+ LazyRow(verticalAlignment = Alignment.Top,
+ horizontalArrangement = Arrangement.Center,
+ modifier = Modifier.layoutId(layoutID)) {
+ items(ratingEntities.size){
+ Box(modifier = Modifier
+ .padding(start = 15.dp, top = 15.dp, bottom = 15.dp)
+ .clickable { selectedChipIndex = it }
+ .clip(RoundedCornerShape(30.dp))
+ .background(
+ if (selectedChipIndex ==it) EnabledChipColor
+ else DisabledChipColor
+ )
+ .padding(12.dp)){
+ Row {
+ Text(text = ratingEntities[it],
+ color = ChipTextColor,
+ modifier = Modifier.padding(end = 4.dp),
+ fontWeight = FontWeight.Bold)
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun Ratings(layoutID: String,items:List>){
+ LazyColumn(modifier=Modifier.padding(10.dp)
+ .layoutId(layoutID)) {
+ items(items.size) {
+ Card(
+ modifier = Modifier.fillMaxWidth()
+ .height(60.dp)
+ .padding(3.dp),
+ elevation = 3.dp,
+ shape = RoundedCornerShape(10.dp),
+ backgroundColor = colorResource(R.color.dark_gray)
+ ) {
+ Row(
+ modifier = Modifier.padding(12.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween
+ ) {
+ Text(items[it].first)
+ RatingBar(items[it].second, modifier = Modifier.height(25.dp).width(150.dp))
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
index 8b185472..c8eb9048 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
@@ -1,60 +1,36 @@
package org.metabrainz.android.presentation.features.userprofile.subscribers_section
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import org.metabrainz.android.R
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.platform.ComposeView
+import androidx.fragment.app.Fragment
+import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-/**
- * A simple [Fragment] subclass.
- * Use the [SubscribersFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
class SubscribersFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
- }
-
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
- ): View? {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_subscribers, container, false)
- }
-
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment SubscribersFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- SubscribersFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
+ ): View {
+ val view = ComposeView(requireContext())
+ view.apply {
+ setContent {
+ ProfileTheme {
+ Surface {
+ SubscribersSectionScreen()
+ }
}
}
+ }
+ return view
}
+}
+
+@Composable
+fun SubscribersSectionScreen(){
+ MockCard()
}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt
new file mode 100644
index 00000000..bfdbc368
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt
@@ -0,0 +1,31 @@
+package org.metabrainz.android.presentation.features.userprofile.subscribers_section
+
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.Card
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.unit.dp
+import org.metabrainz.android.R
+
+@Composable
+fun MockCard(){
+ Row(modifier = Modifier.fillMaxWidth()
+ .height(30.dp)
+ .padding(12.dp)) {
+ Card(modifier = Modifier.fillMaxWidth(),
+ elevation = 3.dp,
+ shape = RoundedCornerShape(10.dp),
+ backgroundColor = colorResource(R.color.dark_gray)
+ ) {
+ Row(verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.padding(13.dp)) {
+ Text("YellowHatpro")
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
index 55fa5e14..9e9e4001 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
@@ -1,20 +1,62 @@
package org.metabrainz.android.presentation.features.userprofile.subscriptions_section
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import org.metabrainz.android.databinding.FragmentSubscriptionsBinding
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.ComposeView
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.ConstraintSet
+import androidx.fragment.app.Fragment
+import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
class SubscriptionsFragment : Fragment() {
- private lateinit var binding: FragmentSubscriptionsBinding
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- binding = FragmentSubscriptionsBinding.inflate(layoutInflater,container,false)
- return binding.root
+ val view = ComposeView(requireContext())
+ view.apply {
+ setContent {
+ ProfileTheme {
+ Surface {
+ SubscriptionSectionScreen()
+ }
+ }
+ }
+ }
+ return view
+ }
+}
+
+@Composable
+fun SubscriptionSectionScreen(){
+
+ val constraints = ConstraintSet {
+ val chipSet = createRefFor("chipSet")
+ val subscriptions = createRefFor("subscriptions")
+
+ constrain(chipSet){
+ top.linkTo(parent.top)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ constrain(subscriptions){
+ top.linkTo(chipSet.bottom)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ }
+
+ ConstraintLayout(constraints,modifier = Modifier.fillMaxSize()) {
+ val subscriptionEntities = listOf("Artist", "Series", "Label", "Collection", "Editor")
+ val subscriptions = listOf("P!nk","Arijit Singh","Coldplay")
+ SubscriptionChipSection(subscriptionEntities, "chipSet")
+ SubscriptionsCards(subscriptions,"subscriptions")
}
}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt
new file mode 100644
index 00000000..0945a989
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt
@@ -0,0 +1,80 @@
+package org.metabrainz.android.presentation.features.userprofile.subscriptions_section
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.Card
+import androidx.compose.material.Text
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.layout.layoutId
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import org.metabrainz.android.presentation.features.userprofile.ChipTextColor
+import org.metabrainz.android.presentation.features.userprofile.DisabledChipColor
+import org.metabrainz.android.presentation.features.userprofile.EnabledChipColor
+
+@Composable
+fun SubscriptionChipSection(
+ subscriptionEntities: List,
+ layoutID: String
+){
+ var selectedChipIndex by remember {
+ mutableStateOf(0)
+ }
+ LazyRow(verticalAlignment = Alignment.Top,
+ horizontalArrangement = Arrangement.Center,
+ modifier = Modifier.layoutId(layoutID)) {
+ items(subscriptionEntities.size){
+ Box(modifier = Modifier
+ .padding(start = 15.dp, top = 15.dp, bottom = 15.dp)
+ .clickable { selectedChipIndex = it }
+ .clip(RoundedCornerShape(30.dp))
+ .background(
+ if (selectedChipIndex ==it) EnabledChipColor
+ else DisabledChipColor
+ )
+ .padding(12.dp)){
+ Row {
+ Text(text = subscriptionEntities[it],
+ color = ChipTextColor,
+ modifier = Modifier.padding(end = 4.dp),
+ fontWeight = FontWeight.Bold)
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun SubscriptionsCards(
+ subscriptions:List,
+ layoutID: String
+){
+ LazyColumn(modifier=Modifier.padding(10.dp).layoutId(layoutID)){
+ items(subscriptions.size){
+ Card(modifier = Modifier.fillMaxWidth()
+ .height(60.dp)
+ .padding(3.dp),
+ elevation = 3.dp,
+ shape = RoundedCornerShape(10.dp),
+ backgroundColor = colorResource(org.metabrainz.android.R.color.dark_gray)
+ ) {
+ Row(verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween,
+ modifier = Modifier.padding(13.dp)) {
+ Text(subscriptions[it])
+ }
+
+ }
+
+ }
+ }
+}
+
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
index f914ab8d..821cf2fb 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
@@ -5,56 +5,61 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import org.metabrainz.android.R
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.ComposeView
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.ConstraintSet
+import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-// TODO: Rename parameter arguments, choose names that match
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-private const val ARG_PARAM1 = "param1"
-private const val ARG_PARAM2 = "param2"
-/**
- * A simple [Fragment] subclass.
- * Use the [TagsFragment.newInstance] factory method to
- * create an instance of this fragment.
- */
class TagsFragment : Fragment() {
- // TODO: Rename and change types of parameters
- private var param1: String? = null
- private var param2: String? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- arguments?.let {
- param1 = it.getString(ARG_PARAM1)
- param2 = it.getString(ARG_PARAM2)
- }
- }
-
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
- ): View? {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_tags, container, false)
- }
-
- companion object {
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment TagsFragment.
- */
- // TODO: Rename and change types and number of parameters
- @JvmStatic
- fun newInstance(param1: String, param2: String) =
- TagsFragment().apply {
- arguments = Bundle().apply {
- putString(ARG_PARAM1, param1)
- putString(ARG_PARAM2, param2)
+ ): View {
+ val view = ComposeView(requireContext())
+ view.apply {
+ setContent {
+ ProfileTheme {
+ Surface {
+ TagsFragmentScreen()
+ }
}
}
+ }
+ return view
+ }
+}
+
+@Composable
+private fun TagsFragmentScreen(){
+ val constraints = ConstraintSet {
+ val chipsSet = createRefFor("chipsSet")
+ val predefinedTagSection = createRefFor("genreTypeSection")
+ val otherTagSection = createRefFor("otherTypeSection")
+
+ constrain(chipsSet){
+ top.linkTo(parent.top)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ constrain(predefinedTagSection){
+ top.linkTo(chipsSet.bottom)
+ start.linkTo(parent.start)
+ }
+ constrain(otherTagSection){
+ top.linkTo(predefinedTagSection.bottom)
+ start.linkTo(parent.start)
+ }
+ }
+ ConstraintLayout(constraints, modifier = Modifier.fillMaxSize()) {
+
+ TagsChipsSection(listOf(UpvotedDownvotedTag.UPVOTE,UpvotedDownvotedTag.DOWNVOTE), layoutID = "chipsSet")
+ TagTypeSection("Genres", listOf("Electronic","Experimental","Rock"), layoutID ="genreTypeSection" )
+ TagTypeSection("Other Tags", listOf("Cool","Favourite"), layoutID = "otherTypeSection")
}
-}
\ No newline at end of file
+
+}
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt
new file mode 100644
index 00000000..f138588e
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt
@@ -0,0 +1,116 @@
+package org.metabrainz.android.presentation.features.userprofile.tags_section
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.Card
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.layout.layoutId
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.Dimension
+import org.metabrainz.android.R
+import org.metabrainz.android.presentation.features.userprofile.ChipTextColor
+import org.metabrainz.android.presentation.features.userprofile.DisabledChipColor
+import org.metabrainz.android.presentation.features.userprofile.EnabledChipColor
+
+
+@Composable
+fun TagsChipsSection(
+ chips : List,
+ layoutID:String
+){
+ var selectedChipIndex by remember {
+ mutableStateOf(0)
+ }
+ LazyRow(verticalAlignment = Alignment.Top,
+ horizontalArrangement = Arrangement.Center,
+ modifier = Modifier.layoutId(layoutID)) {
+ items(chips.size){
+ Box(modifier = Modifier
+ .padding(start = 15.dp,
+ top = 15.dp,
+ bottom = 15.dp)
+ .clickable { selectedChipIndex = it }
+ .clip(RoundedCornerShape(10.dp))
+ .background(
+ if (selectedChipIndex ==it) EnabledChipColor
+ else DisabledChipColor
+ )
+ .padding(12.dp)){
+ Row {
+ Text(text = chips[it].value,
+ color = ChipTextColor,
+ modifier = Modifier.padding(end = 4.dp),
+ fontWeight = FontWeight.Bold)
+ Image(painter = painterResource(chips[it].icon),"")
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun ConstraintListItems(items:List){
+ ConstraintLayout {
+ val cards = createRef()
+ LazyListItems(modifier = Modifier.constrainAs(cards){
+ start.linkTo(parent.start)
+ width = Dimension.fillToConstraints
+ },items)
+ }
+}
+
+@Composable
+fun LazyListItems(modifier: Modifier = Modifier,items:List){
+ LazyColumn(modifier=modifier.padding(10.dp)){
+ items(items.size) {
+ Card(
+ modifier = Modifier.fillMaxWidth()
+ .height(60.dp)
+ .padding(3.dp),
+ elevation = 3.dp,
+ shape = RoundedCornerShape(10.dp),
+ backgroundColor = colorResource(R.color.dark_gray)
+ ) {
+ Row(
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween,
+ modifier = Modifier.padding(13.dp)
+ ) {
+ Text(items[it])
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun TagTypeSection(genre: String,
+ items:List,
+ layoutID: String) {
+ Column(modifier = Modifier.layoutId(layoutID)) {
+ Text(genre, fontSize = 28.sp, modifier = Modifier.padding(start = 16.dp, bottom = 2.dp))
+ ConstraintListItems(items)
+ }
+}
+
+
+enum class UpvotedDownvotedTag(val value:String, val icon: Int){
+ UPVOTE("Upvoted",R.drawable.ic_upvote),
+ DOWNVOTE("Downvoted",R.drawable.ic_downvote)
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_downvote.xml b/app/src/main/res/drawable/ic_downvote.xml
new file mode 100644
index 00000000..6e9ca60f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_downvote.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_editor_image.xml b/app/src/main/res/drawable/ic_editor_image.xml
new file mode 100644
index 00000000..dfcd4e96
--- /dev/null
+++ b/app/src/main/res/drawable/ic_editor_image.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_upvote.xml b/app/src/main/res/drawable/ic_upvote.xml
new file mode 100644
index 00000000..cea79240
--- /dev/null
+++ b/app/src/main/res/drawable/ic_upvote.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml
index a3a6e586..e14673d4 100644
--- a/app/src/main/res/layout/activity_profile.xml
+++ b/app/src/main/res/layout/activity_profile.xml
@@ -10,6 +10,9 @@
android:id="@+id/profile_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:backgroundTint="@color/dark_gray"
+ app:tabTextColor="@color/white"
+ app:tabIndicatorColor="@color/white"
app:tabMode="auto"
app:layout_constraintTop_toTopOf="parent" />
diff --git a/app/src/main/res/layout/fragment_collections.xml b/app/src/main/res/layout/fragment_collections.xml
deleted file mode 100644
index 9e84070a..00000000
--- a/app/src/main/res/layout/fragment_collections.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_profile.xml b/app/src/main/res/layout/fragment_profile.xml
deleted file mode 100644
index caa0798c..00000000
--- a/app/src/main/res/layout/fragment_profile.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_ratings.xml b/app/src/main/res/layout/fragment_ratings.xml
deleted file mode 100644
index 5f9b4ca3..00000000
--- a/app/src/main/res/layout/fragment_ratings.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_subscribers.xml b/app/src/main/res/layout/fragment_subscribers.xml
deleted file mode 100644
index 5d705b02..00000000
--- a/app/src/main/res/layout/fragment_subscribers.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_subscriptions.xml b/app/src/main/res/layout/fragment_subscriptions.xml
deleted file mode 100644
index 8679a72a..00000000
--- a/app/src/main/res/layout/fragment_subscriptions.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_tags.xml b/app/src/main/res/layout/fragment_tags.xml
deleted file mode 100644
index 7386e00a..00000000
--- a/app/src/main/res/layout/fragment_tags.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
From f3362c53d3afcc9d17e5c8a53d2eb72336ed4b85 Mon Sep 17 00:00:00 2001
From: Ashutosh Aswal <75999921+yellowHatpro@users.noreply.github.com>
Date: Mon, 4 Apr 2022 23:01:58 +0530
Subject: [PATCH 3/6] profile activity compose topappbar added,login activity
cleanup
---
app/src/main/AndroidManifest.xml | 1 +
.../features/login/LoginActivity.kt | 11 ---
.../features/userprofile/ProfileActivity.kt | 82 ++++++++++++++++---
app/src/main/res/layout/activity_profile.xml | 20 ++++-
4 files changed, 86 insertions(+), 28 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 172dbb37..7a5b0d7f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -26,6 +26,7 @@
tools:targetApi="31">
{
startActivity(Intent(this,ProfileActivity::class.java))
finish()
-// binding!!.loginPromptId.setText(R.string.logout_prompt)
-// binding!!.loginBtn.setText(R.string.logout)
-// binding!!.loginBtn.setOnClickListener { logoutUser() }
}
else -> binding!!.loginBtn.setOnClickListener { startLogin() }
}
@@ -98,14 +95,6 @@ class LoginActivity : MusicBrainzActivity() {
}
}
- private fun logoutUser() {
- LoginSharedPreferences.logoutUser()
- Toast.makeText(applicationContext,
- "User has successfully logged out.",
- Toast.LENGTH_LONG).show()
- startActivity(Intent(this, DashboardActivity::class.java))
- finish()
- }
override fun onCreateOptionsMenu(menu: Menu): Boolean {
super.onCreateOptionsMenu(menu)
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
index 9e8a97e4..d075ea97 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
@@ -1,12 +1,25 @@
package org.metabrainz.android.presentation.features.userprofile
-import android.graphics.drawable.ColorDrawable
+import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
-import android.view.MenuItem
+import android.widget.Toast
+import androidx.compose.material.Icon
+import androidx.compose.material.IconButton
+import androidx.compose.material.Text
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.ArrowBack
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.unit.dp
import com.google.android.material.tabs.TabLayoutMediator
import org.metabrainz.android.R
import org.metabrainz.android.databinding.ActivityProfileBinding
+import org.metabrainz.android.presentation.features.dashboard.DashboardActivity
+import org.metabrainz.android.presentation.features.login.LoginSharedPreferences
+import org.metabrainz.android.presentation.features.settings.SettingsActivity
class ProfileActivity : AppCompatActivity() {
lateinit var binding: ActivityProfileBinding
@@ -14,10 +27,9 @@ class ProfileActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
binding= ActivityProfileBinding.inflate(layoutInflater)
setContentView(binding.root)
-
- supportActionBar!!.setBackgroundDrawable(ColorDrawable(resources.getColor(R.color.app_bg)))
- supportActionBar!!.title = "User Profile"
- supportActionBar!!.setDisplayHomeAsUpEnabled(true)
+ binding.profileTopAppBar.setContent {
+ TopAppBar()
+ }
val pagerAdapter= ProfileViewPagerAdapter(this)
binding.profilePager.adapter = pagerAdapter
@@ -34,15 +46,59 @@ class ProfileActivity : AppCompatActivity() {
}
}.attach()
+ }
+ private fun logoutUser() {
+ LoginSharedPreferences.logoutUser()
+ Toast.makeText(applicationContext,
+ "User has successfully logged out.",
+ Toast.LENGTH_LONG).show()
+ startActivity(Intent(this, DashboardActivity::class.java))
+ finish()
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- return when (item.itemId) {
- android.R.id.home -> {
- onBackPressed()
- true
+
+ @Composable
+ fun TopAppBar() {
+ androidx.compose.material.TopAppBar(
+ navigationIcon = {
+ IconButton(onClick = {
+ startActivity(
+ Intent(
+ applicationContext,
+ DashboardActivity::class.java
+ )
+ )
+ }) {
+ Icon(Icons.Filled.ArrowBack, "Go Back")
+ }
+ },
+ title = {
+ Text(text = "User Profile")
+ },
+ backgroundColor = colorResource(id = R.color.app_bg),
+ contentColor = colorResource(id = R.color.white),
+ elevation = 2.dp,
+ actions = {
+
+ IconButton(onClick = {
+ logoutUser()
+ }) {
+ Icon(
+ painterResource(id = R.drawable.ic_user),
+ "Log Out",
+ tint = Color.Unspecified
+ )
+ }
+ IconButton(onClick = {
+ startActivity(Intent(applicationContext, SettingsActivity::class.java))
+ }) {
+ Icon(
+ painterResource(id = R.drawable.action_settings),
+ "Settings",
+ tint = Color.Unspecified
+ )
+ }
}
- else -> super.onOptionsItemSelected(item)
- }
+ )
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml
index e14673d4..37d066e1 100644
--- a/app/src/main/res/layout/activity_profile.xml
+++ b/app/src/main/res/layout/activity_profile.xml
@@ -6,15 +6,28 @@
android:layout_height="match_parent"
tools:context=".presentation.features.userprofile.ProfileActivity">
+
+
+
+ app:tabMode="auto" />
-
\ No newline at end of file
From 069231ce16e59753b3fe824bcd33a03328ba26f5 Mon Sep 17 00:00:00 2001
From: Ashutosh Aswal <75999921+yellowHatpro@users.noreply.github.com>
Date: Mon, 4 Apr 2022 23:15:36 +0530
Subject: [PATCH 4/6] removed glide's autogenerated legacy depedency
---
app/build.gradle | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/build.gradle b/app/build.gradle
index 78af339f..6861aa25 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -97,7 +97,6 @@ dependencies {
//Image downloading and Caching library
implementation 'com.github.bumptech.glide:glide:4.13.1'
- implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt 'com.github.bumptech.glide:compiler:4.13.1'
//Fragment Setup For Kotlin
From 80dad245b6723434b00de94925e2802a1479dfaa Mon Sep 17 00:00:00 2001
From: Ashutosh Aswal <75999921+yellowHatpro@users.noreply.github.com>
Date: Tue, 19 Apr 2022 18:44:14 +0530
Subject: [PATCH 5/6] required changes made
---
app/build.gradle | 6 +-
.../features/dashboard/DashboardActivity.kt | 3 +-
.../features/userprofile/ProfileActivity.kt | 201 ++++++++++++++----
.../features/userprofile/ProfileTheme.kt | 45 ----
.../userprofile/ProfileViewPagerAdapter.kt | 29 ---
.../CollectionsFragment.kt | 36 ----
.../CollectionsSectionScreen.kt | 7 +-
.../profile_section/ProfileFragment.kt | 35 ---
.../ratings_section/RatingsFragment.kt | 63 ------
.../ratings_section/RatingsSectionScreen.kt | 35 ++-
.../SubscribersFragment.kt | 36 ----
.../SubscribersSectionScreen.kt | 22 +-
.../SubscriptionsFragment.kt | 62 ------
.../SubscriptionsSectionScreen.kt | 35 ++-
.../userprofile/tags_section/TagsFragment.kt | 65 ------
.../tags_section/TagsSectionScreen.kt | 38 +++-
.../org/metabrainz/android/theme/Colors.kt | 9 +
.../org/metabrainz/android/theme/Theme.kt | 32 +++
app/src/main/res/layout/activity_profile.xml | 39 ----
19 files changed, 329 insertions(+), 469 deletions(-)
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
delete mode 100644 app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
create mode 100644 app/src/main/java/org/metabrainz/android/theme/Colors.kt
create mode 100644 app/src/main/java/org/metabrainz/android/theme/Theme.kt
delete mode 100644 app/src/main/res/layout/activity_profile.xml
diff --git a/app/build.gradle b/app/build.gradle
index 6861aa25..f7be4f87 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -118,6 +118,10 @@ dependencies {
implementation 'com.github.akshaaatt:Onboarding:1.0.3'
implementation 'com.github.akshaaatt:Share-Android:Tag'
+ //ViewPager
+ implementation "com.google.accompanist:accompanist-pager:0.23.0"
+ implementation "com.google.accompanist:accompanist-pager-indicators:0.23.0"
+
//Barcode Scan
implementation 'me.dm7.barcodescanner:zbar:1.9.13'
@@ -143,7 +147,7 @@ dependencies {
implementation "androidx.navigation:navigation-compose:2.5.0-alpha03"
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1'
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
-
+ implementation 'androidx.compose.material3:material3:1.0.0-alpha09'
//Test Setup
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.squareup.okhttp3:mockwebserver:5.0.0-alpha.4'
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/dashboard/DashboardActivity.kt b/app/src/main/java/org/metabrainz/android/presentation/features/dashboard/DashboardActivity.kt
index 03b7fd12..098e11ab 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/dashboard/DashboardActivity.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/dashboard/DashboardActivity.kt
@@ -11,6 +11,7 @@ import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
import com.thefinestartist.finestwebview.FinestWebView
import org.metabrainz.android.R
import org.metabrainz.android.databinding.ActivityDashboardBinding
@@ -102,7 +103,7 @@ class DashboardActivity : AppCompatActivity() {
items.forEach { item ->
BottomNavigationItem(
icon = { Icon(painterResource(id = item.icon), contentDescription = item.title, tint = Color.Unspecified) },
- label = { Text(text = item.title) },
+ label = { Text(text = item.title, fontSize = 11.sp) },
selectedContentColor = colorResource(id = R.color.white),
unselectedContentColor = colorResource(id = R.color.gray),
alwaysShowLabel = true,
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
index d075ea97..8aad5043 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
@@ -4,62 +4,56 @@ import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
-import androidx.compose.material.Icon
-import androidx.compose.material.IconButton
-import androidx.compose.material.Text
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.*
+import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.ArrowBack
+import androidx.compose.material.icons.filled.*
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
-import com.google.android.material.tabs.TabLayoutMediator
+import androidx.compose.ui.unit.sp
+import com.google.accompanist.pager.ExperimentalPagerApi
+import com.google.accompanist.pager.HorizontalPager
+import com.google.accompanist.pager.rememberPagerState
+import kotlinx.coroutines.launch
import org.metabrainz.android.R
-import org.metabrainz.android.databinding.ActivityProfileBinding
import org.metabrainz.android.presentation.features.dashboard.DashboardActivity
import org.metabrainz.android.presentation.features.login.LoginSharedPreferences
import org.metabrainz.android.presentation.features.settings.SettingsActivity
+import org.metabrainz.android.presentation.features.userprofile.collections_section.CollectionsSectionScreen
+import org.metabrainz.android.presentation.features.userprofile.profile_section.ProfileSectionScreen
+import org.metabrainz.android.presentation.features.userprofile.ratings_section.RatingsSectionScreen
+import org.metabrainz.android.presentation.features.userprofile.subscribers_section.SubscribersSectionScreen
+import org.metabrainz.android.presentation.features.userprofile.subscriptions_section.SubscriptionSectionScreen
+import org.metabrainz.android.presentation.features.userprofile.tags_section.TagsSectionScreen
+import org.metabrainz.android.theme.Theme
class ProfileActivity : AppCompatActivity() {
- lateinit var binding: ActivityProfileBinding
+ private val showDialog = mutableStateOf(false)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- binding= ActivityProfileBinding.inflate(layoutInflater)
- setContentView(binding.root)
- binding.profileTopAppBar.setContent {
- TopAppBar()
- }
-
- val pagerAdapter= ProfileViewPagerAdapter(this)
- binding.profilePager.adapter = pagerAdapter
- TabLayoutMediator(binding.profileTabLayout, binding.profilePager){tab,position->
- run{
- when(position){
- 0->tab.text = "Profile"
- 1->tab.text = "Subscriptions"
- 2->tab.text = "Subscribers"
- 3->tab.text = "Collections"
- 4->tab.text = "Tags"
- 5->tab.text = "Ratings"
- }
+ setContent {
+ Column {
+ TopAppBar()
+ CombinedTab()
+ if (showDialog.value) LogOutDialog()
+ TopAppBar()
}
-
- }.attach()
- }
-
- private fun logoutUser() {
- LoginSharedPreferences.logoutUser()
- Toast.makeText(applicationContext,
- "User has successfully logged out.",
- Toast.LENGTH_LONG).show()
- startActivity(Intent(this, DashboardActivity::class.java))
- finish()
+ }
}
@Composable
fun TopAppBar() {
- androidx.compose.material.TopAppBar(
+ TopAppBar(
navigationIcon = {
IconButton(onClick = {
startActivity(
@@ -81,7 +75,7 @@ class ProfileActivity : AppCompatActivity() {
actions = {
IconButton(onClick = {
- logoutUser()
+ showDialog.value = true
}) {
Icon(
painterResource(id = R.drawable.ic_user),
@@ -101,4 +95,133 @@ class ProfileActivity : AppCompatActivity() {
}
)
}
-}
\ No newline at end of file
+
+ @OptIn(ExperimentalPagerApi::class)
+ @Composable
+ fun CombinedTab() {
+ val tabdata = listOf(
+ ProfileTabItem.Profile,
+ ProfileTabItem.Subscriptions,
+ ProfileTabItem.Subscribers,
+ ProfileTabItem.Collection,
+ ProfileTabItem.Tags,
+ ProfileTabItem.Ratings
+ )
+ val pagerState = rememberPagerState(
+ initialPage = 0
+ )
+ val tabIndex = pagerState.currentPage
+ val coroutineScope = rememberCoroutineScope()
+ Column {
+ ScrollableTabRow(
+ selectedTabIndex = tabIndex,
+ edgePadding = TabRowDefaults.ScrollableTabRowPadding,
+ backgroundColor = colorResource(R.color.dark_gray),
+ indicator = @Composable { tabPositions ->
+ TabRowDefaults.Indicator(
+ Modifier.tabIndicatorOffset(tabPositions[tabIndex])
+ )
+ }
+ ) {
+ tabdata.forEachIndexed { index, listItem ->
+ Tab(selected = tabIndex == index, onClick = {
+ coroutineScope.launch {
+ pagerState.animateScrollToPage(index)
+ }
+ }, text = {
+ Text(text = listItem.title, fontSize = 16.sp)
+ }, unselectedContentColor = colorResource(R.color.app_bg_light),
+ selectedContentColor = colorResource(R.color.white)
+ )
+ }
+ }
+ HorizontalPager(
+ state = pagerState,
+ modifier = Modifier.weight(1f),
+ count = tabdata.size
+ ) { page ->
+ Theme {
+ Surface {
+ tabdata[page].screen()
+ }
+ }
+ }
+ }
+ }
+
+ private fun logoutUser() {
+ LoginSharedPreferences.logoutUser()
+ Toast.makeText(
+ applicationContext,
+ "User has successfully logged out.",
+ Toast.LENGTH_LONG
+ ).show()
+ startActivity(Intent(this, DashboardActivity::class.java))
+ finish()
+ }
+
+ @Composable
+ fun LogOutDialog() {
+ if (showDialog.value) {
+ AlertDialog(
+ backgroundColor = colorResource(R.color.dark_gray),
+ onDismissRequest = {
+ showDialog.value = false
+ },
+ title = {
+ Text(
+ text = "Log Out",
+ fontWeight = FontWeight.Bold,
+ fontSize = 20.sp,
+ color = colorResource(R.color.white)
+ )
+ },
+ text = {
+ Text(
+ fontSize = 16.sp,
+ text = "Confirm Log Out",
+ color = colorResource(R.color.white)
+ )
+ },
+ confirmButton = {
+ TextButton(
+ onClick = {
+ showDialog.value = false
+ logoutUser()
+ }
+ ) {
+ Text(
+ "CONFIRM",
+ fontSize = 15.sp,
+ color = colorResource(R.color.mb_purple_medium)
+ )
+ }
+ },
+ dismissButton = {
+ TextButton(
+ onClick = {
+ showDialog.value = false
+ }
+ ) {
+ Text(
+ "DISMISS",
+ fontSize = 15.sp,
+ color = colorResource(R.color.mb_purple_medium)
+ )
+ }
+ },
+ shape = RoundedCornerShape(24.dp)
+ )
+ }
+ }
+}
+
+sealed class ProfileTabItem(var title: String, var screen: @Composable () -> Unit){
+ object Profile: ProfileTabItem("Profile", { ProfileSectionScreen() })
+ object Subscriptions: ProfileTabItem("Subscriptions", { SubscriptionSectionScreen() })
+ object Subscribers: ProfileTabItem("Subscribers", { SubscribersSectionScreen() })
+ object Tags: ProfileTabItem("Tags", { TagsSectionScreen() })
+ object Collection: ProfileTabItem("Collection",{ CollectionsSectionScreen() })
+ object Ratings: ProfileTabItem("Ratings", { RatingsSectionScreen() })
+}
+
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt
deleted file mode 100644
index 01e8d64a..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileTheme.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile
-
-import androidx.compose.foundation.isSystemInDarkTheme
-import androidx.compose.material.MaterialTheme
-import androidx.compose.material.MaterialTheme.shapes
-import androidx.compose.material.MaterialTheme.typography
-import androidx.compose.material.darkColors
-import androidx.compose.material.lightColors
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.graphics.Color
-
-
-//Colors
-val Appbg = Color(0xFF263238)
-val AppbgLight = Color(0xFFe0e0e0)
-val EnabledChipColor = Color(0xFFccabff)
-val DisabledChipColor = Color(0xFFd8cfe8)
-val ChipTextColor = Color(0xFF323232)
-
-private val DarkColorPalette = darkColors(
- surface = Appbg
-)
-
-private val LightColorPalette = lightColors(
- surface = AppbgLight
-)
-
-@Composable
-fun ProfileTheme(
- darkTheme: Boolean = isSystemInDarkTheme(),
- content: @Composable () -> Unit
-) {
- val colors = if (darkTheme) {
- DarkColorPalette
- } else {
- LightColorPalette
- }
-
- MaterialTheme(
- colors = colors,
- typography = typography,
- shapes = shapes,
- content = content
- )
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt
deleted file mode 100644
index 93fdad99..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileViewPagerAdapter.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile
-
-import androidx.appcompat.app.AppCompatActivity
-import androidx.fragment.app.Fragment
-import androidx.viewpager2.adapter.FragmentStateAdapter
-import org.metabrainz.android.presentation.features.userprofile.collections_section.CollectionsFragment
-import org.metabrainz.android.presentation.features.userprofile.profile_section.ProfileFragment
-import org.metabrainz.android.presentation.features.userprofile.ratings_section.RatingsFragment
-import org.metabrainz.android.presentation.features.userprofile.subscribers_section.SubscribersFragment
-import org.metabrainz.android.presentation.features.userprofile.subscriptions_section.SubscriptionsFragment
-import org.metabrainz.android.presentation.features.userprofile.tags_section.TagsFragment
-
-class ProfileViewPagerAdapter(appCompatActivity: AppCompatActivity): FragmentStateAdapter(appCompatActivity) {
- override fun getItemCount(): Int {
- return 6
- }
-
- override fun createFragment(position: Int): Fragment {
- return when(position){
- 0 -> ProfileFragment()
- 1-> SubscriptionsFragment()
- 2-> SubscribersFragment()
- 3-> CollectionsFragment()
- 4-> TagsFragment()
- else -> RatingsFragment()
- }
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
deleted file mode 100644
index becd9492..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsFragment.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile.collections_section
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.compose.material.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.platform.ComposeView
-import androidx.fragment.app.Fragment
-import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-
-
-class CollectionsFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val view = ComposeView(requireContext())
- view.apply {
- setContent {
- ProfileTheme {
- Surface {
- CollectionFragmentSection()
- }
- }
- }
- }
- return view
- }
-}
-
-@Composable
-fun CollectionFragmentSection(){
- CollectionsSectionScreen()
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt
index e54ca70d..e72e0436 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/collections_section/CollectionsSectionScreen.kt
@@ -1,9 +1,14 @@
package org.metabrainz.android.presentation.features.userprofile.collections_section
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
@Composable
fun CollectionsSectionScreen(){
- Text("Coming Soon!!")
+ Column(modifier = Modifier.fillMaxSize()) {
+ Text("Coming Soon!!")
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
deleted file mode 100644
index de3660a5..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/profile_section/ProfileFragment.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile.profile_section
-
-import android.os.Bundle
-import androidx.fragment.app.Fragment
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.compose.material.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.platform.ComposeView
-import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-
-class ProfileFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val view = ComposeView(requireContext())
- view.apply {
- setContent {
- ProfileTheme {
- Surface {
- ProfileFragmentScreen()
- }
- }
- }
- }
- return view
- }
-}
-
-@Composable
-private fun ProfileFragmentScreen(){
- ProfileSectionScreen()
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
deleted file mode 100644
index 9f259a94..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsFragment.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile.ratings_section
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.compose.foundation.layout.*
-import androidx.compose.material.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.ComposeView
-import androidx.constraintlayout.compose.ConstraintLayout
-import androidx.constraintlayout.compose.ConstraintSet
-import androidx.fragment.app.Fragment
-import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-
-
-
-class RatingsFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val view = ComposeView(requireContext())
- view.apply {
- setContent {
- ProfileTheme {
- Surface {
- RatingsFragmentScreen()
- }
- }
- }
- }
- return view
- }
-}
-
-@Composable
-fun RatingsFragmentScreen(){
- val constraints = ConstraintSet {
- val chipSet = createRefFor("chipSet")
- val ratings = createRefFor("ratings")
-
- constrain(chipSet){
- top.linkTo(parent.top)
- start.linkTo(parent.start)
- end.linkTo(parent.end)
- }
- constrain(ratings){
- top.linkTo(chipSet.bottom)
- start.linkTo(parent.start)
- end.linkTo(parent.end)
- }
- }
- ConstraintLayout(constraints,modifier = Modifier.fillMaxSize()) {
- val ratingEntities = listOf("Artist","Event","Label","Release Group","Recording","Work")
- val ratedEntities = listOf(Pair("Fall Out Boy",3f),Pair("Sean Paul",4.5f),Pair("Ed Sheeren",5f))
- RatingChipsSection(ratingEntities,"chipSet")
- Ratings(items = ratedEntities, layoutID = "ratings")
-
- }
-}
-
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt
index 20e91b49..c2035516 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ratings_section/RatingsSectionScreen.kt
@@ -16,10 +16,39 @@ import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.ConstraintSet
import org.metabrainz.android.R
-import org.metabrainz.android.presentation.features.userprofile.ChipTextColor
-import org.metabrainz.android.presentation.features.userprofile.DisabledChipColor
-import org.metabrainz.android.presentation.features.userprofile.EnabledChipColor
+import org.metabrainz.android.theme.ChipTextColor
+import org.metabrainz.android.theme.DisabledChipColor
+
+import org.metabrainz.android.theme.EnabledChipColor
+
+@Composable
+fun RatingsSectionScreen(){
+ val constraints = ConstraintSet {
+ val chipSet = createRefFor("chipSet")
+ val ratings = createRefFor("ratings")
+
+ constrain(chipSet){
+ top.linkTo(parent.top)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ constrain(ratings){
+ top.linkTo(chipSet.bottom)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ }
+ ConstraintLayout(constraints,modifier = Modifier.fillMaxSize()) {
+ val ratingEntities = listOf("Artist","Event","Label","Release Group","Recording","Work")
+ val ratedEntities = listOf(Pair("Fall Out Boy",3f),Pair("Sean Paul",4.5f),Pair("Ed Sheeren",5f))
+ RatingChipsSection(ratingEntities,"chipSet")
+ Ratings(items = ratedEntities, layoutID = "ratings")
+
+ }
+}
@Composable
fun RatingChipsSection(
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
deleted file mode 100644
index c8eb9048..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersFragment.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile.subscribers_section
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.compose.material.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.platform.ComposeView
-import androidx.fragment.app.Fragment
-import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-
-
-class SubscribersFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val view = ComposeView(requireContext())
- view.apply {
- setContent {
- ProfileTheme {
- Surface {
- SubscribersSectionScreen()
- }
- }
- }
- }
- return view
- }
-}
-
-@Composable
-fun SubscribersSectionScreen(){
- MockCard()
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt
index bfdbc368..fd0070a0 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscribers_section/SubscribersSectionScreen.kt
@@ -12,20 +12,26 @@ import androidx.compose.ui.unit.dp
import org.metabrainz.android.R
@Composable
-fun MockCard(){
- Row(modifier = Modifier.fillMaxWidth()
- .height(30.dp)
- .padding(12.dp)) {
- Card(modifier = Modifier.fillMaxWidth(),
+fun SubscribersSectionScreen() {
+ MockCard()
+}
+
+@Composable
+fun MockCard() {
+ Row(modifier = Modifier.fillMaxSize().padding(10.dp)) {
+ Card(
+ modifier = Modifier.fillMaxWidth(),
elevation = 3.dp,
shape = RoundedCornerShape(10.dp),
backgroundColor = colorResource(R.color.dark_gray)
) {
- Row(verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.padding(13.dp)) {
+ Row(
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween,
+ modifier = Modifier.padding(13.dp)
+ ) {
Text("YellowHatpro")
}
-
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
deleted file mode 100644
index 9e9e4001..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsFragment.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile.subscriptions_section
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.ComposeView
-import androidx.constraintlayout.compose.ConstraintLayout
-import androidx.constraintlayout.compose.ConstraintSet
-import androidx.fragment.app.Fragment
-import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-
-
-class SubscriptionsFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val view = ComposeView(requireContext())
- view.apply {
- setContent {
- ProfileTheme {
- Surface {
- SubscriptionSectionScreen()
- }
- }
- }
- }
- return view
- }
-}
-
-@Composable
-fun SubscriptionSectionScreen(){
-
- val constraints = ConstraintSet {
- val chipSet = createRefFor("chipSet")
- val subscriptions = createRefFor("subscriptions")
-
- constrain(chipSet){
- top.linkTo(parent.top)
- start.linkTo(parent.start)
- end.linkTo(parent.end)
- }
- constrain(subscriptions){
- top.linkTo(chipSet.bottom)
- start.linkTo(parent.start)
- end.linkTo(parent.end)
- }
- }
-
- ConstraintLayout(constraints,modifier = Modifier.fillMaxSize()) {
- val subscriptionEntities = listOf("Artist", "Series", "Label", "Collection", "Editor")
- val subscriptions = listOf("P!nk","Arijit Singh","Coldplay")
- SubscriptionChipSection(subscriptionEntities, "chipSet")
- SubscriptionsCards(subscriptions,"subscriptions")
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt
index 0945a989..d799f30d 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/subscriptions_section/SubscriptionsSectionScreen.kt
@@ -16,9 +16,38 @@ import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
-import org.metabrainz.android.presentation.features.userprofile.ChipTextColor
-import org.metabrainz.android.presentation.features.userprofile.DisabledChipColor
-import org.metabrainz.android.presentation.features.userprofile.EnabledChipColor
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.ConstraintSet
+import org.metabrainz.android.theme.ChipTextColor
+import org.metabrainz.android.theme.DisabledChipColor
+import org.metabrainz.android.theme.EnabledChipColor
+
+@Composable
+fun SubscriptionSectionScreen(){
+
+ val constraints = ConstraintSet {
+ val chipSet = createRefFor("chipSet")
+ val subscriptions = createRefFor("subscriptions")
+
+ constrain(chipSet){
+ top.linkTo(parent.top)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ constrain(subscriptions){
+ top.linkTo(chipSet.bottom)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ }
+
+ ConstraintLayout(constraints,modifier = Modifier.fillMaxSize()) {
+ val subscriptionEntities = listOf("Artist", "Series", "Label", "Collection", "Editor")
+ val subscriptions = listOf("P!nk","Arijit Singh","Coldplay")
+ SubscriptionChipSection(subscriptionEntities, "chipSet")
+ SubscriptionsCards(subscriptions,"subscriptions")
+ }
+}
@Composable
fun SubscriptionChipSection(
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
deleted file mode 100644
index 821cf2fb..00000000
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsFragment.kt
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.metabrainz.android.presentation.features.userprofile.tags_section
-
-import android.os.Bundle
-import androidx.fragment.app.Fragment
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.ComposeView
-import androidx.constraintlayout.compose.ConstraintLayout
-import androidx.constraintlayout.compose.ConstraintSet
-import org.metabrainz.android.presentation.features.userprofile.ProfileTheme
-
-
-class TagsFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val view = ComposeView(requireContext())
- view.apply {
- setContent {
- ProfileTheme {
- Surface {
- TagsFragmentScreen()
- }
- }
- }
- }
- return view
- }
-}
-
-@Composable
-private fun TagsFragmentScreen(){
- val constraints = ConstraintSet {
- val chipsSet = createRefFor("chipsSet")
- val predefinedTagSection = createRefFor("genreTypeSection")
- val otherTagSection = createRefFor("otherTypeSection")
-
- constrain(chipsSet){
- top.linkTo(parent.top)
- start.linkTo(parent.start)
- end.linkTo(parent.end)
- }
- constrain(predefinedTagSection){
- top.linkTo(chipsSet.bottom)
- start.linkTo(parent.start)
- }
- constrain(otherTagSection){
- top.linkTo(predefinedTagSection.bottom)
- start.linkTo(parent.start)
- }
- }
- ConstraintLayout(constraints, modifier = Modifier.fillMaxSize()) {
-
- TagsChipsSection(listOf(UpvotedDownvotedTag.UPVOTE,UpvotedDownvotedTag.DOWNVOTE), layoutID = "chipsSet")
- TagTypeSection("Genres", listOf("Electronic","Experimental","Rock"), layoutID ="genreTypeSection" )
- TagTypeSection("Other Tags", listOf("Cool","Favourite"), layoutID = "otherTypeSection")
- }
-
-}
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt
index f138588e..58e1a258 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/tags_section/TagsSectionScreen.kt
@@ -22,11 +22,43 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.ConstraintSet
import androidx.constraintlayout.compose.Dimension
import org.metabrainz.android.R
-import org.metabrainz.android.presentation.features.userprofile.ChipTextColor
-import org.metabrainz.android.presentation.features.userprofile.DisabledChipColor
-import org.metabrainz.android.presentation.features.userprofile.EnabledChipColor
+import org.metabrainz.android.theme.ChipTextColor
+import org.metabrainz.android.theme.DisabledChipColor
+import org.metabrainz.android.theme.EnabledChipColor
+
+
+@Composable
+fun TagsSectionScreen(){
+ val constraints = ConstraintSet {
+ val chipsSet = createRefFor("chipsSet")
+ val predefinedTagSection = createRefFor("genreTypeSection")
+ val otherTagSection = createRefFor("otherTypeSection")
+
+ constrain(chipsSet){
+ top.linkTo(parent.top)
+ start.linkTo(parent.start)
+ end.linkTo(parent.end)
+ }
+ constrain(predefinedTagSection){
+ top.linkTo(chipsSet.bottom)
+ start.linkTo(parent.start)
+ }
+ constrain(otherTagSection){
+ top.linkTo(predefinedTagSection.bottom)
+ start.linkTo(parent.start)
+ }
+ }
+ ConstraintLayout(constraints, modifier = Modifier.fillMaxSize()) {
+
+ TagsChipsSection(listOf(UpvotedDownvotedTag.UPVOTE,UpvotedDownvotedTag.DOWNVOTE), layoutID = "chipsSet")
+ TagTypeSection("Genres", listOf("Electronic","Experimental","Rock"), layoutID ="genreTypeSection" )
+ TagTypeSection("Other Tags", listOf("Cool","Favourite"), layoutID = "otherTypeSection")
+ }
+
+}
@Composable
diff --git a/app/src/main/java/org/metabrainz/android/theme/Colors.kt b/app/src/main/java/org/metabrainz/android/theme/Colors.kt
new file mode 100644
index 00000000..c7e0adb1
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/theme/Colors.kt
@@ -0,0 +1,9 @@
+package org.metabrainz.android.theme
+
+import androidx.compose.ui.graphics.Color
+
+val Appbg = Color(0xFF263238)
+val AppbgLight = Color(0xFFe0e0e0)
+val EnabledChipColor = Color(0xFFccabff)
+val DisabledChipColor = Color(0xFFd8cfe8)
+val ChipTextColor = Color(0xFF323232)
diff --git a/app/src/main/java/org/metabrainz/android/theme/Theme.kt b/app/src/main/java/org/metabrainz/android/theme/Theme.kt
new file mode 100644
index 00000000..c24767d3
--- /dev/null
+++ b/app/src/main/java/org/metabrainz/android/theme/Theme.kt
@@ -0,0 +1,32 @@
+package org.metabrainz.android.theme
+
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.darkColors
+import androidx.compose.material.lightColors
+import androidx.compose.runtime.Composable
+
+
+private val DarkColorPalette = darkColors(
+ surface = Appbg
+)
+private val LightColorPalette = lightColors(
+ surface = AppbgLight
+)
+@Composable
+fun Theme(
+ theme: Boolean = isSystemInDarkTheme(),
+ content: @Composable () -> Unit
+) {
+ val colors = if (theme) {
+ DarkColorPalette
+ } else {
+ LightColorPalette
+ }
+ MaterialTheme(
+ colors = colors,
+ typography = MaterialTheme.typography,
+ shapes = MaterialTheme.shapes,
+ content = content
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml
deleted file mode 100644
index 37d066e1..00000000
--- a/app/src/main/res/layout/activity_profile.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
From f88b65b507572427d57cd22900167fe1122a873f Mon Sep 17 00:00:00 2001
From: Ashutosh Aswal <75999921+yellowHatpro@users.noreply.github.com>
Date: Tue, 19 Apr 2022 18:46:20 +0530
Subject: [PATCH 6/6] small change
---
app/build.gradle | 1 +
.../presentation/features/userprofile/ProfileActivity.kt | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index f7be4f87..96182f81 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -148,6 +148,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1'
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
implementation 'androidx.compose.material3:material3:1.0.0-alpha09'
+
//Test Setup
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.squareup.okhttp3:mockwebserver:5.0.0-alpha.4'
diff --git a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
index 8aad5043..6a25df29 100644
--- a/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
+++ b/app/src/main/java/org/metabrainz/android/presentation/features/userprofile/ProfileActivity.kt
@@ -44,7 +44,7 @@ class ProfileActivity : AppCompatActivity() {
setContent {
Column {
TopAppBar()
- CombinedTab()
+ TabBar()
if (showDialog.value) LogOutDialog()
TopAppBar()
}
@@ -98,7 +98,7 @@ class ProfileActivity : AppCompatActivity() {
@OptIn(ExperimentalPagerApi::class)
@Composable
- fun CombinedTab() {
+ fun TabBar() {
val tabdata = listOf(
ProfileTabItem.Profile,
ProfileTabItem.Subscriptions,