fix: fragment IllegalStateException

This commit is contained in:
rebelonion 2024-03-17 18:25:38 -05:00
parent b373a52218
commit 25b85569fe

View file

@ -76,7 +76,7 @@ class ProfileFragment : Fragment() {
) )
binding.profileUserBio.setBackgroundColor( binding.profileUserBio.setBackgroundColor(
ContextCompat.getColor( ContextCompat.getColor(
requireContext(), activity,
android.R.color.transparent android.R.color.transparent
) )
) )
@ -86,7 +86,7 @@ class ProfileFragment : Fragment() {
super.onPageFinished(view, url) super.onPageFinished(view, url)
binding.profileUserBio.setBackgroundColor( binding.profileUserBio.setBackgroundColor(
ContextCompat.getColor( ContextCompat.getColor(
requireContext(), activity,
android.R.color.transparent android.R.color.transparent
) )
) )
@ -146,7 +146,7 @@ class ProfileFragment : Fragment() {
} }
binding.profileFavStaffRecycler.adapter = AuthorAdapter(favStaff) binding.profileFavStaffRecycler.adapter = AuthorAdapter(favStaff)
binding.profileFavStaffRecycler.layoutManager = LinearLayoutManager( binding.profileFavStaffRecycler.layoutManager = LinearLayoutManager(
requireContext(), activity,
LinearLayoutManager.HORIZONTAL, LinearLayoutManager.HORIZONTAL,
false false
) )
@ -155,7 +155,7 @@ class ProfileFragment : Fragment() {
} }
binding.profileFavCharactersRecycler.adapter = CharacterAdapter(favCharacter) binding.profileFavCharactersRecycler.adapter = CharacterAdapter(favCharacter)
binding.profileFavCharactersRecycler.layoutManager = LinearLayoutManager( binding.profileFavCharactersRecycler.layoutManager = LinearLayoutManager(
requireContext(), activity,
LinearLayoutManager.HORIZONTAL, LinearLayoutManager.HORIZONTAL,
false false
) )
@ -177,9 +177,9 @@ class ProfileFragment : Fragment() {
recyclerView.visibility = View.GONE recyclerView.visibility = View.GONE
if (it != null) { if (it != null) {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
recyclerView.adapter = MediaAdaptor(0, it, requireActivity(), fav=true) recyclerView.adapter = MediaAdaptor(0, it, activity, fav=true)
recyclerView.layoutManager = LinearLayoutManager( recyclerView.layoutManager = LinearLayoutManager(
requireContext(), activity,
LinearLayoutManager.HORIZONTAL, LinearLayoutManager.HORIZONTAL,
false false
) )