feat: moved social bellow synonyms

This commit is contained in:
aayush262 2024-05-03 23:17:43 +05:30
parent 126fe75c46
commit 7bdc7c1719
3 changed files with 37 additions and 35 deletions

View file

@ -251,7 +251,39 @@ class MediaInfoFragment : Fragment() {
}
parent.addView(bind.root)
}
if (!media.users.isNullOrEmpty() && !offline) {
val users: ArrayList<User> = media.users ?: arrayListOf()
if (Anilist.token != null && media.userStatus != null) {
users.add(0,
User(
id = Anilist.userid!!,
name = getString(R.string.you),
pfp = Anilist.avatar,
banner = "",
status = media.userStatus,
score = media.userScore.toFloat(),
progress = media.userProgress,
totalEpisodes = media.anime?.totalEpisodes ?: media.manga?.totalChapters,
nextAiringEpisode = media.anime?.nextAiringEpisode
)
)
}
ItemTitleRecyclerBinding.inflate(
LayoutInflater.from(context),
parent,
false
).apply {
itemTitle.visibility = View.GONE
itemRecycler.adapter =
MediaSocialAdapter(users, type, requireActivity())
itemRecycler.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
false
)
parent.addView(root)
}
}
if (media.trailer != null && !offline) {
@Suppress("DEPRECATION")
class MyChrome : WebChromeClient() {
@ -574,39 +606,6 @@ class MediaInfoFragment : Fragment() {
parent.addView(root)
}
}
if (!media.users.isNullOrEmpty() && !offline) {
val users: ArrayList<User> = media.users ?: arrayListOf()
if (Anilist.token != null && media.userStatus != null) {
users.add(0,
User(
id = Anilist.userid!!,
name = getString(R.string.your_progress),
pfp = Anilist.avatar,
banner = "",
status = media.userStatus,
score = media.userScore.toFloat(),
progress = media.userProgress,
totalEpisodes = media.anime?.totalEpisodes ?: media.manga?.totalChapters,
nextAiringEpisode = media.anime?.nextAiringEpisode
)
)
}
ItemTitleRecyclerBinding.inflate(
LayoutInflater.from(context),
parent,
false
).apply {
itemTitle.setText(R.string.social)
itemRecycler.adapter =
MediaSocialAdapter(users, type, requireActivity())
itemRecycler.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
false
)
parent.addView(root)
}
}
}
}

View file

@ -78,8 +78,10 @@
<TextView
android:id="@+id/profileUserName"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:singleLine="true"
android:layout_gravity="center_horizontal|center_vertical"
android:ellipsize="end"
android:text="@string/username"

View file

@ -966,6 +966,7 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
<string name="banner">%1$s\ [Banner]</string>
<string name="your_story">Your Story</string>
<string name="your_progress">Your Progress</string>
<string name="you">You</string>
<string name="logout_confirm">Are you sure you want to logout?</string>
<string name="app_died">APP DIED</string>
<string name="an_unexpected_error_occurred">An unexpected error occurred.\nPlease send a crash report to the developer :)</string>