check for activity context
This commit is contained in:
parent
8a9668bc79
commit
b8fbeed785
2 changed files with 18 additions and 8 deletions
|
@ -268,14 +268,19 @@ class AnimeFragment : Fragment() {
|
|||
model.loaded = true
|
||||
model.loadTrending(1)
|
||||
model.loadUpdated()
|
||||
model.loadPopular("ANIME", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||
.getBoolean("popular_list", false))
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.animeRefresh?.isRefreshing = false
|
||||
withContext(Dispatchers.Main) {
|
||||
if (isAdded) { // Check if the fragment is still attached
|
||||
model.loadPopular("ANIME", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||
.getBoolean("popular_list", false))
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.animeRefresh?.isRefreshing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue