fix(profile): remove progress in fav media

This commit is contained in:
aayush262 2024-03-06 15:58:55 +05:30
parent 03dae8c1b0
commit 18778f3c5a
5 changed files with 21 additions and 80 deletions

View file

@ -43,6 +43,7 @@ class MediaAdaptor(
private val activity: FragmentActivity, private val activity: FragmentActivity,
private val matchParent: Boolean = false, private val matchParent: Boolean = false,
private val viewPager: ViewPager2? = null, private val viewPager: ViewPager2? = null,
private val fav: Boolean = false,
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { ) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
@ -128,6 +129,7 @@ class MediaAdaptor(
) )
b.itemCompactTotal.text = " | ${media.manga.totalChapters ?: "~"}" b.itemCompactTotal.text = " | ${media.manga.totalChapters ?: "~"}"
} }
b.itemCompactProgressContainer.visibility = if (fav) View.GONE else View.VISIBLE
} }
} }

View file

@ -120,7 +120,6 @@ class ProfileFragment() : Fragment() {
binding.profileFavAnimeContainer, binding.profileFavAnimeContainer,
binding.profileFavAnimeRecyclerView, binding.profileFavAnimeRecyclerView,
binding.profileFavAnimeProgressBar, binding.profileFavAnimeProgressBar,
binding.profileFavAnimeEmpty,
binding.profileFavAnime binding.profileFavAnime
) )
@ -129,7 +128,6 @@ class ProfileFragment() : Fragment() {
binding.profileFavMangaContainer, binding.profileFavMangaContainer,
binding.profileFavMangaRecyclerView, binding.profileFavMangaRecyclerView,
binding.profileFavMangaProgressBar, binding.profileFavMangaProgressBar,
binding.profileFavMangaEmpty,
binding.profileFavManga binding.profileFavManga
) )
@ -186,21 +184,18 @@ class ProfileFragment() : Fragment() {
container: View, container: View,
recyclerView: RecyclerView, recyclerView: RecyclerView,
progress: View, progress: View,
empty: View,
title: View title: View
) { ) {
container.visibility = View.VISIBLE container.visibility = View.VISIBLE
progress.visibility = View.VISIBLE progress.visibility = View.VISIBLE
recyclerView.visibility = View.GONE recyclerView.visibility = View.GONE
empty.visibility = View.GONE
title.visibility = View.INVISIBLE title.visibility = View.INVISIBLE
mode.observe(viewLifecycleOwner) { mode.observe(viewLifecycleOwner) {
recyclerView.visibility = View.GONE recyclerView.visibility = View.GONE
empty.visibility = View.GONE
if (it != null) { if (it != null) {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
recyclerView.adapter = MediaAdaptor(0, it, requireActivity()) recyclerView.adapter = MediaAdaptor(0, it, requireActivity(), fav=true)
recyclerView.layoutManager = LinearLayoutManager( recyclerView.layoutManager = LinearLayoutManager(
requireContext(), requireContext(),
LinearLayoutManager.HORIZONTAL, LinearLayoutManager.HORIZONTAL,
@ -211,7 +206,7 @@ class ProfileFragment() : Fragment() {
LayoutAnimationController(setSlideIn(), 0.25f) LayoutAnimationController(setSlideIn(), 0.25f)
} else { } else {
empty.visibility = View.VISIBLE container.visibility = View.GONE
} }
title.visibility = View.VISIBLE title.visibility = View.VISIBLE
title.startAnimation(setSlideUp()) title.startAnimation(setSlideUp())

View file

@ -144,8 +144,8 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Stats" android:text="Stats"
android:textSize="18sp" android:textSize="18sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -335,8 +335,8 @@
android:id="@+id/userInfoContainer" android:id="@+id/userInfoContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:layout_height="wrap_content" android:orientation="vertical"
android:orientation="vertical"> tools:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/profileUserBioTitle" android:id="@+id/profileUserBioTitle"
@ -345,8 +345,8 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Bio" android:text="Bio"
android:textSize="18sp" android:textSize="18sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -355,12 +355,12 @@
android:id="@+id/profileUserBio" android:id="@+id/profileUserBio"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:textAlignment="textStart"
android:ellipsize="end" android:ellipsize="end"
android:padding="16dp" android:padding="16dp"
android:textAlignment="textStart"
tools:text="@string/slogan" /> tools:text="@string/slogan" />
</LinearLayout> </LinearLayout>
@ -369,8 +369,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone" android:visibility="gone">
tools:visibility="visible">
<TextView <TextView
@ -385,36 +384,7 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:minHeight="250dp">
<LinearLayout
android:id="@+id/profileFavAnimeEmpty"
android:layout_width="match_parent"
android:layout_height="250dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="match_parent"
android:layout_height="32dp"
android:src="@drawable/ic_round_heart_broken_24"
app:tint="?attr/colorPrimary"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.58"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:text="User has no favorite anime"
android:textAlignment="center"
tools:ignore="TextContrastCheck" />
</LinearLayout>
<ProgressBar <ProgressBar
android:id="@+id/profileFavAnimeProgressBar" android:id="@+id/profileFavAnimeProgressBar"
@ -446,7 +416,6 @@
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:id="@+id/profileFavManga" android:id="@+id/profileFavManga"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -459,36 +428,7 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:minHeight="250dp">
<LinearLayout
android:id="@+id/profileFavMangaEmpty"
android:layout_width="match_parent"
android:layout_height="250dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="match_parent"
android:layout_height="32dp"
android:src="@drawable/ic_round_heart_broken_24"
app:tint="?attr/colorPrimary"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.58"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:text="User has no favorite manga."
android:textAlignment="center"
tools:ignore="TextContrastCheck" />
</LinearLayout>
<ProgressBar <ProgressBar
android:id="@+id/profileFavMangaProgressBar" android:id="@+id/profileFavMangaProgressBar"
@ -512,20 +452,22 @@
tools:orientation="horizontal" /> tools:orientation="horizontal" />
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/profileFavCharactersContainer" android:id="@+id/profileFavCharactersContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
tools:visibility="gone"> tools:visibility="gone">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Favorite Characters" android:text="Favorite Characters"
android:textSize="18sp" /> android:textSize="18sp" />
@ -550,14 +492,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
tools:visibility="gone"> tools:visibility="gone">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Favorite Staff" android:text="Favorite Staff"
android:textSize="18sp" /> android:textSize="18sp" />

View file

@ -64,7 +64,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="0.58" android:alpha="0.58"
android:ellipsize="marquee" android:ellipsize="end"
android:includeFontPadding="false" android:includeFontPadding="false"
android:singleLine="true" android:singleLine="true"
android:textAlignment="textEnd" android:textAlignment="textEnd"
@ -73,7 +73,7 @@
android:textStyle="italic" android:textStyle="italic"
android:transitionName="mediaTitle" android:transitionName="mediaTitle"
tools:ignore="TextContrastCheck" tools:ignore="TextContrastCheck"
tools:text="SOURCE " /> tools:text="SOURCE" />
</LinearLayout> </LinearLayout>

View file

@ -149,6 +149,7 @@
tools:text="@string/get_recommendations" /> tools:text="@string/get_recommendations" />
<LinearLayout <LinearLayout
android:id="@+id/itemCompactProgressContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">