Skip to content

Commit

Permalink
fix(profile): remove progress in fav media
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush2622 committed Mar 6, 2024
1 parent 03dae8c commit 18778f3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 80 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/ani/dantotsu/media/MediaAdaptor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MediaAdaptor(
private val activity: FragmentActivity,
private val matchParent: Boolean = false,
private val viewPager: ViewPager2? = null,
private val fav: Boolean = false,
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
Expand Down Expand Up @@ -128,6 +129,7 @@ class MediaAdaptor(
)
b.itemCompactTotal.text = " | ${media.manga.totalChapters ?: "~"}"
}
b.itemCompactProgressContainer.visibility = if (fav) View.GONE else View.VISIBLE
}
}

Expand Down
9 changes: 2 additions & 7 deletions app/src/main/java/ani/dantotsu/profile/ProfileFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class ProfileFragment() : Fragment() {
binding.profileFavAnimeContainer,
binding.profileFavAnimeRecyclerView,
binding.profileFavAnimeProgressBar,
binding.profileFavAnimeEmpty,
binding.profileFavAnime
)

Expand All @@ -129,7 +128,6 @@ class ProfileFragment() : Fragment() {
binding.profileFavMangaContainer,
binding.profileFavMangaRecyclerView,
binding.profileFavMangaProgressBar,
binding.profileFavMangaEmpty,
binding.profileFavManga
)

Expand Down Expand Up @@ -186,21 +184,18 @@ class ProfileFragment() : Fragment() {
container: View,
recyclerView: RecyclerView,
progress: View,
empty: View,
title: View
) {
container.visibility = View.VISIBLE
progress.visibility = View.VISIBLE
recyclerView.visibility = View.GONE
empty.visibility = View.GONE
title.visibility = View.INVISIBLE

mode.observe(viewLifecycleOwner) {
recyclerView.visibility = View.GONE
empty.visibility = View.GONE
if (it != null) {
if (it.isNotEmpty()) {
recyclerView.adapter = MediaAdaptor(0, it, requireActivity())
recyclerView.adapter = MediaAdaptor(0, it, requireActivity(), fav=true)
recyclerView.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
Expand All @@ -211,7 +206,7 @@ class ProfileFragment() : Fragment() {
LayoutAnimationController(setSlideIn(), 0.25f)

} else {
empty.visibility = View.VISIBLE
container.visibility = View.GONE
}
title.visibility = View.VISIBLE
title.startAnimation(setSlideUp())
Expand Down
85 changes: 14 additions & 71 deletions app/src/main/res/layout/fragment_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Stats"
android:textSize="18sp"
tools:ignore="HardcodedText" />
Expand Down Expand Up @@ -335,8 +335,8 @@
android:id="@+id/userInfoContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
tools:layout_height="wrap_content">

<TextView
android:id="@+id/profileUserBioTitle"
Expand All @@ -345,8 +345,8 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Bio"
android:textSize="18sp"
tools:ignore="HardcodedText" />
Expand All @@ -355,12 +355,12 @@
android:id="@+id/profileUserBio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:textAlignment="textStart"
android:ellipsize="end"
android:padding="16dp"
android:textAlignment="textStart"
tools:text="@string/slogan" />
</LinearLayout>

Expand All @@ -369,8 +369,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
android:visibility="gone">


<TextView
Expand All @@ -385,36 +384,7 @@

<FrameLayout
android:layout_width="match_parent"
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>
android:layout_height="wrap_content">

<ProgressBar
android:id="@+id/profileFavAnimeProgressBar"
Expand Down Expand Up @@ -446,7 +416,6 @@
android:orientation="vertical"
android:visibility="gone">


<TextView
android:id="@+id/profileFavManga"
android:layout_width="wrap_content"
Expand All @@ -459,36 +428,7 @@

<FrameLayout
android:layout_width="match_parent"
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>
android:layout_height="wrap_content">

<ProgressBar
android:id="@+id/profileFavMangaProgressBar"
Expand All @@ -512,20 +452,22 @@
tools:orientation="horizontal" />
</FrameLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/profileFavCharactersContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="gone">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Favorite Characters"
android:textSize="18sp" />

Expand All @@ -550,14 +492,15 @@
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="gone">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:padding="8dp"
android:text="Favorite Staff"
android:textSize="18sp" />

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_character.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.58"
android:ellipsize="marquee"
android:ellipsize="end"
android:includeFontPadding="false"
android:singleLine="true"
android:textAlignment="textEnd"
Expand All @@ -73,7 +73,7 @@
android:textStyle="italic"
android:transitionName="mediaTitle"
tools:ignore="TextContrastCheck"
tools:text="SOURCE " />
tools:text="SOURCE" />

</LinearLayout>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/item_media_compact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
tools:text="@string/get_recommendations" />

<LinearLayout
android:id="@+id/itemCompactProgressContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
Expand Down

0 comments on commit 18778f3

Please sign in to comment.